From ee1148ca9f27ab99da4b44c402d9d2e00ad63776 Mon Sep 17 00:00:00 2001 From: Tobias Klemp Date: Fri, 2 Jan 2026 11:46:58 +0100 Subject: [PATCH] debug --- .gitea/workflows/commentDeploy.yml | 67 ++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/commentDeploy.yml b/.gitea/workflows/commentDeploy.yml index 3d8c8e1..fb0ff7f 100644 --- a/.gitea/workflows/commentDeploy.yml +++ b/.gitea/workflows/commentDeploy.yml @@ -23,11 +23,64 @@ jobs: # REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }} # REGISTRY_USER: ${{ gitea.actor }} - - name: Deploy application - uses: ./.gitea/actions/deploy + # - name: Deploy application + # uses: ./.gitea/actions/deploy + # with: + # project_name: ${{ steps.branch_name.outputs.branch_name }} + # url: '${{ steps.branch_name.outputs.branch_name }}.phoenix.klemp.local' + # # image_url: ${{ steps.docker_build.outputs.image_url }} + # image_url: 'git.klemp.dev/tech-reborn/phoenix:feature-branch-deployments' + # deployment_key: ${{ secrets.SSH_DEPLOYMENT_KEY }} + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.9.1 with: - project_name: ${{ steps.branch_name.outputs.branch_name }} - url: '${{ steps.branch_name.outputs.branch_name }}.phoenix.klemp.local' - # image_url: ${{ steps.docker_build.outputs.image_url }} - image_url: 'git.klemp.dev/tech-reborn/phoenix:feature-branch-deployments' - deployment_key: ${{ secrets.SSH_DEPLOYMENT_KEY }} + ssh-private-key: ${{ secrets.SSH_DEPLOYMENT_KEY }} + + - name: Create environment file + run: | + cat > ${{ inputs.environment_file }} << EOF + IMAGE_URL='git.klemp.dev/tech-reborn/phoenix:feature-branch-deployments' + URL='${{ steps.branch_name.outputs.branch_name }}.phoenix.klemp.local' + REGISTRY=git.klemp.dev + PROJECT_NAME=${{ steps.branch_name.outputs.branch_name }} + COMPOSE_PROJECT_NAME=${{ steps.branch_name.outputs.branch_name }} + EOF + + - name: Remove old Docker context + run: 'docker context rm deploy_target 2>/dev/null || true' + + - name: Create Docker context + run: 'docker context create deploy_target --docker "host=ssh://${{ vars.ssh_user }}@${{ vars.ssh_host }}:${{ vars.ssh_port }}"' + + - name: Validate Docker context + run: 'docker --context deploy_target info' + + - name: Stop existing deployment + run: | + docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} down --remove-orphans || true + + - name: Pull latest images + run: | + docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} pull + + - name: Deploy with Docker Compose + id: deploy + run: | + docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} up -d + + echo "Waiting for services to start..." + sleep 10 + + CONTAINERS=$(docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} ps --services | tr '\n' ',' | sed 's/,$//') + echo "containers=$CONTAINERS" >> $GITHUB_OUTPUT + + echo "✅ Deployment completed successfully!" + echo "🌐 URL: ${{ inputs.url }}" + echo "📦 Containers: $CONTAINERS" + + - name: Show deployment status + run: | + echo "=== Deployment Status ===" + docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} ps + echo "========================="