]> Untitled Git - lemmy.git/commitdiff
Fix docker federation setup (#2706)
authorNutomic <me@nutomic.com>
Sun, 5 Feb 2023 17:30:10 +0000 (02:30 +0900)
committerGitHub <noreply@github.com>
Sun, 5 Feb 2023 17:30:10 +0000 (12:30 -0500)
api_tests/src/shared.ts
crates/apub/src/lib.rs
crates/db_schema/src/utils.rs
docker/federation/docker-compose.yml
docker/federation/lemmy_alpha.hjson
docker/federation/lemmy_beta.hjson
docker/federation/lemmy_delta.hjson
docker/federation/lemmy_epsilon.hjson
docker/federation/lemmy_gamma.hjson
docker/federation/start-local-instances.bash

index 0805481858d924d9ec5b29de34b4818b94e637e9..835f119ceb8930fe3d19d870f78903e23cbdcef1 100644 (file)
@@ -147,7 +147,6 @@ export async function setupLogins() {
   // Registration applications are now enabled by default, need to disable them
   let editSiteForm: EditSite = {
     registration_mode: RegistrationMode.Open,
-    federation_debug: true,
     rate_limit_message: 999,
     rate_limit_post: 999,
     rate_limit_register: 999,
index 0908a1f4f4ec1cd3fcec5e28cf8acec0c93decab..53fe7cd3fe54e79b2b38ce5278cdeab10d58c3a2 100644 (file)
@@ -45,15 +45,11 @@ async fn local_instance(context: &LemmyContext) -> &'static LocalInstance {
         .as_ref()
         .map(|l| l.federation_worker_count)
         .unwrap_or(64) as u64;
-      let federation_debug = local_site
-        .as_ref()
-        .map(|l| l.federation_debug)
-        .unwrap_or(true);
 
       let settings = InstanceSettings::builder()
         .http_fetch_retry_limit(FEDERATION_HTTP_FETCH_LIMIT)
         .worker_count(worker_count)
-        .debug(federation_debug)
+        .debug(cfg!(debug_assertions))
         .http_signature_compat(true)
         .url_verifier(Box::new(VerifyUrlData(context.clone())))
         .build()
index 8441b6872b0c063c13f3ff8e93a2b51020f76480..76d1f795007747784bfb944ed698d497a2d9088b 100644 (file)
@@ -154,11 +154,11 @@ pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
 pub fn run_migrations(db_url: &str) {
   // Needs to be a sync connection
   let mut conn =
-    PgConnection::establish(db_url).unwrap_or_else(|_| panic!("Error connecting to {db_url}"));
+    PgConnection::establish(db_url).unwrap_or_else(|e| panic!("Error connecting to {db_url}: {e}"));
   info!("Running Database migrations (This may take a long time)...");
   let _ = &mut conn
     .run_pending_migrations(MIGRATIONS)
-    .unwrap_or_else(|_| panic!("Couldn't run DB Migrations"));
+    .unwrap_or_else(|e| panic!("Couldn't run DB Migrations: {e}"));
   info!("Database migrations complete.");
 }
 
index 5434603bcb6937a4b80ddd70fe4a6edeafa9215b..f581aa4f46c088c03a55c16bee7179274a101163 100644 (file)
@@ -30,9 +30,9 @@ services:
   lemmy-alpha-ui:
     image: dessalines/lemmy-ui:0.17.1
     environment:
-      - LEMMY_INTERNAL_HOST=lemmy-alpha:8541
-      - LEMMY_EXTERNAL_HOST=localhost:8541
-      - LEMMY_HTTPS=false
+      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy-alpha:8541
+      - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:8541
+      - LEMMY_UI_HTTPS=false
     depends_on:
       - lemmy-alpha
   lemmy-alpha:
@@ -52,15 +52,16 @@ services:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
       - POSTGRES_DB=lemmy
+    restart: always
     volumes:
       - ./volumes/postgres_alpha:/var/lib/postgresql/data
 
   lemmy-beta-ui:
     image: dessalines/lemmy-ui:0.17.1
     environment:
-      - LEMMY_INTERNAL_HOST=lemmy-beta:8551
-      - LEMMY_EXTERNAL_HOST=localhost:8551
-      - LEMMY_HTTPS=false
+      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy-beta:8551
+      - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:8551
+      - LEMMY_UI_HTTPS=false
     depends_on:
       - lemmy-beta
   lemmy-beta:
@@ -80,15 +81,16 @@ services:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
       - POSTGRES_DB=lemmy
+    restart: always
     volumes:
       - ./volumes/postgres_beta:/var/lib/postgresql/data
 
   lemmy-gamma-ui:
     image: dessalines/lemmy-ui:0.17.1
     environment:
-      - LEMMY_INTERNAL_HOST=lemmy-gamma:8561
-      - LEMMY_EXTERNAL_HOST=localhost:8561
-      - LEMMY_HTTPS=false
+      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy-gamma:8561
+      - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:8561
+      - LEMMY_UI_HTTPS=false
     depends_on:
       - lemmy-gamma
   lemmy-gamma:
@@ -108,6 +110,7 @@ services:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
       - POSTGRES_DB=lemmy
+    restart: always
     volumes:
       - ./volumes/postgres_gamma:/var/lib/postgresql/data
 
@@ -115,9 +118,9 @@ services:
   lemmy-delta-ui:
     image: dessalines/lemmy-ui:0.17.1
     environment:
-      - LEMMY_INTERNAL_HOST=lemmy-delta:8571
-      - LEMMY_EXTERNAL_HOST=localhost:8571
-      - LEMMY_HTTPS=false
+      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy-delta:8571
+      - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:8571
+      - LEMMY_UI_HTTPS=false
     depends_on:
       - lemmy-delta
   lemmy-delta:
@@ -137,6 +140,7 @@ services:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
       - POSTGRES_DB=lemmy
+    restart: always
     volumes:
       - ./volumes/postgres_delta:/var/lib/postgresql/data
 
@@ -144,9 +148,9 @@ services:
   lemmy-epsilon-ui:
     image: dessalines/lemmy-ui:0.17.1
     environment:
-      - LEMMY_INTERNAL_HOST=lemmy-epsilon:8581
-      - LEMMY_EXTERNAL_HOST=localhost:8581
-      - LEMMY_HTTPS=false
+      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy-epsilon:8581
+      - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:8581
+      - LEMMY_UI_HTTPS=false
     depends_on:
       - lemmy-epsilon
   lemmy-epsilon:
@@ -166,5 +170,6 @@ services:
       - POSTGRES_USER=lemmy
       - POSTGRES_PASSWORD=password
       - POSTGRES_DB=lemmy
+    restart: always
     volumes:
       - ./volumes/postgres_epsilon:/var/lib/postgresql/data
index 5620c447e946bcac5bb7fcc62f08cbf3ed177764..a0329b30fd4db656f6aac2268c25fd42e328e55b 100644 (file)
@@ -7,13 +7,7 @@
     admin_password: lemmylemmy
     site_name: lemmy-alpha
   }
-  # These are ignored, use LEMMY_DATABASE_URL
   database: {
-    database: lemmy_alpha
-    user: lemmy
-    password: password
-    host: localhost
-    port: 5432
-    pool_size: 5
+    host: postgres_alpha
   }
 }
index 4aed8552d75cf7735406058e05ba448ba43ae74e..228fe502d522e4cb87e6e3343e51cd3e45edece3 100644 (file)
@@ -8,11 +8,6 @@
     site_name: lemmy-beta
   }
   database: {
-    database: lemmy_beta
-    user: lemmy
-    password: password
-    host: localhost
-    port: 5432
-    pool_size: 5
+    host: postgres_beta
   }
 }
