4.7 KiB
🚀 Deployment Guide
Table of Contents
🐳 Docker Compose Deployment
This is the simplest way to deploy Nimbus locally or on a single server.
To make it even simpler, we recommend using Coolify.
Prerequisites
1. Clone the Repository
git clone https://github.com/nimbusdotstorage/Nimbus.git
cd Nimbus
2. Set Up Environment Variables
cp .env.example .env
Nimbus requires the following environment variables to work, some will be pre-filled for local testing:
REQUIRED:
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETMICROSOFT_CLIENT_IDMICROSOFT_CLIENT_SECRETBETTER_AUTH_SECRETBETTER_AUTH_URLSERVER_PORTWEB_PORTBACKEND_URLTRUSTED_ORIGINSNEXT_PUBLIC_BACKEND_URLNEXT_PUBLIC_FRONTEND_URLDATABASE_URLDATABASE_HOSTPOSTGRES_PORTPOSTGRES_USERPOSTGRES_PASSWORDPOSTGRES_DBVALKEY_PORTVALKEY_HOSTVALKEY_USERNAMEVALKEY_PASSWORD
OPTIONAL:
EMAIL_FROMRESEND_API_KEY
3. Start Services
docker compose up -d
4. Verify Services
- Web UI: http://localhost:3000
- Server API: http://localhost:1284
- PostgreSQL: localhost:5432
- Valkey (Redis-compatible): localhost:6379
5. Stop Services
docker compose down
6. Service Health Checks
- Database:
pg_isready -h localhost -p 5432 - Cache:
redis-cli -h localhost -p 6379 ping - API:
curl http://localhost:1284/kamehame
7. Enjoy!
Your container should now be available at http://localhost:3000 or at the domain you set up!
☁️ Cloudflare Workers Deployment
Prerequisites
- Bun
- Wrangler CLI
- Cloudflare account with Workers enabled
For any issues, please refer to the official Cloudflare Workers documentation.
1. Install Dependencies and Sign In to Wrangler
bun install
bun wrangler --version
bun wrangler login
2. Configure Worker
The wrangler.toml is already configured to instantly deploy, however you will need to add certain environment
variables for the worker to function fully.
If testing, make sure to add the wrangler.dev url cloudflare provisions for you to the NEXT_PUBLIC_BACKEND_URL and
NEXT_PUBLIC_FRONTEND_URL environment variables in both the wrangler.toml and .env files.
If deploying to production, make sure to use your production url in the NEXT_PUBLIC_BACKEND_URL and
NEXT_PUBLIC_FRONTEND_URL environment variables in both the wrangler.toml and .env files.
- Add the values outlined in the .env.example file to the wrangler.toml file or to your Worker settings on the Cloudflare dashboard.
- Configure your .env file with your production values.
- Run
bun env:syncto sync your .env file to the web workspace or the frontend build will fail. - Run
cp .env .dev.varsto copy your .env file to the .dev.vars file for testing it locally before deployment.
Note: The worker front end is build with opennext and therefore acts exactly as a Nextjs build, so env variables are extracted from the .env file at the root of the workspace (
apps/webin this case). Technically, the only variables required for the frontend build areNEXT_PUBLIC_BACKEND_URLandNEXT_PUBLIC_FRONTEND_URL, but it is recommended to sync all variables.
3. Deploy Worker
You will need to run this command in the apps/web directory and the apps/server directory respectively.
bun run deploy
4. Set Up Custom Domain (Optional)
Refer to the official documentation for adding custom domains to your workers
5. Environment Variables
Set environment variables in the Cloudflare Workers dashboard or using Wrangler:
wrangler secret put API_KEY
wrangler secret put DATABASE_URL
Note:
wrangler.tomlis not ignored in the.gitignore, so if you add environment variables for your deployment, they will be committed to version control. Make sure to remove them before pushing to a public repository.
6. Enjoy!
Your worker should now be available at the domain you set up or at the wrangler.dev url cloudflare provisions for you!