Skip to content

Commit

Permalink
add more configuration options to docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Sep 2, 2018
1 parent 215766c commit b96d58b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
4 changes: 2 additions & 2 deletions build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ pushd ./py_grpc > /dev/null
# Generate version file from git tags
python3 version.py

#Generate tinode-grpc package
python3 setup.py sdist bdist_wheel
# Generate tinode-grpc package
python3 setup.py -q sdist bdist_wheel

popd > /dev/null

Expand Down
25 changes: 25 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,28 @@ then repeat step 4 adding `--env RESET_DB=true`.
### Run the chatbot

See [instructions](../chatbot/).

## Supported environment variables

You can specify the following environment viriables when issuing `docker run` command:

| Variable | Type | Default | Function |
| --- | --- | --- | --- |
| API_KEY_SALT | string | `T713/rYYgW7g4m3vG6zGRh7+FM1t0T8j13koXScOAj4=` | base64-encoded 32 random bytes used as API salt. Use [keygen](../keygen) to create the API key. |
| AUTH_TOKEN_KEY | string | `wfaY2RgF2S1OQI/ZlK+LSrp1KB2jwAdGAIHQ7JZn+Kc=` | base64-encoded 32 random bytes used as salt for authentication tokens |
| DEBUG_EMAIL_VERIFICATION_CODE | string | | Enable dummy email verification code. Disabled by default (empty string). |
| MYSQL_DSN | string | `'root@tcp(mysql)/tinode'` | MySQL [DSN](https://github.com/go-sql-driver/mysql#dsn-data-source-name) |
| RESET_DB | bool | `false` | Drop and recreate the database. |
| SMTP_PASSWORD | string | | Password to use for authentication with the SMTP server |
| SMTP_PORT | string | | Port number of the SMTP server to use for sending verification emails, e.g. `"25"` or `"587"`. |
| SMTP_SENDER | string | | Email address to use in the `FROM` field of verification emails and for authenticationwith the SMTP server. |
| SMTP_SERVER | string | | Name of the SMTP server to use for sending verification emails, e.g. `"smtp.gmail.com"`. If SMTP_SERVER is not defined, email verification will be disabled. |
| TLS_CONTACT_ADDRESS | string | | Optional email address to use as contact for Lets Encrypt certificats. |
| TLS_DOMAIN_NAME | string | | Domain name of your container for TLS support |
| TLS_ENABLED | bool | `false` | Controls if TRL (http**s**) is enabled. If enabled, a valid TLS_DOMAIN_NAME must be provided too. You also have to correctly configure DNS for your container. |
| UID_ENCRYPTION_KEY | string | `la6YsO+bNX/+XIkOqc5Svw==` | base64-encoded 16 random bytes used as an encryption key for user IDs. |

Unix-like systems offer a convenient way to generate a random base64-encoded string of desired length as
```
$ openssl rand -base64 <desired length>
```
7 changes: 4 additions & 3 deletions docker/tinode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ ENV PLUGIN_PYTHON_CHAT_BOT_ENABLED=false

# Various encryption and salt keys. Replace with your own in production.

# Key to initialize UID generator
ENV UID_ENCRYPTION_KEY=la6YsO+bNX/+XIkOqc5Svw==

# Key to sign API app ID.
ENV API_KEY_SALT=T713/rYYgW7g4m3vG6zGRh7+FM1t0T8j13koXScOAj4=

# Key used to sign authentication tokens.
ENV AUTH_TOKEN_KEY=wfaY2RgF2S1OQI/ZlK+LSrp1KB2jwAdGAIHQ7JZn+Kc=

# Key to initialize UID generator
ENV UID_ENCRYPTION_KEY=la6YsO+bNX/+XIkOqc5Svw==


# Adding bash and grep as they are used here.
RUN apk add --no-cache bash grep

Expand Down
14 changes: 7 additions & 7 deletions docker/tinode/config.template
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@
"acc_validation": {
"email": {
"add_to_tags": true,
"required": [],
"required": ["$EMAIL_VERIFICATION_REQUIRED"],
"config": {
"smtp_server": "smtp.example.com",
"smtp_port": "25",
"sender": "noreply@example.com",
"sender_password": "your-password-here",
"smtp_server": "$SMTP_SERVER",
"smtp_port": "$SMTP_PORT",
"sender": "$SMTP_SENDER",
"sender_password": "$SMTP_PASSWORD",
"msg_body_templ": "./templ/email-validation-body.templ",
"msg_subject": "Tinode chat: confirm email",
"headers": [],
"max_retries": 4,
"debug_response": "123456"
"debug_response": "$DEBUG_EMAIL_VERIFICATION_CODE"
}
},

Expand All @@ -77,7 +77,7 @@
"config": {
"template": "./templ/sms-validation.templ",
"max_retries": 4,
"debug_response": "123456"
"debug_response": "$DEBUG_TEL_VERIFICATION_CODE"
}
}
},
Expand Down

0 comments on commit b96d58b

Please sign in to comment.