commit 67dfd6ae070fb364ad78dee5abdd623a88ed80b8 Author: DrMaxNix Date: Thu May 30 17:46:34 2024 +0200 :tada: initial proof of concept diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..249cda9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/data \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7be617c --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +## Steps to reproduce +#### 1. Clone git repo +```console +git clone https://git.tjdev.de/DrMaxNix/plausible-registerdemo +cd plausible-registerdemo +``` + +#### 2. Maybe do data cleanup +If you did run the container before you can do a data wipe +```console +./cleanup.sh +``` + +#### 3. Start docker container +```console +docker compose up --build +``` + +#### 4. Open browser +1. Open a browser of you choice (tested with firefox) +2. Navigate to `http://127.0.0.1:8000/register` +3. Open browser developer tools +4. Reload page +5. Navigate to network tab under developer tools +6. Find `101 Switching Protocols` Packet +7. Check its contained websocket log to see that ws is working + +#### 5. Trigger the error +1. Enter any `Full Name` +2. Enter any `Email` +3. Anter any `Password` and type same into `Password confirmation` +4. Click `Create my account ->` +5. Notice that the UI did not change +6. Click `Create my account ->` again +7. Notice that the UI still didn't change +8. Notice that under the `Email` input there is an error hint diff --git a/cleanup.sh b/cleanup.sh new file mode 100755 index 0000000..410ff22 --- /dev/null +++ b/cleanup.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -euo pipefail + +SCRIPT_PATH=$(readlink -f "${BASH_SOURCE[0]}") +SCRIPT_DIR=$(dirname -- "$SCRIPT_PATH") + +rm -dr "${SCRIPT_PATH}/data" || true diff --git a/clickhouse/clickhouse-config.xml b/clickhouse/clickhouse-config.xml new file mode 100644 index 0000000..c9ad646 --- /dev/null +++ b/clickhouse/clickhouse-config.xml @@ -0,0 +1,16 @@ + + + warning + true + + + + + + + + + + + + diff --git a/clickhouse/clickhouse-user-config.xml b/clickhouse/clickhouse-user-config.xml new file mode 100644 index 0000000..56cf1cd --- /dev/null +++ b/clickhouse/clickhouse-user-config.xml @@ -0,0 +1,8 @@ + + + + 0 + 0 + + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3b2cdae --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,33 @@ +services: + plausible_db: + image: postgres:16-alpine + restart: always + volumes: + - ./data/postgresql:/var/lib/postgresql/data + environment: + - POSTGRES_PASSWORD=postgres + + plausible_events_db: + image: clickhouse/clickhouse-server:24.3.3.102-alpine + restart: always + volumes: + - ./data/clickhouse:/var/lib/clickhouse + - ./data/clickhouse-logs:/var/log/clickhouse-server + - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro + - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro + ulimits: + nofile: + soft: 262144 + hard: 262144 + + plausible: + image: ghcr.io/plausible/community-edition:v2.1.0 + restart: always + command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run" + depends_on: + - plausible_db + - plausible_events_db + ports: + - 127.0.0.1:8000:8000 + env_file: + - plausible-conf.env diff --git a/plausible-conf.env b/plausible-conf.env new file mode 100644 index 0000000..d6260dd --- /dev/null +++ b/plausible-conf.env @@ -0,0 +1,4 @@ +BASE_URL=http://127.0.0.1:8000 +SECRET_KEY_BASE=+WJa3DNahZahgl0WQIXsZn2PFLJn3s+7/uxA8BBboPrwyB7SjBD1Q36jHB1f/0AW +TOTP_VAULT_KEY=y5/Sxn/X0yzXu84p7yciK3UwdHO2gsdQgAllHld8C/k= +DISABLE_REGISTRATION=false