14 Commits

Author SHA1 Message Date
af6e89274d Added preprod rules
Some checks failed
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 42s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Failing after 56s
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 22:26:05 +01:00
ef6cf2999b Test domain
Some checks failed
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Failing after 53s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 41s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 22:23:36 +01:00
1c9be2d57d Use preprod.env
Some checks failed
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Failing after 56s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 39s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 22:03:44 +01:00
01c5229f26 refactor: Update CI workflow to ensure environment variables are loaded for E2E tests and add conditional cleanup.
Some checks failed
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 3s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Failing after 46s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Failing after 14m14s
2026-01-15 21:55:03 +01:00
50aa276c37 Reapply "test: Update default PORT and HTTPS_PORT values for E2E tests."
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 3s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Successful in 1m18s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 42s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
This reverts commit 5920529de7.
2026-01-15 21:48:18 +01:00
f5dc53dc96 Revert "Undid workflow changes"
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Successful in 56s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 1m16s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
This reverts commit d415f0d82f.
2026-01-15 21:47:55 +01:00
d415f0d82f Undid workflow changes
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 3s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 41s
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
2026-01-15 21:42:20 +01:00
5920529de7 Revert "test: Update default PORT and HTTPS_PORT values for E2E tests."
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Successful in 56s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 41s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
This reverts commit c2ef3a3160.
2026-01-15 21:40:41 +01:00
c2ef3a3160 test: Update default PORT and HTTPS_PORT values for E2E tests.
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Successful in 1m3s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 45s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 21:36:09 +01:00
f60d9bb66c Moved sourcing
Some checks failed
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Successful in 1m9s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Failing after 42s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 21:30:00 +01:00
de03b9625c Added sourcing
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Successful in 1m14s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 1m4s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 21:26:30 +01:00
44d0093069 ci: Comment out the branch condition for the pre-production deployment workflow.
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 3s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Successful in 1m21s
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 53s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 21:21:47 +01:00
fc2e0cb44e Uncommented needs
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 3s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 53s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 21:20:17 +01:00
7121747d35 feat: Add pre-production deployment stage with E2E tests, a dedicated environment file, and update production deployment dependency.
All checks were successful
Remote Deployment Pipeline / Prepare Context (pull_request) Successful in 2s
Remote Deployment Pipeline / Deploy (Staging) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Dev/Preview) (pull_request) Successful in 1m33s
Remote Deployment Pipeline / Cleanup Preview (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Pre-Prod) (pull_request) Has been skipped
Remote Deployment Pipeline / Deploy (Production) (pull_request) Has been skipped
2026-01-15 21:17:40 +01:00
6 changed files with 163 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ env:
REMOTE_DEPLOY_PATH: /var/app/traefik/test REMOTE_DEPLOY_PATH: /var/app/traefik/test
REMOTE_PROD_PATH: /var/app/traefik/prod REMOTE_PROD_PATH: /var/app/traefik/prod
REMOTE_STAGING_PATH: /var/app/traefik/staging REMOTE_STAGING_PATH: /var/app/traefik/staging
REMOTE_PREPROD_PATH: /var/app/traefik/preprod
# --- SECRETS --- # --- SECRETS ---
SSH_HOST: ${{ secrets.SSH_HOST }} SSH_HOST: ${{ secrets.SSH_HOST }}
@@ -93,13 +94,75 @@ jobs:
cd ${{ env.REMOTE_STAGING_PATH }} cd ${{ env.REMOTE_STAGING_PATH }}
docker compose --env-file staging.env -f docker-compose.yaml up -d --build --remove-orphans --wait docker compose --env-file staging.env -f docker-compose.yaml up -d --build --remove-orphans --wait
# ------------------------------------------------------------------
# STAGE 3.5: DEPLOY PRE-PROD
# ------------------------------------------------------------------
deploy_preprod:
name: Deploy (Pre-Prod)
runs-on: ubuntu-latest
# needs: [deploy_staging]
# if: github.ref == 'refs/heads/test_preprod'
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Deploy via Rsync & Docker
uses: easingthemes/ssh-deploy@a1aa0b6cf96ce2406eef90faa35007a4a7bf0ac0 # v5.1.1
env:
SSH_PRIVATE_KEY: ${{ env.SSH_PRIVATE_KEY }}
REMOTE_HOST: ${{ env.SSH_HOST }}
REMOTE_USER: ${{ env.SSH_USER }}
REMOTE_PORT: ${{ env.SSH_PORT }}
TARGET: ${{ env.REMOTE_PREPROD_PATH }}
EXCLUDE: ".git/, .github/"
SCRIPT_BEFORE: |
mkdir -p ${{ env.REMOTE_PREPROD_PATH }}
SCRIPT_AFTER: |
set -e
cd ${{ env.REMOTE_PREPROD_PATH }}
docker compose --env-file preprod.env -f docker-compose.yaml -f docker-compose.prod.yaml up -d --build --remove-orphans --wait
- name: Run E2E Tests
uses: appleboy/ssh-action@823bd89e131d8d508129f9443cad5855e9ba96f0 # v1.2.4
with:
host: ${{ env.SSH_HOST }}
username: ${{ env.SSH_USER }}
key: ${{ env.SSH_PRIVATE_KEY }}
port: ${{ env.SSH_PORT }}
script: |
set -e
cd ${{ env.REMOTE_PREPROD_PATH }}
echo "Running E2E tests..."
python3 -m venv .venv
. .venv/bin/activate
# Export env vars
set -a
. preprod.env
set +a
pip install -r tests/e2e/requirements.txt
# Run tests
if pytest tests/e2e/; then
echo "Tests passed!"
# Cleanup on success
docker compose --env-file preprod.env -f docker-compose.yaml -f docker-compose.prod.yaml down --remove-orphans
else
echo "Tests failed!"
# Optional: Cleanup on failure? Or keep for debugging?
# User's previous script had it after, implying it runs if pytest succeeds (due to set -e).
# I will fail the step.
exit 1
fi
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# STAGE 4: DEPLOY PRODUCTION # STAGE 4: DEPLOY PRODUCTION
# ------------------------------------------------------------------ # ------------------------------------------------------------------
deploy_prod: deploy_prod:
name: Deploy (Production) name: Deploy (Production)
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [deploy_staging] needs: [deploy_preprod]
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
steps: steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
@@ -126,6 +189,10 @@ jobs:
# Create venv to avoid polluting system python # Create venv to avoid polluting system python
python3 -m venv .venv python3 -m venv .venv
. .venv/bin/activate . .venv/bin/activate
# Export env vars so pytest can see them
set -a
. prod.env
set +a
pip install -r tests/e2e/requirements.txt pip install -r tests/e2e/requirements.txt
pytest tests/e2e/ pytest tests/e2e/

