Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
lemmy [2025/06/12 11:11] jango |
lemmy [2025/06/28 17:54] (aktuell) jango |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | [[https://hub.docker.com/r/ | + | [[https://github.com/ |
+ | |||
+ | <code bash> | ||
+ | git clone https:// | ||
+ | cd lemmy/ | ||
+ | docker-compose up -d | ||
+ | </ | ||
+ | |||
+ | Docker compose | ||
+ | |||
+ | <code yaml> | ||
+ | version: ' | ||
+ | |||
+ | services: | ||
+ | nginx_lemmy: | ||
+ | image: nginx: | ||
+ | restart: always | ||
+ | ports: | ||
+ | # - < | ||
+ | - 80:80 | ||
+ | depends_on: | ||
+ | - lemmy | ||
+ | volumes: | ||
+ | - ./ | ||
+ | |||
+ | lemmy: | ||
+ | # Update this tag name when the software updates | ||
+ | image: | ||
+ | restart: always | ||
+ | environment: | ||
+ | - RUST_LOG=" | ||
+ | volumes: | ||
+ | - ./ | ||
+ | depends_on: | ||
+ | - postgres | ||
+ | - pictrs | ||
+ | |||
+ | lemmy-ui: | ||
+ | # Update this tag name when the software updates | ||
+ | image: dessalines/ | ||
+ | restart: always | ||
+ | environment: | ||
+ | - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy: | ||
+ | - LEMMY_UI_LEMMY_EXTERNAL_HOST=lemmy | ||
+ | - LEMMY_UI_HTTPS=true | ||
+ | volumes: | ||
+ | - ./ | ||
+ | depends_on: | ||
+ | - lemmy | ||
+ | |||
+ | postgres: | ||
+ | image: postgres: | ||
+ | environment: | ||
+ | - POSTGRES_USER=lemmy | ||
+ | - POSTGRES_PASSWORD=PUT_IN_A_GOOD_PASSWORD_HERE!!! | ||
+ | - POSTGRES_DB=lemmy | ||
+ | volumes: | ||
+ | - ./ | ||
+ | # - ./ | ||
+ | restart: always | ||
+ | |||
+ | pictrs: | ||
+ | image: asonix/ | ||
+ | user: 991:991 | ||
+ | volumes: | ||
+ | - ./ | ||
+ | restart: always | ||
+ | mem_limit: 200m | ||
+ | # we can set options to pictrs like this, here we set max. image size and forced format for conversion | ||
+ | # entrypoint: /sbin/tini -- / | ||
+ | |||
+ | # Not needed if you are using gmail | ||
+ | #postfix: | ||
+ | # image: mwader/ | ||
+ | # environment: | ||
+ | # # Your domain name without any protocol or slashes. e.g. lemmy.yourdomain.net | ||
+ | # - POSTFIX_myhostname=lemmy.yourdomain.net | ||
+ | # restart: always | ||
+ | </ | ||
+ | |||
+ | lemmy.hjson | ||
+ | |||
+ | <code hjson> | ||
+ | { | ||
+ | # for more info about the config, check out the documentation | ||
+ | # https:// | ||
+ | # only few config options are covered in this example config | ||
+ | |||
+ | setup: { | ||
+ | # username for the admin user | ||
+ | admin_username: | ||
+ | # password for the admin user | ||
+ | # remove this password after your account is created, imo. | ||
+ | admin_password: | ||
+ | # name of the site (can be changed later) | ||
+ | site_name: "A selfhosted place" | ||
+ | } | ||
+ | |||
+ | # the domain name of your instance (eg " | ||
+ | hostname: " | ||
+ | # address where lemmy should listen for incoming requests | ||
+ | bind: " | ||
+ | # port where lemmy should listen for incoming requests | ||
+ | port: 8536 | ||
+ | # Whether the site is available over TLS. Needs to be true for federation to work. | ||
+ | tls_enabled: | ||
+ | |||
+ | # pictrs host | ||
+ | pictrs: { | ||
+ | url: " | ||
+ | # api_key: " | ||
+ | } | ||
+ | |||
+ | # settings related to the postgresql database | ||
+ | database: { | ||
+ | # name of the postgres database for lemmy | ||
+ | database: " | ||
+ | # username to connect to postgres | ||
+ | user: " | ||
+ | # password to connect to postgres | ||
+ | password: " | ||
+ | # host where postgres is running | ||
+ | host: " | ||
+ | # port where postgres can be accessed | ||
+ | port: 5432 | ||
+ | # maximum number of active sql connections | ||
+ | pool_size: 5 | ||
+ | } | ||
+ | |||
+ | email: { | ||
+ | # Hostname and port of the smtp server | ||
+ | smtp_server: | ||
+ | # Login name for smtp server | ||
+ | smtp_login: " | ||
+ | # Password to login to the smtp server | ||
+ | smtp_password: | ||
+ | # Address to send emails from, eg " | ||
+ | smtp_from_address: | ||
+ | # Whether or not smtp connections should use tls. Can be none, tls, or starttls | ||
+ | tls_type: " | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | nginx.conf | ||
< | < | ||
- | mkdir /lemmy/ | + | worker_processes 1; |
- | cd /lemmy/ | + | events { |
- | wget https:// | + | worker_connections 1024; |
+ | } | ||
+ | http { | ||
+ | upstream | ||
+ | # this needs to map to the lemmy (server) docker service hostname | ||
+ | | ||
+ | } | ||
+ | upstream | ||
+ | # this needs to map to the lemmy-ui | ||
+ | server "lemmy-ui: | ||
+ | } | ||
- | # repair official image | + | server { |
- | rm -rf / | + | # this is the port inside docker, not the public one yet |
- | wget https:// | + | listen 80; |
+ | # listen 8536; | ||
+ | | ||
+ | | ||
+ | | ||
- | docker-compose up -d | + | gzip on; |
+ | gzip_types text/css application/ | ||
+ | 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"; | ||
+ | |||
+ | # frontend general requests | ||
+ | location / { | ||
+ | # distinguish between ui requests and backend | ||
+ | # don't change lemmy-ui or lemmy here, they refer to the upstream definitions on top | ||
+ | set $proxpass " | ||
+ | |||
+ | if ($http_accept = " | ||
+ | set $proxpass " | ||
+ | } | ||
+ | if ($http_accept = " | ||
+ | set $proxpass " | ||
+ | } | ||
+ | if ($request_method = POST) { | ||
+ | set $proxpass " | ||
+ | } | ||
+ | proxy_pass $proxpass; | ||
+ | |||
+ | rewrite ^(.+)/+$ $1 permanent; | ||
+ | # Send actual client IP upstream | ||
+ | proxy_set_header X-Real-IP $remote_addr; | ||
+ | proxy_set_header Host $host; | ||
+ | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
+ | } | ||
+ | |||
+ | # backend | ||
+ | location ~ ^/ | ||
+ | proxy_pass " | ||
+ | # proxy common stuff | ||
+ | proxy_http_version 1.1; | ||
+ | proxy_set_header Upgrade $http_upgrade; | ||
+ | proxy_set_header Connection " | ||
+ | |||
+ | # Send actual client IP upstream | ||
+ | proxy_set_header X-Real-IP $remote_addr; | ||
+ | proxy_set_header Host $host; | ||
+ | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
+ | } | ||
+ | } | ||
+ | } | ||
</ | </ |