index e2ed25472f194b97b61951243a564e2330441ccd..d05e4121fa9ee80903cc4f5a3c14ca83bfe55c9a 100644 (file)
@@ -8,11 +8,6 @@
     site_name: lemmy-delta
   }
   database: {
-    database: lemmy_delta
-    user: lemmy
-    password: password
-    host: localhost
-    port: 5432
-    pool_size: 5
+    host: postgres_delta
   }
 }
index cdba057718cd13be0124a2efb71af5d4cb827949..17fe2f6356b5a62e0c48d5c591010d3d2bedae47 100644 (file)
@@ -8,11 +8,6 @@
     site_name: lemmy-epsilon
   }
   database: {
-    database: lemmy_epsilon
-    user: lemmy
-    password: password
-    host: localhost
-    port: 5432
-    pool_size: 5
+    host: postgres_epsilon
   }
 }
index 80c75b256d094d4997b0049f2f60e786d278f817..2041c984097a286732a970049f681986f2c2aed4 100644 (file)
@@ -8,11 +8,6 @@
     site_name: lemmy-gamma
   }
   database: {
-    database: lemmy_gamma
-    user: lemmy
-    password: password
-    host: localhost
-    port: 5432
-    pool_size: 5
+    host: postgres_gamma
   }
 }
index 1c38c2daedede7c563d59696966c007bfd8ceb69..7527108d62dbde76a98813faf03144c2a9c6d2a1 100755 (executable)
@@ -3,7 +3,7 @@ set -e
 
 sudo docker-compose down
 
-sudo docker build ../../ --file ../dev/volume_mount.dockerfile -t lemmy-federation:latest
+sudo docker build ../../ --file ../dev/Dockerfile -t lemmy-federation:latest
 
 for Item in alpha beta gamma delta epsilon ; do
   sudo mkdir -p volumes/pictrs_$Item