2 # IMPORTANT NOTE: this script does not use the normal LEMMY_DATABASE_URL format
3 # it is expected that this script is called by run-federation-test.sh script.
6 export RUST_BACKTRACE=1
7 export RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
9 for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
10 echo "DB URL: ${LEMMY_DATABASE_URL} INSTANCE: $INSTANCE"
11 psql "${LEMMY_DATABASE_URL}/lemmy" -c "DROP DATABASE IF EXISTS $INSTANCE"
12 echo "create database"
13 psql "${LEMMY_DATABASE_URL}/lemmy" -c "CREATE DATABASE $INSTANCE"
16 if [ -z "$DO_WRITE_HOSTS_FILE" ]; then
17 if ! grep -q lemmy-alpha /etc/hosts; then
18 echo "Please add the following to your /etc/hosts file, then press enter:
24 127.0.0.1 lemmy-epsilon"
28 for INSTANCE in lemmy-alpha lemmy-beta lemmy-gamma lemmy-delta lemmy-epsilon; do
29 echo "127.0.0.1 $INSTANCE" >> /etc/hosts
36 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_alpha.hjson \
37 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_alpha" \
38 target/lemmy_server >/tmp/lemmy_alpha.out 2>&1 &
41 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_beta.hjson \
42 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_beta" \
43 target/lemmy_server >/tmp/lemmy_beta.out 2>&1 &
46 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_gamma.hjson \
47 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_gamma" \
48 target/lemmy_server >/tmp/lemmy_gamma.out 2>&1 &
51 # An instance with only an allowlist for beta
52 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_delta.hjson \
53 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_delta" \
54 target/lemmy_server >/tmp/lemmy_delta.out 2>&1 &
57 # An instance who has a blocklist, with lemmy-alpha blocked
58 LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_epsilon.hjson \
59 LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_epsilon" \
60 target/lemmy_server >/tmp/lemmy_epsilon.out 2>&1 &
62 echo "wait for all instances to start"
63 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-alpha:8541/api/v3/site')" != "200" ]]; do sleep 1; done
65 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-beta:8551/api/v3/site')" != "200" ]]; do sleep 1; done
67 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-gamma:8561/api/v3/site')" != "200" ]]; do sleep 1; done
69 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-delta:8571/api/v3/site')" != "200" ]]; do sleep 1; done
71 while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-epsilon:8581/api/v3/site')" != "200" ]]; do sleep 1; done
72 echo "epsilon started. All started"