Feat: Supertokens

This commit is contained in:
peaklabs-dev
2024-10-07 14:32:04 +02:00
parent c4ee91930d
commit 8c503bc7fc
2 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
services:
supertokens:
image: 'registry.supertokens.io/supertokens/supertokens-mysql:latest'
depends_on:
mysql:
condition: service_healthy
environment:
- SERVICE_FQDN_SUPERTOKENS_3567
- API_KEYS=${API_KEYS:-}
- MYSQL_CONNECTION_URI=mysql://$SERVICE_USER_MYSQL:$SERVICE_PASSWORD_MYSQL@mysql:3306/${MYSQL_DATABASE:-supertokens}
healthcheck:
test: "bash -c 'exec 3<>/dev/tcp/127.0.0.1/3567 && echo -e \"GET /hello HTTP/1.1\\r\\nhost: 127.0.0.1:3567\\r\\nConnection: close\\r\\n\\r\\n\" >&3 && cat <&3 | grep \"Hello\"'\n"
interval: 10s
timeout: 5s
retries: 5
mysql:
image: 'mysql:latest'
environment:
- MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_MYSQL
- MYSQL_USER=$SERVICE_USER_MYSQL
- MYSQL_PASSWORD=$SERVICE_PASSWORD_MYSQL
- MYSQL_DATABASE=${MYSQL_DATABASE:-supertokens}
volumes:
- 'supertokens-mysql-data:/var/lib/mysql'
healthcheck:
test:
- CMD
- mysqladmin
- ping
- '-h'
- localhost
timeout: 20s
retries: 10

View File

@@ -0,0 +1,34 @@
# documentation: https://supertokens.com/docs/guides
# slogan: An open-source authentication solution that simplifies the implementation of secure user authentication and session management for web and mobile applications.
# tags: supertokens,login,authentication,authorization,oauth,user-management,session-management,access-control,otp,magic-link,passwordless
# logo: svgs/supertokens.svg
# port: 3567
services:
supertokens:
image: registry.supertokens.io/supertokens/supertokens-postgresql:latest
depends_on:
postgres:
condition: service_healthy
environment:
- SERVICE_FQDN_SUPERTOKENS_3567
- API_KEYS=${API_KEYS:-}
- POSTGRESQL_CONNECTION_URI="postgresql://$SERVICE_USER_POSTGRESQL:$SERVICE_PASSWORD_POSTGRESQL@postgres:5432/${POSTGRES_DB:-supertokens}"
healthcheck:
test: "bash -c 'exec 3<>/dev/tcp/127.0.0.1/3567 && echo -e \"GET /hello HTTP/1.1\\r\\nhost: 127.0.0.1:3567\\r\\nConnection: close\\r\\n\\r\\n\" >&3 && cat <&3 | grep \"Hello\"'\n"
interval: 10s
timeout: 5s
retries: 5
postgres:
image: postgres:16
environment:
- POSTGRES_USER=$SERVICE_USER_POSTGRESQL
- POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRESQL
- POSTGRES_DB=${POSTGRES_DB:-supertokens}
volumes:
- supertokens-postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "$SERVICE_USER_POSTGRESQL", "-d", "${POSTGRES_DB:-supertokens}"]
interval: 5s
timeout: 5s
retries: 5