mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Removed server_ for better overview
This commit is contained in:
75
roles/docker-pixelfed/README.md
Normal file
75
roles/docker-pixelfed/README.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Pixelfed Docker Server Role
|
||||
|
||||
This README details the steps to manage your Pixelfed instance running in a Docker container. This setup is part of the server_docker-pixelfed role within Kevin Veen-Birkenbach's computer-playbook located at [this GitHub repository](https://github.com/kevinveenbirkenbach/computer-playbook/tree/master/roles/server_docker-pixelfed).
|
||||
|
||||
## Accessing Services
|
||||
|
||||
### Application Access
|
||||
To gain shell access to the application container, run the following command:
|
||||
```bash
|
||||
docker-compose exec -it application bash
|
||||
```
|
||||
|
||||
### Database Access
|
||||
To access the MariaDB instance in the database container, run the following command:
|
||||
```bash
|
||||
docker-compose exec -it database mariadb -u pixelfed -p
|
||||
```
|
||||
|
||||
## Instagram Import Cleanup
|
||||
|
||||
If you have imported posts from Instagram, you can clean up the imported data and files as follows:
|
||||
|
||||
### Database Cleanup
|
||||
Run these commands inside your MariaDB shell to remove import related data:
|
||||
```bash
|
||||
DELETE from import_posts WHERE 1;
|
||||
DELETE from import_jobs WHERE 1;
|
||||
DELETE from import_datas WHERE 1;
|
||||
DELETE from statuses where created_at < "2022-12-01 22:15:39";
|
||||
DELETE from media where deleted_at >= "2023-07-28 14:39:05";
|
||||
```
|
||||
|
||||
### File System Cleanup
|
||||
Run these commands to remove the imported files and trigger the cleanup job:
|
||||
```bash
|
||||
docker-compose exec -u "www-data" application rm -rv "/var/www/storage/app/imports/1"
|
||||
docker-compose exec -u "www-data" application php artisan schedule:run
|
||||
```
|
||||
|
||||
## Full Cleanup (Reset)
|
||||
|
||||
For a hard reset, which will delete all data and stop all services, use the following commands:
|
||||
```bash
|
||||
docker-compose down
|
||||
docker volume rm pixelfed_application_data pixelfed_database pixelfed_redis_data
|
||||
```
|
||||
|
||||
## Update Procedure
|
||||
|
||||
To update your Pixelfed instance, navigate to the directory where your `docker-compose.yml` file is located and run these commands:
|
||||
```bash
|
||||
cd {{path_docker_compose_files}}pixelfed/ &&
|
||||
docker-compose down &&
|
||||
docker network prune -f &&
|
||||
docker-compose pull &&
|
||||
docker-compose build &&
|
||||
docker-compose -p pixelfed up -d --force-recreate
|
||||
```
|
||||
|
||||
## Inspecting the Services
|
||||
|
||||
To see the status of all services or follow the logs, use these commands:
|
||||
```bash
|
||||
docker-compose ps -a
|
||||
docker-compose logs -f
|
||||
```
|
||||
|
||||
## Further Reading
|
||||
For additional information, refer to these resources:
|
||||
- [Docker image on Docker Hub](https://hub.docker.com/r/zknt/pixelfed)
|
||||
- [Blog Post about running Pixelfed in Docker](https://blog.pixelfed.de/2020/05/29/pixelfed-in-docker/)
|
||||
|
||||
Author: Kevin Veen-Birkenbach, [https://www.veen.world](https://www.veen.world), [kevin@veen.world](mailto:kevin@veen.world)
|
||||
|
||||
This README was optimized with the help of OpenAI's ChatGPT. You can view the conversation [here](https://chat.openai.com/share/3daea33f-2e30-46e9-a709-a9c93e823ed9).
|
8
roles/docker-pixelfed/handlers/main.yml
Normal file
8
roles/docker-pixelfed/handlers/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: recreate pixelfed
|
||||
command:
|
||||
cmd: docker-compose -p pixelfed up -d --force-recreate
|
||||
chdir: "{{path_docker_compose_files}}pixelfed/"
|
||||
environment:
|
||||
COMPOSE_HTTP_TIMEOUT: 600
|
||||
DOCKER_CLIENT_TIMEOUT: 600
|
2
roles/docker-pixelfed/meta/main.yml
Normal file
2
roles/docker-pixelfed/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- server_native-docker-reverse-proxy
|
25
roles/docker-pixelfed/tasks/main.yml
Normal file
25
roles/docker-pixelfed/tasks/main.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: recieve {{domain}} certificate
|
||||
command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
|
||||
|
||||
- name: configure {{domain}}.conf
|
||||
template: src=roles/server_native-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
|
||||
notify: restart nginx
|
||||
|
||||
- name: "create {{docker_compose_path}}"
|
||||
file:
|
||||
path: "{{docker_compose_path}}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: add docker-compose.yml
|
||||
template: src=docker-compose.yml.j2 dest={{docker_compose_path}}docker-compose.yml
|
||||
notify: recreate pixelfed
|
||||
|
||||
- name: add env
|
||||
template:
|
||||
src: env.j2
|
||||
dest: "{{docker_compose_path}}env"
|
||||
mode: '770'
|
||||
force: yes
|
||||
notify: recreate pixelfed
|
68
roles/docker-pixelfed/templates/docker-compose.yml.j2
Normal file
68
roles/docker-pixelfed/templates/docker-compose.yml.j2
Normal file
@@ -0,0 +1,68 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
application:
|
||||
image: zknt/pixelfed
|
||||
restart: always
|
||||
logging:
|
||||
driver: journald
|
||||
env_file:
|
||||
- ./env
|
||||
volumes:
|
||||
- "application_data:/var/www/storage"
|
||||
- "./env:/var/www/.env"
|
||||
ports:
|
||||
- "{{http_port}}:80"
|
||||
depends_on:
|
||||
- database
|
||||
- redis
|
||||
worker:
|
||||
image: zknt/pixelfed
|
||||
restart: always
|
||||
logging:
|
||||
driver: journald
|
||||
env_file:
|
||||
- ./env
|
||||
volumes:
|
||||
- "application_data:/var/www/storage"
|
||||
- "./env:/var/www/.env"
|
||||
entrypoint: /worker-entrypoint.sh
|
||||
depends_on:
|
||||
- database
|
||||
- redis
|
||||
- application
|
||||
healthcheck:
|
||||
test: php artisan horizon:status | grep running
|
||||
interval: 60s
|
||||
timeout: 5s
|
||||
retries: 1
|
||||
database:
|
||||
logging:
|
||||
driver: journald
|
||||
image: mariadb
|
||||
restart: always
|
||||
env_file:
|
||||
- ./env
|
||||
volumes:
|
||||
- database:/var/lib/mysql
|
||||
healthcheck:
|
||||
test: "/usr/bin/mariadb --user=pixelfed --password={{pixelfed_database_password}} --execute \"SHOW DATABASES;\""
|
||||
interval: 3s
|
||||
timeout: 1s
|
||||
retries: 5
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: always
|
||||
logging:
|
||||
driver: journald
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
volumes:
|
||||
database:
|
||||
redis_data:
|
||||
application_data:
|
138
roles/docker-pixelfed/templates/env.j2
Normal file
138
roles/docker-pixelfed/templates/env.j2
Normal file
@@ -0,0 +1,138 @@
|
||||
## Crypto
|
||||
APP_KEY={{pixelfed_app_key}}
|
||||
|
||||
## General Settings
|
||||
APP_NAME="{{pixelfed_app_name}}"
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
APP_URL=https://{{domain}}
|
||||
APP_DOMAIN="{{domain}}"
|
||||
ADMIN_DOMAIN="{{domain}}"
|
||||
SESSION_DOMAIN="{{domain}}"
|
||||
|
||||
OPEN_REGISTRATION=false
|
||||
ENFORCE_EMAIL_VERIFICATION=false
|
||||
PF_MAX_USERS=1000
|
||||
OAUTH_ENABLED=true
|
||||
|
||||
APP_TIMEZONE=UTC
|
||||
APP_LOCALE=en
|
||||
|
||||
## Pixelfed Tweaks
|
||||
LIMIT_ACCOUNT_SIZE=true
|
||||
MAX_ACCOUNT_SIZE=1000000
|
||||
MAX_PHOTO_SIZE=15000
|
||||
MAX_AVATAR_SIZE=2000
|
||||
MAX_CAPTION_LENGTH=500
|
||||
MAX_BIO_LENGTH=125
|
||||
MAX_NAME_LENGTH=30
|
||||
MAX_ALBUM_LENGTH=4
|
||||
IMAGE_QUALITY=80
|
||||
PF_OPTIMIZE_IMAGES=true
|
||||
PF_OPTIMIZE_VIDEOS=true
|
||||
ADMIN_ENV_EDITOR=false
|
||||
ACCOUNT_DELETION=true
|
||||
ACCOUNT_DELETE_AFTER=false
|
||||
MAX_LINKS_PER_POST=0
|
||||
|
||||
## Instance
|
||||
#INSTANCE_DESCRIPTION=
|
||||
INSTANCE_PUBLIC_HASHTAGS=false
|
||||
#INSTANCE_CONTACT_EMAIL=
|
||||
INSTANCE_PUBLIC_LOCAL_TIMELINE=false
|
||||
#BANNED_USERNAMES=
|
||||
STORIES_ENABLED=false
|
||||
RESTRICTED_INSTANCE=false
|
||||
|
||||
## Mail
|
||||
MAIL_DRIVER=log
|
||||
MAIL_HOST={{system_email_host}}
|
||||
MAIL_PORT={{system_email_port}}
|
||||
MAIL_FROM_ADDRESS="{{system_email_username}}"
|
||||
MAIL_FROM_NAME="Pixelfed"
|
||||
MAIL_USERNAME={{system_email_username}}
|
||||
MAIL_PASSWORD={{system_email_password}}
|
||||
MAIL_ENCRYPTION=tls
|
||||
|
||||
## Databases (MySQL)
|
||||
DB_CONNECTION=mysql
|
||||
DB_DATABASE=pixelfed
|
||||
DB_HOST=database
|
||||
DB_PASSWORD="{{pixelfed_database_password}}"
|
||||
DB_PORT=3306
|
||||
DB_USERNAME=pixelfed
|
||||
# pass the same values to the db itself
|
||||
MYSQL_DATABASE="pixelfed"
|
||||
MYSQL_USER="pixelfed"
|
||||
MYSQL_PASSWORD="{{pixelfed_database_password}}"
|
||||
MYSQL_ROOT_PASSWORD="{{pixelfed_database_password}}"
|
||||
MARIADB_AUTO_UPGRADE="1"
|
||||
|
||||
## Cache (Redis)
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_SCHEME=tcp
|
||||
REDIS_HOST=redis
|
||||
#REDIS_PASSWORD=
|
||||
REDIS_PORT=6379
|
||||
REDIS_DATABASE=0
|
||||
|
||||
HORIZON_PREFIX="horizon-"
|
||||
|
||||
## EXPERIMENTS
|
||||
EXP_LC=false
|
||||
EXP_REC=false
|
||||
EXP_LOOPS=false
|
||||
|
||||
## ActivityPub Federation
|
||||
ACTIVITY_PUB=true
|
||||
AP_REMOTE_FOLLOW=true
|
||||
AP_SHAREDINBOX=true
|
||||
AP_INBOX=true
|
||||
AP_OUTBOX=true
|
||||
ATOM_FEEDS=true
|
||||
NODEINFO=true
|
||||
WEBFINGER=true
|
||||
|
||||
## S3
|
||||
FILESYSTEM_DRIVER=local
|
||||
FILESYSTEM_CLOUD=s3
|
||||
PF_ENABLE_CLOUD=false
|
||||
|
||||
## Horizon
|
||||
HORIZON_DARKMODE=false
|
||||
|
||||
## COSTAR - Confirm Object Sentiment Transform and Reduce
|
||||
PF_COSTAR_ENABLED=false
|
||||
|
||||
# Media
|
||||
MEDIA_EXIF_DATABASE=false
|
||||
|
||||
## Logging
|
||||
LOG_CHANNEL=stderr
|
||||
|
||||
## Image
|
||||
IMAGE_DRIVER=imagick
|
||||
|
||||
## Broadcasting
|
||||
BROADCAST_DRIVER=log # log driver for local development
|
||||
|
||||
## Cache
|
||||
CACHE_DRIVER=redis
|
||||
|
||||
## Purify
|
||||
RESTRICT_HTML_TYPES=true
|
||||
|
||||
## Queue
|
||||
QUEUE_DRIVER=redis
|
||||
|
||||
## Session
|
||||
SESSION_DRIVER=redis
|
||||
|
||||
## Trusted Proxy
|
||||
TRUST_PROXIES="*"
|
||||
|
||||
## Passport
|
||||
#PASSPORT_PRIVATE_KEY=
|
||||
#PASSPORT_PUBLIC_KEY=
|
||||
|
||||
ENABLE_CONFIG_CACHE=true
|
2
roles/docker-pixelfed/vars/main.yml
Normal file
2
roles/docker-pixelfed/vars/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
docker_compose_path: "{{path_docker_compose_files}}pixelfed/"
|
||||
client_max_body_size: "512M"
|
Reference in New Issue
Block a user