Deploy to Deno Deploy
June 23, 2024 ยท View on GitHub
Prerequisites
- nodejs
- npm
- deno
- deployctl
- Deno deploy KV access!
Deploy
Hint: If you are really lazy we provide precompiled deploy packages in the branch deno-deploy-data
- Build the app with and frontend, we provide a makefile for this. Just run
make deployand it will automatically create a deployable bundle. If you don't have make installed, you can also build the deploy package yourself see build manual. - Create a new empty project on deno.com/deploy and copy the project id.
- Get your deploy token inside the deno webui and run this command inside your deploy folder:
deployctl deploy --token <token> --project=<project name> ./deploy/deploy.ts"
Build manual
- Install frontend dependencies, open app/frontend and run
npm install - Build frontend, run
npm run build - Create a deploy folder
mkdir deploy - Copy the backend into a new folder
cp -r ./app/backend/* deploy - Copy the frontend build into the backend folder
cp -r ./app/frontend/build ./deploy/static-site
Set the following environment variables in the webui
| Name | Description | Default |
|---|---|---|
| PORT | Port to listen | 8787 |
| VAPID_KEY | Vapid key for the app, see generate | undefined |
| SUB | Admin email in format "mailto:aa@bbb.ccc" | undefined |
| CORS | Enable cors, if your frontend is served on a different domain | false |
| SENDKEY | Key to send notifications | undefined |
| LOGINKEY | Key to login to the ui | undefined |
Generate Vapid key
deno run --allow-net --allow-read --allow-write --unstable ./deploy/main.ts generate
or if you do not want to checkout this repository you can use the following command:
deno run -A --unstable --import-map https://raw.githubusercontent.com/K0IN/Notify/deno-port/app/backend/deno.json https://raw.githubusercontent.com/K0IN/Notify/deno-port/app/backend/main.ts generate