Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zero-config self hosting on Render #612

Merged
merged 42 commits into from
Apr 13, 2024
Merged

Add zero-config self hosting on Render #612

merged 42 commits into from
Apr 13, 2024

Conversation

zachgoll
Copy link
Collaborator

@zachgoll zachgoll commented Apr 10, 2024

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:

  • A user can deploy to the Render hosting platform in one click, for free, in less than 5 minutes
    • Additional configuration will be done in the UI by the user to enhance the app experience.
  • A user can choose their updates mode and configure it in the UI:
    • disabled - this turns off auto-updates. The user will be prompted in the UI for each new release and can manually upgrade if they wish
    • release - this automatically upgrades the self-hosted app each time a new release becomes available. This is the "stable" option
    • commit - this automatically upgrades the self-hosted app to the latest commit and mirrors Render's "auto deploy" functionality
  • Each time the app is upgraded, the user will see a release alert exactly one time with notes of what changed

Technical 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.

  • The Upgrader class/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 a Upgrader::Deployer::<Platform> class that knows how to auto-deploy the self hosted app
  • The Upgrader is provided with git repository data using the pattern introduced in Implement swappable provider infrastructure #561 to keep track of new commits and releases that are available for upgrade
  • config/initializers/version.rb stores 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.
  • The rails-settings-cached gem is used for global settings and can be 100% configured via environment variables and later changed in the UI by the self-hosting user.
    • For example, when deploying to Render, the user will need to supply the app with a deploy hook to trigger upgrades. Since this is not available until after the service is deployed, I have made this one of the dynamic settings that the user will be prompted to enter in the UI

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.

CleanShot.2024-04-11.at.17.05.14.mp4

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):

# Not implemented yet
curl -fsSL https://raw.githubusercontent.com/maybe-finance/maybe/main/install.sh | bash

bin/render-build.sh Outdated Show resolved Hide resolved
render.yaml Outdated Show resolved Hide resolved
@zachgoll zachgoll marked this pull request as ready for review April 12, 2024 23:38
@zachgoll zachgoll merged commit 5aca2ff into main Apr 13, 2024
4 checks passed
@zachgoll zachgoll deleted the self-hosting branch April 13, 2024 13:28
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