Fix docker federation setup (#2706)

This commit is contained in:
Nutomic 2023-02-06 02:30:10 +09:00 committed by GitHub
parent eb78af9b02
commit 2891856b48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 29 additions and 55 deletions

View 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,

View 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()

View 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.");
}

View 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

View 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
}
}

View 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
}
}

View 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
}
}

View 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
}
}

View 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
}
}

View file

@ -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