It's important to set DUO_ENV=prod
.
Note also that X-Forwarded-For
headers are treated as the user's real IP by
Duolicious, which assumes that there's a proxy between it and users.
If there's no proxy, X-Forwarded-For
headers can be spoofed by users. This
will allow malicious users to partially bypass rate limits and bans.
Whether X-Forwarded-For
is used or not should probably be configurable in
Duolicious, but it's currently not. Although hardcoding the solution isn't too
hard: Simply remove the use of werkzeug.middleware.proxy_fix.ProxyFix
.
Install these:
- Docker Compose
- jq
- curl
- ImageMagick
- ffmpeg
Then run this:
./test/util/with-container.sh ./test/functionality.sh
You can also do this in one terminal:
docker compose up
...Then run this in another:
DUO_DB_PORT=5433 ./test/functionality.sh
~/duolicious-backend % sudo docker exec -it $(sudo docker ps | grep duolicious-backend-postgres | cut -d ' ' -f 1) psql -U postgres -d duo_api
[sudo] password for user:
psql (15.3 (Debian 15.3-1.pgdg120+1))
Type "help" for help.
duo_api=# CREATE EXTENSION pg_stat_statements;
duo_api=# select left(query, 100), mean_exec_time, calls from pg_stat_statements order by total_exec_time desc;
duo_api=# select pg_stat_statements_reset();
Terminal A:
docker compose down --remove-orphans
docker compose up postgres
Terminal B:
pg_dump -h ${DB_HOST} -U postgres -d duo_chat -f /tmp/duo_chat.sql
pg_dump -h ${DB_HOST} -U postgres -d duo_api -f /tmp/duo_api.sql
PGPASSWORD=password psql -U postgres -h localhost -p 5433 -c 'create database duo_api;'
PGPASSWORD=password psql -U postgres -h localhost -p 5433 -c 'create database duo_chat;'
PGPASSWORD=password psql -U postgres -d duo_api -h localhost -p 5433 < /tmp/duo_api.sql
PGPASSWORD=password psql -U postgres -d duo_chat -h localhost -p 5433 < /tmp/duo_chat.sql
Terminal A:
^C
docker compose up
- /var/lib/postgresql/data/postgresql.conf
- /var/lib/postgresql/data/log/*
- /etc/postgresql/16/main/postgresql.conf
- /var/lib/postgresql/16/main/postgresql.auto.conf
- /var/log/postgresql/postgresql-16-main.log