dub
dub copied to clipboard
Self host instructions
There should be instructions on how to self-host on a server without Vercel.
@steven-tey your lack of instructions leads to a lot of confusion, especially since you didn't even fill out the entire .env.production for self hosting. UPSTASH_REDIS_REST_URL
isn't in the example env, nor did you explain that it's needed or even what it's for.
➜ dub git:(main) ✗ yarn run start --port 3839
yarn run v1.22.15
$ next start --port 3839
ready - started server on 0.0.0.0:3839, url: http://localhost:3839
info - Loaded env from /root/dub/.env.production
Error: Unable to find environment variable: `UPSTASH_REDIS_REST_URL`
at <unknown> (evalmachine.<anonymous>:4594)
at Function.fromEnv (evalmachine.<anonymous>:4594:19)
at Object.397 (evalmachine.<anonymous>:926:40)
at __webpack_require__ (evalmachine.<anonymous>:25:42)
at Object.3207 (evalmachine.<anonymous>:365:19)
at __webpack_require__ (evalmachine.<anonymous>:25:42)
at __webpack_exec__ (evalmachine.<anonymous>:5494:48)
at <unknown> (evalmachine.<anonymous>:5495:57)
at Function.__webpack_require__.O (evalmachine.<anonymous>:63:23)
at <unknown> (evalmachine.<anonymous>:5496:56)
at webpackJsonpCallback (evalmachine.<anonymous>:158:39)
[next-auth][error][NO_SECRET]
https://next-auth.js.org/errors#no_secret Please define a `secret` in production. MissingSecret [MissingSecretError]: Please define a `secret` in production.
at assertConfig (/root/dub/node_modules/next-auth/core/lib/assert.js:42:12)
at NextAuthHandler (/root/dub/node_modules/next-auth/core/index.js:70:52)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async NextAuthNextHandler (/root/dub/node_modules/next-auth/next/index.js:23:19)
at async /root/dub/node_modules/next-auth/next/index.js:59:32
at async Object.apiResolver (/root/dub/node_modules/next/dist/server/api-utils/node.js:366:9)
at async NextNodeServer.runApi (/root/dub/node_modules/next/dist/server/next-server.js:481:9)
at async Object.fn (/root/dub/node_modules/next/dist/server/next-server.js:735:37)
at async Router.execute (/root/dub/node_modules/next/dist/server/router.js:247:36)
at async NextNodeServer.run (/root/dub/node_modules/next/dist/server/base-server.js:347:29) {
code: 'NO_SECRET'
}
Sorry about that, I ran out of time to write the self-host instructions – I'm going to tackle that tonight! Thanks for the message! :)
Update: Started working on this in this PR: https://github.com/steven-tey/dub/pull/16
Added some self-hosted setup instructions in the .env.example
file + included the required env vars in the Vercel deploy button (it's not perfect yet but it's a start)
It's still a bit confusing though with the redis upstart URL and the Vercel token -- is there (going to be) a way to host this without relying on cloud providers like vercel? I just wanna stick this on my homelab and not worry about another provider.
Maybe someone could even package all of that into a docker image?
Crossposting over from https://github.com/steven-tey/dub/issues/25:
To be completely honest I'm not very familiar with docker – if someone can PR this option into a branch (i.e.
docker
) I'm more than happy to feature it in the README as one of the self-hosted options :)
I've tried out trying to get this to be self-hostable and ended up making a modified fork of it. Since this is mainly reliant Vercel Edge Functions and Upstash Redis, most of the work was just replacing that stuff and getting the rest to work in Docker.
You can try and see if this works out for you: https://github.com/Snazzah/stub
Stub is really amazing @Snazzah, great work! 😄
I'm planning to add a directory that has a simpler version of Dub (removing all unnecessary modules like Stripe, Plausible, etc.) and include proper self-host instructions on here soon! Reason I'm doing this is for y'all to be able to receive upstream updates easily (since you're forking the repo you can just pull from origin every time I push updates).
If you're worried about using Vercel + Upstash – given that you're using it only for your own links your usage will probably stay within their free plan anyway + their developer experience is really unbeatable so I'd still recommend using them! (disclaimer: I work at Vercel)
Sorry again for the delay y'all! Got swamped with a ton of bug fixes this week 😅
Just wanted to follow up and say that I haven't forgotten about this issue yet – it's top on my TODO list for this week! Sorry again for the delay 😅