From 44b22308bb619735cecfd9749d82a576415d4c05 Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Thu, 4 Jun 2026 11:44:07 -0400 Subject: [PATCH] proxy network added --- .claude/settings.local.json | 10 +++- .env_prod | 21 +++++++++ .gitignore | 1 + docker-compose.yml | 7 +++ docker-publish.ps1 | 91 +++++++++++++++++++++++++++++++++++++ storage/cron-settings.json | 2 +- 6 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 .env_prod create mode 100644 docker-publish.ps1 diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 8d2a0e8..ea52b96 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -30,7 +30,15 @@ "Bash(docker compose *)", "Bash(docker exec *)", "PowerShell(docker exec kci-php-kanban-app-1 ls -la /var/www/html/storage/)", - "PowerShell(docker exec kci-php-kanban-app-1 cat /var/www/html/storage/import.log)" + "PowerShell(docker exec kci-php-kanban-app-1 cat /var/www/html/storage/import.log)", + "Bash(Get-ChildItem -Path \"d:\\\\Development\\\\PHP\\\\KCI-PHP-KANBAN\" -Force)", + "Bash(Select-Object Name, PSIsContainer)", + "Bash(Sort-Object Name)", + "WebFetch(domain:onefortheroadgit.sytes.net)", + "Bash(Get-ChildItem \"C:\\\\Temp\\\\KCI-CAMPAIGN-TRACKER-ref\" -Force)", + "Bash(Select-Object Name, LastWriteTime)", + "Bash(ls -la /mnt/c/Temp/KCI-CAMPAIGN-TRACKER-ref/)", + "Read(//mnt/c/Temp/**)" ] } } diff --git a/.env_prod b/.env_prod new file mode 100644 index 0000000..df37b05 --- /dev/null +++ b/.env_prod @@ -0,0 +1,21 @@ +APP_ENV=production +APP_DEBUG=false +# Update APP_URL to the production server hostname/IP and port +APP_URL=http://192.168.1.200:8080 + +# Keycloak SSO +KEYCLOAK_BASE_URL=http://kci-app01.ntp.kentcommunications.com:8180 +KEYCLOAK_REALM=KCI +KEYCLOAK_CLIENT_ID=canopy-web +KEYCLOAK_CLIENT_SECRET=LHWXp5UUuES00Dz2iCjTJJgX9su6co0y +# Update redirect URIs to match APP_URL above +KEYCLOAK_REDIRECT_URI=http://192.168.1.200:8080/auth/callback +KEYCLOAK_LOGOUT_REDIRECT_URI=http://192.168.1.200:8080/login + +# PrintStream SQL Server +PRINTSTREAM_HOST=192.168.1.197 +PRINTSTREAM_PORT=1433 +PRINTSTREAM_DATABASE=Livedata_dosrun +PRINTSTREAM_USER=sa +PRINTSTREAM_PASSWORD=ch@rt3r +IMPORT_RUN_EVERY_MINUTES=30 diff --git a/.gitignore b/.gitignore index 8d68168..29bda9c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .env .env.local .env.* +!.env_prod *.log .DS_Store .idea/ diff --git a/docker-compose.yml b/docker-compose.yml index 0280c16..7b3688c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ services: app: build: . + container_name: kci-kanban-app ports: - "8080:80" volumes: @@ -11,3 +12,9 @@ services: # Set PRINTSTREAM_HOST to the server's IP address in .env # (Docker cannot resolve Windows LAN hostnames by name). - "KCI-PS-2024:${PRINTSTREAM_HOST}" + networks: + - proxy + +networks: + proxy: + external: true diff --git a/docker-publish.ps1 b/docker-publish.ps1 new file mode 100644 index 0000000..c85657d --- /dev/null +++ b/docker-publish.ps1 @@ -0,0 +1,91 @@ +#Requires -Version 5.1 +<# +.SYNOPSIS + Pulls the repo on the server, copies .env_prod as .env, then starts the container. +.EXAMPLE + .\docker-publish.ps1 + .\docker-publish.ps1 -SshKey "~/.ssh/id_rsa" +#> + +param( + [string]$SshKey = "" +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" + +# --------------------------------------------------------------------------- +# Configuration +# --------------------------------------------------------------------------- +$SSH_HOST = "192.168.1.200" +$SSH_USER = "root" +$REPO_PATH = "/root/kanban" +$REPO_URL = "https://onefortheroadgit.sytes.net/dcovington/KCI-PHP-KANBAN.git" + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- +function Write-Step([string]$msg) { + Write-Host "`n==> $msg" -ForegroundColor Cyan +} + +function Get-BaseArgs { + $a = @("-o", "StrictHostKeyChecking=accept-new") + if ($SshKey -ne "") { $a += @("-i", $SshKey) } + return $a +} + +# Deploy whichever branch is currently checked out locally. +$BRANCH = (git rev-parse --abbrev-ref HEAD).Trim() +Write-Host "Branch: $BRANCH" -ForegroundColor Yellow + +# --------------------------------------------------------------------------- +# Step 1 — clone or pull the repo (first password prompt) +# --------------------------------------------------------------------------- +Write-Step "Syncing repo on $SSH_USER@$SSH_HOST" + +$prepCmd = "set -e; " +$prepCmd += "if [ -d '$REPO_PATH/.git' ]; then " +$prepCmd += "cd '$REPO_PATH' && git fetch origin && git checkout $BRANCH && git pull origin $BRANCH; " +$prepCmd += "else " +$prepCmd += "git clone --branch $BRANCH '$REPO_URL' '$REPO_PATH'; " +$prepCmd += "fi" + +$sshArgs = Get-BaseArgs +$sshArgs += "$SSH_USER@$SSH_HOST", $prepCmd +ssh @sshArgs +if ($LASTEXITCODE -ne 0) { Write-Error "Repo sync failed (exit $LASTEXITCODE)." } + +# --------------------------------------------------------------------------- +# Step 2 — copy .env_prod as .env into the now-existing repo dir (second prompt) +# --------------------------------------------------------------------------- +Write-Step "Copying .env_prod to $SSH_USER@$SSH_HOST as .env" +$scpArgs = Get-BaseArgs +$scpArgs += ".env_prod", "${SSH_USER}@${SSH_HOST}:${REPO_PATH}/.env" +scp @scpArgs +if ($LASTEXITCODE -ne 0) { Write-Error "scp failed (exit $LASTEXITCODE)." } + +# --------------------------------------------------------------------------- +# Step 3 — copy the SQLite database (third password prompt) +# --------------------------------------------------------------------------- +Write-Step "Copying database/app.sqlite to $SSH_USER@$SSH_HOST" +$scpDbArgs = Get-BaseArgs +$scpDbArgs += "database/app.sqlite", "${SSH_USER}@${SSH_HOST}:${REPO_PATH}/database/app.sqlite" +scp @scpDbArgs +if ($LASTEXITCODE -ne 0) { Write-Error "scp database failed (exit $LASTEXITCODE)." } + +# --------------------------------------------------------------------------- +# Step 4 — start the container (fourth password prompt) +# --------------------------------------------------------------------------- +Write-Step "Starting container on $SSH_USER@$SSH_HOST" + +$deployCmd = "set -e; " +$deployCmd += "docker rm -f kci-kanban-app 2>/dev/null || true; " +$deployCmd += "cd '$REPO_PATH' && docker compose up -d --build --wait" + +$sshArgs = Get-BaseArgs +$sshArgs += "$SSH_USER@$SSH_HOST", $deployCmd +ssh @sshArgs +if ($LASTEXITCODE -ne 0) { Write-Error "Deployment failed (exit $LASTEXITCODE)." } + +Write-Host "`nDone. KCI Kanban is running on $SSH_HOST." -ForegroundColor Green diff --git a/storage/cron-settings.json b/storage/cron-settings.json index c9ce6ae..e6241ab 100644 --- a/storage/cron-settings.json +++ b/storage/cron-settings.json @@ -1,5 +1,5 @@ { "enabled": true, "interval_minutes": 60, - "last_run": "2026-06-04 13:19:01" + "last_run": "2026-06-04 15:20:01" }