Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .helm/ecamp3/files/hook_db_restore/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SOURCE_FILE=latest
APP_NAME=test-db-backup-job
DATABASE_URL=
#if you want to restore to your local database:
#DATABASE_URL=postgresql://ecamp3:ecamp3@<your-ip>:5432/ecamp3dev
#DATABASE_URL=postgresql://ecamp3:ecamp3@localhost:5432/ecamp3dev
ENCRYPTION_KEY=test
S3_ENDPOINT=https://s3.eu-west-3.amazonaws.com
S3_BUCKET=
Expand Down
7 changes: 7 additions & 0 deletions .helm/ecamp3/files/hook_db_restore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ It also contains a docker-compose.yml file to easily test the [restore-backup.sh
```shell
docker compose run --rm restore-backup
```
4. Maybe locally: change username and password of the support account
That we don't need sharp credentials in the local performance testing.

```shell
docker compose run --rm restore-backup sh update-support-email.sh
```

2 changes: 2 additions & 0 deletions .helm/ecamp3/files/hook_db_restore/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ services:
dockerfile: Dockerfile
volumes:
- ./restore-backup.sh:/restore-backup.sh
- ./update-support-email.sh:/update-support-email.sh
command:
- sh
- "-x"
- /restore-backup.sh
env_file: .env
network_mode: host
17 changes: 17 additions & 0 deletions .helm/ecamp3/files/hook_db_restore/update-support-email.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
set -e

tmpfile=$(mktemp)

cat << 'EOF' | tee -a $tmpfile
BEGIN;

WITH profile as (SELECT id from profile WHERE email = '[email protected]'),
update_password as (UPDATE "user" SET password = '$2y$13$KTCSklVQHNvbwJQ3Awl8Ee7t0wJB1gfRBXDANeQlBblqwJ4wgOEmC' WHERE profileid = (SELECT id FROM profile)),
update_email as (UPDATE "profile" SET email = '[email protected]' WHERE id = (SELECT id FROM profile))
SELECT 1;

COMMIT;

EOF

psql $DATABASE_URL -v ON_ERROR_STOP=1 < $tmpfile
1 change: 1 addition & 0 deletions .ops/performance-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
14 changes: 14 additions & 0 deletions .ops/performance-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Performance tests

Run tests

```shell
docker compose run --rm performance-test run --quiet script.js | jq --sort-keys > output.json
```

Run tests once to debug


```shell
docker compose run --rm -e VUS=1 -e ITERATIONS=1 performance-test run script.js
```
12 changes: 12 additions & 0 deletions .ops/performance-test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
performance-test:
image: grafana/k6:0.53.0
volumes:
- .:/app
user: ${USER_ID:-1000}
network_mode: host
working_dir: /app
# environment:
# - K6_WEB_DASHBOARD=true
ports:
- '5665:5665'
Loading
Loading