Add Railway deployment for web UI
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
node_modules
|
||||
dist
|
||||
.git
|
||||
.gitignore
|
||||
Dockerfile
|
||||
README.md
|
||||
*.tsbuildinfo
|
||||
.env
|
||||
.env.*
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
auto_https off
|
||||
}
|
||||
|
||||
:{$PORT} {
|
||||
root * /srv
|
||||
|
||||
handle /api/* {
|
||||
reverse_proxy {$URAPT_SERVER_URL} {
|
||||
header_up Host {upstream_hostport}
|
||||
}
|
||||
}
|
||||
|
||||
handle /apt/* {
|
||||
reverse_proxy {$URAPT_SERVER_URL} {
|
||||
header_up Host {upstream_hostport}
|
||||
}
|
||||
}
|
||||
|
||||
handle {
|
||||
try_files {path} /index.html
|
||||
file_server
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
COPY . .
|
||||
RUN pnpm build
|
||||
|
||||
FROM caddy:2-alpine
|
||||
COPY --from=build /app/dist /srv
|
||||
COPY Caddyfile /etc/caddy/Caddyfile
|
||||
@@ -65,6 +65,21 @@ and `/apt` to `urapt-server`. No CORS, no server changes — the API base is jus
|
||||
pnpm build # outputs dist/
|
||||
```
|
||||
|
||||
### Railway
|
||||
|
||||
`urapt-web/` includes a Dockerfile for deploying the UI as a separate Railway
|
||||
service. The container builds the Vite app and serves it with Caddy, proxying
|
||||
`/api/*` and `/apt/*` to an existing `urapt-server` service.
|
||||
|
||||
In Railway, create a new service from this repo with:
|
||||
|
||||
- Root Directory: `urapt-web`
|
||||
- Environment variable: `URAPT_SERVER_URL=https://your-urapt-server.up.railway.app`
|
||||
|
||||
Do not set `VITE_API_BASE_URL` for this deployment; the UI should keep using the
|
||||
default same-origin `/api/v1` path.
|
||||
|
||||
|
||||
### Caddy
|
||||
|
||||
```caddy
|
||||
|
||||
Reference in New Issue
Block a user