bajar memoria de tailscaled
This commit is contained in:
@@ -17,6 +17,14 @@ The solution uses a multi-stage Docker build:
|
|||||||
- **Stage 2 (tailscale)**: Downloads and extracts Tailscale binaries
|
- **Stage 2 (tailscale)**: Downloads and extracts Tailscale binaries
|
||||||
- **Stage 3 (production)**: Final Alpine image with nginx, Tailscale, and GoAccess
|
- **Stage 3 (production)**: Final Alpine image with nginx, Tailscale, and GoAccess
|
||||||
|
|
||||||
|
### Memory Optimization
|
||||||
|
|
||||||
|
Configured for 256MB Fly.io containers:
|
||||||
|
- **Go GC settings**: `GOGC=10` and `GOMEMLIMIT=100MiB` for aggressive Tailscale memory management
|
||||||
|
- **GoAccess**: Static HTML generation (60-second intervals) instead of real-time WebSocket
|
||||||
|
- **Nginx**: Reduced connection timeouts and buffer sizes
|
||||||
|
- **Package optimization**: Minimal Alpine packages only
|
||||||
|
|
||||||
### Key Components
|
### Key Components
|
||||||
|
|
||||||
- **nginx.conf**: Main configuration with rate limiting zones, server blocks for each subdomain, and GoAccess metrics endpoint
|
- **nginx.conf**: Main configuration with rate limiting zones, server blocks for each subdomain, and GoAccess metrics endpoint
|
||||||
|
@@ -21,6 +21,10 @@ COPY --from=builder /app/start.sh /app/start.sh
|
|||||||
COPY --from=tailscale /app/tailscaled /app/tailscaled
|
COPY --from=tailscale /app/tailscaled /app/tailscaled
|
||||||
COPY --from=tailscale /app/tailscale /app/tailscale
|
COPY --from=tailscale /app/tailscale /app/tailscale
|
||||||
RUN mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale /usr/share/nginx/html
|
RUN mkdir -p /var/run/tailscale /var/cache/tailscale /var/lib/tailscale /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Set aggressive Go GC settings for Tailscale to reduce memory usage
|
||||||
|
ENV GOGC=10
|
||||||
|
ENV GOMEMLIMIT=100MiB
|
||||||
COPY nginx.conf /etc/nginx/http.d/nginx.conf
|
COPY nginx.conf /etc/nginx/http.d/nginx.conf
|
||||||
COPY custom_50x.html /usr/share/nginx/html/
|
COPY custom_50x.html /usr/share/nginx/html/
|
||||||
COPY goaccess.sh /app/goaccess.sh
|
COPY goaccess.sh /app/goaccess.sh
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set aggressive GC settings for Tailscale to reduce memory usage
|
||||||
|
export GOGC=10
|
||||||
|
export GOMEMLIMIT=100MiB
|
||||||
|
|
||||||
/app/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/var/run/tailscale/tailscaled.sock &
|
/app/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/var/run/tailscale/tailscaled.sock &
|
||||||
/app/tailscale up --authkey=${TAILSCALE_AUTHKEY} --hostname=reverseproxy
|
/app/tailscale up --authkey=${TAILSCALE_AUTHKEY} --hostname=reverseproxy
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user