supertokens / supertokens-docker-mysql

Dockerfile for SuperTokens with MySQL
16 stars 13 forks source link

Quickstart

# This will start with an in memory database.

$ docker run -p 3567:3567 -d registry.supertokens.io/supertokens/supertokens-mysql

Configuration

You can use your own config.yaml file as a shared volume or pass the key-values as environment variables.

If you do both, only the shared config.yaml file will be considered.

Using environment variable

Available environment variables

docker run \
    -p 3567:3567 \
    -e MYSQL_CONNECTION_URI="mysql://username:password@host:port/dbName" \
    -d registry.supertokens.io/supertokens/supertokens-mysql

# OR

docker run \
    -p 3567:3567 \
    -e MYSQL_USER="mysqlUser" \
    -e MYSQL_HOST="192.168.1.2" \
    -e MYSQL_PORT="3306" \
    -e MYSQL_PASSWORD="password" \
    -d registry.supertokens.io/supertokens/supertokens-mysql

Using custom config file

$ docker run \
    -p 3567:3567 \
    -v /path/to/config.yaml:/usr/lib/supertokens/config.yaml \
    -d registry.supertokens.io/supertokens/supertokens-mysql

Logging

$ docker run \
    -p 3567:3567 \
    -v /path/to/logsFolder:/home/logsFolder \
    -e INFO_LOG_PATH="/home/logsFolder/info.log" \
    -e ERROR_LOG_PATH="/home/logsFolder/error.log" \
    -e MYSQL_USER="mysqlUser" \
    -e MYSQL_PASSWORD="password" \
    -d registry.supertokens.io/supertokens/supertokens-mysql

Database setup

Read-only root fs

docker run \
    -p 3567:3567 \
    --mount source=/path/on/host/machine,destination=/lib/supertokens/temp/,type=bind \
    --read-only \
    -d registry.supertokens.io/supertokens/supertokens-mysql
docker run \
    -p 3567:3567 \
    --tmpfs=/lib/supertokens/temp/:exec \
    --read-only \
    -d registry.supertokens.io/supertokens/supertokens-mysql