From 6934a7319dc9dd0b84011b4e9eb77ee59c0d447a Mon Sep 17 00:00:00 2001 From: Tangent Date: Wed, 11 Feb 2026 20:57:50 -0700 Subject: [PATCH] fuck Lemmy --- .deprecated/lemmy/ReadMe.md | 12 ++++ .deprecated/lemmy/config.hjson | 23 +++++++ .deprecated/lemmy/docker-compose.yml | 91 +++++++++++++++++++++++++++ .deprecated/lemmy/nginx_internal.conf | 85 +++++++++++++++++++++++++ .deprecated/lemmy/proxy_params | 4 ++ .gitignore | 1 + 6 files changed, 216 insertions(+) create mode 100644 .deprecated/lemmy/ReadMe.md create mode 100644 .deprecated/lemmy/config.hjson create mode 100644 .deprecated/lemmy/docker-compose.yml create mode 100644 .deprecated/lemmy/nginx_internal.conf create mode 100644 .deprecated/lemmy/proxy_params create mode 100644 .gitignore diff --git a/.deprecated/lemmy/ReadMe.md b/.deprecated/lemmy/ReadMe.md new file mode 100644 index 0000000..a678167 --- /dev/null +++ b/.deprecated/lemmy/ReadMe.md @@ -0,0 +1,12 @@ +# Lemmy +This is like my 3rd attempt to make Lemmy do anything, but it is fundamentally +unable to run alongside other apps for no reason? I don't know. + +Modified from official instructions and resources at +https://join-lemmy.org/docs/administration/install_docker.html + +1. Copy all files (ReadMe.md unnecessary) to the target location. +2. Make changes in docker-compose.yml +3. Make changes in config.hjson +4. `mkdir -p volumes/pictrs volumes/lemmy-ui/extra_themes volumes/postgres` +5. `sudo chown 991:991 volumes/pictrs` diff --git a/.deprecated/lemmy/config.hjson b/.deprecated/lemmy/config.hjson new file mode 100644 index 0000000..d2a3831 --- /dev/null +++ b/.deprecated/lemmy/config.hjson @@ -0,0 +1,23 @@ +# TODO: Replace YOUR_POSTGRES_PASSWORD and YOUR_DOMAIN + +{ + # 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" + # Alternative way: + #uri: "postgresql://lemmy:YOUR_POSTGRES_PASSWORD@postgres/lemmy" + } + hostname: "YOUR_DOMAIN" + pictrs: { + url: "http://pictrs:8080/" + api_key: "YOUR_POSTGRES_PASSWORD" + } + email: { + smtp_server: "postfix:25" + smtp_from_address: "noreply@YOUR_DOMAIN" + tls_type: "none" + } +} diff --git a/.deprecated/lemmy/docker-compose.yml b/.deprecated/lemmy/docker-compose.yml new file mode 100644 index 0000000..42e088c --- /dev/null +++ b/.deprecated/lemmy/docker-compose.yml @@ -0,0 +1,91 @@ +# TODO change ALL_CAPS environment variables in all locations +# YOUR_DOMAIN and YOUR_POSTGRES_PASSWORD + +x-logging: &default-logging + driver: "json-file" + options: + max-size: "50m" + max-file: "4" + +services: + #proxy: + #image: nginx:1-alpine + # ports: + # Listen for outside connections on port 10633. You can freely change the left-side + # number to a different port, eg using port 80 if you don't need a reverse proxy. + # - "10633:8536" + #volumes: + #- ./nginx_internal.conf:/etc/nginx/nginx.conf:ro,Z + #- ./proxy_params:/etc/nginx/proxy_params:ro,Z + #restart: always + #logging: *default-logging + #depends_on: + #- pictrs + #- lemmy-ui + + lemmy: + image: dessalines/lemmy:0.19.15 + hostname: lemmy + restart: always + logging: *default-logging + environment: + - RUST_LOG="warn" + volumes: + - ./config.hjson:/config/config.hjson:Z + depends_on: + - postgres + - pictrs + + lemmy-ui: + image: dessalines/lemmy-ui:0.19.15 + environment: + - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536 + - LEMMY_UI_LEMMY_EXTERNAL_HOST=YOUR_DOMAIN + - LEMMY_UI_HTTPS=true + volumes: + - ./volumes/lemmy-ui/extra_themes:/app/extra_themes + depends_on: + - lemmy + restart: always + logging: *default-logging + + pictrs: + image: asonix/pictrs:0.5.21 + # this needs to match the pictrs url in lemmy.hjson + hostname: pictrs + # we can set options to pictrs like this, here we set max. image size and forced format for conversion + # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp + environment: + - PICTRS_OPENTELEMETRY_URL=http://otel:4137 + - PICTRS__SERVER__API_KEY=YOUR_POSTGRES_PASSWORD + - RUST_BACKTRACE=full + - PICTRS__MEDIA__VIDEO__VIDEO_CODEC=vp9 + - PICTRS__MEDIA__ANIMATION__MAX_WIDTH=256 + - PICTRS__MEDIA__ANIMATION__MAX_HEIGHT=256 + - PICTRS__MEDIA__ANIMATION__MAX_FRAME_COUNT=400 + user: 991:991 + volumes: + - ./volumes/pictrs:/mnt:Z + restart: always + logging: *default-logging + + postgres: + image: pgautoupgrade/pgautoupgrade:18-alpine + hostname: postgres + environment: + - POSTGRES_USER=lemmy + - POSTGRES_PASSWORD=YOUR_POSTGRES_PASSWORD + - POSTGRES_DB=lemmy + shm_size: 1g + volumes: + - ./volumes/postgres:/var/lib/postgresql:Z + # - ./customPostgresql.conf:/etc/postgresql.conf + restart: always + logging: *default-logging + + postfix: + image: mwader/postfix-relay + environment: + - POSTFIX_myhostname=YOUR_DOMAIN + restart: "always" + logging: *default-logging diff --git a/.deprecated/lemmy/nginx_internal.conf b/.deprecated/lemmy/nginx_internal.conf new file mode 100644 index 0000000..f0aae97 --- /dev/null +++ b/.deprecated/lemmy/nginx_internal.conf @@ -0,0 +1,85 @@ +worker_processes auto; + +events { + worker_connections 1024; +} + +http { + # Docker internal DNS IP so we always get the newer containers without having to + # restart/reload the docker container / nginx configuration + resolver 127.0.0.11 valid=5s; + + # set the real_ip when from docker internal ranges. Ensuring our internal nginx + # container can always see the correct ips in the logs + set_real_ip_from 10.0.0.0/8; + set_real_ip_from 172.16.0.0/12; + set_real_ip_from 192.168.0.0/16; + + # We construct a string consistent of the "request method" and "http accept header" + # and then apply soem ~simply regexp matches to that combination to decide on the + # HTTP upstream we should proxy the request to. + # + # Example strings: + # + # "GET:application/activity+json" + # "GET:text/html" + # "POST:application/activity+json" + # + # You can see some basic match tests in this regex101 matching this configuration + # https://regex101.com/r/vwMJNc/1 + # + # Learn more about nginx maps here http://nginx.org/en/docs/http/ngx_http_map_module.html + map "$request_method:$http_accept" $proxpass { + # If no explicit matches exists below, send traffic to lemmy-ui + default "http://lemmy-ui:1234"; + + # GET/HEAD requests that accepts ActivityPub or Linked Data JSON should go to lemmy. + # + # These requests are used by Mastodon and other fediverse instances to look up profile information, + # discover site information and so on. + "~^(?:GET|HEAD):.*?application\/(?:activity|ld)\+json" "http://lemmy:8536"; + + # All non-GET/HEAD requests should go to lemmy + # + # Rather than calling out POST, PUT, DELETE, PATCH, CONNECT and all the verbs manually + # we simply negate the GET|HEAD pattern from above and accept all possibly $http_accept values + "~^(?!(GET|HEAD)).*:" "http://lemmy:8536"; + } + + server { + set $lemmy_ui "lemmy-ui:1234"; + set $lemmy "lemmy:8536"; + # this is the port inside docker, not the public one yet + listen 1236; + listen 8536; + + # change if needed, this is facing the public web + server_name localhost; + server_tokens off; + + # Upload limit, relevant for pictrs + client_max_body_size 20M; + + # Send actual client IP upstream + include proxy_params; + + # frontend general requests + location / { + proxy_pass $proxpass; + rewrite ^(.+)/+$ $1 permanent; + } + + # security.txt + location = /.well-known/security.txt { + proxy_pass "http://$lemmy_ui"; + } + + # backend + location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known|version|sitemap.xml) { + proxy_pass "http://$lemmy"; + + # Send actual client IP upstream + include proxy_params; + } + } +} diff --git a/.deprecated/lemmy/proxy_params b/.deprecated/lemmy/proxy_params new file mode 100644 index 0000000..df75bc5 --- /dev/null +++ b/.deprecated/lemmy/proxy_params @@ -0,0 +1,4 @@ +proxy_set_header Host $http_host; +proxy_set_header X-Real-IP $remote_addr; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header X-Forwarded-Proto $scheme; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store