fix(scaffold): split api:8522/web:8521, fix nginx proxy to host.docker.internal
This commit is contained in:
parent
3a0608ff98
commit
3c9598c443
5 changed files with 22 additions and 13 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -22,3 +22,10 @@ web/dist/
|
|||
|
||||
# Docker override (local dev extras)
|
||||
compose.override.yml
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Logs and runtime files
|
||||
*.log
|
||||
*.db
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ RUN conda run -n pagepiper pip install --no-cache-dir -e "/app/circuitforge-core
|
|||
WORKDIR /app/pagepiper
|
||||
RUN conda run -n pagepiper pip install --no-cache-dir -e .
|
||||
|
||||
EXPOSE 8521
|
||||
EXPOSE 8522
|
||||
CMD ["conda", "run", "--no-capture-output", "-n", "pagepiper", \
|
||||
"uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8521"]
|
||||
"uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8522"]
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ services:
|
|||
dockerfile: docker/web/Dockerfile
|
||||
ports:
|
||||
- "8521:80"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- api
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ server {
|
|||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Proxy API requests to FastAPI
|
||||
# Proxy API requests to FastAPI (host network, port 8522)
|
||||
location /api/ {
|
||||
proxy_pass http://localhost:8521;
|
||||
proxy_pass http://host.docker.internal:8522;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
|
|
|||
18
manage.sh
18
manage.sh
|
|
@ -5,8 +5,8 @@ SERVICE=pagepiper
|
|||
WEB_PORT=8521
|
||||
COMPOSE_FILE="compose.yml"
|
||||
|
||||
OVERRIDE_FLAG=""
|
||||
[[ -f "compose.override.yml" ]] && OVERRIDE_FLAG="-f compose.override.yml"
|
||||
OVERRIDE_ARGS=()
|
||||
[[ -f "compose.override.yml" ]] && OVERRIDE_ARGS=(-f compose.override.yml)
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 {start|stop|restart|status|logs [svc]|open|build|test}"
|
||||
|
|
@ -18,28 +18,28 @@ shift || true
|
|||
|
||||
case "$cmd" in
|
||||
start)
|
||||
docker compose -f "$COMPOSE_FILE" $OVERRIDE_FLAG up -d --build
|
||||
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" up -d --build
|
||||
echo "Pagepiper running → http://localhost:${WEB_PORT}"
|
||||
;;
|
||||
stop)
|
||||
docker compose -f "$COMPOSE_FILE" $OVERRIDE_FLAG down
|
||||
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" down
|
||||
;;
|
||||
restart)
|
||||
docker compose -f "$COMPOSE_FILE" $OVERRIDE_FLAG down
|
||||
docker compose -f "$COMPOSE_FILE" $OVERRIDE_FLAG up -d --build
|
||||
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" down
|
||||
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" up -d --build
|
||||
echo "Pagepiper running → http://localhost:${WEB_PORT}"
|
||||
;;
|
||||
status)
|
||||
docker compose -f "$COMPOSE_FILE" $OVERRIDE_FLAG ps
|
||||
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" ps
|
||||
;;
|
||||
logs)
|
||||
docker compose -f "$COMPOSE_FILE" $OVERRIDE_FLAG logs -f "${1:-}"
|
||||
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" logs -f "${1:-}"
|
||||
;;
|
||||
open)
|
||||
xdg-open "http://localhost:${WEB_PORT}" 2>/dev/null || open "http://localhost:${WEB_PORT}"
|
||||
;;
|
||||
build)
|
||||
docker compose -f "$COMPOSE_FILE" $OVERRIDE_FLAG build --no-cache
|
||||
docker compose -f "$COMPOSE_FILE" "${OVERRIDE_ARGS[@]}" build --no-cache
|
||||
;;
|
||||
test)
|
||||
conda run -n cf pytest tests/ -v
|
||||
|
|
|
|||
Loading…
Reference in a new issue