4 export LEMMY_TEST_SEND_SYNC=1
5 export RUST_BACKTRACE=1
7 for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
8 psql "${LEMMY_DATABASE_URL}/lemmy" -c "DROP DATABASE IF EXISTS $INSTANCE"
9 psql "${LEMMY_DATABASE_URL}/lemmy" -c "CREATE DATABASE $INSTANCE"
12 if [ -z "$DO_WRITE_HOSTS_FILE" ]; then
13 if ! grep -q lemmy-alpha /etc/hosts; then
14 echo "Please add the following to your /etc/hosts file, then press enter:
20 127.0.0.1 lemmy-epsilon"
24 for INSTANCE in lemmy-alpha lemmy-beta lemmy-gamma lemmy-delta lemmy-epsilon; do
25 echo "127.0.0.1 $INSTANCE" >> /etc/hosts
29 killall lemmy_server || true
34 LEMMY_HOSTNAME=lemmy-alpha:8541 \
35 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_alpha.hjson \
36 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_alpha" \
37 LEMMY_HOSTNAME="lemmy-alpha:8541" \
38 target/lemmy_server >/tmp/lemmy_alpha.out 2>&1 &
41 LEMMY_HOSTNAME=lemmy-beta:8551 \
42 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_beta.hjson \
43 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_beta" \
44 target/lemmy_server >/tmp/lemmy_beta.out 2>&1 &
47 LEMMY_HOSTNAME=lemmy-gamma:8561 \
48 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_gamma.hjson \
49 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_gamma" \
50 target/lemmy_server >/tmp/lemmy_gamma.out 2>&1 &
53 # An instance with only an allowlist for beta
54 LEMMY_HOSTNAME=lemmy-delta:8571 \
55 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_delta.hjson \
56 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_delta" \
57 target/lemmy_server >/tmp/lemmy_delta.out 2>&1 &
60 # An instance who has a blocklist, with lemmy-alpha blocked
61 LEMMY_HOSTNAME=lemmy-epsilon:8581 \
62 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_epsilon.hjson \
63 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_epsilon" \
64 target/lemmy_server >/tmp/lemmy_epsilon.out 2>&1 &
66 echo "wait for all instances to start"
67 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8541/api/v3/site')" != "200" ]]; do sleep 1; done
68 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8551/api/v3/site')" != "200" ]]; do sleep 1; done
69 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8561/api/v3/site')" != "200" ]]; do sleep 1; done
70 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8571/api/v3/site')" != "200" ]]; do sleep 1; done
71 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8581/api/v3/site')" != "200" ]]; do sleep 1; done