View File

@@ -1,6 +1,6 @@
services: services:
traefik: traefik:
image: "traefik:v3.6@sha256:a9890c898f379c1905ee5b28342f6b408dc863f08db2dab20e46c267d1ff463a" image: "traefik:v3.6@sha256:03650d05c2ce54959c1016c879371d20ad303ecbaecc1621f6ed231cd2e0b516"
restart: unless-stopped restart: unless-stopped
security_opt: security_opt:
- no-new-privileges:true - no-new-privileges:true

9
preprod.env Normal file
View File

@@ -0,0 +1,9 @@
PORT=8081
HTTPS_PORT=447
ENV=preprod
NETWORK_NAME=proxy
CERTBOT_CA_RESOLVER=https://acme-staging-v02.api.letsencrypt.org/directory
DOMAIN=preprod.kovagoadi.hu
ACME_BYPASS=false
TRAEFIK_LEGACY_OPT="--providers.file.directory=/etc/traefik"
CI=true

View File

@@ -0,0 +1,47 @@
# ./traefik/forward-to-legacy-nginx.yaml
tcp:
routers:
# Router for HTTPS (Passthrough)
nginx-legacy-router-secure:
rule: "HostSNI(`*`)"
service: nginx-legacy-service-secure
# Passthrough must be true for SSL to reach Nginx encrypted
tls:
passthrough: true
priority: 10
entryPoints:
- "https"
services:
# Service defining the external IP
nginx-legacy-service-secure:
loadBalancer:
servers:
# This is the actual external IP and Port of your Nginx
- address: "webserver:443"
http:
routers:
# 1. TRAEFIK-MANAGED ACME HANDLER (Removed manual router)
traefik-acme-handler:
rule: "Host(`test-whoami.kovagoadi.hu`) && PathPrefix(`/.well-known/acme-challenge/`)"
entryPoints:
- "web"
service: "acme-http@internal" # This is the internal service name
priority: 1000 # High priority to ensure it wins
# 2. THE HTTP CATCH-ALL (Sends other ACME and HTTP to Nginx)
nginx-legacy-router:
rule: "HostRegexp(`^.+$`)"
service: nginx-legacy-service
# Low priority ensures specific containers are handled first, but before the default acme-handler
priority: 90
entryPoints:
- "web"
services:
nginx-legacy-service:
loadBalancer:
servers:
- url: "http://webserver:80"

View File

@@ -0,0 +1,33 @@
http:
routers:
# Router for HTTP (Port 80)
staging:
rule: "HostRegexp(`^.+\\.staging\\.kovagoadi\\.hu$`) || HostRegexp(`^.+\\.dev\\.kovagoadi\\.hu$`)"
entryPoints:
- "web"
service: "dev-staging"
priority: 1000
services:
dev-staging:
loadBalancer:
servers:
- url: "http://staging:8080"
tcp:
routers:
# Router for HTTPS (Passthrough)
dev-staging-secure:
rule: "HostSNIRegexp(`^.+\\.staging\\.kovagoadi\\.hu$`) || HostSNIRegexp(`^.+\\.dev\\.kovagoadi\\.hu$`)"
service: "dev-staging-secure"
# Passthrough must be true for SSL to reach Nginx encrypted
tls:
passthrough: true
priority: 1000
entryPoints:
- "https"
services:
dev-staging-secure:
loadBalancer:
servers:
# Note: Ensure Traefik trusts the cert at .85 or set insecureSkipVerify
- address: "staging:445"

View File

@@ -3,9 +3,9 @@ import requests
import os import os
# Configuration # Configuration
DOMAIN = os.getenv("DOMAIN", "dev.kovagoadi.hu") DOMAIN = os.getenv("DOMAIN", "asdasd.kovagoadi.hu")
PORT = os.getenv("PORT", "898") PORT = os.getenv("PORT", "10000")
HTTPS_PORT = os.getenv("HTTPS_PORT", "446") HTTPS_PORT = os.getenv("HTTPS_PORT", "10001")
BASE_URL = f"http://127.0.0.1:{PORT}" BASE_URL = f"http://127.0.0.1:{PORT}"
HTTPS_BASE_URL = f"https://127.0.0.1:{HTTPS_PORT}" HTTPS_BASE_URL = f"https://127.0.0.1:{HTTPS_PORT}"
@@ -88,7 +88,7 @@ def mock_webserver():
# We need to recreate the container to pick up extra_hosts changes # We need to recreate the container to pick up extra_hosts changes
try: try:
subprocess.run(["docker-compose", "--env-file", "dev.env", "up", "-d", "--force-recreate", "--no-deps", "traefik"], env=env, check=True, capture_output=True, text=True) subprocess.run(["docker-compose", "--env-file", "preprod.env", "up", "-d", "--force-recreate", "--no-deps", "traefik"], env=env, check=True, capture_output=True, text=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(f"Docker Compose STDOUT: {e.stdout}") print(f"Docker Compose STDOUT: {e.stdout}")
print(f"Docker Compose STDERR: {e.stderr}") print(f"Docker Compose STDERR: {e.stderr}")
@@ -104,7 +104,7 @@ def mock_webserver():
subprocess.run(["docker", "stop", mock["name"]], capture_output=True) subprocess.run(["docker", "stop", mock["name"]], capture_output=True)
# Restore Traefik to default (optional) # Restore Traefik to default (optional)
subprocess.run(["docker-compose", "--env-file", "dev.env", "up", "-d", "--force-recreate", "--no-deps", "traefik"], check=True) subprocess.run(["docker-compose", "--env-file", "preprod.env", "up", "-d", "--force-recreate", "--no-deps", "traefik"], check=True)
def test_whoami_http_reachable(): def test_whoami_http_reachable():
"""Verify that the whoami service is reachable via HTTP.""" """Verify that the whoami service is reachable via HTTP."""