diff --git a/deploy/docker/.env.example b/deploy/docker/.env.example new file mode 100644 index 0000000000..ed1d230e8f --- /dev/null +++ b/deploy/docker/.env.example @@ -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= diff --git a/deploy/docker/docker-compose-postgres.yml b/deploy/docker/docker-compose-postgres.yml new file mode 100644 index 0000000000..8b808ae32f --- /dev/null +++ b/deploy/docker/docker-compose-postgres.yml @@ -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: diff --git a/deploy/docker/docker-compose.yaml b/deploy/docker/docker-compose.yaml index 2b4c89f340..039b72fbf3 100644 --- a/deploy/docker/docker-compose.yaml +++ b/deploy/docker/docker-compose.yaml @@ -6,6 +6,7 @@ services: stdin_open: true image: tooljet/tooljet-client-ce:latest restart: always + env_file: .env depends_on: - server volumes: @@ -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: diff --git a/docs/docs/deployment/docker.md b/docs/docs/deployment/docker.md index bf5c02b8ca..7d24225df9 100644 --- a/docs/docs/deployment/docker.md +++ b/docs/docs/deployment/docker.md @@ -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 | @@ -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) diff --git a/docs/docs/deployment/env-vars.md b/docs/docs/deployment/env-vars.md index c9380d3fd6..e90078826d 100644 --- a/docs/docs/deployment/env-vars.md +++ b/docs/docs/deployment/env-vars.md @@ -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.