diff --git a/README.md b/README.md index 4350ec8..f5e35f6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,12 @@ Siren is a D&D Bot built for Discord, written in Rust. Features include: - Assistant DM tools to be defined later ## Running +1. Setup the Discord Developer Application and bot +2. Copy `.env.TEMPLATE` to `.env` and fill out the fields +3. Build the [Docker](https://www.docker.com/) application with `make build` +4. Start the application with `make up` + +### Setting up the Discord Developer Application Visit the [Discord Developer Portal](https://discord.com/developers/applications) and create a new application. Click [here](https://discord.com/developers/docs/intro) for guides and more information. Required Scopes: @@ -20,9 +26,9 @@ https://discord.com/api/oauth2/authorize?client_id=&permissions=40671 ``` The CLIENT_ID can be found in the General Information tab on the Discord Developer Portal for your application, under `Application ID` -1. Copy `.env.TEMPLATE` to `.env` and fill out the fields -2. Build the [Docker](https://www.docker.com/) application with `make build` -3. Start the application with `make up` +The DISCORD_TOKEN (used in the `.env file`) can be found under the Bot tab on the Discord Developer Portal for your application. + +![DISCORD_TOKEN Example](docs/discord_token_example.png) ## Contributing [Rust](https://www.rust-lang.org/) must be installed to run locally. See [serenity-rs/serenity](https://github.com/serenity-rs/serenity) for more information about Rust Discord API Library. @@ -61,8 +67,10 @@ The following packages must be installed for [serenity-rs/songbird](https://gith ``` -Begin the application with `cargo run` (note the database must still be running) - - `docker compose up -d db` +### Running Locally +1. Build the [Docker](https://www.docker.com/) containers with `make build` +2. Start the utility containers with `make utils` +3. Start the application with `cargo run` The application can also be tested from within a Docker container: ``` diff --git a/docs/discord_token_example.png b/docs/discord_token_example.png new file mode 100644 index 0000000..87ab9b5 Binary files /dev/null and b/docs/discord_token_example.png differ diff --git a/service/.env.TEMPLATE b/service/.env.TEMPLATE index 580a9eb..743a54d 100644 --- a/service/.env.TEMPLATE +++ b/service/.env.TEMPLATE @@ -1,7 +1,7 @@ RUST_LOG=warn,service=info DATABASE_USER=siren -DATABASE_PASSWORD= +DATABASE_PASSWORD= #Required DATABASE_NAME=siren DATABASE_HOST=localhost DATABASE_PORT=5432 @@ -10,7 +10,7 @@ KEYS_DIR_PATH= SESSION_TTL=1440 MINIO_ROOT_USER=siren -MINIO_ROOT_PASSWORD= +MINIO_ROOT_PASSWORD= #Required MINIO_HOST=localhost MINIO_PORT=9000 MINIO_PORT_INTERNAL=9001 @@ -22,6 +22,6 @@ SERVICE_HOST=localhost SERVICE_PORT=5000 DATA_DIR_PATH= -DISCORD_TOKEN= +DISCORD_TOKEN= #Required OPENAI_API_KEY= OPENAI_API_MODEL=gpt-3.5-turbo \ No newline at end of file diff --git a/service/Makefile b/service/Makefile index b8d76f9..2c90f5f 100644 --- a/service/Makefile +++ b/service/Makefile @@ -13,10 +13,11 @@ help: ## Help command build: ## Build the docker image docker compose build -utils: ## Start the utils - docker compose up -d db - docker compose up -d redis - docker compose up -d minio +backend-up: ## Start the backend containers + docker compose --profile backend up -d + +backend-down: ## Stop the backend containers + docker compose --profile backend down up: ## Start the app docker compose up -d @@ -24,7 +25,7 @@ up: ## Start the app down: ## Stop the app docker compose down -clean: +clean: ## Clean the app docker compose down && \ docker image rm siren-service || \ docker network rm siren_frontend || \ diff --git a/service/docker-compose.yml b/service/docker-compose.yml index d0c1016..73718db 100644 --- a/service/docker-compose.yml +++ b/service/docker-compose.yml @@ -37,6 +37,9 @@ services: - frontend - backend restart: unless-stopped + profiles: + - siren + db: image: postgres:latest container_name: siren-db @@ -53,6 +56,9 @@ services: networks: - backend restart: unless-stopped + profiles: + - backend + redis: image: redis:latest container_name: siren-redis @@ -63,6 +69,9 @@ services: networks: - backend restart: unless-stopped + profiles: + - backend + minio: image: minio/minio container_name: siren-minio @@ -78,6 +87,8 @@ services: - backend command: server --console-address ":9001" /data restart: unless-stopped + profiles: + - backend volumes: db: diff --git a/ui/docker-compose.yml b/ui/docker-compose.yml index b95adaf..0959ef0 100644 --- a/ui/docker-compose.yml +++ b/ui/docker-compose.yml @@ -21,6 +21,8 @@ services: networks: - siren-frontend restart: unless-stopped + profiles: + - frontend networks: siren-frontend: {}