From b005424aa971888c2b31e9082a3ee7d97a124988 Mon Sep 17 00:00:00 2001 From: Murtadha Date: Sat, 27 Jul 2024 21:20:21 -0400 Subject: [PATCH] Refactor pipeline script --- .woodpecker.yml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 6a52ede..b3ade9c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -79,22 +79,18 @@ steps: from_secret: ssh_key port: 2332 script: - - cd /home/mnisyif/docker-containers/mnisyif/frontend - - VERSION=$(cat version.txt) - - echo "Confirming deployment for version: $VERSION" - - docker ps -a - - if ! docker ps | grep -q frontend-$VERSION; then - echo "Container failed to start" - docker logs frontend-$VERSION - exit 1 - fi - - echo "Container is running, checking Nginx configuration..." - - docker exec frontend-$VERSION nginx -t || { echo "Nginx configuration test failed"; exit 1; } - - echo "Listing contents of /usr/share/nginx/html" - - docker exec frontend-$VERSION ls -la /usr/share/nginx/html - - echo "Listing contents of /usr/share/nginx/html/resumes" - - docker exec frontend-$VERSION ls -la /usr/share/nginx/html/resumes || echo "Resumes directory not found" - - echo "Checking HTTP response..." + - echo "Verifying deployment..." + # Verify the container is running + - docker ps | grep frontend || { echo "Container failed to start"; exit 1; } + # Display container logs + - docker logs frontend + # Test Nginx configuration + - docker exec frontend nginx -t + # Check Nginx process + - docker exec frontend ps aux | grep nginx + # Check contents of /usr/share/nginx/html in the container + - docker exec frontend ls -la /usr/share/nginx/html + # Perform a simple HTTP request to check if the server is responding - curl -I http://localhost:5173 || { echo "HTTP request failed"; exit 1; } - echo "Deployment confirmed successfully"