Update Deploying Silvanus Yourself

Skylar Grant 2023-09-02 15:26:16 -07:00
parent 43fece3739
commit 5d55babeab

@ -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.
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: "<YOUR_TOKEN_HERE>"
BOTID: "<YOUR_BOTS_USER_ID_HERE>"
DEBUG: "<true OR false>"
DBHOST: "<DATABASE_HOSTNAME_OR_IP>"
DBPORT: "<DATABASE_PORT>"
DBUSER: "<DATABASE_USERNAME>"
DBPASS: "<DATABASE_PASSWORD>"
DBNAME: "<DATABASE_NAME>"
STATUSCHANNELID: "<CHANNEL_ID>"
ownerId: "<YOUR_USER_ID>"
HEARTBEAT_URL: "<OPTIONAL_HEARTBEAT_URL_FOR_UPTIME_MONITORING>"
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`.