Skip to content

Development

Bradford edited this page Oct 4, 2023 · 6 revisions

Development Requirements

If you want to change the code and test it outside docker, install:

  • nodejs
  • npm
  • typescript

Development & Testing

Running bot in development mode

Docker

To run the bot outside docker for testing or development, first start up an ephemeral mongodb service:

$ docker compose -f docker-compose.mongo.yml up

From another terminal, run:

$ npm install       # if it hasn't been run before
$ npm run dev

Now you can run the app without building a docker image for each test run.

When you are done testing, you can clean up the containers by returning to the docker compose terminal and stopping the mongo services with Ctrl-c and:

$ docker compose -f docker-compose.mongo.yml -v

Deploying Updates

To deploy updates, simply pull the changes from git, rebuild the container in docker, bring the new container online, and optionally redeploy the commands (if the SlashCommandBuilder object in any of the commands has been updated):

git pull origin <branch name>
...
docker compose -f docker-compose.yml -f docker-compose.dev.yml build --no-cache
...
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
...
docker run --env-file .env -it xx-monitor-bot-bot node built/discord/discord-utils.js deploy --global # note! deploy how you originally deployed
...
docker compose -f docker-compose.yml -f docker-compose.dev.yml logs --follow --timestamps bot

Running Locally (non-Docker)

Start mongodb:

docker compose -f docker-compose.mongo.yml up

Run the bot:

npm run dev
Clone this wiki locally