fix: updates to CI/CD Paths
All checks were successful
Deploy to Staging / Build Images (push) Successful in 21s
Deploy to Staging / Deploy to Staging (push) Successful in 28s
Deploy to Staging / Verify Staging (push) Successful in 7s
Deploy to Staging / Notify Staging Ready (push) Successful in 6s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

This commit is contained in:
Eric Gullickson
2025-12-30 09:15:41 -06:00
parent c2514984bb
commit 20696ccbf0
6 changed files with 40 additions and 25 deletions

View File

@@ -145,7 +145,7 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Check container status - name: Check container status and health
run: | run: |
for service in mvp-frontend-staging mvp-backend-staging mvp-postgres-staging mvp-redis-staging; do for service in mvp-frontend-staging mvp-backend-staging mvp-postgres-staging mvp-redis-staging; do
status=$(docker inspect --format='{{.State.Status}}' $service 2>/dev/null || echo "not found") status=$(docker inspect --format='{{.State.Status}}' $service 2>/dev/null || echo "not found")
@@ -157,6 +157,36 @@ jobs:
echo "OK: $service is running" echo "OK: $service is running"
done done
# Wait for Docker healthchecks to complete (services with healthcheck defined)
echo ""
echo "Waiting for Docker healthchecks..."
for service in mvp-frontend-staging mvp-backend-staging mvp-postgres-staging mvp-redis-staging; do
# Check if service has a healthcheck defined
has_healthcheck=$(docker inspect --format='{{if .Config.Healthcheck}}true{{else}}false{{end}}' $service 2>/dev/null || echo "false")
if [ "$has_healthcheck" = "true" ]; then
for i in 1 2 3 4 5 6 7 8 9 10; do
health=$(docker inspect --format='{{.State.Health.Status}}' $service 2>/dev/null || echo "unknown")
if [ "$health" = "healthy" ]; then
echo "OK: $service is healthy"
break
elif [ "$health" = "unhealthy" ]; then
echo "ERROR: $service is unhealthy"
docker logs $service --tail 50 2>/dev/null || true
exit 1
fi
if [ $i -eq 10 ]; then
echo "ERROR: $service health check timed out (status: $health)"
docker logs $service --tail 50 2>/dev/null || true
exit 1
fi
echo "Waiting for $service healthcheck... (attempt $i/10, status: $health)"
sleep 5
done
else
echo "SKIP: $service has no healthcheck defined"
fi
done
- name: Wait for backend health - name: Wait for backend health
run: | run: |
for i in 1 2 3 4 5 6; do for i in 1 2 3 4 5 6; do

View File

@@ -62,7 +62,7 @@ services:
container_name: mvp-postgres-staging container_name: mvp-postgres-staging
volumes: volumes:
- mvp_postgres_staging_data:/var/lib/postgresql/data - mvp_postgres_staging_data:/var/lib/postgresql/data
- ./secrets/staging/postgres-password.txt:/run/secrets/postgres-password:ro - ./secrets/app/postgres-password.txt:/run/secrets/postgres-password:ro
# ======================================== # ========================================
# Redis (Staging) # Redis (Staging)

View File

@@ -69,7 +69,7 @@ services:
depends_on: depends_on:
- mvp-backend - mvp-backend
healthcheck: healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:3000 || exit 1"] test: ["CMD-SHELL", "curl -sf http://localhost:3000 || exit 1"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3

View File

@@ -155,12 +155,13 @@ sudo chown act_runner:act_runner /opt/motovaultpro
sudo -u act_runner git clone https://git.motovaultpro.com/egullickson/motovaultpro.git /opt/motovaultpro sudo -u act_runner git clone https://git.motovaultpro.com/egullickson/motovaultpro.git /opt/motovaultpro
``` ```
### 2. Create Staging Secrets Directory ### 2. Set Secrets Directory Permissions
The `secrets/app` directory exists in the repository. Set proper permissions:
```bash ```bash
sudo mkdir -p /opt/motovaultpro/secrets/staging
sudo chown -R act_runner:act_runner /opt/motovaultpro/secrets sudo chown -R act_runner:act_runner /opt/motovaultpro/secrets
sudo chmod 700 /opt/motovaultpro/secrets/staging sudo chmod 700 /opt/motovaultpro/secrets/app
``` ```
### 3. Configure DNS ### 3. Configure DNS
@@ -325,7 +326,7 @@ curl -vI https://staging.motovaultpro.com
| Path | Description | | Path | Description |
|------|-------------| |------|-------------|
| `/opt/motovaultpro` | Application root | | `/opt/motovaultpro` | Application root |
| `/opt/motovaultpro/secrets/staging` | Staging secrets | | `/opt/motovaultpro/secrets/app` | Application secrets |
| `/etc/act_runner/config.yaml` | Runner configuration | | `/etc/act_runner/config.yaml` | Runner configuration |
| `/home/act_runner/.docker/config.json` | Registry credentials | | `/home/act_runner/.docker/config.json` | Registry credentials |

View File

@@ -228,14 +228,6 @@
args: args:
creates: "{{ app_root }}/.git" creates: "{{ app_root }}/.git"
- name: Create production secrets directory
file:
path: "{{ app_root }}/secrets/production"
state: directory
owner: act_runner
group: act_runner
mode: '0700'
- name: Create data directories - name: Create data directories
file: file:
path: "{{ app_root }}/{{ item }}" path: "{{ app_root }}/{{ item }}"
@@ -343,6 +335,6 @@
sudo journalctl -u act_runner -f sudo journalctl -u act_runner -f
docker ps docker ps
IMPORTANT: Ensure production secrets are configured in: IMPORTANT: Ensure secrets are configured in:
{{ app_root }}/secrets/production/ {{ app_root }}/secrets/app/
================================================ ================================================

View File

@@ -258,14 +258,6 @@
args: args:
creates: "{{ app_root }}/.git" creates: "{{ app_root }}/.git"
- name: Create staging secrets directory
file:
path: "{{ app_root }}/secrets/staging"
state: directory
owner: act_runner
group: act_runner
mode: '0700'
- name: Create data directories - name: Create data directories
file: file:
path: "{{ app_root }}/{{ item }}" path: "{{ app_root }}/{{ item }}"