paste/pixelfed.de-compose.md

2.9 KiB

compose stack for pixelfed.de

My current compose file, as the one in my blog post about my setup has aged quite a bit.

Please keep in mind that I use an external database cluster, and an external load balancer, so these services are not listed in my compose.

---
version: '3'

networks:
  back:

services:
  app:
    image: "quay.io/zknt/pixelfed:dev"
    restart: "unless-stopped"
    networks:
      back: {}
    depends_on:
      - redis
    env_file:
      - ./env
    ports:
      - "127.0.0.1:8098:80"
    volumes:
      - "./data/storage:/var/www/storage"
      - "./env:/var/www/.env"
      - "./robots.txt:/var/www/public/robots.txt:ro"
      - "./docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/opcache.ini:ro"

  websockets:
    image: "quay.io/zknt/pixelfed:dev"
    restart: "unless-stopped"
    depends_on:
      - redis
      - app
    env_file:
      - ./env
    volumes:
      - "./data/storage:/var/www/storage"
      - "./env:/var/www/.env"
      - "./docker-php-ext-opcache.ini:/usr/local/etc/php/conf.d/opcache.ini:ro"
    ports:
      - "127.0.0.1:8099:6001"
    networks:
      back: {}
    entrypoint: /websockets-entrypoint.sh

  worker:
    image: "quay.io/zknt/pixelfed:dev"
    restart: "unless-stopped"
    networks:
      back: {}
    depends_on:
      - redis
      - app
    env_file:
      - ./env
    volumes:
      - "./data/storage:/var/www/storage"
      - "./env:/var/www/.env"
    entrypoint: /worker-entrypoint.sh
    healthcheck:
      test: php artisan horizon:status | grep running
      interval: 60s
      timeout: 5s
      retries: 1

  schedule:
    image: "quay.io/zknt/pixelfed:dev"
    restart: "unless-stopped"
    networks:
      back: {}
    depends_on:
      - redis
      - app
    env_file:
      - ./env
    volumes:
      - "./data/storage:/var/www/storage"
      - "./env:/var/www/.env"
    entrypoint: /schedule-entrypoint.sh

  redis:
    image: "docker.io/library/redis"
    restart: "unless-stopped"
    volumes:
      - "./data/redis:/data"
    networks:
      - back

For an example env file please see the example in pixelfeds github repo.

app and websockets services reference a opcache config file, which looks like this for my box:

[opcache]
opcache.enable=1
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.max_accelerated_files=10000
opcache.memory_consumption=192
opcache.max_wasted_percentage=10
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1

And last but not least, if you don't use my image, these are the main commands from my entrypoint scripts. See my git for the full scripts.

  • Worker container gets started with: php artisan horizon
  • Websockets container gets started with: php artisan websockets:serve
  • Scheduler container gets started with: php artisan schedule:work