Skip to content

Commit 8d48ebd

Browse files
authored
docs: supabase guide without pooling section (#299)
* docs: add supabase guide * docs: add supabase to mint.json * docs: change supabase schema from public * docs: supabase pooling coming soon
1 parent 7ef0fe7 commit 8d48ebd

11 files changed

+176
-2
lines changed

docs/documentation/guides/self-hosting.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,20 @@ We provide an official Trigger.dev [docker image](https://github.com/triggerdotd
2424
icon="fly"
2525
href="/documentation/guides/self-hosting/flyio"
2626
>
27-
Easily to deploy to Fly.io
27+
Easily deploy to Fly.io
2828
</Card>
2929
<Card
3030
title="Render.com"
3131
icon="draw-square"
3232
href="/documentation/guides/self-hosting/flyio"
3333
>
34-
Easily to deploy to Render.com
34+
Easily deploy to Render.com
35+
</Card>
36+
<Card
37+
title="Supabase.com"
38+
icon="bolt"
39+
href="/documentation/guides/self-hosting/supabase"
40+
>
41+
Easily deploy with Supabase
3542
</Card>
3643
</CardGroup>
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
title: "Deploy with Supabase"
3+
description: "Self-host [Trigger.dev](https://trigger.dev) with Supabase and Docker"
4+
---
5+
6+
## Requirements
7+
8+
- [docker](https://docs.docker.com/engine/install/)
9+
- time
10+
11+
## Set up your project
12+
13+
1. Create a project dir and grab the latest `.env` template
14+
15+
```sh
16+
mkdir trigger-docker && cd trigger-docker
17+
curl -L https://github.com/triggerdotdev/docker/raw/main/.env.example > .env
18+
```
19+
20+
2. Generate secrets with `openssl rand -hex 16` for the following variables:
21+
22+
<Warning>Do NOT just copy and paste this. Generate your own secrets instead!</Warning>
23+
24+
```sh .env (excerpt)
25+
...
26+
MAGIC_LINK_SECRET=15600f1236e568d6c9c400a94e16a4ed
27+
SESSION_SECRET=8d92078940c89588fc8b6f5481f2c6e0
28+
ENCRYPTION_KEY=1189c93e399856a2a9a1454496171b2e
29+
...
30+
```
31+
32+
## Create a Supabase DB
33+
34+
<Tip>Alternative: [Self-host Supabase](https://supabase.com/docs/guides/self-hosting/docker)</Tip>
35+
36+
1. No account yet? [Click here](https://supabase.com/dashboard/sign-up) to complete onboarding
37+
38+
2. [Create a new project](https://supabase.com/dashboard/projects)
39+
40+
<Frame>
41+
<img src="/images/supabase-new-project.png" alt="Supabase - New Project" />
42+
</Frame>
43+
44+
3. Make a note of your password, we'll need it in a moment
45+
46+
<Frame>
47+
<img src="/images/supabase-project-password.png" alt="Supabase - Project Password" />
48+
</Frame>
49+
50+
4. Wait until your project has finished setting up
51+
52+
<Frame>
53+
<img src="/images/supabase-project-setup.png" alt="Supabase - Project Setup" />
54+
</Frame>
55+
56+
5. Navigate to Project `Settings -> Database` and copy your database connection string
57+
58+
<Frame>
59+
<img src="/images/supabase-db-url.png" alt="Supabase - Database URL" />
60+
</Frame>
61+
62+
6. Paste it into your `.env` file, and append `?schema=triggerdotdev`
63+
64+
<Tip>Don't forget to replace `<PASSWORD>` with the project password you set in Step 3.</Tip>
65+
66+
```sh .env (excerpt)
67+
...
68+
DATABASE_URL=postgresql://postgres:<PASSWORD>@db.<ID>.supabase.co:5432/postgres?schema=triggerdotdev
69+
...
70+
```
71+
72+
7. The complete file should look something like this now:
73+
74+
```sh .env
75+
LOGIN_ORIGIN=http://localhost:3030
76+
APP_ORIGIN=http://localhost:3030
77+
PORT=3030
78+
REMIX_APP_PORT=3030
79+
80+
MAGIC_LINK_SECRET=15600f1236e568d6c9c400a94e16a4ed
81+
SESSION_SECRET=8d92078940c89588fc8b6f5481f2c6e0
82+
ENCRYPTION_KEY=1189c93e399856a2a9a1454496171b2e
83+
84+
DATABASE_URL=postgresql://postgres:<PASSWORD>@db.<ID>.supabase.co:5432/postgres?schema=triggerdotdev
85+
86+
NODE_ENV=development
87+
RUNTIME_PLATFORM=docker-compose
88+
```
89+
90+
## Self-host Trigger.dev with docker compose
91+
92+
1. Create a docker compose file in your project dir
93+
94+
```yaml docker-compose.yml
95+
---
96+
version: "3.8"
97+
98+
services:
99+
triggerdotdev:
100+
image: ghcr.io/triggerdotdev/trigger.dev:latest
101+
container_name: triggerdotdev
102+
restart: unless-stopped
103+
env_file:
104+
- .env
105+
ports:
106+
- 3030:3030
107+
```
108+
109+
2. Start your docker container
110+
111+
```sh
112+
docker compose up
113+
```
114+
115+
3. Wait for the database setup to finish - this might take a while
116+
117+
4. You should now be able to visit http://localhost:3030 and see this screen:
118+
119+
<Frame>
120+
<img src="/images/trigger.dev-login.png" alt="Trigger.dev - Login" />
121+
</Frame>
122+
123+
5. Click "Continue with Email", enter your email address and hit submit
124+
125+
6. Grab the magic link from your terminal and proceed with account creation
126+
127+
<Frame>
128+
<img src="/images/trigger.dev-magic-link.png" alt="Trigger.dev - CLI Magic Link" />
129+
</Frame>
130+
131+
7. If everything went well, the `triggerdotdev` and `graphile_worker` schemas should now be populated. Check your Supabase DB dashboard to be sure:
132+
133+
<Frame>
134+
<img src="/images/supabase-db-seed.png" alt="Supabase - Database Seed" />
135+
</Frame>
136+
137+
8. Congratulations, you're all set up and ready to go with Supabase and Docker! 🚀
138+
139+
{/* TODO: add pooling setup */}
140+
141+
## Bonus: Connection pooling
142+
143+
<Frame caption="Connection Pool - © 2023 Supabase, Apache License 2.0">
144+
<img src="/images/supabase-connection-pool.png" alt="Supabase - Connection Pool" />
145+
</Frame>
146+
147+
...coming soon!
148+
149+
## Next steps
150+
151+
<CardGroup>
152+
<Card
153+
title="Bootstrap your Next.js project"
154+
icon="person-running-fast"
155+
href="/documentation/quickstart#run-the-cli-init-command"
156+
>
157+
Get started in 5 minutes.
158+
</Card>
159+
<Card
160+
title="Tunnel local traffic"
161+
icon="person-digging"
162+
href="/documentation/guides/tunneling-platform"
163+
>
164+
Start digging with ngrok.
165+
</Card>
166+
</CardGroup>
261 KB
Loading

docs/images/supabase-db-seed.png

48 KB
Loading

docs/images/supabase-db-url.png

65.7 KB
Loading

docs/images/supabase-new-project.png

21.1 KB
Loading
53.8 KB
Loading
20.9 KB
Loading

docs/images/trigger.dev-login.png

30.2 KB
Loading
101 KB
Loading

0 commit comments

Comments
 (0)