Last active 1736107024

Korbs's Avatar Korbs revised this gist 1736107023. Go to revision

1 file changed, 26 insertions, 1 deletion

README.md

@@ -1 +1,26 @@
1 - # Lemmy
1 + # Lemmy Instance in Docker
2 +
3 + > This is how SudoVanilla's Lemmy server is setup.
4 +
5 + Create a folder for your Lemmy instance and change over to it in your terminal:
6 + ```bash
7 + mkdir lemmy
8 + cd lemmy
9 + ```
10 +
11 + Add the files below in this Gist to the folder.
12 +
13 + Then create the pictrs volume and set it's permissiosn:
14 + ```bash
15 + mkdir volumes/pictrs
16 + chown -R 991:991 volumes/pictrs
17 + ```
18 +
19 + Then start your Lemmy instance, using the compose command:
20 + ```bash
21 + docker compose up
22 + ```
23 +
24 + Please wait at least 2 - 5 minutes, going to your instance's URL may show an error message if you look too soon. This is because the database is still starting up, this is the case for when you startup the instance again in the future too.
25 +
26 + Once the instance is done booting and the database is finished starting up, go to your instance and login to your admin user to confirm setup is complete. The URL with this setup is at [`http://localhost:3080`](http://localhost:3080).

Korbs's Avatar Korbs revised this gist 1736106671. Go to revision

1 file changed, 1 insertion

README.md(file created)

@@ -0,0 +1 @@
1 + # Lemmy

Korbs's Avatar Korbs revised this gist 1736106635. Go to revision

3 files changed, 142 insertions

docker-compose.yml(file created)

@@ -0,0 +1,51 @@
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(file created)

@@ -0,0 +1,32 @@
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(file created)

@@ -0,0 +1,59 @@
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 + }
Newer Older