Setup Postiz on Coolify

The Postiz Coolify template doesn't seem to work by default.

Use this docker-compose.yml instead:

services:
  postiz:
    image: ghcr.io/gitroomhq/postiz-app:latest
    container_name: postiz
    restart: always
    environment:
      - SERVICE_FQDN_POSTIZ_5000
      - MAIN_URL=${SERVICE_FQDN_POSTIZ}
      - FRONTEND_URL=${SERVICE_FQDN_POSTIZ}
      - NEXT_PUBLIC_BACKEND_URL=${SERVICE_FQDN_POSTIZ}/api
      - JWT_SECRET=${SERVICE_PASSWORD_JWTSECRET}
      - DATABASE_URL=postgresql://postgres:${SERVICE_PASSWORD_POSTGRESQL}@postgres:5432/${POSTGRESQL_DATABASE:-postiz-db}
      - REDIS_URL=redis://default:${SERVICE_PASSWORD_REDIS}@redis:6379
      - BACKEND_INTERNAL_URL=http://localhost:3000
      - CLOUDFLARE_ACCOUNT_ID=${CLOUDFLARE_ACCOUNT_ID}
      - CLOUDFLARE_ACCESS_KEY=${CLOUDFLARE_ACCESS_KEY}
      - CLOUDFLARE_SECRET_ACCESS_KEY=${CLOUDFLARE_SECRET_ACCESS_KEY}
      - CLOUDFLARE_BUCKETNAME=${CLOUDFLARE_BUCKETNAME}
      - CLOUDFLARE_BUCKET_URL=${CLOUDFLARE_BUCKET_URL}
      - CLOUDFLARE_REGION=${CLOUDFLARE_REGION}
      - STORAGE_PROVIDER=${STORAGE_PROVIDER:-local}
      - UPLOAD_DIRECTORY=${UPLOAD_DIRECTORY:-/uploads}
      - NEXT_PUBLIC_UPLOAD_DIRECTORY=${NEXT_PUBLIC_UPLOAD_DIRECTORY:-/uploads}
      - NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY=${NEXT_PUBLIC_UPLOAD_STATIC_DIRECTORY}
      - RESEND_API_KEY=${RESEND_API_KEY}
      - EMAIL_FROM_ADDRESS=${EMAIL_FROM_ADDRESS}
      - EMAIL_FROM_NAME=${EMAIL_FROM_NAME}
      - EMAIL_PROVIDER=${EMAIL_PROVIDER}
      - EMAIL_HOST=${EMAIL_HOST}
      - EMAIL_PORT=${EMAIL_PORT}
      - EMAIL_SECURE=${EMAIL_SECURE}
      - EMAIL_USER=${EMAIL_USER}
      - EMAIL_PASS=${EMAIL_PASS}
      - X_API_KEY=${SERVICE_X_API}
      - X_API_SECRET=${SERVICE_X_SECRET}
      - LINKEDIN_CLIENT_ID=${SERVICE_LINKEDIN_ID}
      - LINKEDIN_CLIENT_SECRET=${SERVICE_LINKEDIN_SECRET}
      - REDDIT_CLIENT_ID=${SERVICE_REDDIT_API}
      - REDDIT_CLIENT_SECRET=${SERVICE_REDDIT_SECRET}
      - GITHUB_CLIENT_ID=${SERVICE_GITHUB_ID}
      - GITHUB_CLIENT_SECRET=${SERVICE_GITHUB_SECRET}
      - THREADS_APP_ID=${SERVICE_THREADS_ID}
      - THREADS_APP_SECRET=${SERVICE_THREADS_SECRET}
      - FACEBOOK_APP_ID=${SERVICE_FACEBOOK_ID}
      - FACEBOOK_APP_SECRET=${SERVICE_FACEBOOK_SECRET}
      - YOUTUBE_CLIENT_ID=${SERVICE_YOUTUBE_ID}
      - YOUTUBE_CLIENT_SECRET=${SERVICE_YOUTUBE_SECRET}
      - TIKTOK_CLIENT_ID=${SERVICE_TIKTOK_ID}
      - TIKTOK_CLIENT_SECRET=${SERVICE_TIKTOK_SECRET}
      - PINTEREST_CLIENT_ID=${SERVICE_PINTEREST_ID}
      - PINTEREST_CLIENT_SECRET=${SERVICE_PINTEREST_SECRET}
      - DRIBBBLE_CLIENT_ID=${SERVICE_DRIBBLE_ID}
      - DRIBBBLE_CLIENT_SECRET=${SERVICE_DRIBBLE_SECRET}
      - DISCORD_CLIENT_ID=${SERVICE_DISCORD_ID}
      - DISCORD_CLIENT_SECRET=${SERVICE_DISCORD_SECRET}
      - DISCORD_BOT_TOKEN_ID=${SERVICE_DISCORD_TOKEN}
      - SLACK_ID=${SERVICE_SLACK_ID}
      - SLACK_SECRET=${SERVICE_SLACK_SECRET}
      - SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET}
      - MASTODON_CLIENT_ID=${SERVICE_MASTODON_ID}
      - MASTODON_CLIENT_SECRET=${SERVICE_MASTODON_SECRET}
      - BEEHIIVE_API_KEY=${SERVICE_BEEHIIVE_KEY}
      - BEEHIIVE_PUBLICATION_ID=${SERVICE_BEEHIIVE_PUBID}
      - OPENAI_API_KEY=${SERVICE_OPENAI_KEY}
      - NEXT_PUBLIC_DISCORD_SUPPORT=${NEXT_PUBLIC_DISCORD_SUPPORT}
      - NEXT_PUBLIC_POLOTNO=${NEXT_PUBLIC_POLOTNO}
      - IS_GENERAL=true
      - NX_ADD_PLUGINS=${NX_ADD_PLUGINS:-false}
      - FEE_AMOUNT=${FEE_AMOUNT:-0.05}
      - STRIPE_PUBLISHABLE_KEY=${STRIPE_PUBLISHABLE_KEY}
      - STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
      - STRIPE_SIGNING_KEY=${STRIPE_SIGNING_KEY}
      - STRIPE_SIGNING_KEY_CONNECT=${STRIPE_SIGNING_KEY_CONNECT}
    volumes:
      - postiz_config:/config/
      - postiz_uploads:/uploads/
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    healthcheck:
      test: ['CMD-SHELL', 'wget -qO- http://127.0.0.1:5000/']
      interval: 5s
      timeout: 20s
      retries: 10
    labels:
      - traefik.enable=true
      - traefik.http.routers.postiz-https.rule=Host(`${SERVICE_FQDN_POSTIZ#https://}`) && PathPrefix(`/`)
      - traefik.http.routers.postiz-https.entryPoints=https
      - traefik.http.routers.postiz-https.middlewares=gzip
      - traefik.http.routers.postiz-https.service=postiz-service
      - traefik.http.routers.postiz-https.tls=true
      - traefik.http.services.postiz-service.loadbalancer.server.port=5000
      - traefik.http.routers.postiz-https.tls.certresolver=letsencrypt
      - traefik.http.routers.postiz-http.rule=Host(`${SERVICE_FQDN_POSTIZ#https://}`) && PathPrefix(`/`)
      - traefik.http.routers.postiz-http.entryPoints=http
      - traefik.http.routers.postiz-http.middlewares=redirect-to-https
    networks:
      - postiz-network

  postgres:
    image: postgres:14.5
    container_name: postiz-postgres
    restart: always
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
      - POSTGRES_DB=${POSTGRESQL_DATABASE:-postiz-db}
    volumes:
      - postiz_postgresql_data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB:-postiz-db}']
      interval: 5s
      timeout: 20s
      retries: 10
    networks:
      - postiz-network

  redis:
    image: redis:7.2
    container_name: postiz-redis
    restart: always
    command: redis-server --requirepass ${SERVICE_PASSWORD_REDIS}
    environment:
      - REDIS_PASSWORD=${SERVICE_PASSWORD_REDIS}
    volumes:
      - postiz_redis_data:/data
    healthcheck:
      test: ['CMD', 'redis-cli', '-a', '${SERVICE_PASSWORD_REDIS}', 'ping']
      interval: 5s
      timeout: 10s
      retries: 20
    networks:
      - postiz-network

volumes:
  postiz_config:
  postiz_uploads:
  postiz_postgresql_data:
  postiz_redis_data:

networks:
  postiz-network:

Configure APIs and env variables

To connect to all your services, follow the instructions to create apps in those services (e.g. Facebook, X, LinkedIn). Then, set the generated APP IDs, secrets and API keys in the env variables.

Required env variables:

  • SERVICE_PASSWORD_JWTSECRET
  • SERVICE_PASSWORD_POSTGRESQL
  • SERVICE_PASSWORD_REDIS
  • Email:
    • EMAIL_FROM_ADDRESS
    • EMAIL_FROM_NAME
    • EMAIL_HOST
    • EMAIL_PASS
    • EMAIL_PORT
    • EMAIL_PROVIDER
    • EMAIL_USER
    • EMAIL_SECURE

Activate account

For me, the initial account activation didn't work, so I had to manually set it as activate in the database.

Steps to activate account on Postiz on Coolify:

  1. Go to Terminal.
  2. Choose postgres container.
  3. Access psql using this command:
    PGPASSWORD="$SERVICE_PASSWORD_POSTGRESQL" psql -U postgres -d "$POSTGRESQL_DATABASE"
  4. Set user as activated by running this SQL query:
    UPDATE "User" SET activated = 't';

If you encounter any issues, feel free to leave a comment below.

SPONSORED
CTA Image

Stop using multiple, complicated tools trying to understand your users. Ditch Google Analytics and Hotjar and get all the insights you need, in a single place!

Get unlimited access to:
* 📊Stats, 🔥Heatmaps, 📹Recordings
* 🌓A/B tests, 🌟Events, 🎯Goals
* 👥Segments, 🤖Ask AI, 🪲Error Tracking and more!

Install UXWizz on your server!