Add zero-config self hosting on Render #612
Reference in New Issue
Block a user
Delete Branch "self-hosting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR introduces a system to allow for "zero config" / "one-click" self hosting deploys.
Overview
Below are some highlights of what this solution aims to accomplish:
disabled- this turns off auto-updates. The user will be prompted in the UI for each new release and can manually upgrade if they wishrelease- this automatically upgrades the self-hosted app each time a new release becomes available. This is the "stable" optioncommit- this automatically upgrades the self-hosted app to the latest commit and mirrors Render's "auto deploy" functionalityTechnical Features
The main goal with this system design is to enable a self-hoster to get their app running without touching any code and enable incremental configuration via the UI.
Upgraderclass/namespace has been designed to be agnostic of the hosting platform. To support a new platform (such as Docker, Heroku, etc.), all that needs to be added is some configuration and aUpgrader::Deployer::<Platform>class that knows how to auto-deploy the self hosted appUpgraderis provided with git repository data using the pattern introduced in #561 to keep track of new commits and releases that are available for upgradeconfig/initializers/version.rbstores a hardcoded version number which will be updated manually each new release. This is required so the app knows which commits and releases are available for upgrade.rails-settings-cachedgem is used for global settings and can be 100% configured via environment variables and later changed in the UI by the self-hosting user.Upgrades
As described above—all users (whether self-hosted or paying users) will see notifications of new releases with changelogs. Self-hosted users will see special "prompts" to upgrade and can trigger new deploys within their app.
https://github.com/maybe-finance/maybe/assets/16676157/fb7c1786-f521-4227-80ee-0b5be38efbbe
Docker
This solution provides an extension point for setting up a Docker compose self-hosting configuration. In the future, a self-hosting user should be able to deploy to any Linux-enabled VPS with a single command (not supported yet):
@@ -2,6 +2,24 @@# exit on error@@ -0,0 +1,57 @@databases:I'd suggest moving the db:migrate into the build script - you probably don't want the DB migrate task running for every start of the service
@@ -0,0 +1,57 @@databases:That's true, I'll go ahead and make that change.
Ideally this is run in
preDeployCommand, so I may add something like this to therender-build.shscript: