]> Untitled Git - lemmy.git/commitdiff
setup db
authorFelix Ableitner <me@nutomic.com>
Fri, 11 Dec 2020 17:09:47 +0000 (18:09 +0100)
committerFelix Ableitner <me@nutomic.com>
Fri, 11 Dec 2020 17:09:47 +0000 (18:09 +0100)
.drone.yml
api_tests/prepare-drone-federation-test.sh

index c1fb1b7cb93f1031de35f06752c248b3835b9257..3988661e09194f496ac4f2df2d1f97e935a03680 100644 (file)
@@ -45,7 +45,6 @@ steps:
     image: ekidd/rust-musl-builder:1.47.0
     environment:
       LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
-      DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
       RUST_BACKTRACE: 1
       RUST_TEST_THREADS: 1
     commands:
@@ -57,17 +56,16 @@ steps:
       ref:
         - refs/tags/*
 
-  # cargo build --release
-  # mv target/x86_64-unknown-linux-musl/release/lemmy_server target/lemmy_server
   - name: cargo build
     image: ekidd/rust-musl-builder:1.47.0
     commands:
       - cargo build
       - mv target/x86_64-unknown-linux-musl/debug/lemmy_server target/lemmy_server
-      - ls -la target/lemmy_server
 
   - name: run federation tests
     image: node:15-alpine3.12
+    environment:
+      LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
     commands:
       - ls -la target/lemmy_server
       - apk add bash curl postgresql-client
index 84e4f28830fa9c939a918665ee2dc9ef23c6b4b0..769fb3867dcc3733fe0a959e217e0c9428aed9fd 100755 (executable)
@@ -11,52 +11,56 @@ export LEMMY_CAPTCHA__ENABLED=false
 export RUST_BACKTRACE=1
 export RUST_LOG=debug
 
+for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
+  psql "$LEMMY_DATABASE_URL" -c "CREATE DATABASE $INSTANCE"
+done
+
 echo "start alpha"
 LEMMY_HOSTNAME=lemmy-alpha:8541 \
   LEMMY_PORT=8541 \
-  LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_alpha:5432/lemmy \
+  LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_alpha \
   LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon \
   LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha \
   LEMMY_SETUP__SITE_NAME=lemmy-alpha \
-  target/lemmy_server
+  target/lemmy_server &
 
 echo "start beta"
 LEMMY_HOSTNAME=lemmy-beta:8551 \
   LEMMY_PORT=8551 \
-  LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_beta:5432/lemmy \
+  LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_beta \
   LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon \
   LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta \
   LEMMY_SETUP__SITE_NAME=lemmy-beta \
-  target/debug/lemmy_server &
+  target/lemmy_server &
 
 echo "start gamma"
 LEMMY_HOSTNAME=lemmy-gamma:8561 \
   LEMMY_PORT=8561 \
-  LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_gamma:5432/lemmy \
+  LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_gamma \
   LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon \
   LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma \
   LEMMY_SETUP__SITE_NAME=lemmy-gamma \
-  target/debug/lemmy_server &
+  target/lemmy_server &
 
 echo "start delta"
 # An instance with only an allowlist for beta
 LEMMY_HOSTNAME=lemmy-delta:8571 \
   LEMMY_PORT=8571 \
-  LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_delta:5432/lemmy \
+  LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_delta \
   LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta \
   LEMMY_SETUP__ADMIN_USERNAME=lemmy_delta \
   LEMMY_SETUP__SITE_NAME=lemmy-delta \
-  target/debug/lemmy_server &
+  target/lemmy_server &
 
 echo "start epsilon"
 # An instance who has a blocklist, with lemmy-alpha blocked
 LEMMY_HOSTNAME=lemmy-epsilon:8581 \
   LEMMY_PORT=8581 \
-  LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_epsilon:5432/lemmy \
+  LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_epsilon \
   LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha \
   LEMMY_SETUP__ADMIN_USERNAME=lemmy_epsilon \
   LEMMY_SETUP__SITE_NAME=lemmy-epsilon \
-  target/debug/lemmy_server &
+  target/lemmy_server &
 
 echo "wait for all instances to start"
 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8541/api/v1/site')" != "200" ]]; do sleep 1; done