11
submitted 8 months ago* (last edited 8 months ago) by Tiritibambix@lemmy.ml to c/selfhosted@lemmy.world

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

you are viewing a single comment's thread
view the rest of the comments
[-] lemmyreader@lemmy.ml 4 points 8 months ago

Nice. Can you edit the subject from your post and add the word howto or guide or something ? That could be nicer for people searching for solutions.

this post was submitted on 21 Apr 2024
11 points (86.7% liked)

Selfhosted

40677 readers
89 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS