Installation
Docker Compose

Docker Compose

This guide assumes that you have docker installed, with a reasonable amount of resources to run Postiz. This Docker Compose setup has been tested with;

  • Virtual Machine, Ubuntu 24.04, 4Gb RAM, 2 vCPUs.

Installation Prerequisites

This section will ask you to install & configure several services exaplained below.

Network Requirements

HTTPS is required (or localhost)

Postiz marks it's login cookies as Secure, which means you must run it either on localhost, or behind HTTPS - this is called a "secure context" in modern web browsers.

If you are not running either HTTPS or on localhost, then you will not be able to login, as your browser will refuse to send the login cookie.

Postiz will not generate your HTTPS certificates for you, and it's servers cannot yet be configured to use a HTTPS certificate. This means you must use a reverse proxy to handle HTTPS. Documentation on popular reverse proxies can be found in the reverse proxies section, and if you've never used a reverse proxy with docker compose before, then caddy is recommended.

Network Ports

  • 5000/tcp: for a single single entry point for postiz when running in a container. This is the one port your reverse proxy should talk to.
  • 4200/tcp: for the Frontend service (the web interface). Most users do not need to expose this port publicly.
  • 3000/tcp: for the Backend service (the API). Most users do not need to expose this port publicly.
  • 5432/tcp: for the Postgres container. Most users do not need to expose this port publicly.
  • 6379/tcp: for the Redis container. Most users do not need to expose this port publicly.

If you are using docker images, we recommend just exposing port 5000 to your external proxy. This will reduce the likelihood of misconfiguration, and make it easier to manage your network.

Configuration uses environment variables

The docker containers for Postiz are entirely configured with environment variables.

  • Option A - environment variables in your docker-compose.yml file
  • Option B - environment variables in a postiz.env file mounted in /config for the Postiz container only
  • Option C - environment variables in a .env file next to your docker-compose.yml file (not recommended).

... or a mixture of the above options!

There is a configuration reference page with a list of configuration settings.

Example docker-compose.yml file

services:
  postiz:
    image: ghcr.io/gitroomhq/postiz-app:latest
    container_name: postiz
    restart: always
    environment:
      # You must change these. Replace `postiz.your-server.com` with your DNS name - what your web browser sees.
      MAIN_URL: "https://postiz.your-server.com"
      FRONTEND_URL: "https://postiz.your-server.com"
      NEXT_PUBLIC_BACKEND_URL: "https://postiz.your-server.com/api"
      JWT_SECRET: "random string that is unique to every install - just type random characters here!"
 
      # These defaults are probably fine, but if you change your user/password, update it in the
      # postiz-postgres or postiz-redis services below.
      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" # Required for self-hosting.
      # The container images are pre-configured to use /uploads for file storage.
      # You probably should not change this unless you have a really good reason!
      STORAGE_PROVIDER: "local"
      UPLOAD_DIRECTORY: "/uploads"
      NEXT_PUBLIC_UPLOAD_DIRECTORY: "/uploads"
    volumes:
      - postiz-config:/config/
      - postiz-uploads:/uploads/
    ports:
      - 5000:5000
    networks:
      - postiz-network
    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

How to use docker compose

Save the file contents to docker-compose.yml in your directory you create for postiz.

Run docker compose up to start the services.

⚠️

Note When you change variables, you must run docker compose down and then docker compose up to recreate these containers with these updated variables.

Look through the logs for startup errors, and if you have problems, check out the support page.

If everything looks good, then you can access the Postiz web interface at https://postiz.your-server.com (opens in a new tab)

Controlling container services

When the environment variable POSTIZ_APPS is not set, or is set to an empty string, all services will be started in a single container. This is normally fine for small, personal deployments.

However, you can only start specific services within the docker container by changing this environement variable.

If you need to scale, you can experiement with having multiple containers defined like;

  • Frontend only: POSTIZ_APPS="frontend"
  • Backend only: POSTIZ_APPS="backend"
  • Worker and Cron only: POSTIZ_APPS="worker cron"

Next Steps