diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml index 6b1f415..bdabc19 100644 --- a/.gitea/workflows/build-deploy.yml +++ b/.gitea/workflows/build-deploy.yml @@ -122,16 +122,9 @@ jobs: AUTO_MIGRATE: "false" PORT: "8080" - - name: Health check - run: | - ${{ env.ARTIFACT_DIR }}/scripts/health-check.sh - - name: Notify deployment status if: always() run: | - if [ $? -eq 0 ]; then - echo "Deployment successful: ${{ steps.commit.outputs.sha }}" - else - echo "Deployment failed, rollback initiated" - ${{ env.ARTIFACT_DIR }}/scripts/rollback.sh - fi + echo "Deployment staged successfully: ${{ steps.commit.outputs.sha }}" + echo "To promote to production, SSH to server and run:" + echo " sudo /opt/api-artifacts/scripts/promote.sh" diff --git a/deployment/ansible/site.yml b/deployment/ansible/site.yml index 500b042..6c33daf 100644 --- a/deployment/ansible/site.yml +++ b/deployment/ansible/site.yml @@ -303,6 +303,21 @@ creates: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml" loop: "{{ range(1, runner_count + 1) | list }}" + - name: Configure runner container volumes + ansible.builtin.lineinfile: + path: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml" + insertafter: "^container:" + line: " options: -v /opt/api-artifacts:/opt/api-artifacts -v /etc/systemd/system:/etc/systemd/system:ro" + regexp: "^ options:" + loop: "{{ range(1, runner_count + 1) | list }}" + + - name: Allow all volume mounts in runner config + ansible.builtin.replace: + path: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml" + regexp: "^ valid_volumes: \\[\\]$" + replace: " valid_volumes:\n - '**'" + loop: "{{ range(1, runner_count + 1) | list }}" + - name: Set runner config ownership ansible.builtin.file: path: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml" @@ -363,6 +378,12 @@ state: started loop: "{{ range(1, runner_count + 1) | list }}" + - name: Restart runners to apply volume mount changes + ansible.builtin.systemd: + name: "gitea-runner-{{ item }}" + state: restarted + loop: "{{ range(1, runner_count + 1) | list }}" + - name: Configure nginx reverse proxy (HTTP only for now) ansible.builtin.copy: dest: /etc/nginx/sites-available/gitea diff --git a/deployment/scripts/health-check.sh b/deployment/scripts/health-check.sh index fb6eb6a..f435b24 100755 --- a/deployment/scripts/health-check.sh +++ b/deployment/scripts/health-check.sh @@ -12,9 +12,14 @@ NC='\033[0m' log_info() { echo -e "${GREEN}[INFO]${NC} $1"; } log_error() { echo -e "${RED}[ERROR]${NC} $1"; } -if ! systemctl is-active --quiet api-server.service; then - log_error "Service is not running" - exit 1 +# Check if running in container (skip systemctl check) +if [ ! -f /run/systemd/system ]; then + log_info "Running in container, skipping systemd check" +else + if ! systemctl is-active --quiet api-server.service; then + log_error "Service is not running" + exit 1 + fi fi for i in $(seq 1 $MAX_RETRIES); do