@@ -17,16 +17,35 @@ This is a minimal scratch-based Docker image containing only the statically-link
1717``` bash
1818docker run -d \
1919 --name crowdsec-spoa-bouncer \
20- -e API_KEY=your-api-key \
20+ -e CROWDSEC_KEY=your-api-key \
21+ -e CROWDSEC_URL=http://crowdsec:8080/ \
2122 -p 9000:9000 \
23+ -p 6060:6060 \
2224 crowdsecurity/spoa-bouncer
2325```
2426
2527## Configuration
2628
2729### Environment Variables
2830
29- The default config supports environment variable substitution for ` API_KEY ` . For other settings, mount a custom config file.
31+ The Docker image uses a configuration file optimized for containers with extensive environment variable support:
32+
33+ | Variable | Default | Description |
34+ | ----------| ---------| -------------|
35+ | ` CROWDSEC_KEY ` | * (required)* | API key for CrowdSec LAPI |
36+ | ` CROWDSEC_URL ` | ` http://crowdsec:8080/ ` | CrowdSec LAPI URL |
37+ | ` LOG_MODE ` | ` stdout ` | Log output: ` stdout ` or ` file ` |
38+ | ` LOG_LEVEL ` | ` info ` | Log level: ` trace ` , ` debug ` , ` info ` , ` warn ` , ` error ` |
39+ | ` UPDATE_FREQUENCY ` | ` 10s ` | How often to poll LAPI for decisions |
40+ | ` INSECURE_SKIP_VERIFY ` | ` false ` | Skip TLS verification for LAPI |
41+ | ` LISTEN_TCP ` | ` 0.0.0.0:9000 ` | TCP listener address |
42+ | ` LISTEN_UNIX ` | * (disabled)* | Unix socket path (uncomment in config) |
43+ | ` PROMETHEUS_ENABLED ` | ` true ` | Enable Prometheus metrics |
44+ | ` PROMETHEUS_ADDR ` | ` 0.0.0.0 ` | Prometheus listen address |
45+ | ` PROMETHEUS_PORT ` | ` 6060 ` | Prometheus listen port |
46+ | ` APPSEC_URL ` | * (disabled)* | AppSec endpoint URL |
47+ | ` APPSEC_TIMEOUT ` | ` 200ms ` | AppSec request timeout |
48+ | ` GOMEMLIMIT ` | * (unset)* | Go memory limit (e.g., ` 200MiB ` ) |
3049
3150### Custom Configuration
3251
@@ -68,32 +87,33 @@ services:
6887 image : crowdsecurity/spoa-bouncer
6988 restart : unless-stopped
7089 environment :
71- - API_KEY=${CROWDSEC_API_KEY}
72- volumes :
73- - ./config/crowdsec-spoa-bouncer.yaml:/etc/crowdsec/bouncers/crowdsec-spoa-bouncer.yaml:ro
74- - spoa-socket:/run/crowdsec-spoa
75- # Optional: resource limits
90+ - CROWDSEC_KEY=${CROWDSEC_API_KEY}
91+ - CROWDSEC_URL=http://crowdsec:8080/
92+ - LOG_LEVEL=info
93+ - GOMEMLIMIT=200MiB
94+ ports :
95+ - " 6060:6060" # Prometheus metrics
96+ networks :
97+ - crowdsec
7698 deploy :
7799 resources :
78100 limits :
79101 memory : 256M
80- # Optional: set GOMEMLIMIT for better memory management
81- # environment:
82- # - GOMEMLIMIT=200MiB
83102
84103 haproxy :
85104 image : haproxy:latest
86105 volumes :
87106 - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
88- - spoa-socket:/run/crowdsec-spoa
89107 ports :
90108 - " 80:80"
91109 - " 443:443"
110+ networks :
111+ - crowdsec
92112 depends_on :
93113 - crowdsec-spoa-bouncer
94114
95- volumes :
96- spoa-socket :
115+ networks :
116+ crowdsec :
97117` ` `
98118
99119## Running as Non-Root
@@ -112,36 +132,37 @@ Note: Ensure mounted volumes have appropriate permissions for the specified user
112132
113133## Health Checks
114134
115- The bouncer exposes Prometheus metrics when enabled in config :
135+ Prometheus metrics are enabled by default on port 6060. Since this is a scratch image with no shell, use external health checks :
116136
117137``` yaml
118- prometheus :
119- enabled : true
120- listen_addr : 0.0.0.0
121- listen_port : 60601
138+ # Docker Compose with healthcheck via curl sidecar
139+ services :
140+ crowdsec-spoa-bouncer :
141+ image : crowdsecurity/spoa-bouncer
142+ environment :
143+ - CROWDSEC_KEY=${API_KEY}
144+ # Use depends_on with service_healthy for dependent services
145+
146+ healthcheck :
147+ image : curlimages/curl:latest
148+ command : ["sh", "-c", "while true; do curl -sf http://crowdsec-spoa-bouncer:6060/metrics > /dev/null && echo healthy || echo unhealthy; sleep 30; done"]
149+ depends_on :
150+ - crowdsec-spoa-bouncer
122151` ` `
123152
124- Then use for health checks :
153+ Or check from the host :
125154
126155` ` ` bash
127- docker run -d \
128- --name crowdsec-spoa-bouncer \
129- --health-cmd="wget -q --spider http://localhost:60601/metrics || exit 1" \
130- --health-interval=30s \
131- -p 9000:9000 \
132- -p 60601:60601 \
133- crowdsecurity/spoa-bouncer
156+ curl -sf http://localhost:6060/metrics > /dev/null && echo "healthy" || echo "unhealthy"
134157```
135158
136- Note: Since this is a scratch image, ` wget ` is not available. Use an external health check or a sidecar container for HTTP health probes.
137-
138159## Ports
139160
140- | Port | Description |
141- | ------| -------------|
142- | 9000 | SPOA TCP listener (default) |
143- | 60601 | Prometheus metrics (when enabled) |
144- | 6060 | pprof debug endpoint (when enabled ) |
161+ | Port | Default | Description |
162+ | ------| ---------| --------- ----|
163+ | 9000 | Yes | SPOA TCP listener |
164+ | 6060 | Yes | Prometheus metrics (enabled by default ) |
165+ | 6070 | No | pprof debug endpoint (disabled by default ) |
145166
146167## Troubleshooting
147168
@@ -153,7 +174,11 @@ docker logs -f crowdsec-spoa-bouncer
153174
154175### Debug Mode
155176
156- Set ` log_level: debug ` in your config file for verbose logging.
177+ Set the ` LOG_LEVEL ` environment variable:
178+
179+ ``` bash
180+ docker run -e LOG_LEVEL=debug -e CROWDSEC_KEY=... crowdsecurity/spoa-bouncer
181+ ```
157182
158183### Connection Issues
159184
0 commit comments