Get your directory set up.
git clone https://github.com/Rapha01/activityRank-bot.git activityrankRunning ls in activityrank should look like this:
apps/bot
apps/manager
Launch the mysql container, and get the root password.
Caution
Make sure you note down this password. You will not be able to retrieve it in the future.
Once you're done, press CMD+C to exit.
docker compose up db &| grep "GENERATED ROOT PASSWORD" Get the container ID of the db container. Note this down as well - although you can always run docker ps to find it later.
docker psCreate a shell inside the database container.
docker exec -it <db container ID> shCreate a bot user. You can change 'PASSWORD' to be something else, but you'll need to change it in the rest of the guide as well.
Also create the two databases needed by the bot.
If you get an error message when creating the user, try relogging (using
exit;) or dropping the user (DROP USER 'activityrank';).
sh-4.4# mysql -u root -p
<enter generated root password>
mysql> CREATE USER 'activityrank'@'%' IDENTIFIED BY 'PASSWORD';
mysql> CREATE DATABASE `manager`;
mysql> CREATE DATABASE `dbShard`;
mysql> exit;
sh-4.4# exit;Now we can run the database initialisation scripts:
docker exec -i <database container ID> sh -c 'exec mysql -uroot -p"<generated root password>"' < packages/database/schemas/full/manager.sql
docker exec -i <database container ID> sh -c 'exec mysql -uroot -p"<generated root password>"' < packages/database/schemas/full/shard.sqland go back into the MySQL CLI tool to give the bot user the priviliges it needs.
sh-4.4# mysql -u root -p
<enter generated root password>
mysql> GRANT ALL ON *.* TO 'activityrank'@'%';
mysql> FLUSH PRIVILEGES;
mysql> exit;
sh-4.4# exit;Now, we can set up credentials.
cp config/keys.example.json config/keys.json
cp config/config.example.json config/config.json
vi config/keys.jsonconfig/keys.json:
{
"botId": "<your test bot's Discord Client ID>",
"managerApiAuth": "",
"managerHost": "host.docker.internal",
"managerDb": {
"dbUser": "activityrank",
"dbPassword": "PASSWORD",
"dbName": "manager"
},
"shardDb": {
"dbUser": "activityrank",
"dbPassword": "PASSWORD",
"dbName": "dbShard"
},
"patreonAccessToken": ""
}Now we can run the manager!
docker compose up -d managerWell done! Now for the bot.
pnpm install
pnpm --filter @activityrank/bot run dev:watchYou can also deploy slash commands.
pnpm activityrank deploy --local <your guild ID> --deploy-global=localHopefully this worked! :D