149 lines
6.0 KiB
Plaintext
149 lines
6.0 KiB
Plaintext
---
|
|
sidebar_position: 2
|
|
---
|
|
|
|
import { SponsorButton } from '../../src/js/SponsorButton.jsx'
|
|
|
|
# Docker
|
|
|
|
:::note
|
|
The easiest way to get started with Typebot is with [the official managed service in the Cloud](https://app.typebot.io). It takes 1 minute to try out the tool for free. You'll have high availability, backups, security, and maintenance all managed for you by me, Baptiste, Typebot's founder.
|
|
|
|
That's also the best way to support my work, open-source software, and you'll get great service!
|
|
:::
|
|
|
|
## Requirements
|
|
|
|
You need a server with Docker installed. If your server doesn't come with Docker pre-installed, you can follow [their docs](https://docs.docker.com/get-docker/) to install it.
|
|
|
|
## Installation
|
|
|
|
### 1. Download the compose file
|
|
|
|
On your server, download the latest `docker-compose.yml` file:
|
|
|
|
```sh
|
|
wget https://raw.githubusercontent.com/baptisteArno/typebot.io/latest/docker-compose.yml
|
|
```
|
|
|
|
### 2. Add the required configuration
|
|
|
|
The compose file has placeholders for the required parameters. To set the parameters you'll first need a random 32-character secret key which will be used to encrypt sensitive data. Here is a simple way to generate one:
|
|
|
|
```sh
|
|
openssl rand -base64 32 | tr -d '\n' ; echo
|
|
```
|
|
|
|
Now edit `docker-compose.yml` and:
|
|
|
|
- Replace `<your-encryption-secret>` with the generated secret.
|
|
- Replace `<your-builder-url>` with the public URL of the builder (i.e. `https://typebot.domain.com:8080`).
|
|
- Replace `<your-viewer-url>` with the public URL of the viewer (i.e. `https://typebot.domain.com:8081`).
|
|
- Replace `<your-admin-email>` with the email address of the administrator.
|
|
- Configure at least one authentication provider (Email, Google, GitHub, Facebook or GitLab). More info here: [Configuration](https://docs.typebot.io/self-hosting/configuration).
|
|
|
|
By default the compose file will pull the latest stable Typebot images: `baptistearno/typebot-builder:latest` and `baptistearno/typebot-viewer:latest`. You can decide to replace `latest` with a specific version or with `main` to get the latest modifications. You can find all the existing tags [here](https://hub.docker.com/r/baptistearno/typebot-builder/tags)
|
|
|
|
### 3. Start the server
|
|
|
|
Once you've added your configuration to the compose file, you're ready to start up the server:
|
|
|
|
```sh
|
|
docker-compose up -d
|
|
```
|
|
|
|
When you run this command it does the following:
|
|
|
|
- Create a database
|
|
- Run the migrations
|
|
- Start the builder on port 8080
|
|
- Start the viewer on port 8081
|
|
|
|
You can now navigate to `http://typebot.domain.com:8080` and see the login screen. Login with the admin email to have access to a Team plan workspace automatically.
|
|
|
|
Typebot server itself does not perform SSL termination. It only runs on unencrypted HTTP. If you want to run on HTTPS you also need to set up a reverse proxy in front of the server. See below instructions.
|
|
|
|
### Update Typebot
|
|
|
|
Typebot is updated regularly, but it is up to you to apply these updates on your server. By virtue of using Docker, these updates are safe and easy to apply.
|
|
|
|
```sh
|
|
docker-compose down --remove-orphans
|
|
docker-compose pull baptistearno/typebot-builder
|
|
docker-compose pull baptistearno/typebot-viewer
|
|
docker-compose up -d
|
|
```
|
|
|
|
The self-hosted version is somewhat of a LTS, only getting the changes after they have been battle tested on the hosted version. If you want features as soon as they are available, consider becoming a hosted customer.
|
|
|
|
## Optional extras
|
|
|
|
### Reverse proxy
|
|
|
|
By default, Typebot runs on unencrypted HTTP on ports 8080 for the builder and 8081 for the viewer. We recommend running it on HTTPS behind a reverse proxy of some sort. You may or may not already be running a reverse proxy on your host, let's look at both options:
|
|
|
|
#### No existing reverse proxy
|
|
|
|
If your DNS is managed by a service that offers a proxy option with automatic SSL management, feel free to use that. For example, you could use Cloudflare as a reverse proxy in front of Typebot.
|
|
|
|
Alternatively, you can run your own Caddy server as a reverse proxy. This way your SSL certificate will be stored on the host machine and managed by Let's Encrypt. The Caddy server will expose port 443, terminate SSL traffic and proxy the requests to your Typebot server.
|
|
|
|
Here is an example of a docker-compose file using Caddy as a reverse proxy:
|
|
|
|
```yml
|
|
version: '3.3'
|
|
services:
|
|
caddy-gen:
|
|
container_name: caddy-gen
|
|
image: 'wemakeservices/caddy-gen:latest'
|
|
restart: always
|
|
volumes:
|
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
|
- caddy-certificates:/data/caddy
|
|
ports:
|
|
- '80:80'
|
|
- '443:443'
|
|
depends_on:
|
|
- typebot
|
|
|
|
typebot-builder:
|
|
labels:
|
|
virtual.host: 'typebot.domain.com' # change to your domain name
|
|
virtual.port: '8080'
|
|
virtual.tls-email: 'admin@example.com' # change to your email
|
|
|
|
typebot-builder:
|
|
labels:
|
|
virtual.host: 'bot.domain.com' # change to your domain name
|
|
virtual.port: '8081'
|
|
virtual.tls-email: 'admin@example.com' # change to your email
|
|
|
|
volumes:
|
|
caddy-certificates:
|
|
driver: local
|
|
```
|
|
|
|
You can merge this compose file with the first one. It should automatically enable SSL on your server and you should be able to navigate to:
|
|
|
|
- `https://typebot.domain.com`
|
|
- `https://bot.domain.com`
|
|
|
|
#### Existing reverse proxy
|
|
|
|
If you're already running a reverse proxy, the most important things to note are:
|
|
|
|
1. Configure the virtual hosts to match the `NEXTAUTH_URL` and `NEXT_PUBLIC_VIEWER_URL` in your `docker-compose` configuration.
|
|
2. Proxy the traffic to `127.0.0.1:8080` or `{ip-address}:8080` and to `127.0.0.1:8081` or `{ip-address}:8081` if running on a remote machine
|
|
|
|
:::note
|
|
If you're self-hosting Typebot, [sponsoring me](https://github.com/sponsors/baptisteArno) is a great way to give back to the community and to contribute to the long-term sustainability of the project.
|
|
|
|
<SponsorButton />
|
|
|
|
Thank you for supporting independent creators of Free Open Source Software!
|
|
:::
|
|
|
|
:::note
|
|
This doc has been inspired by [Plausible docs](https://plausible.io/docs). They have a similar self-hosting solutions, and their documentation is 🔥.
|
|
:::
|