Some sort of code sync to allow version control is needed for OpenFn to be a robust solution for low and non-technical implementers. Is there a way to enable GitHub sync for self-hosted instances? If not, is there a best practice for connecting with a repository branch for a project for a non-technical implementer?
Hey @Cord42, yes you can enable Github Sync for self hosted instances.
To get this working, you’ll need to set up a Github App. GitHub provides a great guide on how to create one here: Creating GitHub Apps - GitHub Docs
We’ve listed all the required environment variables and permissions for the Github App in our Deployment Guide: lightning/DEPLOYMENT.md at main · OpenFn/lightning · GitHub
As you go through the configuration process, we’d really appreciate your feedback on our docs. If you find any parts unclear or think of ways we could improve the documentation, please don’t hesitate to let us know. Your input helps us make our guides more user-friendly for everyone in the community.
hey @Cord42 once you get the Github sync set up - if you’re considering having separate “prod” and “sandbox” environments, our services team will often create 2 separate OpenFn projects (1 for each environment).
Having multiple projects allows you to decide which users get access to each project and workflow configuration. This means that more users can safely play around in the “sandbox” project linked to a “dev” Github branch, but you can be more controlled about who has access to a “prod” project linked to a “main/prod” Github branch.
See these docs for recommendations on how to structure your Github repository to support syncing for production and test projects to the same repo.
Also note that there is an open feature request for more robust support with managing sandbox/production projects and deployments - comment here with your thoughts and ideas!
Can you please point me in the right direction for starting the configuration for GitHub sync on a local instance - within he project settings it tells me to contact the superuser, which I am for this instance. When I look in the super user settings I do not see anywhere to enable GitHub Sync, either per project or in general.
Now that I’ve looked into creating the GitHub app, some further docs on that would be nice - some required things are not clear, like the webhook URL for setting up the app.
Hey @Cord42 , sorry for confusion. You’re right - our documentation isn’t clear enough on this. We’ll update it accordingly.
To clarify:
-
There isn’t a specific setting within the platform to toggle GitHub Sync on or off. The feature is enabled by configuring the required environment variables, as listed in our deployment guide: lightning/DEPLOYMENT.md at main · OpenFn/lightning · GitHub
When we mention contacting the superuser, we’re assuming they know why it isn’t enabled, as they would have configured these environment variables. -
Regarding the GitHub App configuration for localhost deployment, here are the specific URLs you’ll need:
- Homepage URL:
http://localhost:4000
- Callback URL for authorizing users:
http://localhost:4000/oauth/github/callback
(Do NOT check the two checkboxes in this section requesting Device Flow and OAuth.) - Setup URL for Post installation:
http://localhost:4000/setup_vcs
(Check the box for Redirect on update)
Note that you don’t need to configure a webhook URL.
I hope this makes it clearer now. Please let us know if you encounter any other unclear areas or have additional questions as you proceed with the configuration.