Skip to content
Merged

Fixes #753

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 18 additions & 18 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:4-24-bookworm
# FROM mcr.microsoft.com/devcontainers/javascript-node:4-24-bookworm

# Install MongoDB command line tools - though mongo-database-tools not available on arm64
ARG MONGO_TOOLS_VERSION=6.0
RUN . /etc/os-release \
&& curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.asc" | gpg --dearmor > /usr/share/keyrings/mongodb-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian ${VERSION_CODENAME}/mongodb-org/${MONGO_TOOLS_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_TOOLS_VERSION}.list \
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y mongodb-mongosh \
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then apt-get install -y mongodb-database-tools; fi \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
# # Install MongoDB command line tools - though mongo-database-tools not available on arm64
# ARG MONGO_TOOLS_VERSION=6.0
# RUN . /etc/os-release \
# && curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.asc" | gpg --dearmor > /usr/share/keyrings/mongodb-archive-keyring.gpg \
# && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] http://repo.mongodb.org/apt/debian ${VERSION_CODENAME}/mongodb-org/${MONGO_TOOLS_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGO_TOOLS_VERSION}.list \
# && apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get install -y mongodb-mongosh \
# && if [ "$(dpkg --print-architecture)" = "amd64" ]; then apt-get install -y mongodb-database-tools; fi \
# && apt-get clean -y && rm -rf /var/lib/apt/lists/*

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# # [Optional] Uncomment this section to install additional OS packages.
# # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# # && apt-get -y install --no-install-recommends <your-package-list-here>

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# # [Optional] Uncomment if you want to install an additional version of node using nvm
# # ARG EXTRA_NODE_VERSION=10
# # RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>"
# # [Optional] Uncomment if you want to install more global node modules
# # RUN su node -c "npm install -g <your-package-list-here>"



58 changes: 29 additions & 29 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node-mongo
{
"name": "Node.js & Mongo DB",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// // README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node-mongo
// {
// "name": "Node.js & Mongo DB",
// "dockerComposeFile": "docker-compose.yml",
// "service": "app",
// "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// // Features to add to the dev container. More info: https://containers.dev/features.
// // "features": {},

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"mongodb.mongodb-vscode"
]
}
},
"features": {
"ghcr.io/devcontainer-config/features/dot-config:4": {}
}
// // Configure tool-specific properties.
// "customizations": {
// // Configure properties specific to VS Code.
// "vscode": {
// // Add the IDs of extensions you want installed when the container is created.
// "extensions": [
// "mongodb.mongodb-vscode"
// ]
// }
// },
// "features": {
// "ghcr.io/devcontainer-config/features/dot-config:4": {}
// }

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [3000, 27017],
// // Use 'forwardPorts' to make a list of ports inside the container available locally.
// // "forwardPorts": [3000, 27017],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// // Use 'postCreateCommand' to run commands after the container is created.
// // "postCreateCommand": "yarn install",

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
// // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// // "remoteUser": "root"
// }
72 changes: 36 additions & 36 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
version: '3.8'

services:
app:
build:
context: .
dockerfile: Dockerfile
volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: mongo:latest
restart: unless-stopped
volumes:
- mongodb-data:/data/db

# Uncomment to change startup options
# environment:
# MONGO_INITDB_ROOT_USERNAME: root
# MONGO_INITDB_ROOT_PASSWORD: example
# MONGO_INITDB_DATABASE: your-database-here

# Add "forwardPorts": ["27017"] to **devcontainer.json** to forward MongoDB locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
mongodb-data:
# version: '3.8'

# services:
# app:
# build:
# context: .
# dockerfile: Dockerfile
# volumes:
# - ../..:/workspaces:cached

# # Overrides default command so things don't shut down after the process ends.
# command: sleep infinity

# # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
# network_mode: service:db

# # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# # (Adding the "ports" property to this file will not forward from a Codespace.)

# db:
# image: mongo:latest
# restart: unless-stopped
# volumes:
# - mongodb-data:/data/db

