2023-04-06 13:39:47 +00:00
---
id: docker
title: Docker
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Deploying ToolJet using Docker Compose
Follow the steps below to deploy ToolJet on a server using Docker Compose. ToolJet requires a PostgreSQL database to store applications definitions, (encrypted) credentials for datasources and user authentication data.
:::info
2023-08-02 11:29:57 +00:00
If you rather want to try out ToolJet on your local machine with Docker, you can follow the steps [here ](/docs/2.4.0/setup/try-tooljet ).
2023-04-06 13:39:47 +00:00
:::
2023-08-03 07:39:07 +00:00
*If you have any questions feel free to join our [Slack Community ](https://tooljet.com/slack ) or send us an email at hello@tooljet.com.*
2023-04-06 13:39:47 +00:00
### Installing Docker and Docker Compose
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/ )
### Deployment options
There are two options to deploy ToolJet using Docker Compose:
2023-08-03 09:27:57 +00:00
1. **With in-built PostgreSQL database (recommended)** . This setup uses the official Docker image of PostgreSQL.
2. **With external PostgreSQL database** . This setup is recommended if you want to use a managed PostgreSQL service such as AWS RDS or Google Cloud SQL.
2023-04-06 13:39:47 +00:00
Confused about which setup to select? Feel free to ask the community via Slack: https://tooljet.com/slack.
< Tabs >
2023-08-03 09:27:57 +00:00
< TabItem value = "with-in-built-postgres" label = "With in-built PostgreSQL" default >
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
1. Download our production docker-compose file into the server.
```bash
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/docker-compose-db.yaml
mv docker-compose-db.yaml docker-compose.yaml
mkdir postgres_data
```
2. Create `.env` file in the current directory (where the docker-compose.yaml file is downloaded as in step 1):
2023-04-06 13:39:47 +00:00
```bash
2023-08-03 09:27:57 +00:00
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/.env.internal.example
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/internal.sh & & chmod +x internal.sh
mv .env.internal.example .env & & ./internal.sh
2023-04-06 13:39:47 +00:00
```
2023-08-03 09:27:57 +00:00
3. To start the docker container, use the following command:
2023-04-06 13:39:47 +00:00
```bash
2023-08-03 09:27:57 +00:00
docker-compose up -d
2023-04-06 13:39:47 +00:00
```
2023-08-03 09:27:57 +00:00
4. ** (Optional)** `TOOLJET_HOST` environment variable can either be the public ipv4 address of your server or a custom domain that you want to use. Which can be modified in the .env file.
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
Also, for setting up additional environment variables in the .env file, please check our documentation on [environment variable ](/docs/setup/env-vars )
2023-04-06 13:39:47 +00:00
Examples:
`TOOLJET_HOST=http://12.34.56.78` or
`TOOLJET_HOST=https://tooljet.yourdomain.com`
2023-08-03 09:27:57 +00:00
If you've set a custom domain for `TOOLJET_HOST` , add a `A record` entry in your DNS settings to point to the IP address of the server.
2023-04-06 13:39:47 +00:00
:::info
2023-08-03 09:27:57 +00:00
i. Please make sure that `TOOLJET_HOST` starts with either `http://` or `https://`
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
ii. Setup docker to run without root privileges by following the instructions written here https://docs.docker.com/engine/install/linux-postinstall/
iii. If you're running on a linux server, `docker` might need sudo permissions. In that case you can either run:
`sudo docker-compose up -d`
2023-04-06 13:39:47 +00:00
:::
2023-08-03 09:27:57 +00:00
< / TabItem >
< TabItem value = "with-external-postgres" label = "With external PostgreSQL" >
1. Setup a PostgreSQL database and make sure that the database is accessible.
2. Download our production docker-compose file into the server.
2023-04-06 13:39:47 +00:00
```bash
2023-08-03 09:27:57 +00:00
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/docker-compose.yaml
2023-04-06 13:39:47 +00:00
```
2023-08-03 09:27:57 +00:00
3. Create `.env` file in the current directory (where the docker-compose.yaml file is downloaded as in step 1):
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
Kindly set the postgresql database credentials according to your external database. Please enter the database details with the help of the bash as shown below.
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
< div style = {{textAlign: ' center ' } } >
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
< img className = "screenshot-full" src = "/img/setup/docker/bash.gif" / >
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
< / div >
2023-04-06 13:39:47 +00:00
```bash
2023-08-03 09:27:57 +00:00
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/.env.external.example
curl -LO https://raw.githubusercontent.com/ToolJet/ToolJet/main/deploy/docker/external.sh & & chmod +x external.sh
mv .env.external.example .env & & ./external.sh
2023-04-06 13:39:47 +00:00
```
2023-08-03 09:27:57 +00:00
4. To start the docker container, use the following command:
2023-04-06 13:39:47 +00:00
```bash
2023-08-03 09:27:57 +00:00
docker-compose up -d
2023-04-06 13:39:47 +00:00
```
2023-08-03 09:27:57 +00:00
5. ** (Optional)** `TOOLJET_HOST` environment variable can either be the public ipv4 address of your server or a custom domain that you want to use. Which can be modified in the .env file.
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
Also, for setting up additional environment variables in the .env file, please check our documentation on [environment variable ](/docs/setup/env-vars )
2023-04-06 13:39:47 +00:00
Examples:
`TOOLJET_HOST=http://12.34.56.78` or
`TOOLJET_HOST=https://tooljet.yourdomain.com`
2023-08-03 09:27:57 +00:00
If you've set a custom domain for `TOOLJET_HOST` , add a `A record` entry in your DNS settings to point to the IP address of the server.
2023-04-06 13:39:47 +00:00
:::info
2023-08-03 09:27:57 +00:00
i. Please make sure that `TOOLJET_HOST` starts with either `http://` or `https://`
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
ii. If there are self signed HTTPS endpoints that Tooljet needs to connect to, please make sure that `NODE_EXTRA_CA_CERTS` environment variable is set to the absolute path containing the certificates.
2023-04-06 13:39:47 +00:00
2023-08-03 09:27:57 +00:00
iii. If you're running a linux server, `docker` might need sudo permissions. In that case you can either run:
2023-04-06 13:39:47 +00:00
`sudo docker-compose up -d`
2023-08-03 09:27:57 +00:00
iv. Setup docker to run without root privileges by following the instructions written here https://docs.docker.com/engine/install/linux-postinstall/
2023-12-05 08:20:37 +00:00
:::
< / TabItem >
< / Tabs >
2024-02-27 07:23:21 +00:00
## Upgrading to the Latest Version
2023-12-05 08:20:37 +00:00
2024-02-27 07:23:21 +00:00
The latest version includes architectural changes and, hence, comes with new migrations.
2023-12-05 08:20:37 +00:00
2024-02-27 07:23:21 +00:00
If this is a new installation of the application, you may start directly with the latest version. This guide is not required for new installations.
2023-12-05 08:20:37 +00:00
#### Prerequisites for Upgrading to the Latest Version:
- It is **crucial to perform a comprehensive backup of your database** before starting the upgrade process to prevent data loss.
2024-04-29 11:42:28 +00:00
- Ensure that your current version is v2.23.0-ee2.10.2 before upgrading.
2023-12-05 08:20:37 +00:00
2024-04-29 11:42:28 +00:00
- Users on versions earlier than v2.23.0-ee2.10.2 must first upgrade to this version before proceeding to the latest version.
2023-12-05 08:20:37 +00:00
For specific issues or questions, refer to our ** [Slack ](https://tooljet.slack.com/join/shared_invite/zt-25438diev-mJ6LIZpJevG0LXCEcL0NhQ# )**.
2023-04-06 13:39:47 +00:00