This is a followup to my previous post.

If you want to bind volumes outside of Docker, this is what you need to do.

There was a huge permission and volume mapping problem. I mention github issues that helped me here.

I hope that will help noobs and insecure people like me.


cd /srv/path/Files
git clone https://github.com/mediacms-io/mediacms
cd /srv/path/Files/mediacms
mkdir postgres_data \
&& chmod -R 755 postgres_data
nano docker-compose.yaml
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:
      - /srv/path/Files/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /srv/path/Files/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /srv/path/Files/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /srv/path/Files/mediacms/cms/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: 'complicatedpassword'
    restart: on-failure
    depends_on:
      redis:
        condition: service_healthy
  web:
    image: mediacms/mediacms:latest
    deploy:
      replicas: 1
    ports:
      - "8870:80" #whatever:80
    volumes:
      - /srv/path/Files/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /srv/path/Files/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /srv/path/Files/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /srv/path/Files/mediacms/cms/settings.py:/home/mediacms.io/mediacms/cms/settings.py
    environment:
#      ENABLE_UWSGI: 'no' #keep commented
      ENABLE_CELERY_BEAT: 'no'
      ENABLE_CELERY_SHORT: 'no'
      ENABLE_CELERY_LONG: 'no'
      ENABLE_MIGRATIONS: 'no'
      
  db:
    image: postgres:15.2-alpine
    volumes:
      - /srv/path/Files/mediacms/postgres_data:/var/lib/postgresql/data/
    restart: always
    environment:
      POSTGRES_USER: mediacms
      POSTGRES_PASSWORD: mediacms
      POSTGRES_DB: mediacms
      TZ: Europe/Paris
    healthcheck:
      test: ["CMD-SHELL", "pg_isready", "--host=db", "--dbname=$POSTGRES_DB", "--username=$POSTGRES_USER"]
      interval: 30s
      timeout: 10s
      retries: 5

  celery_beat:
    image: mediacms/mediacms:latest
    volumes:
      - /srv/path/Files/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /srv/path/Files/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /srv/path/Files/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /srv/path/Files/mediacms/cms/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:
      - /srv/path/Files/mediacms/deploy:/home/mediacms.io/mediacms/deploy
      - /srv/path/Files/mediacms/logs:/home/mediacms.io/mediacms/logs
      - /srv/path/Files/mediacms/media_files:/home/mediacms.io/mediacms/media_files
      - /srv/path/Files/mediacms/cms/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
docker-compose up -d

CSS will probably be missing because reasons, so bash into web container

docker exec -it mediacms_web_1 /bin/bash

Then

python manage.py collectstatic

No need to reboot

  • N0x0n@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 months ago

    Thank your for the write up 😁 Glad you solved your issue !!