Fix: Migration interface now shows correct Podman commands for production servers

- Updated migrations.html to detect production environment and use podman/docker accordingly
- Added container runtime info to settings page
- Updated VERSION to 2.1.1
This commit is contained in:
Christian 2026-01-29 00:47:40 +01:00
parent 4b467aeeec
commit ef171c7573
5 changed files with 39 additions and 8 deletions

26
RELEASE_NOTES_v2.1.1.md Normal file
View File

@ -0,0 +1,26 @@
# BMC Hub v2.1.1 - Bug Fix Release
**Release Date:** 29. januar 2026
## 🐛 Bug Fixes
### Migrationer Interface
- **Fixed container runtime detection**: Production servers using Podman now show correct commands instead of Docker commands
- **Updated migration command display**: Frontend now correctly shows `podman exec` commands for production environments
- **Improved user experience**: Added container runtime information in the standard setup section
## 🔧 Technical Changes
- Updated `app/settings/frontend/migrations.html` to detect production environment and use appropriate container runtime
- Modified `app/settings/backend/views.py` to pass production environment flag to template
- Container runtime detection based on hostname (production vs localhost/127.0.0.1)
## 📋 Deployment Notes
This is a frontend-only change that fixes the migration interface display. No database changes required.
## ✅ Verification
- Migration page now shows correct Podman commands on production servers
- Local development still uses Docker commands
- Migration execution via web interface continues to work as before

View File

@ -1 +1 @@
2.1.0 2.1.1

View File

@ -501,7 +501,7 @@ def _get_opportunity(opportunity_id: int):
# Fetch linked contacts # Fetch linked contacts
contacts_query = """ contacts_query = """
SELECT c.id, c.first_name, c.last_name, c.email, c.phone, c.mobile_phone, poc.role SELECT c.id, c.first_name, c.last_name, c.email, c.phone, c.mobile, poc.role
FROM contacts c FROM contacts c
JOIN pipeline_opportunity_contacts poc ON c.id = poc.contact_id JOIN pipeline_opportunity_contacts poc ON c.id = poc.contact_id
WHERE poc.opportunity_id = %s WHERE poc.opportunity_id = %s

View File

@ -46,7 +46,8 @@ async def migrations_page(request: Request):
"migrations": migrations, "migrations": migrations,
"db_user": settings.POSTGRES_USER, "db_user": settings.POSTGRES_USER,
"db_name": settings.POSTGRES_DB, "db_name": settings.POSTGRES_DB,
"db_container": "bmc-hub-postgres" "db_container": "bmc-hub-postgres",
"is_production": request.url.hostname not in ['localhost', '127.0.0.1', '0.0.0.0']
}) })

View File

@ -118,7 +118,8 @@
<ul class="list-unstyled mb-0"> <ul class="list-unstyled mb-0">
<li class="mb-2"><strong>DB bruger:</strong> {{ db_user }}</li> <li class="mb-2"><strong>DB bruger:</strong> {{ db_user }}</li>
<li class="mb-2"><strong>DB navn:</strong> {{ db_name }}</li> <li class="mb-2"><strong>DB navn:</strong> {{ db_name }}</li>
<li class="mb-0"><strong>DB container:</strong> {{ db_container }}</li> <li class="mb-2"><strong>DB container:</strong> {{ db_container }}</li>
<li class="mb-0"><strong>Container runtime:</strong> {{ 'Podman' if is_production else 'Docker' }}</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -130,11 +131,14 @@
let currentAltCommand = ""; let currentAltCommand = "";
function buildCommand(migrationName) { function buildCommand(migrationName) {
const dockerCmd = `docker exec -i {{ db_container }} psql -U {{ db_user }} -d {{ db_name }} < migrations/${migrationName}`; // Use podman for production, docker for local development
const runtime = {{ 'true' if is_production else 'false' }} ? 'podman' : 'docker';
const containerCmd = `${runtime} exec -i {{ db_container }} psql -U {{ db_user }} -d {{ db_name }} < migrations/${migrationName}`;
const localCmd = `psql \"$DATABASE_URL\" -f migrations/${migrationName}`; const localCmd = `psql \"$DATABASE_URL\" -f migrations/${migrationName}`;
currentCommand = dockerCmd; currentCommand = containerCmd;
currentAltCommand = `${dockerCmd}\n${localCmd}`; currentAltCommand = `${containerCmd}\n${localCmd}`;
document.getElementById('commandBox').textContent = dockerCmd; document.getElementById('commandBox').textContent = containerCmd;
document.getElementById('copyCommandBtn').disabled = false; document.getElementById('copyCommandBtn').disabled = false;
document.getElementById('copyAltBtn').disabled = false; document.getElementById('copyAltBtn').disabled = false;
} }