From 5d55babeab00a0da2cea4680a157d6156a186db8 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sat, 2 Sep 2023 15:26:16 -0700 Subject: [PATCH] Update Deploying Silvanus Yourself --- Deploying-Silvanus-Yourself.md | 49 ++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/Deploying-Silvanus-Yourself.md b/Deploying-Silvanus-Yourself.md index 271b23a..304ba03 100644 --- a/Deploying-Silvanus-Yourself.md +++ b/Deploying-Silvanus-Yourself.md @@ -86,6 +86,51 @@ $ profit Running Silvanus in a Docker container is preferred when deployed to production use. This will allow for easy restarts if and when the bot crashes due to my lazy code. `--restart unless-stopped` is your friend here. -### Secrets +### Docker Compose +Create a folder to store the `docker-compose.yml` and logs, for example `~/silvanus`: +``` +$ mkdir -p ~/silvanus/logs +$ cd ~/silvanus +``` -You'll have to figure this one out, it's the same variable structure as above, but I've never had to pass variables to Docker manually as I use unRAID to host my bots. Alternatively if you're not going to be publishing the docker image, you can use a `.env` file and remove `.env` from the `.dockerignore` file, this will include the variables in the image and Silvanus will load them from the `.env` file. If you also use unRAID send me a DM on Discord and I'll send the template I've built for Silvanus. \ No newline at end of file +Create a `docker-compose.yml` based on this template: +``` +~/silvanus $ vim docker-compose.yml +``` +``` +version: "3" + +services: + web: + image: v0idf1sh/silvanus + container_name: silvanus + restart: unless-stopped + environment: + TOKEN: "" + BOTID: "" + DEBUG: "" + DBHOST: "" + DBPORT: "" + DBUSER: "" + DBPASS: "" + DBNAME: "" + STATUSCHANNELID: "" + ownerId: "" + HEARTBEAT_URL: "" + volumes: + - ./logs:/logs +~ +``` +Start the container: +``` +~/silvanus $ sudo docker-compose up -d +``` + +Stop the container: +``` +~/silvanus $ sudo docker-compose stop +~/silvanus $ sudo docker-compose down +``` + +### Logs +By default logs are stored in the `logs` folder where your `docker-compose.yml` file is. This can be changed by modifying the `volumes` entry in the Compose file. Unique logs are created on every startup, with a timestamp for a title. Silvanus does not implement any log rotation at the moment, so these may need to be periodically cleared out. Alternatively you could change how log files are generated in the `Dockerfile`. \ No newline at end of file