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.
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
.env
file mounted in/config
for the Postiz container only - Option C - environment variables in a
.env
file next to yourdocker-compose.yml
file (not recommended).
... or a mixture of the above options!
There is a configuration reference page with a list of configuration settings.
Secure Context required
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". Postiz only supports listening on HTTP, so if you are not using localhost, you will need to use a reverse proxy to handle HTTPS and and be careful to set your URLs accordingly. 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 traefik is recommended.
Example docker-compose.yml
file
services:
postiz:
image: ghcr.io/gitroomhq/postiz-app:latest
container_name: postiz
restart: always
environment:
# You must change these. `yourServerAddress` is what your web browser uses.
MAIN_URL: "https://yourServerAddress:4200"
FRONTEND_URL: "https://yourServerAddress:4200"
NEXT_PUBLIC_BACKEND_URL: "https://yourServerAddress:3000"
JWT_SECRET: "random string that is unique to every install - just type random characters here!"
# These are totally fake values, you must change them with your own Cloudflare settings.
CLOUDFLARE_ACCOUNT_ID: "QhcMSXQyPuMCRpSQcSYdEuTYgHeCXHbu"
CLOUDFLARE_ACCESS_KEY: "dcfCMSuFEeCNfvByUureMZEfxWJmDqZe"
CLOUDFLARE_SECRET_ACCESS_KEY: "zTTMXBmtyLPwHEdpACGHgDgzRTNpTJewiNriLnUS"
CLOUDFLARE_BUCKETNAME: "postiz"
CLOUDFLARE_BUCKET_URL: "https://QhcMSXQyPuMCRpSQcSYdEuTYgHeCXHbu.r2.cloudflarestorage.com/"
CLOUDFLARE_REGION: "auto"
# 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.
volumes:
- postiz-config:/config/
ports:
- 4200:4200
- 3000:3000
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
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 http://yourServer:4200 (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"