debugging

This commit is contained in:
2025-08-13 21:42:01 +10:00
parent 9abaa12dce
commit b7d1ecb8d6

View File

@@ -19,12 +19,12 @@ steps:
- cd /app # Navigate to the mounted project directory. - cd /app # Navigate to the mounted project directory.
# Configure Git to trust the mounted directory to avoid 'unsafe repository' warnings. # Configure Git to trust the mounted directory to avoid 'unsafe repository' warnings.
- git config --global --add safe.directory /app - git config --global --add safe.directory /app
- git pull # Pull the latest changes from the 'main' branch. - git pull origin main # Pull the latest changes from the 'main' branch.
- echo "Source code updated." - echo "Source code updated."
- ls -la /app # Verify files were updated.
- name: manage-bot-containers # Step 2: Manage your bot's Docker containers. - name: manage-bot-containers # Step 2: Manage your bot's Docker containers.
image: docker # This image provides the 'docker compose' CLI. # Changed image to 'docker:latest' to use the unhyphenated 'docker compose'
image: docker:latest
volumes: volumes:
# Mount the Docker socket from the host to allow control over host Docker daemon. # Mount the Docker socket from the host to allow control over host Docker daemon.
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
@@ -34,22 +34,21 @@ steps:
# IMPORTANT: Explicitly set the Docker Compose project name. # IMPORTANT: Explicitly set the Docker Compose project name.
# This ensures containers are managed with the 'Acrybot' prefix, # This ensures containers are managed with the 'Acrybot' prefix,
# matching your existing containers. # matching your existing containers.
# If your actual project name (from 'docker inspect <container_id>') COMPOSE_PROJECT_NAME: Acrybot
# is different, replace 'Acrybot' here.
COMPOSE_PROJECT_NAME: acrybot
commands: commands:
- echo "--- Managing Docker Compose services ---" - echo "--- Stopping Discord bot service python-app ---"
# Stop the specific Discord bot service. # Stop the specific Discord bot service using the unhyphenated 'docker compose'.
# Replace 'your_bot_service_name' with the EXACT service name from your docker-compose.yml.
- echo "--- Stopping Discord bot service your_bot_service_name ---"
- docker compose stop python-app - docker compose stop python-app
- ls -la
# Bring the specific Discord bot service back up. - echo "--- Bringing Discord bot service up python-app ---"
# Bring the specific Discord bot service back up using the unhyphenated 'docker compose'.
# '--build' is essential if your docker-compose.yml uses 'build: .' to create the image, # '--build' is essential if your docker-compose.yml uses 'build: .' to create the image,
# as it ensures the image is rebuilt with the newly pulled source code. # as it ensures the image is rebuilt with the newly pulled source code.
- docker compose up -d --build - docker compose up -d python-app --build
- echo "--- Verification after actions ---" - echo "--- Verifying bot status ---"
- docker compose ps -a # Show all services in this project again. # Get the container ID of the bot service to inspect its status and logs
# Directly grep for the expected container name to confirm. - BOT_CONTAINER_ID=$(docker compose ps -q python-app)
- docker ps -a | grep acrybot-python-app - docker inspect --format='{{.State.Status}} (Exit Code: {{.State.ExitCode}})' "${BOT_CONTAINER_ID}"
- echo "--- Logs of Discord bot container (if it exited) ---"
- docker logs "${BOT_CONTAINER_ID}" # Fetch the logs of the bot container