Update postgres (#3)
Release Tagging / release (push) Failing after 56s
icarus_auth Build / Check (push) Successful in 2m2s
icarus_auth Build / Test Suite (push) Successful in 2m19s
icarus_auth Build / Rustfmt (push) Successful in 32s
icarus_auth Build / build (push) Successful in 1m44s
icarus_auth Build / Clippy (push) Successful in 2m25s

Reviewed-on: phoenix/icarus_auth#3
This commit was merged in pull request #3.
This commit is contained in:
2026-07-09 10:35:55 -04:00
parent e518b1e096
commit 2d376524eb
2 changed files with 10 additions and 25 deletions
+2 -11
View File
@@ -1,14 +1,12 @@
name: Rust Build name: icarus_auth Build
on: on:
push: push:
branches: branches:
- main - main
- devel
pull_request: pull_request:
branches: branches:
- main - main
- devel
jobs: jobs:
check: check:
@@ -34,16 +32,13 @@ jobs:
test: test:
name: Test Suite name: Test Suite
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
# --- Add database service definition ---
services: services:
postgres: postgres:
image: postgres:18.3-alpine image: postgres:18.4-alpine
env: env:
# Use secrets for DB init, with fallbacks for flexibility
POSTGRES_USER: ${{ secrets.DB_TEST_USER || 'testuser' }} POSTGRES_USER: ${{ secrets.DB_TEST_USER || 'testuser' }}
POSTGRES_PASSWORD: ${{ secrets.DB_TEST_PASSWORD || 'testpassword' }} POSTGRES_PASSWORD: ${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}
POSTGRES_DB: ${{ secrets.DB_TEST_NAME || 'testdb' }} POSTGRES_DB: ${{ secrets.DB_TEST_NAME || 'testdb' }}
# Options to wait until the database is ready
options: >- options: >-
--health-cmd pg_isready --health-cmd pg_isready
--health-interval 10s --health-interval 10s
@@ -56,7 +51,6 @@ jobs:
with: with:
toolchain: 1.96.1 toolchain: 1.96.1
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
# --- Add this step for explicit verification ---
- name: Verify Docker Environment - name: Verify Docker Environment
run: | run: |
echo "Runner User Info:" echo "Runner User Info:"
@@ -68,15 +62,12 @@ jobs:
echo "Checking Docker Daemon Status (ps):" echo "Checking Docker Daemon Status (ps):"
docker ps -a docker ps -a
echo "Docker environment check complete." echo "Docker environment check complete."
# NOTE: Do NOT use continue-on-error here.
# If Docker isn't working as expected, the job SHOULD fail here.
- name: Run tests - name: Run tests
env: env:
# Define DATABASE_URL for tests to use # Define DATABASE_URL for tests to use
DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }} DATABASE_URL: postgresql://${{ secrets.DB_TEST_USER || 'testuser' }}:${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}@postgres:5432/${{ secrets.DB_TEST_NAME || 'testdb' }}
RUST_LOG: info # Optional: configure test log level RUST_LOG: info # Optional: configure test log level
SECRET_KEY: ${{ secrets.TOKEN_SECRET_KEY }} SECRET_KEY: ${{ secrets.TOKEN_SECRET_KEY }}
# Make SSH agent available if tests fetch private dependencies
SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }} SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }}
ENABLE_REGISTRATION: 'TRUE' ENABLE_REGISTRATION: 'TRUE'
run: | run: |
+8 -14
View File
@@ -1,33 +1,28 @@
version: '3.8' # Use a recent version version: '3.8' # Use a recent version
services: services:
# Your Rust Application Service
auth_api: auth_api:
build: # Tells docker-compose to build the Dockerfile in the current directory build:
context: . context: .
ssh: ["default"] # Uses host's SSH agent ssh: ["default"]
container_name: icarus_auth # Optional: Give the container a specific name container_name: icarus_auth
ports: ports:
# Map host port 8000 to container port 3000 (adjust as needed)
- "8001:8001" - "8001:8001"
env_file: env_file:
- .env - .env
depends_on: depends_on:
auth_db: auth_db:
condition: service_healthy # Wait for the DB to be healthy before starting the app condition: service_healthy
restart: unless-stopped # Optional: Restart policy restart: unless-stopped
# PostgreSQL Database Service
auth_db: auth_db:
image: postgres:18.3-alpine # Use an official Postgres image (Alpine variant is smaller) image: postgres:18.4-alpine
container_name: icarus_auth_db # Optional: Give the container a specific name container_name: icarus_auth_db
environment: environment:
# These MUST match the user, password, and database name in the DATABASE_URL above
POSTGRES_USER: ${POSTGRES_AUTH_USER:-icarus_op} POSTGRES_USER: ${POSTGRES_AUTH_USER:-icarus_op}
POSTGRES_PASSWORD: ${POSTGRES_AUTH_PASSWORD:-password} POSTGRES_PASSWORD: ${POSTGRES_AUTH_PASSWORD:-password}
POSTGRES_DB: ${POSTGRES_AUTH_DB:-icarus_auth_db} POSTGRES_DB: ${POSTGRES_AUTH_DB:-icarus_auth_db}
volumes: volumes:
# Persist database data using a named volume
- postgres_data:/var/lib/postgresql - postgres_data:/var/lib/postgresql
ports: [] ports: []
healthcheck: healthcheck:
@@ -37,9 +32,8 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 10s start_period: 10s
restart: always # Optional: Restart policy restart: always
# Define the named volume for data persistence
volumes: volumes:
postgres_data: postgres_data:
driver: local # Use the default local driver driver: local # Use the default local driver