# # Uncomment to change startup options
# # environment:
# # MONGO_INITDB_ROOT_USERNAME: root
# # MONGO_INITDB_ROOT_PASSWORD: example
# # MONGO_INITDB_DATABASE: your-database-here

# # Add "forwardPorts": ["27017"] to **devcontainer.json** to forward MongoDB locally.
# # (Adding the "ports" property to this file will not forward from a Codespace.)

# volumes:
# mongodb-data:
112 changes: 56 additions & 56 deletions .github/actions/deploy-app/action.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
name: Deploy Backend App
description: Deploys a Docker image to the target environment and verifies health.
# name: Deploy Backend App
# description: Deploys a Docker image to the target environment and verifies health.

inputs:
image_tag:
description: Full Docker image tag to deploy
required: true
environment:
description: Target environment (staging | production)
required: true
git_sha:
description: Git SHA being deployed
required: true
deploy_token:
description: Deployment platform token / webhook secret
required: true
app_url:
description: Base URL of the deployed app (for health check)
required: true
# inputs:
# image_tag:
# description: Full Docker image tag to deploy
# required: true
# environment:
# description: Target environment (staging | production)
# required: true
# git_sha:
# description: Git SHA being deployed
# required: true
# deploy_token:
# description: Deployment platform token / webhook secret
# required: true
# app_url:
# description: Base URL of the deployed app (for health check)
# required: true

runs:
using: composite
steps:
- name: Trigger deployment
shell: bash
env:
DEPLOY_TOKEN: ${{ inputs.deploy_token }}
run: |
# Replace this curl with your actual deploy platform call
# (Render deploy hook, Railway redeploy, Fly.io deploy, etc.)
# The IMAGE_TAG and GIT_SHA are passed so the platform can pull the right image.
curl -fsSL -X POST "${{ inputs.app_url }}/_deploy" \
-H "Authorization: Bearer ${DEPLOY_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"image": "${{ inputs.image_tag }}",
"sha": "${{ inputs.git_sha }}",
"environment": "${{ inputs.environment }}"
}' || true # remove `|| true` once real endpoint is wired up
# runs:
# using: composite
# steps:
# - name: Trigger deployment
# shell: bash
# env:
# DEPLOY_TOKEN: ${{ inputs.deploy_token }}
# run: |
# # Replace this curl with your actual deploy platform call
# # (Render deploy hook, Railway redeploy, Fly.io deploy, etc.)
# # The IMAGE_TAG and GIT_SHA are passed so the platform can pull the right image.
# curl -fsSL -X POST "${{ inputs.app_url }}/_deploy" \
# -H "Authorization: Bearer ${DEPLOY_TOKEN}" \
# -H "Content-Type: application/json" \
# -d '{
# "image": "${{ inputs.image_tag }}",
# "sha": "${{ inputs.git_sha }}",
# "environment": "${{ inputs.environment }}"
# }' || true # remove `|| true` once real endpoint is wired up

- name: Wait for health check
shell: bash
run: |
echo "Waiting for ${{ inputs.app_url }}/health ..."
for i in $(seq 1 24); do
STATUS=$(curl -o /dev/null -s -w "%{http_code}" "${{ inputs.app_url }}/health" || echo "000")
if [ "$STATUS" = "200" ]; then
echo "Health check passed (attempt ${i})"
exit 0
fi
echo "Attempt ${i}/24 — status ${STATUS}, retrying in 10s..."
sleep 10
done
echo "::error::Health check failed after 4 minutes"
exit 1
# - name: Wait for health check
# shell: bash
# run: |
# echo "Waiting for ${{ inputs.app_url }}/health ..."
# for i in $(seq 1 24); do
# STATUS=$(curl -o /dev/null -s -w "%{http_code}" "${{ inputs.app_url }}/health" || echo "000")
# if [ "$STATUS" = "200" ]; then
# echo "Health check passed (attempt ${i})"
# exit 0
# fi
# echo "Attempt ${i}/24 — status ${STATUS}, retrying in 10s..."
# sleep 10
# done
# echo "::error::Health check failed after 4 minutes"
# exit 1

