Skip to content

Commit

Permalink
Revise docker-compose docs (ToolJet#2387)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaysasidrn authored Mar 4, 2022
1 parent 184876c commit f170cf3
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 33 deletions.
50 changes: 50 additions & 0 deletions deploy/docker/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Create .env from this example file and replace values for the environment.
# The application expects a separate .env.test for test environment configuration
# Get detailed information about each variable here: https://docs.tooljet.com/docs/deployment/env-vars

TOOLJET_HOST=http://localhost:8082
LOCKBOX_MASTER_KEY=replace_with_lockbox_master_key
SECRET_KEY_BASE=replace_with_secret_key_base

# DATABASE CONFIG
ORM_LOGGING=all
PG_DB=tooljet_production
PG_USER=postgres
PG_HOST=postgres
PG_PASS=postgres

# Checks every 24 hours to see if a new version of ToolJet is available
# (Enabled by default. Set 0 to disable)
CHECK_FOR_UPDATES=

# Checks every 24 hours to update app telemetry data to ToolJet hub.
# (Telemetry is enabled by default. Set value to true to disable.)
# DISABLE_APP_TELEMETRY=false

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# EMAIL CONFIGURATION
DEFAULT_FROM_EMAIL=hello@tooljet.io
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_DOMAIN=
SMTP_PORT=

# DISABLE USER SIGNUPS (true or false). Default: true
DISABLE_SIGNUPS=

# OBSERVABILITY
APM_VENDOR=
SENTRY_DNS=
SENTRY_DEBUG=

# FEATURE TOGGLE
COMMENT_FEATURE_ENABLE=

#SSO
SSO_DISABLE_SIGNUP=
SSO_RESTRICTED_DOMAIN=
SSO_GOOGLE_OAUTH2_CLIENT_ID=
SSO_GIT_OAUTH2_CLIENT_ID=
SSO_GIT_OAUTH2_CLIENT_SECRET=
54 changes: 54 additions & 0 deletions deploy/docker/docker-compose-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: '3'

services:
client:
tty: true
stdin_open: true
image: tooljet/tooljet-client-ce:latest
restart: always
env_file: .env
depends_on:
- server
volumes:
- logs:/var/log/openresty/
- certs:/etc/resty-auto-ssl/
- fallbackcerts:/etc/fallback-certs
ports:
- 80:80
- 443:443
command: openresty -g "daemon off;"

server:
image: tooljet/tooljet-server-ce:latest
tty: true
stdin_open: true
restart: always
ports:
- 3000
env_file: .env
environment:
SERVE_CLIENT: "false"
command: npm run start:prod
depends_on:
- postgres

postgres:
image: postgres:13
restart: always
ports:
- 5432:5432
volumes:
- postgres:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres

volumes:
postgres:
driver: local
driver_opts:
o: bind
type: none
device: ${PWD}/postgres_data
certs:
logs:
fallbackcerts:
25 changes: 1 addition & 24 deletions deploy/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
stdin_open: true
image: tooljet/tooljet-client-ce:latest
restart: always
env_file: .env
depends_on:
- server
volumes:
Expand All @@ -28,32 +29,8 @@ services:
environment:
SERVE_CLIENT: "false"
command: npm run start:prod
# We recommend to use managed postgres service on production for ease of
# administration, security and management (high availability, backups, monitoring etc)
#
# If you'd still want to run posgres with persistent volumes in a docker compose
# setup, uncomment the lines below and create postgres_data folder within
# the directory.
# depends_on:
# - postgres

# postgres:
# image: postgres:13
# restart: always
# ports:
# - 5432:5432
# volumes:
# - postgres:/var/lib/postgresql/data
# environment:
# - POSTGRES_PASSWORD=postgres

volumes:
# postgres:
# driver: local
# driver_opts:
# o: bind
# type: none
# device: ${PWD}/postgres_data
certs:
logs:
fallbackcerts:
30 changes: 21 additions & 9 deletions docs/docs/deployment/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ sidebar_label: Docker

# Deploying ToolJet using docker-compose

:::info
You should setup a PostgreSQL database manually to be used by the ToolJet server.
:::

Follow the steps below to deploy ToolJet on a server using docker-compose. This setup will deploy both **ToolJet server** and **ToolJet client**.

1. Setup a PostgreSQL database and make sure that the database is accessible.

2. Make sure that the server can receive traffic on port 80, 443 and 22.
1. Make sure that the server can receive traffic on port 80, 443 and 22.
For example, if the server is an AWS EC2 instance and the installation should receive traffic from the internet, the inbound rules of the security group should look like this:

| protocol | port | allowed_cidr |
Expand All @@ -22,20 +17,37 @@ Follow the steps below to deploy ToolJet on a server using docker-compose. This
| tcp | 80 | 0.0.0.0/0 |
| tcp | 443 | 0.0.0.0/0 |

3. Install docker and docker-compose on the server.
2. Install docker and docker-compose on the server.
- Docs for [Docker Installation](https://docs.docker.com/engine/install/)
- Docs for [Docker Compose Installation](https://docs.docker.com/compose/install/)

4. Download our production docker-compose file into the server by running:
3. Setup a PostgreSQL database and make sure that the database is accessible. (Optional)
:::info
We recommend to use managed postgres service on production for ease of administration, security and management (backups, monitoring etc).
If you'd want to run posgres with persistent volume rather, curl for the alternate docker compose file shared in the next step.
:::

4. Download our production docker-compose file into the server.

For managed PostgreSQL database:
```bash
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/docker-compose.yaml
```

OR

For PostgreSQL database setup with persistent volume:
```bash
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/docker-compose-postgres.yaml
mv docker-compose-postgres.yml docker-compose.yml
mkdir postgres_data
```

5. Create `.env` file in the current directory (where the docker-compose.yaml file is downloaded):

```bash
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/.env.example mv .env.example .env
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/.env.example
mv .env.example .env
```

Set up environment variables in `.env` file as explained in [environment variables reference](/docs/deployment/env-vars)
Expand Down
4 changes: 4 additions & 0 deletions docs/docs/deployment/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ ToolJet server uses PostgreSQL as the database.
| PG_USER | username |
| PG_PASS | password |

:::tip
If you are using docker-compose setup, you can set PG_HOST as `postgres` which will be DNS resolved by docker
:::

#### Check for updates ( optional )

Self-hosted version of ToolJet pings our server to fetch the latest product updates every 24 hours. You can disable this by setting the value of `CHECK_FOR_UPDATES` environment variable to `0`. This feature is enabled by default.
Expand Down

0 comments on commit f170cf3

Please sign in to comment.