diff --git a/.env.example b/.env.example index 482fa6d..f0959a7 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ -# Host port of the Drivers Hub API. -HUB_PORT=7777 +# Address and port on the Docker host. +BACKEND_BIND=127.0.0.1:17777 DB_NAME=drivershub DB_PASSWORD=replace-with-a-long-random-password diff --git a/Dockerfile b/Dockerfile index 4f472d8..9839eab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,7 @@ RUN apt-get update \ WORKDIR /app COPY --from=builder --chown=drivershub:drivershub /build/dist/ ./ +COPY --from=builder --chown=drivershub:drivershub /build/src/external_plugins/ ./external_plugins/ COPY --chown=root:root docker/entrypoint.sh /usr/local/bin/drivershub-entrypoint USER drivershub diff --git a/README.md b/README.md index bb2174a..30fb489 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Set secure MariaDB passwords in `.env`. Then, set at least these values in ```json { - "abbr": "drivershub", + "abbr": "api", "name": "Drivers Hub", "domain": "hub.example.com", "prefix": "/api", @@ -39,7 +39,8 @@ Set secure MariaDB passwords in `.env`. Then, set at least these values in "db_name": "drivershub", "db_data_directory": "/var/lib/mysqlext/", "redis_host": "valkey", - "redis_port": 6379 + "redis_port": 6379, + "external_plugins": ["client-config"] } ``` @@ -50,6 +51,8 @@ from `config_sample.json`. Restart the backend after you change Use the same database password in `.env` and `config/config.json`. Set `domain` to the public host name of the backend. Do not include a protocol or path. +Set `prefix` to `/{abbr}` when you use the official frontend. The +`client-config` plugin uses this relation to create frontend API URLs. ## Start the deployment @@ -59,8 +62,9 @@ docker compose up -d docker compose ps ``` -By default, the API is available at `http://localhost:7777/api`. Swagger UI is -available at `http://localhost:7777/api/doc`. +By default, the API is available at `http://localhost:17777/api`. Swagger UI is +available at `http://localhost:17777/api/doc`. +The default bind address is suitable for a reverse proxy on the Docker host. ## Store persistent data diff --git a/compose.yaml b/compose.yaml index 280b38c..e8bbfb7 100644 --- a/compose.yaml +++ b/compose.yaml @@ -60,7 +60,7 @@ services: volumes: - ./config:/app/config ports: - - "${HUB_PORT:-7777}:7777" + - "${BACKEND_BIND:-127.0.0.1:17777}:7777" depends_on: db-init: condition: service_completed_successfully