Skip to content

Commit

Permalink
📝 Self-hosting manual docs (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
itzomen authored Jan 17, 2023
1 parent cf5520b commit 930fef2
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/docs/docs/self-hosting/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ I've written guides on how to deploy Typebot using:

- [Docker](/self-hosting/docker)
- [Vercel](/self-hosting/vercel)
- [Manual](/self-hosting/manual)
132 changes: 132 additions & 0 deletions apps/docs/docs/self-hosting/manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
sidebar_position: 3
---

# Manual

:::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

- A PostgresDB database hosted somewhere. [Supabase](https://supabase.com/) offer great free options. But you can also setup your own database on your server.
- A server with Node.js 14+, Nginx, and PM2 installed.
- Experience deploying Next.js applications with PM2. Check out [this guide](https://www.coderrocketfuel.com/article/how-to-deploy-a-next-js-website-to-a-digital-ocean-server/) for more information.

## Getting Started

1. Fork/clone the repository

```sh
git clone git@github.com:<username>/typebot.io.git
```

2. Setup environment variables by copying the example files and following the [configuration guide](/self-hosting/configuration) to fill in the missing values.

```sh
cd typebot.io
# check out the latest stable version or the one you want to use
git checkout v2.9.1
# copy the example env file
cp packages/db/.env.example packages/db/.env
cp apps/builder/.env.local.example apps/builder/.env.local
cp apps/viewer/.env.local.example apps/viewer/.env.local
```

:::note
The database user should have the `SUPERUSER` role. You can setup and migrate the database with the `pnpm prisma generate && pnpm db:migrate` command.
:::

3. Install dependencies

```sh
pnpm install
```

4. Build the builder and viewer

```sh
pnpm run build:apps
# or build them separately
pnpm run build:builder
pnpm run build:viewer
```

:::note
If you face the issue `Node ran out of memory`, then you should increase the memory limit for Node.js. For example,`NODE_OPTIONS=--max-old-space-size=4096` will increase the memory limit to 4GB. Check [this stackoverflow answer](https://stackoverflow.com/questions/53230823/fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-failed-javas) for more information.
:::

## Deployments

### Deploy the builder

1. Cd into the builder directory and make sure it can be started with `pnpm start`

```sh
cd apps/builder
pnpm start
# You may have to set the port if it's already in use
pnpm next start -p 3001
```

2. Deploy the builder with PM2

```sh
pm2 start --name=typebot pnpm -- start
# or select a different port
pm2 start --name=typebot pnpm -- next start -p 3001
```

### Deploy the viewer

1. Cd into the viewer directory and make sure it can be started with `pnpm start`

```sh
cd apps/viewer
pnpm start
# You may have to set the port if it's already in use
pnpm next start -p 3002
```

2. Deploy the viewer with PM2

```sh
pm2 start --name=typebot pnpm -- start
# or select a different port
pm2 start --name=typebot pnpm -- next start -p 3002
```

## Nginx configuration

You can use the following configuration to serve the builder and viewer with Nginx. Make sure to replace the `server_name` with the respective domain name for your Typebot instance. Check out [this guide](https://www.coderrocketfuel.com/article/how-to-deploy-a-next-js-website-to-a-digital-ocean-server/) for a step-by-step guide on how to setup Nginx and PM2.

```nginx
server {
listen 80;
server_name typebot.example.com www.typebot.example.com;
return 301 https://typebot.example.com$request_uri;
}
server {
listen 443 ssl;
server_name typebot.example.com www.typebot.example.com;
# managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # ma>
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # >
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location ^~ / {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
```

4 comments on commit 930fef2

@vercel
Copy link

@vercel vercel bot commented on 930fef2 Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 930fef2 Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 930fef2 Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

ns8.vn
8jours.top
chat.hayuri.id
chicken.cr8.ai
gollum.riku.ai
gsbulletin.com
panther.cr7.ai
panther.cr8.ai
penguin.cr8.ai
talk.gocare.io
ticketfute.com
unicorn.cr8.ai
apo.nigerias.io
apr.nigerias.io
aso.nigerias.io
bot.ageenda.com
bot.artiweb.app
bot.devitus.com
bot.jesopizz.it
bot.reeplai.com
bot.tc-mail.com
chat.lalmon.com
chat.sureb4.com
eventhub.com.au
fitness.riku.ai
games.klujo.com
sakuranembro.it
typebot.aloe.do
bot.contakit.com
bot.piccinato.co
bot.sv-energy.it
botc.ceox.com.br
clo.closeer.work
cockroach.cr8.ai
faqs.nigerias.io
feedback.ofx.one
form.syncwin.com
kw.wpwakanda.com
myrentalhost.com
stan.vselise.com
start.taxtree.io
typebot.aloe.bot
voicehelp.cr8.ai
zap.fundviser.in
app.chatforms.net
bot.hostnation.de
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
bot.rihabilita.it
cares.urlabout.me
fmm.wpwakanda.com
bot.adventureconsulting.hu
casestudyemb.wpwakanda.com
chat.atlasoutfittersk9.com
configurator.bouclidom.com
help.atlasoutfittersk9.com
herbalife.barrettamario.it
homepageonly.wpwakanda.com
liveconvert.kandalearn.com
mainmenu1one.wpwakanda.com
tarian.theiofoundation.org
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chatbot.berbelanjabiz.trade
designguide.techyscouts.com
liveconvert2.kandalearn.com
presente.empresarias.com.mx
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
bot.seidibergamoseanchetu.it
desabafe.sergiolimajr.com.br
piazzatorre.barrettamario.it
type.cookieacademyonline.com
bot.brigadeirosemdrama.com.br
forms.escoladeautomacao.com.br
onboarding.libertydreamcare.ie
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
elevateyourmind.groovepages.com
viewer-v2-typebot-io.vercel.app
yourfeedback.comebackreward.com
gerador.verificadordehospedes.com
personal-trainer.barrettamario.it
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
bot.studiotecnicoimmobiliaremerelli.it
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
viewer-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 930fef2 Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.