2023-06-08 19:38:26 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-07-19 08:28:10 +00:00
|
|
|
# IMPORTANT NOTE: this script does not use the normal LEMMY_DATABASE_URL format
|
|
|
|
# it is expected that this script is called by run-federation-test.sh script.
|
2020-12-10 17:03:11 +00:00
|
|
|
set -e
|
|
|
|
|
2024-05-21 18:47:06 +00:00
|
|
|
if [ -z "$LEMMY_LOG_LEVEL" ];
|
2024-01-26 09:38:15 +00:00
|
|
|
then
|
2024-05-21 18:47:06 +00:00
|
|
|
LEMMY_LOG_LEVEL=info
|
2024-01-26 09:38:15 +00:00
|
|
|
fi
|
|
|
|
|
2020-12-10 17:03:11 +00:00
|
|
|
export RUST_BACKTRACE=1
|
Search combined (#5271)
* Renaming person_mention to person_comment_mention.
* Finishing up post body mentions.
* Combined tables try 2
* Finishing up combined report table.
* Fix ts optionals.
* Adding tests, triggers, and history updates for report_combined.
* Adding profile.
* Add cursor pagination to report_combined view (#5244)
* add pagination cursor
* store timestamp instead of id in cursor (partial)
* Revert "store timestamp instead of id in cursor (partial)"
This reverts commit 89359dde4bc5fee39fdd2840828330f398444a36.
* use paginated query builder
* Fixing migration and paged API.
* Using dullbananas trigger procedure
* Removing pointless list routes, reorganizing tests.
* Fixing column XOR check.
* Forgot to remove list report actions.
* Cleanup.
* Use internal tagging.
* Fixing api tests.
* Adding a few indexes.
* Fixing migration name.
* Fixing unique constraints.
* Addressing PR comments.
* Start working on profile combined
* Adding views and replaceable schema.
* A few changes to profile view.
- Separating the profile fetch from its combined content fetch.
- Starting to separate saved_only into its own combined view.
* Finishing up combined person_saved and person_content.
* Fixing api tests.
* Moving to api-v4 routes.
* Fixing imports.
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views/src/report_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update migrations/2024-12-02-181601_add_report_combined_table/up.sql
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update migrations/2024-12-02-181601_add_report_combined_table/up.sql
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Fixing import and fmt.
* Fixing null types in postgres.
* Comment out err.
* Fixing TS issues.
* Adding types, fixing allow and blocklist crud.
* Starting to work on combined views.
* Using dullbananas trigger procedure
* Adding the full combined view queries.
* Adding tests.
* taplo fmt.
* Upgrading package.json deps.
* Updating pnpm
* Most of the bulk work done, need to add tests yet.
* Finishing up inbox.
* Using assert_length
* Fixing sql_format.
* Running fmt.
* Fixing cargo shear.
* Fixing clippy.
* Addressing PR comments.
* Starting to work on search combined.
* Fix
* Removing serialization
* Removing serialization
* Moving db_views_actor and _moderator into db_views.
- This is necessary because the combined views use both, and that
separation was arbitrary to begin with. db_schema has no such crate
separation.
* Adding search combined view, need to write tests yet.
* Filters done, working on tests.
* Adding tests for person, post, and community.
* Finishing up tests.
* Fixing duped trigger.
* Remove saved_only test.
* Remove pointless post_tags types.
* Remove pointless index.
* Changing published to saved for person_saved_combined.
* Removing comment.
* Renaming modlog when_ columns to published.
- Fixes #5312
* Adding strum and simplifying imports.
* Avoiding clone in map_to_enum
* Changing modded_person to other_person.
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Update crates/db_views_moderator/src/modlog_combined_view.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Addressing PR comments.
* Fixing split.
* Revert "Adding strum and simplifying imports."
This reverts commit 15f167110721429dd6e465f522250c8beb3d4dd7.
* Running fmt.
* Using assert + matches instead of filter_map.
* Adding listPersonContent check.
* Updating lemmy-js-client
* Fixing mark all as read route, changing mark read to SuccessResponse.
* Adding post body mention api test, fixing api tests.
* Fixing route locations, and api tests.
* Formatting sql.
* Formatting sql 2.
* Fixing search result, running clippy.
* Fixing ts_option.
* Adding search_combined.score column, and DB triggers.
* Fixing API tests.
* Adding an index for score.
* Update crates/db_schema/src/newtypes.rs
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
* Avoiding inner joins for up.sql
* Adding person_aggregates.published column.
---------
Co-authored-by: dullbananas <dull.bananas0@gmail.com>
2025-01-28 03:58:19 +00:00
|
|
|
export RUST_LOG="warn,lemmy_server=$LEMMY_LOG_LEVEL,lemmy_federate=$LEMMY_LOG_LEVEL,lemmy_api=$LEMMY_LOG_LEVEL,lemmy_api_common=$LEMMY_LOG_LEVEL,lemmy_api_crud=$LEMMY_LOG_LEVEL,lemmy_apub=$LEMMY_LOG_LEVEL,lemmy_db_schema=$LEMMY_LOG_LEVEL,lemmy_db_views=$LEMMY_LOG_LEVEL,lemmy_routes=$LEMMY_LOG_LEVEL,lemmy_utils=$LEMMY_LOG_LEVEL,lemmy_websocket=$LEMMY_LOG_LEVEL"
|
2020-12-10 17:03:11 +00:00
|
|
|
|
2023-09-20 14:18:31 +00:00
|
|
|
export LEMMY_TEST_FAST_FEDERATION=1 # by default, the persistent federation queue has delays in the scale of 30s-5min
|
2023-09-15 15:51:31 +00:00
|
|
|
|
2025-01-23 13:05:47 +00:00
|
|
|
PICTRS_PATH="api_tests/pict-rs"
|
|
|
|
PICTRS_EXPECTED_HASH="8feb52c0dee1dd0b41caa0e92afd9d5e597fbb4d7174d7bba22a1ba72fa01dbc pict-rs"
|
|
|
|
|
|
|
|
# Pictrs setup. Download file with hash check and up to 3 retries.
|
|
|
|
if [ ! -f "$PICTRS_PATH" ]; then
|
|
|
|
retry=true
|
|
|
|
count=0
|
|
|
|
while $retry && [ "$count" -lt 3 ]
|
|
|
|
do
|
|
|
|
# This one sometimes goes down
|
|
|
|
# curl "https://git.asonix.dog/asonix/pict-rs/releases/download/v0.5.16/pict-rs-linux-amd64" -o "$PICTRS_PATH"
|
|
|
|
curl "https://codeberg.org/asonix/pict-rs/releases/download/v0.5.5/pict-rs-linux-amd64" -o "$PICTRS_PATH"
|
|
|
|
PICTRS_HASH=$(sha256sum "$PICTRS_PATH")
|
|
|
|
[[ "$PICTRS_HASH" != "$PICTRS_EXPECTED_HASH" ]] && retry=true || retry=false
|
|
|
|
let count=count+1
|
|
|
|
done
|
|
|
|
chmod +x "$PICTRS_PATH"
|
2023-11-17 04:43:40 +00:00
|
|
|
fi
|
2025-01-23 13:05:47 +00:00
|
|
|
|
2023-11-17 04:43:40 +00:00
|
|
|
./api_tests/pict-rs \
|
|
|
|
run -a 0.0.0.0:8080 \
|
|
|
|
--danger-dummy-mode \
|
2023-11-22 15:15:06 +00:00
|
|
|
--api-key "my-pictrs-key" \
|
2023-11-17 04:43:40 +00:00
|
|
|
filesystem -p /tmp/pictrs/files \
|
|
|
|
sled -p /tmp/pictrs/sled-repo 2>&1 &
|
|
|
|
|
2020-12-11 17:09:47 +00:00
|
|
|
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
|
2023-07-19 08:28:10 +00:00
|
|
|
echo "DB URL: ${LEMMY_DATABASE_URL} INSTANCE: $INSTANCE"
|
2020-12-15 13:58:11 +00:00
|
|
|
psql "${LEMMY_DATABASE_URL}/lemmy" -c "DROP DATABASE IF EXISTS $INSTANCE"
|
2023-07-19 08:28:10 +00:00
|
|
|
echo "create database"
|
2020-12-15 13:58:11 +00:00
|
|
|
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
|
2023-09-09 16:25:03 +00:00
|
|
|
echo "127.0.0.1 $INSTANCE" >>/etc/hosts
|
2020-12-15 13:58:11 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2021-03-01 17:24:11 +00:00
|
|
|
echo "$PWD"
|
|
|
|
|
2024-01-26 09:38:15 +00:00
|
|
|
LOG_DIR=target/log
|
|
|
|
mkdir -p $LOG_DIR
|
|
|
|
|
2020-12-10 17:03:11 +00:00
|
|
|
echo "start alpha"
|
2022-11-09 10:05:00 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_alpha.hjson \
|
2023-09-18 14:28:49 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_alpha" \
|
2024-01-26 09:38:15 +00:00
|
|
|
target/lemmy_server >$LOG_DIR/lemmy_alpha.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start beta"
|
2022-11-09 10:05:00 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_beta.hjson \
|
2023-09-18 14:28:49 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_beta" \
|
2024-01-26 09:38:15 +00:00
|
|
|
target/lemmy_server >$LOG_DIR/lemmy_beta.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start gamma"
|
2022-11-09 10:05:00 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_gamma.hjson \
|
2023-09-18 14:28:49 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_gamma" \
|
2024-01-26 09:38:15 +00:00
|
|
|
target/lemmy_server >$LOG_DIR/lemmy_gamma.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start delta"
|
2022-11-09 10:05:00 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_delta.hjson \
|
2023-09-18 14:28:49 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_delta" \
|
2024-01-26 09:38:15 +00:00
|
|
|
target/lemmy_server >$LOG_DIR/lemmy_delta.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "start epsilon"
|
2022-11-09 10:05:00 +00:00
|
|
|
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_epsilon.hjson \
|
2023-09-18 14:28:49 +00:00
|
|
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_epsilon" \
|
2024-01-26 09:38:15 +00:00
|
|
|
target/lemmy_server >$LOG_DIR/lemmy_epsilon.out 2>&1 &
|
2020-12-10 17:03:11 +00:00
|
|
|
|
|
|
|
echo "wait for all instances to start"
|
2024-12-07 21:06:33 +00:00
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-alpha:8541/api/v4/site')" != "200" ]]; do sleep 1; done
|
2023-07-19 08:28:10 +00:00
|
|
|
echo "alpha started"
|
2024-12-07 21:06:33 +00:00
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-beta:8551/api/v4/site')" != "200" ]]; do sleep 1; done
|
2023-07-19 08:28:10 +00:00
|
|
|
echo "beta started"
|
2024-12-07 21:06:33 +00:00
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-gamma:8561/api/v4/site')" != "200" ]]; do sleep 1; done
|
2023-07-19 08:28:10 +00:00
|
|
|
echo "gamma started"
|
2024-12-07 21:06:33 +00:00
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-delta:8571/api/v4/site')" != "200" ]]; do sleep 1; done
|
2023-07-19 08:28:10 +00:00
|
|
|
echo "delta started"
|
2024-12-07 21:06:33 +00:00
|
|
|
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-epsilon:8581/api/v4/site')" != "200" ]]; do sleep 1; done
|
2023-07-19 08:28:10 +00:00
|
|
|
echo "epsilon started. All started"
|