4e935d03fc
- adds home timeline specific index (mostly used by postgres, but used by sqlite for larger queries, all credit to @cdn0x12) - adds local timeline specific index (again, all credit to @cdn0x12) - fine tunes some existing indices to further reduce size with partial clauses - fine tunes some existing indices to reduce columns not actually queried on Co-Authored by: @cdn0x12 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4761 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
# Determine available docker binary
|
|
_docker=$(command -v 'podman') || \
|
|
_docker=$(command -v 'docker') || \
|
|
{ echo 'docker not found'; exit 1; }
|
|
|
|
# Database config.
|
|
DB_NAME='postgres'
|
|
DB_USER='postgres'
|
|
DB_PASS='postgres'
|
|
DB_IP='127.0.0.1'
|
|
DB_PORT=${RANDOM}
|
|
|
|
# Start postgres container
|
|
CID=$($_docker run --detach \
|
|
--publish "${DB_IP}:${DB_PORT}:${DB_PORT}" \
|
|
--env "POSTGRES_DB=${DB_NAME}" \
|
|
--env "POSTGRES_USER=${DB_USER}" \
|
|
--env "POSTGRES_PASSWORD=${DB_PASS}" \
|
|
--env "POSTGRES_HOST_AUTH_METHOD=trust" \
|
|
--env "PGHOST=0.0.0.0" \
|
|
--env "PGPORT=${DB_PORT}" \
|
|
'docker.io/postgres:latest')
|
|
|
|
# On exit kill the container
|
|
trap "$_docker kill ${CID}" exit
|
|
|
|
sleep 5
|
|
$_docker exec "$CID" psql --user "$DB_USER" --password "$DB_PASS" -c "GRANT ALL PRIVILEGES ON DATABASE \"${DB_NAME}\" TO \"${DB_USER}\";"
|
|
|
|
env \
|
|
GTS_DB_TYPE=postgres \
|
|
GTS_DB_ADDRESS=${DB_IP} \
|
|
GTS_DB_PORT=${DB_PORT} \
|
|
GTS_DB_USER=${DB_USER} \
|
|
GTS_DB_PASSWORD=${DB_PASS} \
|
|
GTS_DB_DATABASE=${DB_NAME} \
|
|
GTS_LOG_LEVEL=trace \
|
|
GTS_PORT=${GTS_DB_PORT:-${RANDOM}} \
|
|
go run -v -tags='debug nosqlite' ./cmd/gotosocial testrig start
|