1- name : Deploy
1+ name : deploy
22
33on :
44 workflow_run :
@@ -18,16 +18,17 @@ jobs:
1818 - name : Copy .env.example to .env
1919 run : cp .env.example .env
2020
21- - name : Install Docker Compose CLI
22- run : |
23- # Install Docker Compose using the official method
24- sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
25- sudo chmod +x /usr/local/bin/docker-compose
26- docker-compose --version
27-
2821 - name : Set up Docker Buildx
2922 uses : docker/setup-buildx-action@v3
3023
24+ # Add Docker login step - CRITICAL FIX
25+ - name : Login to GitHub Container Registry
26+ uses : docker/login-action@v3
27+ with :
28+ registry : ghcr.io
29+ username : ${{ github.actor }}
30+ password : ${{ secrets.GITHUB_TOKEN }}
31+
3132 # Cache Docker layers
3233 - name : Cache Docker layers
3334 uses : actions/cache@v4
@@ -43,11 +44,17 @@ jobs:
4344 context : .
4445 push : true
4546 tags : |
46- ${{ secrets.DOCKER_REGISTRY && format('{0}/llm-output-processor :staging-{1}', secrets.DOCKER_REGISTRY, github.sha) || format('llm-output-processor :staging-{0}', github.sha) }}
47- ${{ secrets.DOCKER_REGISTRY && format('{0}/llm-output-processor :staging-latest', secrets.DOCKER_REGISTRY) || 'llm-output-processor :staging-latest' }}
47+ ${{ secrets.DOCKER_REGISTRY && format('{0}/second-brain :staging-{1}', secrets.DOCKER_REGISTRY, github.sha) || format('second-brain :staging-{0}', github.sha) }}
48+ ${{ secrets.DOCKER_REGISTRY && format('{0}/second-brain :staging-latest', secrets.DOCKER_REGISTRY) || 'second-brain :staging-latest' }}
4849 cache-from : type=local,src=/tmp/.buildx-cache
4950 cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
5051
52+ # Move cache - PERFORMANCE FIX
53+ - name : Move cache
54+ run : |
55+ rm -rf /tmp/.buildx-cache
56+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
57+
5158 - name : Deploy to staging
5259 env :
5360 DOCKER_REGISTRY : ${{ secrets.DOCKER_REGISTRY }}
@@ -59,16 +66,24 @@ jobs:
5966 docker compose -f docker-compose.staging.yml pull
6067 docker compose -f docker-compose.staging.yml up -d
6168
69+ - name : Wait for services to start
70+ run : |
71+ echo "Waiting for services to start..."
72+ sleep 30
73+
6274 - name : Health check staging
6375 run : |
6476 echo "Performing health check on staging..."
65- timeout 60 bash -c 'until curl -f http://localhost:8001/health; do sleep 2 ; done'
77+ timeout 120 bash -c 'until curl -f http://localhost:8001/health; do echo "Waiting for health check..."; sleep 5 ; done'
6678 echo "Staging deployment successful!"
6779
6880 - name : Print logs on failure
6981 if : failure()
7082 run : |
71- docker compose logs
83+ echo "=== Docker Compose Logs ==="
84+ docker compose -f docker-compose.staging.yml logs
85+ echo "=== Container Status ==="
86+ docker compose -f docker-compose.staging.yml ps
7287
7388 deploy-production :
7489 if : github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/main'
@@ -82,16 +97,17 @@ jobs:
8297 - name : Copy .env.example to .env
8398 run : cp .env.example .env
8499
85- - name : Install Docker Compose CLI
86- run : |
87- # Install Docker Compose using the official method
88- sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
89- sudo chmod +x /usr/local/bin/docker-compose
90- docker-compose --version
91-
92100 - name : Set up Docker Buildx
93101 uses : docker/setup-buildx-action@v3
94102
103+ # Add Docker login step - CRITICAL FIX
104+ - name : Login to GitHub Container Registry
105+ uses : docker/login-action@v3
106+ with :
107+ registry : ghcr.io
108+ username : ${{ github.actor }}
109+ password : ${{ secrets.GITHUB_TOKEN }}
110+
95111 # Cache Docker layers
96112 - name : Cache Docker layers
97113 uses : actions/cache@v4
@@ -107,11 +123,17 @@ jobs:
107123 context : .
108124 push : true
109125 tags : |
110- ${{ secrets.DOCKER_REGISTRY && format('{0}/llm-output-processor :production-{1}', secrets.DOCKER_REGISTRY, github.sha) || format('llm-output-processor :production-{0}', github.sha) }}
111- ${{ secrets.DOCKER_REGISTRY && format('{0}/llm-output-processor :production-latest', secrets.DOCKER_REGISTRY) || 'llm-output-processor :production-latest' }}
126+ ${{ secrets.DOCKER_REGISTRY && format('{0}/second-brain :production-{1}', secrets.DOCKER_REGISTRY, github.sha) || format('second-brain :production-{0}', github.sha) }}
127+ ${{ secrets.DOCKER_REGISTRY && format('{0}/second-brain :production-latest', secrets.DOCKER_REGISTRY) || 'second-brain :production-latest' }}
112128 cache-from : type=local,src=/tmp/.buildx-cache
113129 cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
114130
131+ # Move cache - PERFORMANCE FIX
132+ - name : Move cache
133+ run : |
134+ rm -rf /tmp/.buildx-cache
135+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
136+
115137 - name : Deploy to production
116138 env :
117139 DOCKER_REGISTRY : ${{ secrets.DOCKER_REGISTRY }}
@@ -123,20 +145,28 @@ jobs:
123145 docker compose -f docker-compose.production.yml pull
124146 docker compose -f docker-compose.production.yml up -d
125147
148+ - name : Wait for services to start
149+ run : |
150+ echo "Waiting for services to start..."
151+ sleep 30
152+
126153 - name : Health check production
127154 run : |
128155 echo "Performing health check on production..."
129- timeout 60 bash -c 'until curl -f http://localhost:8000/health; do sleep 2 ; done'
156+ timeout 120 bash -c 'until curl -f http://localhost:8000/health; do echo "Waiting for health check..."; sleep 5 ; done'
130157 echo "Production deployment successful!"
131158
132159 - name : Print logs on failure
133160 if : failure()
134161 run : |
135- docker compose logs
162+ echo "=== Docker Compose Logs ==="
163+ docker compose -f docker-compose.production.yml logs
164+ echo "=== Container Status ==="
165+ docker compose -f docker-compose.production.yml ps
136166
137167 - name : Notify deployment success
138168 run : |
139169 echo "🚀 Deployment to production completed successfully!"
140170 echo "Version: ${{ github.sha }}"
141171 echo "Environment: Production"
142- echo "Docker Image: ${{ secrets.DOCKER_REGISTRY && format('{0}/llm-output-processor :production-{1}', secrets.DOCKER_REGISTRY, github.sha) || format('llm-output-processor :production-{0}', github.sha) }}"
172+ echo "Docker Image: ${{ secrets.DOCKER_REGISTRY && format('{0}/second-brain :production-{1}', secrets.DOCKER_REGISTRY, github.sha) || format('second-brain :production-{0}', github.sha) }}"
0 commit comments