Skip to content

Commit 4bbf86b

Browse files
committed
chore: add readme for docker
1 parent cc77955 commit 4bbf86b

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed

.github/helpers/docker/README.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
## Quickstart
2+
3+
```bash
4+
# This will start with an in memory database.
5+
6+
$ docker run -p 3567:3567 -d registry.supertokens.io/supertokens/supertokens-postgresql
7+
```
8+
9+
## Configuration
10+
You can use your own `config.yaml` file as a shared volume or pass the key-values as environment variables.
11+
12+
If you do both, only the shared `config.yaml` file will be considered.
13+
14+
#### Using environment variables
15+
Available environment variables
16+
- **Core**
17+
- API\_KEYS
18+
- SUPERTOKENS\_HOST
19+
- SUPERTOKENS\_PORT
20+
- ACCESS\_TOKEN\_VALIDITY
21+
- ACCESS\_TOKEN\_BLACKLISTING
22+
- ACCESS\_TOKEN\_SIGNING\_KEY\_DYNAMIC
23+
- ACCESS\_TOKEN\_DYNAMIC\_SIGNING\_KEY\_UPDATE\_INTERVAL
24+
- REFRESH\_TOKEN\_VALIDITY
25+
- PASSWORD\_RESET\_TOKEN\_LIFETIME
26+
- EMAIL\_VERIFICATION\_TOKEN\_LIFETIME
27+
- INFO\_LOG\_PATH
28+
- ERROR\_LOG\_PATH
29+
- MAX\_SERVER\_POOL\_SIZE
30+
- PASSWORDLESS\_MAX\_CODE\_INPUT\_ATTEMPTS
31+
- PASSWORDLESS\_CODE\_LIFETIME
32+
- DISABLE\_TELEMETRY
33+
- BASE\_PATH
34+
- PASSWORD\_HASHING\_ALG
35+
- ARGON2\_ITERATIONS
36+
- ARGON2\_MEMORY\_KB
37+
- ARGON2\_PARALLELISM
38+
- ARGON2\_HASHING\_POOL\_SIZE
39+
- BCRYPT\_LOG\_ROUNDS
40+
- LOG\_LEVEL
41+
- FIREBASE\_PASSWORD\_HASHING\_POOL\_SIZE
42+
- FIREBASE\_PASSWORD\_HASHING\_SIGNER\_KEY
43+
- IP\_ALLOW\_REGEX
44+
- IP\_DENY\_REGEX
45+
- TOTP\_MAX\_ATTEMPTS
46+
- TOTP\_RATE\_LIMIT\_COOLDOWN\_SEC
47+
- SUPERTOKENS\_SAAS\_LOAD\_ONLY\_CUD
48+
- OAUTH\_PROVIDER\_PUBLIC\_SERVICE\_URL
49+
- OAUTH\_PROVIDER\_ADMIN\_SERVICE\_URL
50+
- OAUTH\_PROVIDER\_CONSENT\_LOGIN\_BASE\_URL
51+
- OAUTH\_PROVIDER\_URL\_CONFIGURED\_IN\_OAUTH\_PROVIDER
52+
- OAUTH\_CLIENT\_SECRET\_ENCRYPTION\_KEY
53+
- BULK\_MIGRATION\_PARALLELISM
54+
- BULK\_MIGRATION\_BATCH\_SIZE
55+
- BULK\_MIGRATION\_CRON\_ENABLED
56+
- WEBAUTHN\_RECOVER\_ACCOUNT\_TOKEN\_LIFETIME
57+
- **POSTGRESQL:**
58+
- POSTGRESQL\_CONNECTION\_URI
59+
- POSTGRESQL\_USER
60+
- POSTGRESQL\_PASSWORD
61+
- POSTGRESQL\_PASSWORD\_FILE
62+
- POSTGRESQL\_CONNECTION\_POOL\_SIZE
63+
- POSTGRESQL\_HOST
64+
- POSTGRESQL\_PORT
65+
- POSTGRESQL\_DATABASE\_NAME
66+
- POSTGRESQL\_TABLE\_NAMES\_PREFIX
67+
- POSTGRESQL\_TABLE\_SCHEMA
68+
- POSTGRESQL\_IDLE\_CONNECTION\_TIMEOUT
69+
- POSTGRESQL\_MINIMUM\_IDLE\_CONNECTIONS
70+
71+
72+
```bash
73+
docker run \
74+
-p 3567:3567 \
75+
-e POSTGRESQL_CONNECTION_URI="postgresql://username:password@host:port/dbName" \
76+
-d registry.supertokens.io/supertokens/supertokens-postgresql
77+
78+
# OR
79+
80+
docker run \
81+
-p 3567:3567 \
82+
-e POSTGRESQL_USER="postgresqlUser" \
83+
-e POSTGRESQL_HOST="192.168.1.2" \
84+
-e POSTGRESQL_PORT="5432" \
85+
-e POSTGRESQL_PASSWORD="password" \
86+
-d registry.supertokens.io/supertokens/supertokens-postgresql
87+
```
88+
89+
#### Using custom config file
90+
- In your `config.yaml` file, please make sure you store the following key / values:
91+
- `core_config_version: 0`
92+
- `host: "0.0.0.0"`
93+
- `postgresql_config_version: 0`
94+
- `info_log_path: null` (to log in docker logs)
95+
- `error_log_path: null` (to log in docker logs)
96+
- The path for the `config.yaml` file in the container is `/usr/lib/supertokens/config.yaml`
97+
98+
```bash
99+
docker run \
100+
-p 3567:3567 \
101+
-v /path/to/config.yaml:/usr/lib/supertokens/config.yaml \
102+
-d registry.supertokens.io/supertokens/supertokens-postgresql
103+
```
104+
105+
## Logging
106+
- By default, all the logs will be available via the `docker logs <container-name>` command.
107+
- You can setup logging to a shared volume by:
108+
- Setting the `info_log_path` and `error_log_path` variables in your `config.yaml` file (or passing the values asn env variables).
109+
- Mounting the shared volume for the logging directory.
110+
111+
```bash
112+
docker run \
113+
-p 3567:3567 \
114+
-v /path/to/logsFolder:/home/logsFolder \
115+
-e INFO_LOG_PATH="/home/logsFolder/info.log" \
116+
-e ERROR_LOG_PATH="/home/logsFolder/error.log" \
117+
-e POSTGRESQL_USER="postgresqlUser" \
118+
-e POSTGRESQL_PASSWORD="password" \
119+
-d registry.supertokens.io/supertokens/supertokens-postgresql
120+
```
121+
122+
## Database setup
123+
- Before you start this container, make sure to initialize your database.
124+
- You do not need to ensure that the Postgresql database has started before this container is started. During bootup, SuperTokens will wait for ~1 hour for a Postgresql instance to be available.
125+
- If `POSTGRESQL_USER`, `POSTGRESQL_PASSWORD`, `POSTGRESQL_PASSWORD_FILE` and `POSTGRESQL_CONNECTION_URI` are not provided, then SuperTokens will use an in memory database.
126+
127+
128+
## Read-only root fs
129+
- If you wish to run this container with a read-only root filesystem, you can do so.
130+
- The container still needs a temp area, where it can write its stuff, and also needs to be able to execute from there.
131+
- You will have to create a mount for `/lib/supertokens/temp/`
132+
133+
```bash
134+
docker run \
135+
-p 3567:3567 \
136+
--mount source=/path/on/host/machine,destination=/lib/supertokens/temp/,type=bind \
137+
--read-only \
138+
-d registry.supertokens.io/supertokens/supertokens-postgresql
139+
```
140+
141+
```bash
142+
docker run \
143+
-p 3567:3567 \
144+
--tmpfs=/lib/supertokens/temp/:exec \
145+
--read-only \
146+
-d registry.supertokens.io/supertokens/supertokens-postgresql
147+
```
148+
149+
## Running with tcp keepalive settings
150+
```bash
151+
docker run \
152+
-p 3567:3567 \
153+
--sysctl net.ipv4.tcp_keepalive_time=60 \
154+
--sysctl net.ipv4.tcp_keepalive_intvl=5 \
155+
--sysctl net.ipv4.tcp_keepalive_probes=3 \
156+
-d registry.supertokens.io/supertokens/supertokens-postgresql
157+
```

0 commit comments

Comments
 (0)