Files
bracket/docs/content/deployment/nomad.mdx
Erik Vroon 583eb4e963 Migrate Next.js to Vite (#1397)
Vite is much simpler to use than Next.js and we don't need any of the
features Next has that Vite doesn't have.

Benefits of moving to Vite are:
- Much better performance in dev and prod environments
- Much better build times
- Actual support for static exports, no vendor lock-in of having to use
Vercel
- Support for runtime environment variables/loading config from `.env`
files
- No annoying backwards-incompatible changes on major releases of Next
- Better i18n support without having to define getServerSideProps on
every page
- Better bundle optimization
- No opt-out Vercel telemetry 

Also replaces yarn by pnpm and upgrades mantine to 8.3
2025-11-12 11:18:06 +01:00

111 lines
2.1 KiB
Plaintext

---
title: Nomad
---
# Nomad
This section describes how to deploy Bracket (frontend and backend) to
[Nomad](https://www.nomadproject.io).
First, make sure you have a running Nomad cluster. See the
[production deployment guide](https://developer.hashicorp.com/nomad/tutorials/enterprise/production-deployment-guide-vm-with-consul) {/*<!-- markdownlint-disable-line -->*/}
on how to achieve that.
Then, you can use the following files describing the tasks for the backend and frontend.
## Backend
```hcl
job "bracket-backend" {
datacenters = ["*"]
group "servers" {
count = 1
network {
port "uvicorn" {
to = 8400
}
}
service {
provider = "nomad"
port = "uvicorn"
}
task "api" {
driver = "docker"
env {
ENVIRONMENT = "PRODUCTION"
PG_DSN = "postgresql://bracket_prod:bracket_prod@postgres:5432/bracket_prod"
JWT_SECRET = "38af87ade31804cc115166f605586a57c6533eeb4342e66c5229f44a76afdde4"
AUTO_RUN_MIGRATIONS = "false"
}
config {
image = "ghcr.io/evroon/bracket-backend"
ports = ["uvicorn"]
command = "uv"
args = [
"run",
"uvicorn",
"bracket.app:app",
"--port",
"${NOMAD_PORT_uvicorn}",
"--host",
"0.0.0.0",
]
}
resources {
cpu = 256
memory = 512
}
}
}
}
```
## Frontend
```hcl
job "bracket-frontend" {
datacenters = ["*"]
group "servers" {
count = 1
network {
port "nextjs" { }
}
service {
provider = "nomad"
port = "nextjs"
}
task "api" {
driver = "docker"
env {
VITE_API_BASE_URL = "https://my.bracketdomain.com"
VITE_HCAPTCHA_SITE_KEY = "xxxxx"
NODE_ENV = "production"
}
config {
image = "ghcr.io/evroon/bracket-frontend"
ports = ["nextjs"]
args = ["pnpm", "start", "-p", "${NOMAD_PORT_nextjs}"]
}
resources {
cpu = 256
memory = 512
}
}
}
}
```