add pixelfed.de compose

This commit is contained in:
chris 2023-12-02 21:10:05 +01:00
parent 9c57dd2b0c
commit 6f1bf4cce6

121
pixelfed.de-compose.md Normal file
View file

@ -0,0 +1,121 @@
# compose stack for pixelfed.de
My current compose file, as the one in my
[blog post about my setup](https://blog.pixelfed.de/2020/05/29/pixelfed-in-docker/)
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.
```yaml
---
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](https://github.com/pixelfed/pixelfed/blob/dev/.env.docker).
`app` and `websockets` services reference a opcache config file, which looks
like this for my box:
```ini
[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](https://git.zknt.org/dockers/pixelfed) 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`