feat: SDLC database separation for CI/testing (#35)
## Summary - Fix `isProductionDatabase()` to allow CI database (`euchre_camp_ci`) - Add database schema reset before CI test runs - Create `global.teardown.ts` for cleanup (CI: full reset, dev/prod: selective cleanup) - Add `acceptance-tests` job to PR workflow with CI database - Create `sync-prod-to-dev.js` script for one-way prod→dev sync - Add `just` recipes: `sync-dev`, `test-prod`, `reset-ci-db` - Store credentials in `.credentials` (gitignored) with unique CI user ## Testing Verified against CI database: - Schema reset works - Migrations apply correctly - Test users created successfully - 219 tests pass (slow but working) ## Next Steps - Set `CI_DATABASE_URL` as Gitea repository variable Reviewed-on: #35 Co-authored-by: David Gwilliam <dhgwilliam@gmail.com> Co-committed-by: David Gwilliam <dhgwilliam@gmail.com>
This commit was merged in pull request #35.
This commit is contained in:
@@ -163,32 +163,26 @@ jobs:
|
||||
if: steps.commit.outputs.committed == 'true'
|
||||
run: |
|
||||
echo "Deploying version ${{ steps.version.outputs.new_version }} to dev environment..."
|
||||
|
||||
# Update docker-compose.yml with new image tag using full registry path
|
||||
# The registry is docker.notsosm.art and image is euchre-camp
|
||||
|
||||
# Update dev compose file with new image tag
|
||||
IMAGE_TAG="${{ steps.version.outputs.new_version }}"
|
||||
sed -i "s|image: docker.notsosm.art/euchre-camp:[0-9.]*|image: docker.notsosm.art/euchre-camp:${IMAGE_TAG}|" docker-compose.yml
|
||||
|
||||
# Copy the updated docker-compose.yml to the deployment location
|
||||
# The runners are on the same Docker server where the container is running
|
||||
sudo mkdir -p /home/euchre_camp
|
||||
sudo cp docker-compose.yml /home/euchre_camp/
|
||||
sudo chown -R euchre:euchre /home/euchre_camp
|
||||
|
||||
COMPOSE_FILE="/apps/intelligent_silasak/docker-compose.yml"
|
||||
sed -i "s|image: docker.notsosm.art/euchre-camp:[a-zA-Z0-9.-]*|image: docker.notsosm.art/euchre-camp:${IMAGE_TAG}|" ${COMPOSE_FILE}
|
||||
|
||||
# Pull and restart the dev container
|
||||
cd /home/euchre_camp
|
||||
docker-compose pull app
|
||||
docker-compose up -d app
|
||||
|
||||
cd /apps/intelligent_silasak
|
||||
docker compose pull app
|
||||
docker compose up -d app
|
||||
|
||||
# Wait for container to be healthy
|
||||
echo "Waiting for container to start..."
|
||||
sleep 10
|
||||
|
||||
# Check if container is running
|
||||
if docker ps --filter "name=euchre-camp-app" --format "{{.Status}}" | grep -q "Up"; then
|
||||
echo "✅ Dev environment successfully deployed with version ${{ steps.version.outputs.new_version }}"
|
||||
else
|
||||
echo "❌ Dev environment deployment failed"
|
||||
docker-compose logs app
|
||||
exit 1
|
||||
fi
|
||||
echo "Waiting for dev site to be healthy..."
|
||||
for i in {1..30}; do
|
||||
if curl -sf https://euchre-dev.notsosm.art/api/health > /dev/null 2>&1; then
|
||||
echo "✅ Dev environment successfully deployed with version ${{ steps.version.outputs.new_version }}"
|
||||
exit 0
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
echo "❌ Dev environment deployment failed"
|
||||
docker compose logs app
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user