The powerful Discord bot which powers the OTA (Ordinul Templierilor Azteci) Discord community. Written in Go.
bot-service
(Handles Discord interactions like new messages, slash commands, join events, reaction adding or removing, etc.)
mysql-db
(Containerised MySQL instance for local development)
aztemusic-service
(Standalone music orchestrator bot application - see development here AzteMusic)aztemarket-service
(Standalone marketplace bot application - see development here AzteMarket)
In order to run the application, a few prerequisites must be met.
- Have the repository cloned locally.
- Have Docker installed.
- Have Make installed.
- Have a fully-configured
.env
file saved in the root of the repository. (contact @RazvanBerbece for the configuration) - Additionally, for full local development capabilities and to run the database migrations on the development machine, have the Aztebot-Infrastructure repository cloned locally in a folder which also contains the
Aztebot
repository (For example, the folderProject
should contain both theAztebot
and theAztebot-Infrastructure
repository folders)
At the moment, to propagate remote DB changes to the local dev environment, the Infrastructure
submodule has to be updated manually when there are changes in the remote source (e.g. a new migration file).
This can be done by running git submodule update --recursive --remote --init
in the root of this repository.
- Run a freshly built full service composition (app, DBs, etc.) with the
make up
command.- This is required so the local development database is configured with all the necessary default data.
- Once the
mysql-db
service has sucessfully started, run the DB migrations locally by executing the following commands from the root of this repository (requires Aztebot-Infrastructure as described in prerequisite #5)- To execute a dryrun and double-check the to-be-applied migrations:
make migrate-up-dry
- To apply the migrations
make migrate-up
- To execute a dryrun and double-check the to-be-applied migrations:
To bring down all the services, one can do so by running make down
.
This project will employ CI/CD through the use of GitHub Actions and Google Cloud.
Continuous integration is implemented through a workflow script which sets up a containerised service composition containing the Go environment and other dependencies (MySql, etc.) and then runs the internal logic tests on all pull request and pushes to main. The workflow file for the AzteBot CI can be seen in test.yml.
Continuous deployment is implemented through a workflow script which builds all the project artifacts and uploads them to Google Cloud Artifact Registry on pushes to the main branch. Additionally, a GKE pod is created with the new container image and ultimately executed upstream to run the apps. The workflow file for the AzteBot CD can be seen in deploy.yml.
Notes:
- The production environment file is base64 encoded using
make update-envs
and decoded accordingly in the Actions workflows.
cmd
folder -- contains the main entry point of the bot application (and it also contains the Dockerfile associated with it) that starts the connection to Discord and actions on the various events emitted by it.internal
folder -- has multiple folders, each one containing the various logic components that the Aztebot service needs including data models, interfaces, handlers and DB contexts.pkg
folder -- contains util packages which are leveraged across the entire project.