chatgpt_telegram_bot
chatgpt_telegram_bot copied to clipboard
The current docker-compose implementation is wrong, here my small tweak
Mounting mongo volume in that way makes the files to be created with high privilegies so the files does not belong to the user, Which makes it almost impossible to restart the services if you are not root to delete the mongodb folder.
Also, having to pass the env files via CLI is not a good approach, by default docker compose always reads from .env files located at the root. So I rather pass the env_files in the stack and not by CLI (this can be even better if just save the .env file in the root folder.
Anyways, this works for me, I don't have to deal with permissions errors neither with long CLI to manage the stack. Only use this all known command and good to go.
docker-compose up -d
version: "3"
services:
mongo:
container_name: mongo
image: mongo:latest
restart: always
env_file:
- ./config/config.env
ports:
- 127.0.0.1:${MONGODB_PORT:-27017}:${MONGODB_PORT:-27017}
volumes:
- mongodb:/data/db
# TODO: add auth
chatgpt_telegram_bot:
container_name: chatgpt_telegram_bot
command: python3 bot/bot.py
restart: always
env_file:
- ./config/config.env
build:
context: "."
dockerfile: Dockerfile
depends_on:
- mongo
mongo_express:
container_name: mongo-express
image: mongo-express:latest
restart: always
env_file:
- ./config/config.env
ports:
- 127.0.0.1:${MONGO_EXPRESS_PORT:-8081}:${MONGO_EXPRESS_PORT:-8081}
environment:
- ME_CONFIG_MONGODB_SERVER=mongo
- ME_CONFIG_MONGODB_PORT=${MONGODB_PORT:-27017}
- ME_CONFIG_MONGODB_ENABLE_ADMIN=false
- ME_CONFIG_MONGODB_AUTH_DATABASE=chatgpt_telegram_bot
- ME_CONFIG_BASICAUTH_USERNAME=${MONGO_EXPRESS_USERNAME:-username}
- ME_CONFIG_BASICAUTH_PASSWORD=${MONGO_EXPRESS_PASSWORD:-password}
depends_on:
- mongo
volumes:
mongodb:
Note I did not made a PR cause I noticed a long list of good and descent PR there which are being basically ignored, this tool has good potential tho.
yeah it's a shame that he's only in it for the money and not willing to listen to ideas to actually improve it..