2020-12-10 17:29:13 +00:00
|
|
|
#!/bin/bash
|
2020-12-10 17:03:11 +00:00
|
|
|
set -e
|
|
|
|
|
2020-12-14 16:44:27 +00:00
|
|
|
export LEMMY_TEST_SEND_SYNC=1
|
2020-12-10 17:03:11 +00:00
|
|
|
export RUST_BACKTRACE=1
|
Apub inbox rewrite (#1652)
* start to implement apub inbox routing lib
* got something that almost works
* it compiles!
* implemented some more
* move library code to separate crate (most of it)
* convert private message handlers
* convert all comment receivers (except undo comment)
* convert post receiver
* add verify trait
* convert community receivers
* add cc field for all activities which i forgot before
* convert inbox functions, add missing checks
* convert undo like/dislike receivers
* convert undo_delete and undo_remove receivers
* move block/unblock activities
* convert remaining activity receivers
* reimplement http signature verification and other checks
* also use actor type for routing, VerifyActivity and SendActivity traits
* cleanup and restructure apub_receive code
* wip: try to fix activity routing
* implement a (very bad) derive macro for activityhandler
* working activity routing!
* rework pm verify(), fix tests and confirm manually
also remove inbox username check which was broken
* rework following verify(), fix tests and test manually
* fix post/comment create/update, rework voting
* Rewrite remove/delete post/comment, fix tests, test manually
* Rework and fix (un)block user, announce, update post
* some code cleanup
* rework delete/remove activity receivers (still quite messy)
* rewrite, test and fix add/remove mod, update community handlers
* add docs for ActivityHandler derive macro
* dont try to compile macro comments
2021-07-17 16:08:46 +00:00
|
|
|
export RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_apub_receive=debug,lemmy_db_queries=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"
|
2020-12-10 17:03:11 +00:00
|
|
|
|
2020-12-11 17:09:47 +00:00
|
|
|
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
|
2020-12-15 13:58:11 +00:00
|
|
|
psql "${LEMMY_DATABASE_URL}/lemmy" -c "DROP DATABASE IF EXISTS $INSTANCE"
|
|
|
|
psql "${LEMMY_DATABASE_URL}/lemmy" -c "CREATE DATABASE $INSTANCE"
|
2020-12-11 17:09:47 +00:00
|
|
|
done
|
|
|
|
|
2020-12-15 13:58:11 +00:00
|
|
|
if [ -z "$DO_WRITE_HOSTS_FILE" ]; then
|
|
|
|
if ! grep -q lemmy-alpha /etc/hosts; then
|
|
|
|
echo "Please add the following to your /etc/hosts file, then press enter:
|
|
|
|
|
|
|
|
127.0.0.1 lemmy-alpha
|
|
|
|
127.0.0.1 lemmy-beta
|
|
|
|
127.0.0.1 lemmy-gamma
|
|
|
|
127.0.0.1 lemmy-delta
|
|
|
|
127.0.0.1 lemmy-epsilon"
|
|
|
|
read -p ""
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
for INSTANCE in lemmy-alpha lemmy-beta lemmy-gamma lemmy-delta lemmy-epsilon; do
|
|
|
|
echo "127.0.0.1 $INSTANCE" >> /etc/hosts
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
killall lemmy_server || true
|
2020-12-11 17:22:16 +00:00
|
|
|
|
2021-03-01 17:24:11 +00:00
|
|
|
echo "$PWD"
|
|
|
|
|
2020-12-10 17:03:11 +00:00
|
|
|
echo "start alpha"
|
|
|
|
LEMMY_HOSTNAME=lemmy-alpha:8541 \
|
2021-03-01 17:24:11 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_alpha.hjson \
|
2020-12-15 13:58:11 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_alpha" \
|
2021-03-01 17:24:11 +00:00
|
|
|
LEMMY_HOSTNAME="lemmy-alpha:8541" \
|
|
|
|
target/lemmy_server >/tmp/lemmy_alpha.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start beta"
|
|
|
|
LEMMY_HOSTNAME=lemmy-beta:8551 \
|
2021-03-01 17:24:11 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_beta.hjson \
|
2020-12-15 13:58:11 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_beta" \
|
2021-03-01 17:24:11 +00:00
|
|
|
target/lemmy_server >/tmp/lemmy_beta.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start gamma"
|
|
|
|
LEMMY_HOSTNAME=lemmy-gamma:8561 \
|
2021-03-01 17:24:11 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_gamma.hjson \
|
2020-12-15 13:58:11 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_gamma" \
|
2021-03-01 17:24:11 +00:00
|
|
|
target/lemmy_server >/tmp/lemmy_gamma.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start delta"
|
|
|
|
# An instance with only an allowlist for beta
|
|
|
|
LEMMY_HOSTNAME=lemmy-delta:8571 \
|
2021-03-01 17:24:11 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_delta.hjson \
|
2020-12-15 13:58:11 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_delta" \
|
2021-03-01 17:24:11 +00:00
|
|
|
target/lemmy_server >/tmp/lemmy_delta.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start epsilon"
|
|
|
|
# An instance who has a blocklist, with lemmy-alpha blocked
|
|
|
|
LEMMY_HOSTNAME=lemmy-epsilon:8581 \
|
2021-03-01 17:24:11 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_epsilon.hjson \
|
2020-12-15 13:58:11 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_epsilon" \
|
2021-03-01 17:24:11 +00:00
|
|
|
target/lemmy_server >/tmp/lemmy_epsilon.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "wait for all instances to start"
|
2021-03-29 15:26:15 +00:00
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8541/api/v3/site')" != "200" ]]; do sleep 1; done
|
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8551/api/v3/site')" != "200" ]]; do sleep 1; done
|
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8561/api/v3/site')" != "200" ]]; do sleep 1; done
|
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8571/api/v3/site')" != "200" ]]; do sleep 1; done
|
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'localhost:8581/api/v3/site')" != "200" ]]; do sleep 1; done
|