- name: Log release metadata
shell: bash
run: |
echo "::notice title=Release [${{ inputs.environment }}]::image=${{ inputs.image_tag }} | sha=${{ inputs.git_sha }} | env=${{ inputs.environment }} | ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
# - name: Log release metadata
# shell: bash
# run: |
# echo "::notice title=Release [${{ inputs.environment }}]::image=${{ inputs.image_tag }} | sha=${{ inputs.git_sha }} | env=${{ inputs.environment }} | ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
92 changes: 46 additions & 46 deletions .github/actions/run-migrations/action.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
name: Run Supabase Migrations
description: Applies pending Supabase migrations exactly once and logs the result.
# name: Run Supabase Migrations
# description: Applies pending Supabase migrations exactly once and logs the result.

inputs:
supabase_url:
description: Supabase project URL
required: true
supabase_service_key:
description: Supabase service-role key
required: true
environment:
description: Target environment (staging | production)
required: true
git_sha:
description: Git SHA being deployed
required: true
# inputs:
# supabase_url:
# description: Supabase project URL
# required: true
# supabase_service_key:
# description: Supabase service-role key
# required: true
# environment:
# description: Target environment (staging | production)
# required: true
# git_sha:
# description: Git SHA being deployed
# required: true

runs:
using: composite
steps:
- name: Install Supabase CLI
shell: bash
run: |
curl -fsSL https://github.com/supabase/cli/releases/latest/download/supabase_linux_amd64.tar.gz \
| tar -xz -C /usr/local/bin supabase
# runs:
# using: composite
# steps:
# - name: Install Supabase CLI
# shell: bash
# run: |
# curl -fsSL https://github.com/supabase/cli/releases/latest/download/supabase_linux_amd64.tar.gz \
# | tar -xz -C /usr/local/bin supabase

- name: Link project
shell: bash
env:
SUPABASE_ACCESS_TOKEN: ${{ inputs.supabase_service_key }}
run: |
supabase link --project-ref "$(echo '${{ inputs.supabase_url }}' | sed 's|https://||;s|\.supabase\.co.*||')"
# - name: Link project
# shell: bash
# env:
# SUPABASE_ACCESS_TOKEN: ${{ inputs.supabase_service_key }}
# run: |
# supabase link --project-ref "$(echo '${{ inputs.supabase_url }}' | sed 's|https://||;s|\.supabase\.co.*||')"

- name: Run migrations
id: migrate
shell: bash
env:
SUPABASE_ACCESS_TOKEN: ${{ inputs.supabase_service_key }}
run: |
echo "::group::Migration output"
supabase db push --include-all 2>&1 | tee /tmp/migration.log
echo "::endgroup::"
# - name: Run migrations
# id: migrate
# shell: bash
# env:
# SUPABASE_ACCESS_TOKEN: ${{ inputs.supabase_service_key }}
# run: |
# echo "::group::Migration output"
# supabase db push --include-all 2>&1 | tee /tmp/migration.log
# echo "::endgroup::"

STATUS="${PIPESTATUS[0]}"
APPLIED=$(grep -c 'Applying migration' /tmp/migration.log || true)
echo "migrations_applied=${APPLIED}" >> "$GITHUB_OUTPUT"
exit "$STATUS"
# STATUS="${PIPESTATUS[0]}"
# APPLIED=$(grep -c 'Applying migration' /tmp/migration.log || true)
# echo "migrations_applied=${APPLIED}" >> "$GITHUB_OUTPUT"
# exit "$STATUS"

- name: Log migration metadata
shell: bash
run: |
echo "::notice title=Migration [${{ inputs.environment }}]::Applied ${{ steps.migrate.outputs.migrations_applied }} migration(s) | sha=${{ inputs.git_sha }} | env=${{ inputs.environment }} | ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
# - name: Log migration metadata
# shell: bash
# run: |
# echo "::notice title=Migration [${{ inputs.environment }}]::Applied ${{ steps.migrate.outputs.migrations_applied }} migration(s) | sha=${{ inputs.git_sha }} | env=${{ inputs.environment }} | ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
Loading
Loading