docker-compose.yml
· 1.3 KiB · YAML
Raw
services:
nginx_lemmy:
image: nginx:mainline-alpine
restart: always
ports:
- 3080:80
depends_on:
- lemmy
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
lemmy:
image: dessalines/lemmy:0.19.8
restart: always
environment:
- RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_queries=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
volumes:
- ./lemmy.hjson:/config/config.hjson
depends_on:
- postgres
- pictrs
lemmy-ui:
image: dessalines/lemmy-ui:0.19.8
restart: always
environment:
- LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_UI_LEMMY_EXTERNAL_HOST=lemmy
- LEMMY_UI_HTTPS=true
volumes:
- ./volumes/lemmy-ui/extra_themes:/app/extra_themes
depends_on:
- lemmy
postgres:
image: postgres:15-alpine
environment:
- POSTGRES_USER=lemmy
- POSTGRES_PASSWORD=PASSWORD_HERE
- POSTGRES_DB=lemmy
volumes:
- ./volumes/postgres:/var/lib/postgresql/data
restart: always
pictrs:
image: asonix/pictrs:latest
user: 991:991
volumes:
- ./volumes/pictrs:/mnt
restart: always
mem_limit: 200m
| 1 | services: |
| 2 | nginx_lemmy: |
| 3 | image: nginx:mainline-alpine |
| 4 | restart: always |
| 5 | ports: |
| 6 | - 3080:80 |
| 7 | depends_on: |
| 8 | - lemmy |
| 9 | volumes: |
| 10 | - ./nginx.conf:/etc/nginx/nginx.conf:ro |
| 11 | |
| 12 | lemmy: |
| 13 | image: dessalines/lemmy:0.19.8 |
| 14 | restart: always |
| 15 | environment: |
| 16 | - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_queries=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info" |
| 17 | volumes: |
| 18 | - ./lemmy.hjson:/config/config.hjson |
| 19 | depends_on: |
| 20 | - postgres |
| 21 | - pictrs |
| 22 | |
| 23 | lemmy-ui: |
| 24 | image: dessalines/lemmy-ui:0.19.8 |
| 25 | restart: always |
| 26 | environment: |
| 27 | - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536 |
| 28 | - LEMMY_UI_LEMMY_EXTERNAL_HOST=lemmy |
| 29 | - LEMMY_UI_HTTPS=true |
| 30 | volumes: |
| 31 | - ./volumes/lemmy-ui/extra_themes:/app/extra_themes |
| 32 | depends_on: |
| 33 | - lemmy |
| 34 | |
| 35 | postgres: |
| 36 | image: postgres:15-alpine |
| 37 | environment: |
| 38 | - POSTGRES_USER=lemmy |
| 39 | - POSTGRES_PASSWORD=PASSWORD_HERE |
| 40 | - POSTGRES_DB=lemmy |
| 41 | volumes: |
| 42 | - ./volumes/postgres:/var/lib/postgresql/data |
| 43 | restart: always |
| 44 | |
| 45 | pictrs: |
| 46 | image: asonix/pictrs:latest |
| 47 | user: 991:991 |
| 48 | volumes: |
| 49 | - ./volumes/pictrs:/mnt |
| 50 | restart: always |
| 51 | mem_limit: 200m |
lemmy.hjson
· 615 B · Text
Raw
{
setup: {
admin_username: "Admin_Username"
admin_password: "SUPER_SECURE_PASSWORD_HERE"
site_name: "A selfhosted place"
}
hostname: "lemmy.example.org"
bind: "0.0.0.0"
port: 8536
tls_enabled: true
pictrs: {
url: "http://pictrs:8080/"
api_key: "API_KEY_HERE"
}
database: {
host: postgres
port: 5432
pool_size: 5
uri: "postgresql://lemmy:PASSWORD_HERE@postgres/lemmy"
}
email: {
smtp_server: "smtp.resend.com:587"
smtp_login: "resend"
smtp_password: "PASSWORD_HERE"
smtp_from_address: "no-reply@example.org"
tls_type: "starttls"
}
}
| 1 | { |
| 2 | setup: { |
| 3 | admin_username: "Admin_Username" |
| 4 | admin_password: "SUPER_SECURE_PASSWORD_HERE" |
| 5 | site_name: "A selfhosted place" |
| 6 | } |
| 7 | |
| 8 | hostname: "lemmy.example.org" |
| 9 | bind: "0.0.0.0" |
| 10 | port: 8536 |
| 11 | tls_enabled: true |
| 12 | |
| 13 | pictrs: { |
| 14 | url: "http://pictrs:8080/" |
| 15 | api_key: "API_KEY_HERE" |
| 16 | } |
| 17 | |
| 18 | database: { |
| 19 | host: postgres |
| 20 | port: 5432 |
| 21 | pool_size: 5 |
| 22 | uri: "postgresql://lemmy:PASSWORD_HERE@postgres/lemmy" |
| 23 | } |
| 24 | |
| 25 | email: { |
| 26 | smtp_server: "smtp.resend.com:587" |
| 27 | smtp_login: "resend" |
| 28 | smtp_password: "PASSWORD_HERE" |
| 29 | smtp_from_address: "no-reply@example.org" |
| 30 | tls_type: "starttls" |
| 31 | } |
| 32 | } |
nginx.conf
· 1.7 KiB · Nginx configuration file
Raw
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream lemmy {
server "lemmy:8536";
}
upstream lemmy-ui {
server "lemmy-ui:1234";
}
server {
listen 80;
server_name localhost;
server_tokens off;
gzip on;
gzip_types text/css application/javascript image/svg+xml;
gzip_vary on;
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";
location / {
set $proxpass "http://lemmy-ui";
if ($http_accept = "application/activity+json") {
set $proxpass "http://lemmy";
}
if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") {
set $proxpass "http://lemmy";
}
if ($request_method = POST) {
set $proxpass "http://lemmy";
}
proxy_pass $proxpass;
rewrite ^(.+)/+$ $1 permanent;
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 ~ ^/(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";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
| 1 | worker_processes 1; |
| 2 | events { |
| 3 | worker_connections 1024; |
| 4 | } |
| 5 | http { |
| 6 | upstream lemmy { |
| 7 | server "lemmy:8536"; |
| 8 | } |
| 9 | upstream lemmy-ui { |
| 10 | server "lemmy-ui:1234"; |
| 11 | } |
| 12 | |
| 13 | server { |
| 14 | listen 80; |
| 15 | server_name localhost; |
| 16 | server_tokens off; |
| 17 | |
| 18 | gzip on; |
| 19 | gzip_types text/css application/javascript image/svg+xml; |
| 20 | gzip_vary on; |
| 21 | |
| 22 | client_max_body_size 20M; |
| 23 | |
| 24 | add_header X-Frame-Options SAMEORIGIN; |
| 25 | add_header X-Content-Type-Options nosniff; |
| 26 | add_header X-XSS-Protection "1; mode=block"; |
| 27 | |
| 28 | location / { |
| 29 | set $proxpass "http://lemmy-ui"; |
| 30 | |
| 31 | if ($http_accept = "application/activity+json") { |
| 32 | set $proxpass "http://lemmy"; |
| 33 | } |
| 34 | if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") { |
| 35 | set $proxpass "http://lemmy"; |
| 36 | } |
| 37 | if ($request_method = POST) { |
| 38 | set $proxpass "http://lemmy"; |
| 39 | } |
| 40 | proxy_pass $proxpass; |
| 41 | |
| 42 | rewrite ^(.+)/+$ $1 permanent; |
| 43 | proxy_set_header X-Real-IP $remote_addr; |
| 44 | proxy_set_header Host $host; |
| 45 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 46 | } |
| 47 | |
| 48 | location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) { |
| 49 | proxy_pass "http://lemmy"; |
| 50 | proxy_http_version 1.1; |
| 51 | proxy_set_header Upgrade $http_upgrade; |
| 52 | proxy_set_header Connection "upgrade"; |
| 53 | |
| 54 | proxy_set_header X-Real-IP $remote_addr; |
| 55 | proxy_set_header Host $host; |
| 56 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 57 | } |
| 58 | } |
| 59 | } |