Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Docker and Docker Compose files #709

Open
ykorzikowski opened this issue Feb 1, 2023 · 2 comments
Open

Improve Docker and Docker Compose files #709

ykorzikowski opened this issue Feb 1, 2023 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@ykorzikowski
Copy link

ykorzikowski commented Feb 1, 2023

Hey there,

it took me a while to understand the architecture of mediacms. The setup-guide was not working for me in the beginning.

I had to set ENABLE_UWSGI to yesby uncommenting it. Otherwise I got a Bad Gateway from the nginx proxy.

I also removed postgres as I use a productive database hosted on a different machine.

for volumes, I only mount logs, media and the deploy-directory, as it contains configuration details.

I would not recommend mount the whole git-repo, as you overwrite the containers code, which makes no sense IMHO.

Also, making the settings.py readonly will lead into error:

mediacms-migrations-1     | chown: changing ownership of '/home/mediacms.io/mediacms/cms/settings.py': Read-only file system

When using config-maps in kubernetes i.e., a read-only settings-file would be mandatory.

Maybe change to a yaml file and use pyyaml to manage it. I do this on my python projects aswell.

version: "3"

services:
  redis:
    image: "redis:alpine"
    restart: always
    healthcheck:
      test: ["CMD", "redis-cli","ping"]
      interval: 30s
      timeout: 10s
      retries: 3

  migrations:
    image: mediacms/mediacms:latest
    volumes:
      - /mnt/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /mnt/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /mnt/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /mnt/mediacms/settings.py:/home/mediacms.io/mediacms/cms/settings.py
    environment:
      ENABLE_UWSGI: 'no'
      ENABLE_NGINX: 'no'
      ENABLE_CELERY_SHORT: 'no'
      ENABLE_CELERY_LONG: 'no'
      ENABLE_CELERY_BEAT: 'no'
      ADMIN_USER: 'admin'
      ADMIN_EMAIL: 'admin@localhost'
      ADMIN_PASSWORD: 'NeLr67Q#5z*oMD@foN79^dsQxyTEVezyG3c^v5W'
    restart: on-failure
    depends_on:
      redis:
        condition: service_healthy
  web:
    image: mediacms/mediacms:latest
    deploy:
      replicas: 1
    ports:
      - "11180:80"
    volumes:
      - /mnt/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /mnt/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /mnt/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /mnt/mediacms/settings.py:/home/mediacms.io/mediacms/cms/settings.py
    environment:
#      ENABLE_UWSGI: 'no'
      ENABLE_CELERY_BEAT: 'no'
      ENABLE_CELERY_SHORT: 'no'
      ENABLE_CELERY_LONG: 'no'
      ENABLE_MIGRATIONS: 'no'

  celery_beat:
    image: mediacms/mediacms:latest
    volumes:
      - /mnt/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /mnt/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /mnt/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /mnt/mediacms/settings.py:/home/mediacms.io/mediacms/cms/settings.py
    environment:
      ENABLE_UWSGI: 'no'
      ENABLE_NGINX: 'no'
      ENABLE_CELERY_SHORT: 'no'
      ENABLE_CELERY_LONG: 'no'
      ENABLE_MIGRATIONS: 'no'

  celery_worker:
    image: mediacms/mediacms:latest
    deploy:
      replicas: 1
    volumes:
      - /mnt/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /mnt/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /mnt/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /mnt/mediacms/settings.py:/home/mediacms.io/mediacms/cms/settings.py
    environment:
      ENABLE_UWSGI: 'no'
      ENABLE_NGINX: 'no'
      ENABLE_CELERY_BEAT: 'no'
      ENABLE_MIGRATIONS: 'no'
    depends_on:
      - migrations
@mgogoulos
Copy link
Contributor

Hi, these are all valid suggestions, and I definitely want to get rid of the ENABLE_X variables any time soon...they have served well for a number of vanilla installations, but it's time to get the Docker setup updated.

Would you be interested to work on it and even open a PR?

@mgogoulos mgogoulos added the help wanted Extra attention is needed label Feb 2, 2023
@mgogoulos mgogoulos changed the title Improve Documentation for productive docker environment Improve Docker and Docker Compose files Mar 14, 2023
@ykorzikowski
Copy link
Author

adding this to my plate and check when I have time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants