Updated docker commands, docs

This commit is contained in:
Benjamin Sherriff
2024-03-03 16:17:56 -05:00
parent aebc3516b1
commit 39d9850c41
6 changed files with 35 additions and 13 deletions

View File

@@ -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 - Assistant DM tools to be defined later
## Running ## 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. 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: Required Scopes:
@@ -20,9 +26,9 @@ https://discord.com/api/oauth2/authorize?client_id=<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` 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 The DISCORD_TOKEN (used in the `.env file`) can be found under the Bot tab on the Discord Developer Portal for your application.
2. Build the [Docker](https://www.docker.com/) application with `make build`
3. Start the application with `make up` ![DISCORD_TOKEN Example](docs/discord_token_example.png)
## Contributing ## 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. [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
``` ```
</details> </details>
Begin the application with `cargo run` (note the database must still be running) ### Running Locally
- `docker compose up -d db` 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: The application can also be tested from within a Docker container:
``` ```

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View File

@@ -1,7 +1,7 @@
RUST_LOG=warn,service=info RUST_LOG=warn,service=info
DATABASE_USER=siren DATABASE_USER=siren
DATABASE_PASSWORD= DATABASE_PASSWORD= #Required
DATABASE_NAME=siren DATABASE_NAME=siren
DATABASE_HOST=localhost DATABASE_HOST=localhost
DATABASE_PORT=5432 DATABASE_PORT=5432
@@ -10,7 +10,7 @@ KEYS_DIR_PATH=
SESSION_TTL=1440 SESSION_TTL=1440
MINIO_ROOT_USER=siren MINIO_ROOT_USER=siren
MINIO_ROOT_PASSWORD= MINIO_ROOT_PASSWORD= #Required
MINIO_HOST=localhost MINIO_HOST=localhost
MINIO_PORT=9000 MINIO_PORT=9000
MINIO_PORT_INTERNAL=9001 MINIO_PORT_INTERNAL=9001
@@ -22,6 +22,6 @@ SERVICE_HOST=localhost
SERVICE_PORT=5000 SERVICE_PORT=5000
DATA_DIR_PATH= DATA_DIR_PATH=
DISCORD_TOKEN= DISCORD_TOKEN= #Required
OPENAI_API_KEY= OPENAI_API_KEY=
OPENAI_API_MODEL=gpt-3.5-turbo OPENAI_API_MODEL=gpt-3.5-turbo

View File

@@ -13,10 +13,11 @@ help: ## Help command
build: ## Build the docker image build: ## Build the docker image
docker compose build docker compose build
utils: ## Start the utils backend-up: ## Start the backend containers
docker compose up -d db docker compose --profile backend up -d
docker compose up -d redis
docker compose up -d minio backend-down: ## Stop the backend containers
docker compose --profile backend down
up: ## Start the app up: ## Start the app
docker compose up -d docker compose up -d
@@ -24,7 +25,7 @@ up: ## Start the app
down: ## Stop the app down: ## Stop the app
docker compose down docker compose down
clean: clean: ## Clean the app
docker compose down && \ docker compose down && \
docker image rm siren-service || \ docker image rm siren-service || \
docker network rm siren_frontend || \ docker network rm siren_frontend || \

View File

@@ -37,6 +37,9 @@ services:
- frontend - frontend
- backend - backend
restart: unless-stopped restart: unless-stopped
profiles:
- siren
db: db:
image: postgres:latest image: postgres:latest
container_name: siren-db container_name: siren-db
@@ -53,6 +56,9 @@ services:
networks: networks:
- backend - backend
restart: unless-stopped restart: unless-stopped
profiles:
- backend
redis: redis:
image: redis:latest image: redis:latest
container_name: siren-redis container_name: siren-redis
@@ -63,6 +69,9 @@ services:
networks: networks:
- backend - backend
restart: unless-stopped restart: unless-stopped
profiles:
- backend
minio: minio:
image: minio/minio image: minio/minio
container_name: siren-minio container_name: siren-minio
@@ -78,6 +87,8 @@ services:
- backend - backend
command: server --console-address ":9001" /data command: server --console-address ":9001" /data
restart: unless-stopped restart: unless-stopped
profiles:
- backend
volumes: volumes:
db: db:

View File

@@ -21,6 +21,8 @@ services:
networks: networks:
- siren-frontend - siren-frontend
restart: unless-stopped restart: unless-stopped
profiles:
- frontend
networks: networks:
siren-frontend: {} siren-frontend: {}