mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-17 17:55:48 +00:00
Update test_docker.yml
This commit is contained in:
parent
961d42a11f
commit
0d92cd36c6
85
.github/workflows/test_docker.yml
vendored
85
.github/workflows/test_docker.yml
vendored
@ -155,91 +155,6 @@ jobs:
|
||||
# echo "Checking HAProxy container logs..."
|
||||
# sudo docker logs haproxy-waf
|
||||
|
||||
- name: Validate Traefik configuration
|
||||
run: |
|
||||
echo "Validating Traefik configuration..."
|
||||
for file in waf_patterns/traefik/*.toml; do
|
||||
echo "Validating $file..."
|
||||
sudo docker run --rm -v $(pwd)/waf_patterns/traefik:/etc/traefik:ro traefik traefik validate --configFile=/etc/traefik/$(basename "$file")
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Validation failed for $file"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Start Traefik container with WAF rules
|
||||
run: |
|
||||
echo "Starting Traefik container..."
|
||||
sudo docker run -d \
|
||||
--name traefik-waf \
|
||||
-p ${{ env.TRAEFIK_PORT }}:80 \
|
||||
-v $(pwd)/waf_patterns/traefik:/etc/traefik \
|
||||
traefik:latest
|
||||
echo "Traefik is running on port ${{ env.TRAEFIK_PORT }}."
|
||||
|
||||
- name: Check Traefik container logs
|
||||
run: |
|
||||
echo "Checking Traefik container logs..."
|
||||
sudo docker logs traefik-waf
|
||||
|
||||
- name: Validate services are running
|
||||
run: |
|
||||
echo "Validating services are running..."
|
||||
# Check if Nginx is running
|
||||
if ! curl -s http://localhost:${{ env.NGINX_PORT }} > /dev/null; then
|
||||
echo "Error: Nginx is not running!"
|
||||
sudo docker logs nginx-waf
|
||||
exit 1
|
||||
fi
|
||||
echo "Nginx is running successfully."
|
||||
|
||||
# Check if Apache is running
|
||||
if ! curl -s http://localhost:${{ env.APACHE_PORT }} > /dev/null; then
|
||||
echo "Error: Apache is not running!"
|
||||
sudo docker logs apache-waf
|
||||
exit 1
|
||||
fi
|
||||
echo "Apache is running successfully."
|
||||
|
||||
# Check if HAProxy is running
|
||||
if ! curl -s http://localhost:${{ env.HAPROXY_PORT }} > /dev/null; then
|
||||
echo "Error: HAProxy is not running!"
|
||||
sudo docker logs haproxy-waf
|
||||
exit 1
|
||||
fi
|
||||
echo "HAProxy is running successfully."
|
||||
|
||||
# Check if Traefik is running
|
||||
if ! curl -s http://localhost:${{ env.TRAEFIK_PORT }} > /dev/null; then
|
||||
echo "Error: Traefik is not running!"
|
||||
sudo docker logs traefik-waf
|
||||
exit 1
|
||||
fi
|
||||
echo "Traefik is running successfully."
|
||||
|
||||
- name: Test WAF rules
|
||||
run: |
|
||||
echo "Testing WAF rules..."
|
||||
# Test Nginx WAF rules
|
||||
echo "Testing Nginx rules..."
|
||||
curl -s http://localhost:${{ env.NGINX_PORT }}/attack
|
||||
curl -s http://localhost:${{ env.NGINX_PORT }}/bots
|
||||
|
||||
# Test Apache WAF rules
|
||||
echo "Testing Apache rules..."
|
||||
curl -s http://localhost:${{ env.APACHE_PORT }}/attack
|
||||
curl -s http://localhost:${{ env.APACHE_PORT }}/bots
|
||||
|
||||
# Test HAProxy WAF rules
|
||||
echo "Testing HAProxy rules..."
|
||||
curl -s http://localhost:${{ env.HAPROXY_PORT }}/attack
|
||||
curl -s http://localhost:${{ env.HAPROXY_PORT }}/bots
|
||||
|
||||
# Test Traefik WAF rules
|
||||
echo "Testing Traefik rules..."
|
||||
curl -s http://localhost:${{ env.TRAEFIK_PORT }}/attack
|
||||
curl -s http://localhost:${{ env.TRAEFIK_PORT }}/bots
|
||||
|
||||
- name: Clean up containers
|
||||
if: always()
|
||||
run: |
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user