Skip to content

Instantly share code, notes, and snippets.

@mtthwnestor
Created July 14, 2023 11:48
Show Gist options
  • Save mtthwnestor/242fd959605ad125ca8de70604a83e6d to your computer and use it in GitHub Desktop.
Save mtthwnestor/242fd959605ad125ca8de70604a83e6d to your computer and use it in GitHub Desktop.
Lemmy Docker
{
# for more info about the config, check out the documentation
# https://join-lemmy.org/docs/en/administration/configuration.html
database: {
host: postgres
password: "your-postgres-password"
}
hostname: "lemmy.mydomain.com"
pictrs: {
url: "http://pictrs:8080/"
api_key: "your-postgres-password"
}
email: {
tls_type: "starttls"
smtp_server: "smtp-relay.sendinblue.com:587"
smtp_login: "your-brevo-username@email.com"
smtp_password: "your-brevo-password"
smtp_from_address: "noreply-lemmy@mydomain.com"
}
}
version: '3'
services:
lemmy:
image: dessalines/lemmy:0.18.2
restart: always
environment:
- RUST_LOG="warn"
volumes:
- ./config.hjson:/config/config.hjson
depends_on:
- postgres
- pictrs
lemmy-ui:
image: dessalines/lemmy-ui:0.18.2
restart: always
environment:
- LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_UI_LEMMY_EXTERNAL_HOST=lemmy.mydomain.com
- LEMMY_UI_HTTPS=true
volumes:
- extra_themes:/app/extra_themes
depends_on:
- lemmy
postgres:
image: postgres:15-alpine
environment:
- POSTGRES_USER=lemmy
- POSTGRES_PASSWORD=your-postgres-password
- POSTGRES_DB=lemmy
volumes:
- db:/var/lib/postgresql/data
# - ./customPostgresql.conf:/etc/postgresql.conf
restart: always
pictrs:
image: asonix/pictrs:0.4.0
hostname: pictrs
user: 991:991
environment:
- PICTRS__MEDIA__VIDEO_CODEC=vp9
- PICTRS__MEDIA__GIF__MAX_WIDTH=256
- PICTRS__MEDIA__GIF__MAX_HEIGHT=256
- PICTRS__MEDIA__GIF__MAX_AREA=65536
- PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
volumes:
- pictrs:/mnt
restart: always
mem_limit: 690m
proxy:
image: nginx:stable
ports:
- 8976:80
restart: unless-stopped
depends_on:
- pictrs
- lemmy-ui
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
volumes:
extra_themes:
db:
pictrs:
upstream lemmy {
# this needs to map to the lemmy (server) docker service hostname
server "lemmy:8536";
}
upstream lemmy-ui {
# this needs to map to the lemmy-ui docker service hostname
server "lemmy-ui:1234";
}
map "$request_method:$http_accept" $proxpass {
default "http://lemmy-ui";
"~^(?:GET|HEAD):.*?application\/(?:activity|ld)\+json" "http://lemmy";
"~^(?!(GET|HEAD)).*:" "http://lemmy";
}
server {
listen 80;
# this needs to be your public domain name
server_name lemmy.mydomain.com;
server_tokens off;
gzip on;
gzip_types text/css application/javascript image/svg+xml;
gzip_vary on;
# Upload limit, relevant for pictrs
client_max_body_size 20M;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass $proxpass;
rewrite ^(.+)/+$ $1 permanent;
}
location /.well-known/security.txt {
proxy_pass "http://lemmy-ui";
}
location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
proxy_pass "http://lemmy";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment