5 Commits
Author SHA1 Message Date
owen 2a1ed3af04 Normalize Railway upstream URL for web proxy
CI / Test (linux/amd64) (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Cross-build (darwin/amd64) (push) Waiting to run
CI / Cross-build (linux/amd64) (push) Waiting to run
CI / Cross-build (darwin/arm64) (push) Waiting to run
CI / Cross-build (linux/arm64) (push) Waiting to run
2026-06-29 20:37:33 -05:00
owen 59a8580ee1 Pin pnpm version for Railway web build 2026-06-29 20:35:33 -05:00
owen d9d997d912 Add Railway deployment for web UI 2026-06-29 20:33:17 -05:00
owen 11eb1d54d6 Use Go 1.26.1 in Docker build 2026-06-29 20:16:48 -05:00
owen d9efa5f06d Fix Railway Docker volume build 2026-06-29 20:14:43 -05:00
7 changed files with 89 additions and 3 deletions
+4 -3
View File
@@ -1,17 +1,18 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM golang:1.22-bookworm AS build FROM golang:1.26.1-bookworm AS build
WORKDIR /src WORKDIR /src
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY . . COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/urapt-server ./cmd/urapt-server \ RUN mkdir -p /out/data/store \
&& CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/urapt-server ./cmd/urapt-server \
&& CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/urapt ./cmd/urapt && CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/urapt ./cmd/urapt
FROM gcr.io/distroless/static-debian12:nonroot FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/urapt-server /usr/local/bin/urapt-server COPY --from=build /out/urapt-server /usr/local/bin/urapt-server
COPY --from=build --chown=nonroot:nonroot /out/data /data
EXPOSE 8080 EXPOSE 8080
VOLUME ["/data"]
ENV URAPT_STORE_DIR=/data/store ENV URAPT_STORE_DIR=/data/store
ENV URAPT_BASE_URL=http://localhost:8080 ENV URAPT_BASE_URL=http://localhost:8080
USER nonroot:nonroot USER nonroot:nonroot
+9
View File
@@ -0,0 +1,9 @@
node_modules
dist
.git
.gitignore
Dockerfile
README.md
*.tsbuildinfo
.env
.env.*
+24
View File
@@ -0,0 +1,24 @@
{
auto_https off
}
:{$PORT} {
root * /srv
handle /api/* {
reverse_proxy {$URAPT_UPSTREAM} {
header_up Host {upstream_hostport}
}
}
handle /apt/* {
reverse_proxy {$URAPT_UPSTREAM} {
header_up Host {upstream_hostport}
}
}
handle {
try_files {path} /index.html
file_server
}
}
+17
View File
@@ -0,0 +1,17 @@
FROM node:20-alpine AS build
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@10.32.1 --activate
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
COPY docker-entrypoint.sh /usr/local/bin/urapt-web-entrypoint
RUN chmod +x /usr/local/bin/urapt-web-entrypoint
ENTRYPOINT ["/usr/local/bin/urapt-web-entrypoint"]
+17
View File
@@ -65,6 +65,23 @@ and `/apt` to `urapt-server`. No CORS, no server changes — the API base is jus
pnpm build # outputs dist/ 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`
A trailing slash is okay; the container normalizes it before starting Caddy.
Do not set `VITE_API_BASE_URL` for this deployment; the UI should keep using the
default same-origin `/api/v1` path.
### Caddy ### Caddy
```caddy ```caddy
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
set -eu
if [ -z "${URAPT_SERVER_URL:-}" ]; then
echo "URAPT_SERVER_URL is required, e.g. https://urapt-production.up.railway.app" >&2
exit 1
fi
# Caddy reverse_proxy upstreams may only contain scheme, host, and port.
# Railway/public URLs are often copied with a trailing slash; normalize that.
URAPT_UPSTREAM="$URAPT_SERVER_URL"
while [ "${URAPT_UPSTREAM%/}" != "$URAPT_UPSTREAM" ]; do
URAPT_UPSTREAM="${URAPT_UPSTREAM%/}"
done
export URAPT_UPSTREAM
exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
+1
View File
@@ -2,6 +2,7 @@
"name": "urapt-web", "name": "urapt-web",
"private": true, "private": true,
"version": "0.1.0", "version": "0.1.0",
"packageManager": "pnpm@10.32.1",
"type": "module", "type": "module",
"description": "Web UI for urapt-server (self-hosted APT repository server).", "description": "Web UI for urapt-server (self-hosted APT repository server).",
"scripts": { "scripts": {