http_request action working nicely
This commit is contained in:
@@ -109,9 +109,9 @@ WORKDIR /opt/attune
|
||||
# Note: We copy from /build/attune-service-binary because the cache mount is not available in COPY
|
||||
COPY --from=builder /build/attune-service-binary /usr/local/bin/attune-service
|
||||
|
||||
# Copy configuration files
|
||||
COPY config.production.yaml ./config.yaml
|
||||
COPY config.docker.yaml ./config.docker.yaml
|
||||
# Copy configuration for Docker Compose development
|
||||
# Production: mount config files as a volume instead of baking them into the image
|
||||
COPY config.docker.yaml ./config.yaml
|
||||
|
||||
# Copy migrations for services that need them
|
||||
COPY migrations/ ./migrations/
|
||||
@@ -132,7 +132,7 @@ USER attune
|
||||
|
||||
# Environment variables (can be overridden at runtime)
|
||||
ENV RUST_LOG=info
|
||||
ENV ATTUNE_CONFIG=/opt/attune/config.docker.yaml
|
||||
ENV ATTUNE_CONFIG=/opt/attune/config.yaml
|
||||
|
||||
# Health check (will be overridden per service in docker-compose)
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
|
||||
@@ -123,6 +123,17 @@ COPY migrations/ ./migrations/
|
||||
# Copy the common crate (almost all services depend on this)
|
||||
COPY crates/common/ ./crates/common/
|
||||
|
||||
# Build the specified service
|
||||
# The cargo registry and git cache are pre-populated from the planner stage
|
||||
# Only the actual compilation happens here
|
||||
# - registry/git use sharing=shared (concurrent builds of different services are safe)
|
||||
# - target uses service-specific cache ID (each service compiles different crates)
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=shared \
|
||||
--mount=type=cache,target=/usr/local/cargo/git,sharing=shared \
|
||||
--mount=type=cache,target=/build/target,sharing=locked \
|
||||
cargo build --release --lib -p attune-common
|
||||
|
||||
|
||||
# Build argument to specify which service to build
|
||||
ARG SERVICE=api
|
||||
|
||||
@@ -137,7 +148,7 @@ COPY crates/${SERVICE}/ ./crates/${SERVICE}/
|
||||
# - target uses service-specific cache ID (each service compiles different crates)
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=shared \
|
||||
--mount=type=cache,target=/usr/local/cargo/git,sharing=shared \
|
||||
--mount=type=cache,target=/build/target,id=target-builder-${SERVICE} \
|
||||
--mount=type=cache,target=/build/target,sharing=shared \
|
||||
cargo build --release --bin attune-${SERVICE} && \
|
||||
cp /build/target/release/attune-${SERVICE} /build/attune-service-binary
|
||||
|
||||
@@ -164,9 +175,9 @@ WORKDIR /opt/attune
|
||||
# Copy the service binary from builder
|
||||
COPY --from=builder /build/attune-service-binary /usr/local/bin/attune-service
|
||||
|
||||
# Copy configuration files
|
||||
COPY config.production.yaml ./config.yaml
|
||||
COPY config.docker.yaml ./config.docker.yaml
|
||||
# Copy configuration file for Docker Compose development
|
||||
# In production, mount config files as a volume instead of baking them into the image
|
||||
COPY config.docker.yaml ./config.yaml
|
||||
|
||||
# Copy migrations for services that need them
|
||||
COPY migrations/ ./migrations/
|
||||
@@ -184,7 +195,7 @@ USER attune
|
||||
|
||||
# Environment variables (can be overridden at runtime)
|
||||
ENV RUST_LOG=info
|
||||
ENV ATTUNE_CONFIG=/opt/attune/config.docker.yaml
|
||||
ENV ATTUNE_CONFIG=/opt/attune/config.yaml
|
||||
|
||||
# Health check (will be overridden per service in docker-compose)
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
|
||||
@@ -26,9 +26,18 @@ server {
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
|
||||
# Use Docker's embedded DNS resolver so that proxy_pass with variables
|
||||
# resolves hostnames at request time, not config load time.
|
||||
# This prevents nginx from crashing if backends aren't ready yet.
|
||||
resolver 127.0.0.11 valid=10s;
|
||||
set $api_upstream http://api:8080;
|
||||
set $notifier_upstream http://notifier:8081;
|
||||
|
||||
# Auth proxy - forward auth requests to backend
|
||||
# With variable proxy_pass (no URI path), the full original request URI
|
||||
# (e.g. /auth/login) is passed through to the backend as-is.
|
||||
location /auth/ {
|
||||
proxy_pass http://api:8080/auth/;
|
||||
proxy_pass $api_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
@@ -45,8 +54,10 @@ server {
|
||||
}
|
||||
|
||||
# API proxy - forward API requests to backend (preserves /api prefix)
|
||||
# With variable proxy_pass (no URI path), the full original request URI
|
||||
# (e.g. /api/packs?page=1) is passed through to the backend as-is.
|
||||
location /api/ {
|
||||
proxy_pass http://api:8080/api/;
|
||||
proxy_pass $api_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
@@ -63,8 +74,11 @@ server {
|
||||
}
|
||||
|
||||
# WebSocket proxy for notifier service
|
||||
# Strip the /ws/ prefix before proxying (notifier expects paths at root).
|
||||
# e.g. /ws/events → /events
|
||||
location /ws/ {
|
||||
proxy_pass http://notifier:8081/;
|
||||
rewrite ^/ws/(.*) /$1 break;
|
||||
proxy_pass $notifier_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
|
||||
Reference in New Issue
Block a user