update build-deploy
All checks were successful
Build and Deploy API Server / build (push) Successful in 52s
Build and Deploy API Server / deploy (push) Successful in 4s

This commit is contained in:
Farid Siddiqi 2025-12-25 09:49:14 -08:00
parent 351011f9e2
commit 7ab87de90d
3 changed files with 32 additions and 13 deletions

View File

@ -122,16 +122,9 @@ jobs:
AUTO_MIGRATE: "false" AUTO_MIGRATE: "false"
PORT: "8080" PORT: "8080"
- name: Health check
run: |
${{ env.ARTIFACT_DIR }}/scripts/health-check.sh
- name: Notify deployment status - name: Notify deployment status
if: always() if: always()
run: | run: |
if [ $? -eq 0 ]; then echo "Deployment staged successfully: ${{ steps.commit.outputs.sha }}"
echo "Deployment successful: ${{ steps.commit.outputs.sha }}" echo "To promote to production, SSH to server and run:"
else echo " sudo /opt/api-artifacts/scripts/promote.sh"
echo "Deployment failed, rollback initiated"
${{ env.ARTIFACT_DIR }}/scripts/rollback.sh
fi

View File

@ -303,6 +303,21 @@
creates: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml" creates: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml"
loop: "{{ range(1, runner_count + 1) | list }}" 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 - name: Set runner config ownership
ansible.builtin.file: ansible.builtin.file:
path: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml" path: "{{ runner_base_dir }}/runner-{{ item }}/config.yaml"
@ -363,6 +378,12 @@
state: started state: started
loop: "{{ range(1, runner_count + 1) | list }}" 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) - name: Configure nginx reverse proxy (HTTP only for now)
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/nginx/sites-available/gitea dest: /etc/nginx/sites-available/gitea

View File

@ -12,10 +12,15 @@ NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; } log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; } log_error() { echo -e "${RED}[ERROR]${NC} $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 if ! systemctl is-active --quiet api-server.service; then
log_error "Service is not running" log_error "Service is not running"
exit 1 exit 1
fi fi
fi
for i in $(seq 1 $MAX_RETRIES); do for i in $(seq 1 $MAX_RETRIES); do
log_info "Health check attempt $i/$MAX_RETRIES..." log_info "Health check attempt $i/$MAX_RETRIES..."