Skip to content

Postgresql vacation planner#94

Merged
paolosalvatori merged 3 commits into
mainfrom
postgresql-vacation-planner
May 28, 2026
Merged

Postgresql vacation planner#94
paolosalvatori merged 3 commits into
mainfrom
postgresql-vacation-planner

Conversation

@paolosalvatori
Copy link
Copy Markdown
Contributor

Motivation

Add a new web-app-postgresql-flexible-server sample that mirrors the existing web-app-cosmosdb-mongodb-api and web-app-sql-database vacation-planner samples, but backed by an Azure Database for PostgreSQL flexible server fronted by a Private Endpoint.

This PR also changes the favicon.ico for all the vacation planner samples.

Changes

A new sample at samples/web-app-postgresql-flexible-server/python/, with the same shape as the sibling Mongo / SQL samples:

  • src/ — Flask Vacation Planner UI, switched to psycopg2 (database.py, app.py, requirements.txt).
  • bicep/main.bicep + main.bicepparam + per-resource modules under bicep/modules/ (PostgreSQL flexible server, Private Endpoint to the server with group postgresqlServer, Private DNS Zone privatelink.postgres.database.azure.com, VNet, NAT Gateway, NSGs, Log Analytics, App Service Plan, VNet-integrated Web App).
  • terraform/ — the same topology expressed as Terraform modules.
  • scripts/deploy.sh (raw az CLI) provisions the resources, validate.sh inspects them, call-web-app.sh (unchanged from the Cosmos sample) exercises the deployed Web App from four entry points.
  • All three deploy scripts include a psql bootstrap step (matching the pattern in web-app-sql-database): create a dedicated testuser application role, grant minimum schema privileges on PlannerDB, create the activities table, seed three sample rows, and write PG_USER/PG_PASSWORD onto the Web App so the runtime never authenticates as the server admin.
  • READMEs at the top level and inside bicep/, terraform/, scripts/.
  • Vacation-planner palm-tree favicon (rendered from the Twemoji 🌴 SVG) reused across the existing vacation-planner samples.

Testing

The Bicep, Terraform, Azure CLI based deployments were successfully tested end-to-end first against real Azure and then locally against the LocalStack for Azure emulator. validate.sh and call-web-app.sh were run after each deploy.

paolosalvatori and others added 2 commits May 27, 2026 15:32
Sibling to web-app-cosmosdb-mongodb-api: same Vacation Planner Flask UI,
backed by Azure Database for PostgreSQL flexible server fronted by a
Private Endpoint (group `postgresqlServer`). The server runs in
public-access mode with a permissive firewall rule so the deploy machine
can run the post-create psql bootstrap; the Web App reaches the server
through the Private Endpoint via the linked
`privatelink.postgres.database.azure.com` Private DNS Zone.

The deploy flow mirrors web-app-sql-database: after the IaC provisions
the infra (server + database + private endpoint + Web App), psql creates
a dedicated application role `testuser`, grants the minimum schema
privileges on `PlannerDB`, creates the `activities` table, and seeds
three demo rows. The Web App's `PG_USER` / `PG_PASSWORD` are set to
`testuser` after psql — the server-admin login is never written to the
Web App's app settings.

Three IaC variants (scripts, Bicep, Terraform) deploy the same topology.
All three derive `PG_HOST` and `PG_PORT` from the server's
`fullyQualifiedDomainName` by splitting on `:`: LocalStack returns
host:port (the dynamic TCP-proxy port that fronts the shared `postgres:18`
container), real Azure returns just the bare host so `PG_PORT` defaults
to 5432.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

@DrisDary DrisDary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants