-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from nightly-labs/analytics-tests
Analytics tests
- Loading branch information
Showing
37 changed files
with
1,166 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
/target | ||
/Cargo.lock | ||
/.vscode | ||
/grafana-client-gen/build | ||
/grafana-client-gen/build | ||
/infra/target | ||
/infra/config | ||
/infra/logs | ||
/infra/backups | ||
/infra/ofelia_logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
CREATE TABLE domain_verifications( | ||
domain_name TEXT PRIMARY KEY, | ||
domain_name TEXT NOT NULL, | ||
app_id TEXT NOT NULL, | ||
code TEXT NOT NULL, | ||
created_at TIMESTAMPTZ NOT NULL, | ||
finished_at TIMESTAMPTZ | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | ||
finished_at TIMESTAMPTZ, | ||
PRIMARY KEY (domain_name, app_id) -- One app can only verify particular domain once | ||
); | ||
|
||
-- Safety measure to prevent verification blockade in case of malicious intent | ||
CREATE UNIQUE INDEX idx_unique_verified_domains ON domain_verifications (domain_name) | ||
WHERE finished_at IS NOT NULL; | ||
|
||
CREATE INDEX domain_verifications_app_id_idx ON domain_verifications(app_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
ENV=DEV # PROD or DEV | ||
PGDATA=/home/postgres/pgdata/data | ||
ENV=DEV # Does nothing for now | ||
|
||
# Database Configuration | ||
# Those two has to be the same | ||
POSTGRES_USER=admin1234 | ||
PGUSER=admin1234 | ||
# ----------------------- | ||
POSTGRES_PASSWORD=password12345 | ||
POSTGRES_DB=connect_db | ||
PG_DATA=/home/postgres/pgdata | ||
|
||
# Images | ||
TIMESCALEDB_IMAGE=timescale/timescaledb-ha:pg15-ts2.10 | ||
OFELIA_IMAGE=mcuadros/ofelia:988d988 | ||
|
||
# Volume Bindings | ||
TIMESCALEDB_DATA=./target | ||
TIMESCALEDB_BACKUPS=./backups | ||
TIMESCALEDB_LOGS=./logs | ||
TIMESCALEDB_PGBACKREST_CONFIG=./config | ||
OFELIA_LOGS=./ofelia_logs | ||
CUSTOM_ENTRYPOINT=./scripts/custom_entrypoint.sh | ||
|
||
# Ofelia Configuration | ||
OFELIA_SMTP_HOST=smtp.example.com | ||
OFELIA_SMTP_PORT=587 | ||
# Those two has to be the same | ||
OFELIA_SMTP_USER=[email protected] | ||
OFELIA_EMAIL_FROM=[email protected] | ||
# ----------------------- | ||
OFELIA_SMTP_PASSWORD=examplepassword | ||
OFELIA_EMAIL_TO=[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,66 @@ | ||
services: | ||
timescaledb: | ||
image: timescale/timescaledb-ha:pg15 | ||
image: ${TIMESCALEDB_IMAGE} | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- ./target:/var/lib/postgresql/data | ||
- ${TIMESCALEDB_DATA}:/home/postgres/pgdata | ||
- ${TIMESCALEDB_BACKUPS}:/var/lib/pgbackrest | ||
- ${TIMESCALEDB_PGBACKREST_CONFIG}:/home/postgres/pgdata/backup | ||
- ${TIMESCALEDB_LOGS}:/var/log | ||
- ${CUSTOM_ENTRYPOINT}:/usr/local/bin/custom_entrypoint.sh | ||
entrypoint: ["/usr/local/bin/custom_entrypoint.sh"] | ||
command: ["postgres"] | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
restart: no | ||
env_file: | ||
- .env | ||
environment: | ||
- POSTGRES_USER | ||
- POSTGRES_PASSWORD | ||
- POSTGRES_DB | ||
- TIMESCALEDB_TELEMETRY=off | ||
ENV: ${ENV} | ||
POSTGRES_USER: ${POSTGRES_USER} | ||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} | ||
POSTGRES_DB: ${POSTGRES_DB} | ||
PG_DATA: ${PG_DATA} | ||
PGUSER: ${PGUSER} | ||
labels: | ||
ofelia.enabled: "true" | ||
# Schedule job to backup timescaledb, commands can be changed to instead run scripts in order to log more data | ||
# Perform full backup every day at 00:00 | ||
ofelia.job-exec.full-backup.user: "postgres" | ||
ofelia.job-exec.full-backup.schedule: "0 0 * * *" | ||
ofelia.job-exec.full-backup.command: "pgbackrest --stanza=db --type=full --log-level-stderr=info backup" | ||
# Perform diff backup every 15 minutes (900 seconds) | ||
ofelia.job-exec.diff-backup.schedule: "@every 900s" | ||
ofelia.job-exec.diff-backup.user: "postgres" | ||
ofelia.job-exec.diff-backup.command: "pgbackrest --stanza=db --type=diff --log-level-stderr=info backup" | ||
|
||
|
||
# Service for running shedule job to backup timescaledb | ||
# https://github.com/mcuadros/ofelia | ||
ofelia: | ||
image: ${OFELIA_IMAGE} | ||
depends_on: | ||
timescaledb: | ||
condition: service_healthy | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
- ${OFELIA_LOGS}:/tmp/logs:rw | ||
command: daemon --docker | ||
env_file: | ||
- .env | ||
labels: | ||
# Save logs locally and via email reports | ||
ofelia.save-folder: "./tmp/logs" | ||
ofelia.smtp-host: "${OFELIA_SMTP_HOST}" | ||
ofelia.smtp-port: "${OFELIA_SMTP_PORT}" | ||
ofelia.smtp-user: "${OFELIA_SMTP_USER}" | ||
ofelia.smtp-password: "${OFELIA_SMTP_PASSWORD}" | ||
ofelia.email-to: "${OFELIA_EMAIL_TO}" | ||
ofelia.email-from: "${OFELIA_EMAIL_FROM}" | ||
|
||
|
||
|
Oops, something went wrong.