gitroomhq / postiz-docs

https://postiz-docs.vercel.app
1 stars 15 forks source link

Docs are incorrect for docker-compose/Coolify #20

Open petergerdes opened 1 month ago

petergerdes commented 1 month ago

When everything is passed through port 5000 (to use with reverse-proxy (I use Traefik)), the NEXT_PUBLIC_BACKEND_URL is incorrect. It needs to have /api added to it in order to work.

Here is my working example (in Coolify):

  postiz:
    image: 'ghcr.io/gitroomhq/postiz-app:latest'
    container_name: postiz
    restart: always
    environment:
      MAIN_URL: 'https://<your exposed url>/'
      FRONTEND_URL: 'https://<your exposed url>/'
      NEXT_PUBLIC_BACKEND_URL: 'https://<your exposed url>/api'
      JWT_SECRET: <make a secret here>
      DATABASE_URL: 'postgresql://postiz-user:postiz-password@postiz-postgres:5432/postiz-db-local'
      REDIS_URL: 'redis://postiz-redis:6379'
      BACKEND_INTERNAL_URL: 'http://localhost:3000/'
      IS_GENERAL: 'true'
      STORAGE_PROVIDER: local
      UPLOAD_DIRECTORY: /uploads
      NEXT_PUBLIC_UPLOAD_DIRECTORY: /uploads
    volumes:
      - 'postiz-config:/config/'
      - 'postiz-uploads:/uploads/'
    ports:
      - '5000:5000'
    networks:
      - postiz-network
    labels:
      - traefik.enable=true
      - 'traefik.http.routers.postiz.rule=Host(`<your exposed url>`) && PathPrefix(`/`)'
      - traefik.http.routers.postiz.entryPoints=http
      - traefik.http.routers.postiz.tls=true
      - traefik.http.routers.postiz.tls.certresolver=letsencrypt
      - traefik.http.services.postiz.loadbalancer.server.port=5000
    depends_on:
      postiz-postgres:
        condition: service_healthy
      postiz-redis:
        condition: service_healthy
  postiz-postgres:
    image: 'postgres:14.5'
    container_name: postiz-postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: postiz-password
      POSTGRES_USER: postiz-user
      POSTGRES_DB: postiz-db-local
    volumes:
      - 'postgres-volume:/var/lib/postgresql/data'
    ports:
      - '5432:5432'
    networks:
      - postiz-network
    healthcheck:
      test: 'pg_isready -U postiz-user -d postiz-db-local'
      interval: 10s
      timeout: 3s
      retries: 3
  postiz-redis:
    image: 'redis:7.2'
    container_name: postiz-redis
    restart: always
    ports:
      - '6379:6379'
    healthcheck:
      test: 'redis-cli ping'
      interval: 10s
      timeout: 3s
      retries: 3
    volumes:
      - 'postiz-redis-data:/data'
    networks:
      - postiz-network
volumes:
  postgres-volume:
    external: false
  postiz-redis-data:
    external: false
  postiz-config:
    external: false
networks:
  postiz-network:
    external: false

I have also added Traefik labels in order to get Letsencrypt working.

jamesread commented 1 month ago

Hey @petergerdes , yep, this is probably OK. Would you like to raise a Pull Request?

graphiostudio commented 2 weeks ago

This didn't deploy to coolify, had syntax errors, but this did:

version: '3.8'
services:
  postiz:
    image: 'ghcr.io/gitroomhq/postiz-app:latest'
    container_name: postiz
    restart: always
    environment:
      MAIN_URL: 'https://your.url'
      FRONTEND_URL: 'https://your.url'
      NEXT_PUBLIC_BACKEND_URL: 'https://your.url/api'
      JWT_SECRET: 'random-token-generated-use-it_tools'
      DATABASE_URL: 'postgresql://postiz-user:postiz-password@postiz-postgres:5432/postiz-db-local'
      REDIS_URL: 'redis://postiz-redis:6379'
      BACKEND_INTERNAL_URL: 'http://localhost:3000'
      IS_GENERAL: 'true'
      STORAGE_PROVIDER: local
      UPLOAD_DIRECTORY: /uploads
      NEXT_PUBLIC_UPLOAD_DIRECTORY: /uploads
    volumes:
      - 'postiz-config:/config/'
      - 'postiz-uploads:/uploads/'
    ports:
      - '5000:5000' 
    networks:
      - postiz-network
    labels:
      - traefik.enable=true
      - 'traefik.http.routers.postiz.rule=Host(`your.url`) && PathPrefix(`/`)' 
      - traefik.http.routers.postiz.entryPoints=http
      - traefik.http.routers.postiz.tls=true
      - traefik.http.routers.postiz.tls.certresolver=letsencrypt
      - traefik.http.services.postiz.loadbalancer.server.port=5000 
    depends_on:
      postiz-postgres:
        condition: service_healthy
      postiz-redis:
        condition: service_healthy
  postiz-postgres:
    image: 'postgres:14.5'
    container_name: postiz-postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: postiz-password
      POSTGRES_USER: postiz-user
      POSTGRES_DB: postiz-db-local
    volumes:
      - 'postgres-volume:/var/lib/postgresql/data'
    ports:
      - '5432:5432'
    networks:
      - postiz-network
    healthcheck:
      test: 'pg_isready -U postiz-user -d postiz-db-local'
      interval: 10s
      timeout: 3s
      retries: 3
  postiz-redis:
    image: 'redis:7.2'
    container_name: postiz-redis
    restart: always
    ports:
      - '6379:6379'
    healthcheck:
      test: 'redis-cli ping'
      interval: 10s
      timeout: 3s
      retries: 3
    volumes:
      - 'postiz-redis-data:/data'
    networks:
      - postiz-network
volumes:
  postgres-volume:
    external: false
  postiz-redis-data:
    external: false
  postiz-config:
    external: false
  postiz-uploads:
    external: false
networks:
  postiz-network:
    external: false