Repository navigation
RFC: Applications: multi-server, multi-environment deployments to eventually replace Sites #1264
RichardAnderson
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I've built a proof of concept on
feat/appsthat adds Applications to Vito. A Site ties one codebase to one server, one domain and one Linux user. That works for a typical Laravel app, but it can't describe a web tier and a queue tier on separate servers, a load-balanced pair of web servers, or a Discord bot that has no HTTP route. Applications separate what you deploy from where it runs and how it's reached.An Application is a repository in a project. It has one or more Environments (production, staging, preview…), and each one tracks a branch and holds its own domains, variables, attached databases and Redis, deploy scripts and deployment history. An Environment is made of Components. A Component is one placement of the code on one server, and it gets its capabilities from Functions:
httpserves the environment's domains,processesruns Supervisor workers andschedulerruns cron. Plugins can register more Functions. Components can also beload_balancers that forward traffic over a Vito Network tohttpcomponents.proxyandcontainertypes are reserved but not built yet.erDiagram PROJECT ||--o{ APPLICATION : has APPLICATION }o--|| SOURCE_CONTROL : "pulls from" APPLICATION ||--o{ ENVIRONMENT : has ENVIRONMENT ||--o{ COMPONENT : "made of" ENVIRONMENT ||--o{ ENVIRONMENT_DOMAIN : "alias / redirect" ENVIRONMENT ||--o{ ENVIRONMENT_VARIABLE : "env + per-component overrides" ENVIRONMENT ||--o{ ENVIRONMENT_RESOURCE : "attached DB / Redis" ENVIRONMENT ||--o{ ENVIRONMENT_DEPLOYMENT : "staged run" COMPONENT }o--|| SERVER : "runs on" COMPONENT ||--o{ COMPONENT_FUNCTION : "http / processes / scheduler" COMPONENT ||--o{ COMPONENT_BACKEND : "LB targets" COMPONENT ||--o{ WORKER : "existing table" COMPONENT ||--o{ CRON_JOB : "existing table" ENVIRONMENT_DEPLOYMENT ||--o{ DEPLOYMENT : "one per component"Deploys run per Environment. A push, or a manual click, starts one
EnvironmentDeploymentthat fans out to every Component. The deploy moves in stages:clone → build → pre-flight → release. No Component starts a stage until every Component has finished the previous one. Migrations run once in pre-flight, on the primary component. If anything fails before release, nothing has switched over. If something fails during release, the run is markedpartialinstead of being reported as success.flowchart LR DNS["example.com<br/>*.example.com"] --> LB["lb · load_balancer<br/>server-1"] LB -- "private network" --> W1["web-1 · http<br/>server-2"] LB -- "private network" --> W2["web-2 · http<br/>server-3"] Q["worker · processes + scheduler<br/>server-4"] BOT["discord-bot · processes<br/>server-4"] W1 & W2 & Q --> DB[("MySQL + Redis<br/>attached resources")] subgraph ENV["Environment: production (branch main)"] LB W1 W2 Q BOT endHow it relates to Sites
The two models live side by side, and nobody is forced to migrate. Instead of copying the deploy machinery, the POC reuses the tables and code Sites already use.
deployments,deployment_scripts,workers,cron_jobsandgit_hookseach gained a nullablecomponent_id/environment_idnext tosite_id. Components use the same release-directory layout, vhost templates, SSL issuance, FPM pools, isolated users and GitHub webhooks. Delete checks look at both tables, so removing a Component never deletes an FPM pool or Linux user that a Site still needs.That overlap gives us the path to replacing Sites. A Site is just an Application with one Environment and one
appComponent with thehttpfunction, plusprocessesandschedulerif it has workers or cron. Once Applications reach feature parity (site types, deployment modes, logs, stats, backups), we can convert each Site to that shape in place. Its rows already fit the shared tables, so the change is mostly re-parenting records. The Sites UI can then be retired.Why this model
Feedback welcome, especially on naming (Application / Environment / Component / Function) and on which Site features you'd need before switching over.
All reactions