Support four database engines in Flask React template

This commit is contained in:
rob
2026-11-17 19:52:08 +00:00
parent 444406d2fc
commit a00837178e
21 changed files with 131 additions and 41 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
# Current state # Current state
FORGE-F001, FORGE-F002, and FORGE-F007 were human accepted and are present on `codex`. F003 and F004 candidates are merged with external validation and acceptance pending. F006 has an independent Flask/React template package and generator candidate directly on `codex`; human acceptance and some generated-project checks remain pending. Explicit business/personal profile configuration is implemented. `bortstack-context`, `bortstack-contributor`, and `bortstack-design` packages are present; one skill directory remains reserved. The repository `testtask` entry point is provisioned but blocked because Forge has no application runtime or manual-test hook. No cross-template generator or active legacy-skill migration has been implemented. Captain reports successful external validation of local Penpot 2.18 Docker and integrated MCP, but this session has no Penpot connector/browser. Windows and JJ's hands-on workflow have not been tested. Decisions FORGE-001 through FORGE-009 remain accepted. Captain has authorised direct `codex` work until further notice. FORGE-F001, FORGE-F002, and FORGE-F007 were human accepted and are present on `codex`. F003 and F004 candidates are merged with external validation and acceptance pending. F006 has an independent Flask/React template package and generator candidate directly on `codex`; human acceptance and Windows generation remain pending. F006 now supports SQLite, PostgreSQL, MySQL, and MariaDB, with generated migrations verified against all four in disposable Docker containers. Explicit business/personal profile configuration is implemented. `bortstack-context`, `bortstack-contributor`, and `bortstack-design` packages are present; one skill directory remains reserved. The repository `testtask` entry point is provisioned but blocked because Forge has no application runtime or manual-test hook. No cross-template generator or active legacy-skill migration has been implemented. Captain reports successful external validation of local Penpot 2.18 Docker and integrated MCP, but this session has no Penpot connector/browser. Windows and JJ's hands-on workflow have not been tested. Decisions FORGE-001 through FORGE-010 remain accepted. Captain has authorised direct `codex` work until further notice.
+4 -1
View File
@@ -1,6 +1,6 @@
# Architecture decisions # Architecture decisions
FORGE-001 through FORGE-005 were approved planning inputs on 2026-11-17 and are retained with subsequent approved details. FORGE-006 records the approved task identification policy. FORGE-007 supersedes only the PitchInvader pilot clause of FORGE-004; its design ownership and approval policy remain in force. FORGE-008 records Captain's temporary direct-`codex` workflow. FORGE-009 records the approved template migration defaults. FORGE-001 through FORGE-005 were approved planning inputs on 2026-11-17 and are retained with subsequent approved details. FORGE-006 records the approved task identification policy. FORGE-007 supersedes only the PitchInvader pilot clause of FORGE-004; its design ownership and approval policy remain in force. FORGE-008 records Captain's temporary direct-`codex` workflow. FORGE-009 records the approved template migration defaults. FORGE-010 records the approved database set for the Flask/React template.
## FORGE-001 — Technology-Agnostic Project Bootstrap Architecture ## FORGE-001 — Technology-Agnostic Project Bootstrap Architecture
Status: Accepted. Date: 2026-11-17. Rationale: project lifecycle must apply across stacks. Consequences: Core has no Flask, React, React Native, or other framework dependency; independently maintained templates own stack-specific behavior. Generated projects have no Forge runtime dependency. Supersedes: none. Status: Accepted. Date: 2026-11-17. Rationale: project lifecycle must apply across stacks. Consequences: Core has no Flask, React, React Native, or other framework dependency; independently maintained templates own stack-specific behavior. Generated projects have no Forge runtime dependency. Supersedes: none.
@@ -28,3 +28,6 @@ Status: Accepted. Date: 2026-11-17. Rationale: Captain wants initial Forge tasks
## FORGE-009 — Optional Email and Hosting Foundations in Migrated Template ## FORGE-009 — Optional Email and Hosting Foundations in Migrated Template
Status: Accepted. Date: 2026-11-17. Rationale: generated applications must remain useful without a GitHub account, a production host, or a Bortstack email identity. Consequences: FORGE-F006 preserves the template's email and hosting foundations as optional configuration, uses neutral project-specific defaults, and does not publish or deploy during generation. GitHub, Resend, Cloudflare, SWAG, and production setup require separate project choices; the original template repository remains unchanged. Supersedes: mandatory provider and immediate-deployment assumptions for the Forge migration only. Status: Accepted. Date: 2026-11-17. Rationale: generated applications must remain useful without a GitHub account, a production host, or a Bortstack email identity. Consequences: FORGE-F006 preserves the template's email and hosting foundations as optional configuration, uses neutral project-specific defaults, and does not publish or deploy during generation. GitHub, Resend, Cloudflare, SWAG, and production setup require separate project choices; the original template repository remains unchanged. Supersedes: mandatory provider and immediate-deployment assumptions for the Forge migration only.
## FORGE-010 — Multi-Database Flask/React Template
Status: Accepted. Date: 2026-11-17. Rationale: Captain wants the generated application to support multiple database engines and selected SQLite, PostgreSQL, MySQL, and MariaDB for FORGE-F006. Consequences: local generation defaults to persistent SQLite; PostgreSQL, MySQL, and MariaDB are opt-in Compose overlays with their respective Python drivers and configuration examples. Validate generated migrations against all four engines. Database credentials belong in private project configuration, never in tracked production files. Supersedes: the inherited assumption that MySQL is the default generated database.
+3 -3
View File
@@ -2,10 +2,10 @@
Current work: FORGE-F006 migrated the tracked `flask-react-auth-base` source at `ff139bf5f28f4604b4a7108f4ee26608dea9924e` into Forge on `codex`, starting from `bc6b6d2`. The original source repository was read and remained clean/unchanged. F006 is Ready to Finalise for Captain review, not Complete. Direct `codex` work follows FORGE-008. No external application, provider, or production infrastructure was modified. Current work: FORGE-F006 migrated the tracked `flask-react-auth-base` source at `ff139bf5f28f4604b4a7108f4ee26608dea9924e` into Forge on `codex`, starting from `bc6b6d2`. The original source repository was read and remained clean/unchanged. F006 is Ready to Finalise for Captain review, not Complete. Direct `codex` work follows FORGE-008. No external application, provider, or production infrastructure was modified.
Implementation: `templates/flask-react/` now contains a descriptor, independent source payload, Python generator, fresh neutral context boilerplate, and optional GitHub workflow. Generated projects do not need GitHub, SWAG, Resend, a production host, or Forge at runtime. Email is disabled by default, branding is project-specific, and optional SWAG uses a separate Compose overlay. Existing `roborto-*` skills and Forge distribution tooling are untouched. Implementation: `templates/flask-react/` now contains a descriptor, independent source payload, Python generator, fresh neutral context boilerplate, and optional GitHub workflow. Generated projects do not need GitHub, SWAG, Resend, a production host, or Forge at runtime. Email is disabled by default, branding is project-specific, and optional SWAG uses a separate Compose overlay. Under FORGE-010, the generated Compose base uses persistent SQLite; PostgreSQL, MySQL, and MariaDB have opt-in database overlays and example environment files. The API image includes psycopg and PyMySQL. Existing `roborto-*` skills and Forge distribution tooling are untouched.
Validation: Forge `python3 -m unittest discover -s tests -v` passed 15 tests and `python3 scripts/validate-skills.py` passed. A disposable `Orion Starter` generated at `/tmp/forge-f006-orion2` passed 14 backend tests in an ephemeral Docker container, SQLite migration upgrades, Compose configuration, and API/nginx image builds. A fresh `/tmp/forge-f006-orion3` passed base and optional SWAG-overlay Compose configuration, clean `npm ci`, 16 frontend tests, lint, and build in a Node container. A further disposable `/tmp/forge-f006-browser-trial` passed 23 Playwright checks with one intentional skip after Chromium OS libraries were installed in the ephemeral runner. Generator tests cover local-only mode, optional local Git, collision refusal, copied capabilities, neutral identity, and no active GitHub workflow. `git diff --check` passed. Validation: Forge `python3 -m unittest discover -s tests -v` passed 15 tests and `python3 scripts/validate-skills.py` passed. A disposable `Orion Starter` generated at `/tmp/forge-f006-orion2` passed 14 backend tests in an ephemeral Docker container, SQLite migration upgrades, Compose configuration, and API/nginx image builds. A fresh `/tmp/forge-f006-orion3` passed base and optional SWAG-overlay Compose configuration, clean `npm ci`, 16 frontend tests, lint, and build in a Node container. A further disposable `/tmp/forge-f006-browser-trial` passed 23 Playwright checks with one intentional skip after Chromium OS libraries were installed in the ephemeral runner. A new `Matrix Trial` generation passed base and all database-overlay Compose configuration, API image build, and live Alembic upgrades on SQLite, PostgreSQL, MySQL, and MariaDB. Disposable database containers, networks, and volumes were removed. Generator tests cover local-only mode, optional local Git, collision refusal, copied capabilities, neutral identity, no active GitHub workflow, and the database overlays. `git diff --check` passed.
Limitations: Host Python lacked Flask, so a direct host test failed; an initial network-disabled pip install and API build also failed on dependency resolution. Container validation succeeded using available dependency/image cache and normal Docker networking. Host npm was absent, but a clean generated-project `npm ci` and subsequent checks passed inside Node Docker. `npm ci` reported 14 advisories in development dependencies (5 moderate, 7 high, 2 critical); `npm audit --omit=dev` reported zero production advisories. The first Playwright attempt failed because the minimal runner lacked Chromium libraries; after installing those libraries inside an ephemeral container, the suite passed. MySQL runtime tests, Windows generation, and live email/hosting remain unverified. The existing bootstrap workflow must stay available until Captain acceptance. Forge `testtask` remains blocked because Forge has no application runtime. Limitations: Host Python lacked Flask, so a direct host test failed; an initial network-disabled pip install and API build also failed on dependency resolution. Container validation succeeded using available dependency/image cache and normal Docker networking. Host npm was absent, but a clean generated-project `npm ci` and subsequent checks passed inside Node Docker. `npm ci` reported 14 advisories in development dependencies (5 moderate, 7 high, 2 critical); `npm audit --omit=dev` reported zero production advisories. The first Playwright attempt failed because the minimal runner lacked Chromium libraries; after installing those libraries inside an ephemeral container, the suite passed. The full backend test suite has not been run separately on PostgreSQL, MySQL, or MariaDB; live migration checks passed on each. Windows generation and live email/hosting remain unverified. The existing bootstrap workflow must stay available until Captain acceptance. Forge `testtask` remains blocked because Forge has no application runtime.
Next action: Captain reviews and accepts F006 or requests changes. F005 may use the descriptor and generator after F006 acceptance. F003 and F004 still await their separate external validation and acceptance. No push or deployment has occurred. Next action: Captain reviews and accepts F006 or requests changes. F005 may use the descriptor and generator after F006 acceptance. F003 and F004 still await their separate external validation and acceptance. No push or deployment has occurred.
+4 -2
View File
@@ -56,11 +56,13 @@ Status: Ready to Finalise (human acceptance pending). Priority: High. Dependenci
Migrate `flask-react-auth-base` into Forge's template architecture. Preserve Flask backend/authentication, React/Vite frontend, Docker configuration, database support, automated tests, and documentation. Remove mandatory GitHub and immediate production-deployment assumptions. Validate generated applications before retiring the existing bootstrap workflow. No additional framework templates yet. Migrate `flask-react-auth-base` into Forge's template architecture. Preserve Flask backend/authentication, React/Vite frontend, Docker configuration, database support, automated tests, and documentation. Remove mandatory GitHub and immediate production-deployment assumptions. Validate generated applications before retiring the existing bootstrap workflow. No additional framework templates yet.
Acceptance: a generated application passes relevant checks and retains the listed capabilities before the existing bootstrap is retired. Acceptance: a generated application passes relevant checks and retains the listed capabilities before the existing bootstrap is retired. Explicitly support SQLite, PostgreSQL, MySQL, and MariaDB under FORGE-010.
Accepted migration boundary (2026-11-17): preserve email and hosting foundations as optional configuration with neutral project-specific defaults. Generation must work locally without GitHub or production infrastructure and must not publish or deploy. Keep the source `flask-react-auth-base` repository unchanged. Accepted migration boundary (2026-11-17): preserve email and hosting foundations as optional configuration with neutral project-specific defaults. Generation must work locally without GitHub or production infrastructure and must not publish or deploy. Keep the source `flask-react-auth-base` repository unchanged.
Implementation record (2026-11-17): Copied the tracked source at `ff139bf5f28f4604b4a7108f4ee26608dea9924e` into Forge's independent template package without changing the original repository. Added a descriptor and Python generator, fresh neutral project context, optional GitHub workflow and SWAG overlay, disabled email by default, and removed mandatory external-network and Roborto branding defaults. Generated projects passed 14 backend tests, 16 frontend tests, frontend lint/build, 23 Playwright checks (one intentional skip), SQLite migrations, Compose base/optional-overlay configuration, and API/nginx image builds. Forge's 15 tests and skill validation passed. A fresh generated frontend passed `npm ci`; the install reported 14 advisories in development dependencies, while `npm audit --omit=dev` reported zero production advisories. A clean host Python install, MySQL runtime test, and Windows generation remain unverified in this session; prior source-repository evidence does not substitute for those generated-project checks. Do not retire the existing bootstrap workflow or mark F006 Complete before human acceptance. Implementation record (2026-11-17): Copied the tracked source at `ff139bf5f28f4604b4a7108f4ee26608dea9924e` into Forge's independent template package without changing the original repository. Added a descriptor and Python generator, fresh neutral project context, optional GitHub workflow and SWAG overlay, disabled email by default, and removed mandatory external-network and Roborto branding defaults. Generated projects passed 14 backend tests, 16 frontend tests, frontend lint/build, 23 Playwright checks (one intentional skip), SQLite migrations, Compose base/optional-overlay configuration, and API/nginx image builds. Forge's 15 tests and skill validation passed. A fresh generated frontend passed `npm ci`; the install reported 14 advisories in development dependencies, while `npm audit --omit=dev` reported zero production advisories. A clean host Python install and Windows generation remain unverified in this session; prior source-repository evidence does not substitute for those generated-project checks.
Database follow-up (2026-11-17): Under FORGE-010, generation now defaults to persistent SQLite in Docker, with separate PostgreSQL, MySQL, and MariaDB Compose overlays and example environment files. The API image includes psycopg and PyMySQL. A fresh generated `Matrix Trial` project passed Compose configuration for the base and all three overlays, API image build, and live Alembic upgrades against each of the four engines in disposable containers. All test containers, networks, and volumes were removed. Forge's 15 tests passed. This validates migration compatibility; the full backend test suite has not been repeated separately on all three server databases. Do not retire the existing bootstrap workflow or mark F006 Complete before human acceptance.
## FORGE-F007 — Implement Business/Personal Profiles ## FORGE-F007 — Implement Business/Personal Profiles
Status: Complete; human acceptance received 2026-11-17. Priority: Medium. Dependencies: FORGE-F002. Implemented directly on `codex` under FORGE-008 in commit `d3a88fd`. Status: Complete; human acceptance received 2026-11-17. Priority: Medium. Dependencies: FORGE-F002. Implemented directly on `codex` under FORGE-008 in commit `d3a88fd`.
+1 -1
View File
@@ -10,6 +10,6 @@ python3 templates/flask-react/generate.py "My Application" /tmp/my-application
Add `--git-init` to initialize a local `main` branch. GitHub is not required. The generator refuses existing destinations and destinations inside Forge. It installs no packages, contacts no provider, and performs no deployment. It leaves profile selection to `bortstack-context`/F007; F005 will later orchestrate template and profile selection together. Add `--git-init` to initialize a local `main` branch. GitHub is not required. The generator refuses existing destinations and destinations inside Forge. It installs no packages, contacts no provider, and performs no deployment. It leaves profile selection to `bortstack-context`/F007; F005 will later orchestrate template and profile selection together.
The generated project has safe local/example configuration: SQLite is the development default, email is disabled, branding and project name are neutral, and Compose has no mandatory external SWAG network. Resend code, MySQL, Docker/nginx, an optional SWAG sample, and a GitHub CI/deployment example remain available. The GitHub workflow stays under `optional/github/` in Forge and is not generated as an active workflow. Enabling external services requires separate project decisions and configuration. See `boilerplate/docs/OPTIONAL_SERVICES.md`. The generated project has safe local/example configuration: SQLite is the development and default Compose database, email is disabled, branding and project name are neutral, and Compose has no mandatory external database or SWAG network. PostgreSQL, MySQL, and MariaDB are selectable through `ops/databases/` overlays. Resend code, Docker/nginx, an optional SWAG sample, and a GitHub CI/deployment example remain available. The GitHub workflow stays under `optional/github/` in Forge and is not generated as an active workflow. Enabling external services requires separate project decisions and configuration. See `boilerplate/docs/OPTIONAL_SERVICES.md`.
Linux generation was exercised. The Python generator is platform-neutral, but Windows generation and the full generated-project runtime matrix remain to be verified on Windows. The source package is a migration snapshot, not a live dependency on `/home/rob/projects/flask-react-auth-base`. Linux generation was exercised. The Python generator is platform-neutral, but Windows generation and the full generated-project runtime matrix remain to be verified on Windows. The source package is a migration snapshot, not a live dependency on `/home/rob/projects/flask-react-auth-base`.
+1 -1
View File
@@ -26,7 +26,7 @@ cd react && npm run lint && npm test && npm run build
docker compose --env-file .env.example config --quiet docker compose --env-file .env.example config --quiet
``` ```
Playwright browser tests are optional and require `npx playwright install chromium` followed by `npm run test:e2e`. Docker is optional for local development. `.env.example` contains local/example values only; do not use its placeholder passwords in production or commit a populated `.env`. Playwright browser tests are optional and require `npx playwright install chromium` followed by `npm run test:e2e`. Docker is optional for local development. Default Compose uses a persistent SQLite volume; PostgreSQL, MySQL, and MariaDB are opt-in through `ops/databases/` overlays. `.env.example` contains local/example values only; do not use database example passwords in production or commit a populated `.env`.
## Project context ## Project context
@@ -2,6 +2,6 @@
Local development needs no GitHub, production host, SWAG network, Resend account, or Cloudflare routing. Email delivery starts disabled. To enable it, choose and verify a project-specific sender/domain and contact destination, set `RESEND_API_KEY`, `EMAIL_FROM`, `CONTACT_EMAIL`, and `EMAIL_DELIVERY_ENABLED=true` in an untracked environment, then test account and contact flows. The code currently implements Resend outbound delivery; inbound routing is a separate operator choice. Local development needs no GitHub, production host, SWAG network, Resend account, or Cloudflare routing. Email delivery starts disabled. To enable it, choose and verify a project-specific sender/domain and contact destination, set `RESEND_API_KEY`, `EMAIL_FROM`, `CONTACT_EMAIL`, and `EMAIL_DELIVERY_ENABLED=true` in an untracked environment, then test account and contact flows. The code currently implements Resend outbound delivery; inbound routing is a separate operator choice.
`docker-compose.yml` provides MySQL, API, and nginx services with loopback diagnostic ports. It does not require an external reverse-proxy network. `ops/swag/` includes an optional Compose overlay and proxy sample for projects using SWAG; adapt networking and TLS separately before hosting. The Forge package retains a GitHub Actions CI/deployment example under `optional/github/`, but generation does not install an active workflow. Copying or enabling any deployment workflow is a separate project decision. Never use `.env.example` placeholder passwords or secrets in production. `docker-compose.yml` provides API and nginx services with loopback diagnostic ports and a persistent SQLite volume. It does not require an external database or reverse-proxy network. `ops/databases/` contains separate PostgreSQL, MySQL, and MariaDB Compose overlays plus safe example environment files. Select one engine per deployment; set `SQLALCHEMY_DATABASE_URI` explicitly outside Compose, or let the chosen overlay supply it. Replace example passwords in an untracked private env file and URL-encode reserved password characters in any database URL. Apply migrations against the selected engine before starting the API. `ops/swag/` includes an optional Compose overlay and proxy sample; adapt networking and TLS separately before hosting. The Forge package retains a GitHub Actions CI/deployment example under `optional/github/`, but generation does not install an active workflow. Copying or enabling any deployment workflow is a separate project decision. Never use example passwords or secrets in production.
Before production, choose a host and repository provider, configure external secrets, verify migrations/backup/rollback, review authentication and email policy, and run the project's required tests. Generation performs none of these actions. Before production, choose a host and repository provider, configure external secrets, verify migrations/backup/rollback, review authentication and email policy, and run the project's required tests. Generation performs none of these actions.
@@ -1,3 +1,3 @@
# Project overview # Project overview
__PROJECT_NAME__ is a newly generated Flask/React application foundation. Product purpose, intended users, ownership, branding, and deployment target are not yet selected. React/Vite lives under `react/`; Flask/SQLAlchemy and migrations live under `api/`. Development defaults to SQLite and disabled email. MySQL, Docker/nginx, Resend outbound email, SWAG, and GitHub automation are optional project choices. Generated code has no Forge runtime dependency. __PROJECT_NAME__ is a newly generated Flask/React application foundation. Product purpose, intended users, ownership, branding, and deployment target are not yet selected. React/Vite lives under `react/`; Flask/SQLAlchemy and migrations live under `api/`. SQLite is the local/default database; PostgreSQL, MySQL, and MariaDB are supported through explicit SQLAlchemy URLs and optional Compose overlays. Email is disabled by default. Docker/nginx, Resend outbound email, SWAG, and GitHub automation are optional project choices. Generated code has no Forge runtime dependency.
+3 -1
View File
@@ -9,7 +9,9 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parent ROOT = Path(__file__).resolve().parent
TOKEN_FILES = (".env.example", "docker-compose.yml", "react/index.html", TOKEN_FILES = (".env.example", "docker-compose.yml", "react/index.html",
"react/src/config/site.js", "react/src/components/Logo/Logo.jsx") "react/src/config/site.js", "react/src/components/Logo/Logo.jsx",
"ops/databases/postgres.env.example", "ops/databases/mysql.env.example",
"ops/databases/mariadb.env.example")
def generate(name, destination, git_init=False): def generate(name, destination, git_init=False):
+1 -5
View File
@@ -4,11 +4,7 @@ APP_SLUG=__APP_SLUG__
REGISTRATION_MODE=open REGISTRATION_MODE=open
SECRET_KEY=replace-with-a-long-random-value SECRET_KEY=replace-with-a-long-random-value
MYSQL_DATABASE=__DATABASE_NAME__ SQLALCHEMY_DATABASE_URI=sqlite:///mydatabase.sqlite
MYSQL_USER=__DATABASE_NAME__
MYSQL_PASSWORD=replace-with-a-strong-password
MYSQL_ROOT_PASSWORD=replace-with-a-different-strong-password
SQLALCHEMY_DATABASE_URI=mysql+pymysql://__DATABASE_NAME__:replace-with-a-strong-password@mysql:3306/__DATABASE_NAME__
SQLALCHEMY_ECHO=false SQLALCHEMY_ECHO=false
SQLALCHEMY_TRACK_MODIFICATIONS=false SQLALCHEMY_TRACK_MODIFICATIONS=false
@@ -6,6 +6,7 @@ RUN pip install --no-cache-dir -r ./config/requirements.txt \
&& groupadd --gid 10001 app \ && groupadd --gid 10001 app \
&& useradd --uid 10001 --gid app --create-home --shell /usr/sbin/nologin app && useradd --uid 10001 --gid app --create-home --shell /usr/sbin/nologin app
COPY . /app COPY . /app
RUN install -d -o app -g app /app/instance
ENV HOME=/home/app \ ENV HOME=/home/app \
PYTHONDONTWRITEBYTECODE=1 \ PYTHONDONTWRITEBYTECODE=1 \
@@ -2,6 +2,7 @@ Flask==3.1.3
Flask-Migrate==4.1.0 Flask-Migrate==4.1.0
Flask-SQLAlchemy==3.1.1 Flask-SQLAlchemy==3.1.1
PyMySQL==1.2.0 PyMySQL==1.2.0
psycopg[binary]==3.3.9
flask-cors==6.0.5 flask-cors==6.0.5
python-dotenv==1.2.3 python-dotenv==1.2.3
Flask-HTTPAuth==4.8.1 Flask-HTTPAuth==4.8.1
@@ -1,23 +1,4 @@
services: services:
mysql:
image: mysql:8.4
restart: unless-stopped
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE:?MYSQL_DATABASE must be set}
MYSQL_USER: ${MYSQL_USER:?MYSQL_USER must be set}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?MYSQL_PASSWORD must be set}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?MYSQL_ROOT_PASSWORD must be set}
volumes:
- db:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -uroot -p$$MYSQL_ROOT_PASSWORD --silent"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- internal
api: api:
image: ${API_IMAGE:-__APP_SLUG__-api:local} image: ${API_IMAGE:-__APP_SLUG__-api:local}
build: build:
@@ -34,9 +15,8 @@ services:
- ALL - ALL
env_file: env_file:
- ${APP_ENV_FILE:-.env.example} - ${APP_ENV_FILE:-.env.example}
depends_on: volumes:
mysql: - sqlite_data:/app/instance
condition: service_healthy
healthcheck: healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/api/health/ready')"] test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/api/health/ready')"]
interval: 15s interval: 15s
@@ -77,4 +57,4 @@ networks:
internal: true internal: true
volumes: volumes:
db: sqlite_data:
@@ -0,0 +1,29 @@
# Opt-in MariaDB service. Supply ops/databases/mariadb.env.example or a private env file.
services:
mariadb:
image: mariadb:11
restart: unless-stopped
environment:
MARIADB_DATABASE: ${MARIADB_DATABASE:?set MARIADB_DATABASE}
MARIADB_USER: ${MARIADB_USER:?set MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD:?set MARIADB_PASSWORD}
MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD:?set MARIADB_ROOT_PASSWORD}
volumes:
- mariadb_data:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "healthcheck.sh --connect --innodb_initialized"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- internal
api:
depends_on:
mariadb:
condition: service_healthy
environment:
SQLALCHEMY_DATABASE_URI: mysql+pymysql://${MARIADB_USER}:${MARIADB_PASSWORD}@mariadb:3306/${MARIADB_DATABASE}
volumes:
mariadb_data:
@@ -0,0 +1,4 @@
MARIADB_DATABASE=__DATABASE_NAME__
MARIADB_USER=__DATABASE_NAME__
MARIADB_PASSWORD=replace-with-a-private-password
MARIADB_ROOT_PASSWORD=replace-with-a-different-private-password
@@ -0,0 +1,29 @@
# Opt-in MySQL service. Supply ops/databases/mysql.env.example or a private env file.
services:
mysql:
image: mysql:8.4
restart: unless-stopped
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE:?set MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER:?set MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?set MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?set MYSQL_ROOT_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h localhost -uroot -p$$MYSQL_ROOT_PASSWORD --silent"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
networks:
- internal
api:
depends_on:
mysql:
condition: service_healthy
environment:
SQLALCHEMY_DATABASE_URI: mysql+pymysql://${MYSQL_USER}:${MYSQL_PASSWORD}@mysql:3306/${MYSQL_DATABASE}
volumes:
mysql_data:
@@ -0,0 +1,4 @@
MYSQL_DATABASE=__DATABASE_NAME__
MYSQL_USER=__DATABASE_NAME__
MYSQL_PASSWORD=replace-with-a-private-password
MYSQL_ROOT_PASSWORD=replace-with-a-different-private-password
@@ -0,0 +1,27 @@
# Opt-in PostgreSQL service. Supply ops/databases/postgres.env.example or a private env file.
services:
postgres:
image: postgres:15
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:?set POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER:?set POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 3s
retries: 12
networks:
- internal
api:
depends_on:
postgres:
condition: service_healthy
environment:
SQLALCHEMY_DATABASE_URI: postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
volumes:
postgres_data:
@@ -0,0 +1,3 @@
POSTGRES_DB=__DATABASE_NAME__
POSTGRES_USER=__DATABASE_NAME__
POSTGRES_PASSWORD=replace-with-a-private-password
+2 -1
View File
@@ -13,7 +13,8 @@
}, },
"development_commands": ["cd api && flask --app api.py run", "cd react && npm run dev"], "development_commands": ["cd api && flask --app api.py run", "cd react && npm run dev"],
"validation_commands": ["cd api && pytest", "cd react && npm run lint && npm test && npm run build", "docker compose --env-file .env.example config --quiet"], "validation_commands": ["cd api && pytest", "cd react && npm run lint && npm test && npm run build", "docker compose --env-file .env.example config --quiet"],
"optional_capabilities": ["Resend outbound email", "MySQL production persistence", "Docker/nginx hosting", "SWAG integration", "GitHub Actions publishing/deployment"], "database_engines": ["SQLite", "PostgreSQL", "MySQL", "MariaDB"],
"optional_capabilities": ["Resend outbound email", "PostgreSQL/MySQL/MariaDB production persistence", "Docker/nginx hosting", "SWAG integration", "GitHub Actions publishing/deployment"],
"initial_context": "Fresh AGENTS.md and five docs records are generated; profile selection is delegated to bortstack-context/F007.", "initial_context": "Fresh AGENTS.md and five docs records are generated; profile selection is delegated to bortstack-context/F007.",
"platforms": ["Linux", "Windows via Python; application dependencies and Docker must be installed separately"] "platforms": ["Linux", "Windows via Python; application dependencies and Docker must be installed separately"]
} }
+8
View File
@@ -31,6 +31,12 @@ class FlaskReactTemplateTests(unittest.TestCase):
self.assertIn("EMAIL_FROM=\n", env) self.assertIn("EMAIL_FROM=\n", env)
self.assertNotIn("roborto.net", env) self.assertNotIn("roborto.net", env)
self.assertNotIn("swag:", (project / "docker-compose.yml").read_text()) self.assertNotIn("swag:", (project / "docker-compose.yml").read_text())
self.assertNotIn("mysql:", (project / "docker-compose.yml").read_text())
self.assertIn("sqlite_data:", (project / "docker-compose.yml").read_text())
self.assertIn("SQLALCHEMY_DATABASE_URI=sqlite:///mydatabase.sqlite", env)
for engine in ("postgres", "mysql", "mariadb"):
self.assertTrue((project / f"ops/databases/{engine}.compose.yml").is_file())
self.assertIn("orion_starter", (project / f"ops/databases/{engine}.env.example").read_text())
self.assertIn("Orion Starter", (project / "react/src/config/site.js").read_text()) self.assertIn("Orion Starter", (project / "react/src/config/site.js").read_text())
self.assertIn("developer: null", (project / "react/src/config/site.js").read_text()) self.assertIn("developer: null", (project / "react/src/config/site.js").read_text())
self.assertIn("No product profile", (project / "docs/DECISIONS.md").read_text()) self.assertIn("No product profile", (project / "docs/DECISIONS.md").read_text())
@@ -55,6 +61,8 @@ class FlaskReactTemplateTests(unittest.TestCase):
descriptor = json.loads((package / "template.json").read_text()) descriptor = json.loads((package / "template.json").read_text())
self.assertEqual(descriptor["id"], "flask-react") self.assertEqual(descriptor["id"], "flask-react")
self.assertTrue(descriptor["source_commit"]) self.assertTrue(descriptor["source_commit"])
self.assertEqual(set(descriptor["database_engines"]), {"SQLite", "PostgreSQL", "MySQL", "MariaDB"})
self.assertIn("psycopg[binary]", (package / "source/api/config/requirements.txt").read_text())
self.assertTrue((package / "optional/github/ci-deploy.yml").is_file()) self.assertTrue((package / "optional/github/ci-deploy.yml").is_file())
self.assertFalse((package / "source/.github").exists()) self.assertFalse((package / "source/.github").exists())