Skip to content

feat: complete install wizard with db, mail, storage, security & third-party config#8

Open
roncodes wants to merge 1 commit intomainfrom
feat/install-wizard-complete-config
Open

feat: complete install wizard with db, mail, storage, security & third-party config#8
roncodes wants to merge 1 commit intomainfrom
feat/install-wizard-complete-config

Conversation

@roncodes
Copy link
Member

Summary

This PR replaces the minimal 4-variable install-fleetbase command with a full 9-step interactive installation wizard, making the Fleetbase CLI suitable for both development and production deployments out of the box.


Problem

The existing install-fleetbase command only configured four environment variables (APP_KEY, CONSOLE_HOST, ENVIRONMENT, APP_DEBUG). This left critical configuration gaps:

  • Database ran with an empty root password (MYSQL_ALLOW_EMPTY_PASSWORD: yes) and had no path to an external managed database
  • Mail was never configured — password resets, invitations, and notifications silently failed
  • WebSocket origins were unrestricted (SOCKETCLUSTER_OPTIONS was never set)
  • File storage defaulted to ephemeral local container storage with no S3/GCS option
  • Session domain was hardcoded to localhost, breaking session cookies on real domains
  • No pre-flight checks — missing Docker, Git, or port conflicts were only discovered after failure

Changes

Pre-flight Checks (Step 0)

  • Verifies docker, docker compose (v2), git, and openssl are installed
  • Warns (non-blocking) on port conflicts for 8000 (API), 4200 (Console), 3306 (MySQL), 38000 (SocketCluster)

Core Configuration (Step 1)

  • Adds APP_NAME prompt alongside existing host/environment/directory options

Database Configuration (Step 3)

  • Choose bundled Docker MySQL (auto-generated secure credentials via crypto.randomBytes) or external MySQL/RDS
  • Sets DATABASE_URL, MYSQL_ROOT_PASSWORD, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_ALLOW_EMPTY_PASSWORD: no

Mail Configuration (Step 4)

  • Select driver: SMTP, Mailgun, Postmark, SendGrid, Resend, AWS SES, or log-only
  • Collects driver-specific credentials
  • Sets MAIL_MAILER, MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_FROM_ADDRESS, MAIL_FROM_NAME and driver-specific keys

File Storage (Step 5)

  • Choose local disk, AWS S3, or Google Cloud Storage
  • Sets FILESYSTEM_DRIVER, AWS_* / GOOGLE_CLOUD_* variables

Security & CORS (Step 6)

  • Auto-derives SESSION_DOMAIN from the configured host
  • Restricts SOCKETCLUSTER_OPTIONS origins to the configured host
  • Prompts for additional FRONTEND_HOSTS for CORS

Third-Party APIs (Step 7)

  • Optional: IPINFO_API_KEY, GOOGLE_MAPS_API_KEY, GOOGLE_MAPS_LOCALE, TWILIO_SID, TWILIO_TOKEN, TWILIO_FROM

Config Writing (Step 8)

  • Writes a complete docker-compose.override.yml covering application, socket, and database services
  • Backs up any existing override file with a timestamp suffix
  • Active database readiness polling (mysqladmin ping) instead of a fixed sleep

Post-Install Summary (Step 9)

  • Rich summary showing all configured and skipped items with next steps

Non-Interactive Mode

  • --non-interactive flag skips all optional prompts with safe defaults (useful for CI/CD)

New Helper Functions

  • isPortAvailable() — TCP port conflict detection
  • execAsync() — promisified child process execution
  • buildEnvBlock() — clean YAML environment block builder

…d-party config

Add a comprehensive multi-step installation wizard to the install-fleetbase
command, replacing the minimal 4-variable setup with a full production-ready
configuration flow.

Changes:
- Pre-flight checks: verify Docker, Docker Compose v2, and Git are installed;
  warn on port conflicts for 8000, 4200, 3306, and 38000
- Step 1 (core): add app name prompt alongside existing host/environment/directory
- Step 3 (database): choose bundled Docker MySQL (auto-generated secure
  credentials) or external MySQL/RDS; sets DATABASE_URL, MYSQL_ROOT_PASSWORD,
  MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_ALLOW_EMPTY_PASSWORD
- Step 4 (mail): select driver (SMTP, Mailgun, Postmark, SendGrid, Resend, SES,
  or log); collect driver-specific credentials; sets MAIL_MAILER, MAIL_HOST,
  MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_FROM_ADDRESS, MAIL_FROM_NAME
- Step 5 (storage): choose local disk, AWS S3, or Google Cloud Storage; sets
  FILESYSTEM_DRIVER, AWS_* / GOOGLE_CLOUD_* variables
- Step 6 (security/CORS): auto-derive SESSION_DOMAIN and SOCKETCLUSTER_OPTIONS
  origins from the configured host; prompt for additional FRONTEND_HOSTS
- Step 7 (third-party): optional IPINFO_API_KEY, GOOGLE_MAPS_API_KEY,
  GOOGLE_MAPS_LOCALE, TWILIO_SID, TWILIO_TOKEN, TWILIO_FROM
- Write a complete docker-compose.override.yml covering application, socket,
  and database services; back up any existing override file
- Active database readiness polling (mysqladmin ping) instead of a fixed sleep
- Rich post-install summary showing configured/skipped items and next steps
- Add --non-interactive flag to skip all optional prompts with safe defaults
  (useful for CI/CD pipelines)
- Add helper functions: isPortAvailable(), execAsync(), buildEnvBlock()
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.

1 participant