Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ services:
ports:
- "8001:80"
restart: unless-stopped
environment:
BACKEND_ADDR: ${BACKEND_ADDR:-http://backend:8000}

mailpit:
image: axllent/mailpit:latest
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ services:
depends_on:
backend:
condition: service_healthy
environment:
BACKEND_ADDR: http://backend:8000

test-runner:
build:
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ services:
ports:
- "8001:80"
restart: unless-stopped
environment:
BACKEND_ADDR: ${BACKEND_ADDR:-http://backend:8000}
16 changes: 12 additions & 4 deletions docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,19 @@ To opt out entirely:
TELEMETRY_DISABLED=true
```

## Frontend Build
## Frontend

| Variable | Description | Default |
|----------|-------------|---------|
| `PUBLIC_DEFAULT_LOCALE` | Default UI language (`en`, `de`, `zh`, `es`, or `fr`) | `en` |
### Run Time

| Variable | Description |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `BACKEND_ADDR` | Configures the upstream address for the Nginx webserver. For the default `docker-compose.yml` this is set to `http://backend:8000`. **NOTE**: Remove trailing `/` as they might interfere with NGINXs routing behavior. |

### Build Time

| Variable | Description | Default |
| ----------------------- | ----------------------------------------------------- | ------- |
| `PUBLIC_DEFAULT_LOCALE` | Default UI language (`en`, `de`, `zh`, `es`, or `fr`) | `en` |

## Import Limits

Expand Down
1 change: 1 addition & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ LibrisLog v1.9.0 brings shareable public profile pages, edition grouping and an
- 🌍 **Localized source names.** Import sources are shown under their translated name in the search progress list and in the edition chips, in all five UI languages

**Improvements**
- 🌐 Allow a configurable backend address via `BACKEND_ADDR` for setups besides the default `docker-compose.yml`
- 📌 **Sticky Add Book dialog header.** The dialog title and the close button stay pinned to the top of the window while the content scrolls, so closing the dialog no longer requires scrolling back up after a long list of results
- 🔍 **Search results report each source.** The progress list names every source that was queried, including those that were skipped and why

Expand Down
4 changes: 3 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ RUN npm run build
# Stage 2: serve
FROM nginx:alpine
COPY --from=builder /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
COPY docker-entrypoint.d/ /docker-entrypoint.d/
ENV BACKEND_ADDR=http://backend:8000
EXPOSE 80
30 changes: 30 additions & 0 deletions frontend/docker-entrypoint.d/10-warn-backend-addr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
# Warns about BACKEND_ADDR values that would break API routing.
#
# nginx treats a URI part in proxy_pass (a trailing slash) as a prefix to replace,
# so "http://backend:8000/" forwards a request for /api/books as /books and every
# API call returns 404 while nginx itself starts cleanly.
#
# The value cannot be corrected here. envsubst only substitutes variables verbatim,
# and the image runs each script in /docker-entrypoint.d as a separate process, so an
# export from this script never reaches the later envsubst call. Printing is the only
# thing that works without replacing the image entrypoint or giving up nginx's
# startup-time upstream validation.
#
# The numbered filename makes this run before 20-envsubst-on-templates.sh.

BACKEND_ADDR="${BACKEND_ADDR-}"

case "$BACKEND_ADDR" in
"")
echo "librislog: BACKEND_ADDR is empty, so nginx renders an invalid proxy_pass and will not start." >&2
echo "librislog: set it to an address such as http://backend:8000." >&2
;;
*/)
echo "librislog: BACKEND_ADDR ends with a slash ('$BACKEND_ADDR')." >&2
echo "librislog: nginx replaces the matched location prefix, so /api/books is forwarded as /books and every API call returns 404." >&2
echo "librislog: drop the trailing slash." >&2
;;
esac

exit 0
2 changes: 1 addition & 1 deletion frontend/nginx.conf → frontend/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ server {

# API proxy to backend service inside docker network.
location /api/ {
proxy_pass http://backend:8000;
proxy_pass ${BACKEND_ADDR};
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
Expand Down
Loading