Skip to main content

Git Sync Global

You can enable Git Sync globally to effectively manage version control for all your apps on DronaHQ by linking them to a Git hosting provider, like GitHub, GitLab, Bitbucket, and others in single Git repository. This integration simplifies the process of monitoring changes, facilitating rollbacks, and promoting collaborative work via git branches. Moreover, it allows for seamless connectivity to any app, whether it resides within the same account or another, enabling users to effortlessly transition between diverse environments.

info

For Git sync to work the user needs Git hosting service which supports SSH protocols and currently it is available on self-hosted and not available on the cloud.

DronaHQ Git Sync Workflow

GitHub SSH URL
Git Recommended Workflow

Here, Staging and Production instances are locked for editing. All App changes is done on Development instance and changes are pushed into dev branch in git. Merge request from dev branch should go into staging instance and you should sync all your apps in your staging instance. Once, your Staging instance is working as expected, you should then proceed with merging staging branch into main branch and sync All your Apps in Production instance.

Git Workflow

Prerequisite

To connect your apps on DronaHQ with Git, you must have a GitHub account, or any other version control accounts such as GitLab, Bitbucket, etc., and must have basic knowledge of git operations.

Create SSH Key in each DronaHQ Instance

You need to create SSH key in each of your DronaHQ instances. Navigate to Profile -> Account Settings -> Integrations -> SSH Key Management -> + Add Key. Provide a friendly name and Generate & Save Key. Make a note of the friendly name that will be required later for setting up environment variable and public key that will be required for setting up Git repository later.

Setting up Git Sync Environment Variables

Below Environment variables to be configured -

Environment VariableDescription
GIT_SYNC_IS_GLOBALThis variable specifies if you want to enable Global Git Sync feature. By default it is set to false
GIT_SYNC_SSH_REPO_URLSSH Url of the Git Repo which you want all your apps to be checked into. Mandatory if GIT_SYNC_IS_GLOBAL is set to true.
GIT_SYNC_BRANCH_NAMEBranch name of the above repo url which this instance should be synced with. For production instance, ideally use main branch.
GIT_SYNC_AUTH_SSH_KEY_FRIENDLY_NAMEFriendly Key name you have used for creating SSH key from SSH Key management. The public key of this friendly key should be added in your GIT repo with read/write rights to above GIT Sync repo.
GIT_SYNC_IS_AUTO_SAVEEnable this to automatically save your app changes to your GIT repo.
GIT_SYNC_IS_LOCK_APP_EDITEnable this to disable editing of you app that is added to GIT. Ideally, you should set to true for your production instance and set it to false for your development instance.
GIT_SYNC_CREATE_REPO_ON_APP_ADDEnable this to automatically add new apps to git. Ideally, you should set to true for your development instance if you want all apps to be automatically added to git and set it to false for your production instance. By default, it is set to false.

Setup Git repo

Various Git providers are supported. For detailed instructions refer here

  • Github
  • Gitlab
  • Bitbucket

Git Sync In Action

Add to Git

Add to Git option will check in the App's JSON in version control in the following location - App -> <App Name> -> <App name>.json. If GIT_SYNC_IS_AUTO_SAVE is set to true, any changes you perform in the app will be auto-saved into git with auto-commit message.

Remove from Git

Removing from Git will delete the App's entire Folder from git.

Push changes to Git

Its recommended to set GIT_SYNC_IS_AUTO_SAVE environment variable to true so that any changes you make in your app is auto-committed into git.

Pull changes from Git

In case, another user have made updates to the same app, DronaHQ will auto-detect the remote changes and will notify you of the remote changes and will ask you to take update before making any changes in the app.

Git Pull Changes
Git Pull Changes

Once the Changes has been pulled successfully, you will see App pull Successful! message.

Sync Apps from Git Repo

When you have multiple instances setup, Sync Apps option enables you to sync all your Apps across instances (Newly added, Updated and Delete Apps) from a single overview sidebar.

Below are the various options available

APPS ADDED Section

  1. Install option to add this app in current instance.
  2. Install & Release option if this app has been published in other instance. This option will add this app in current instance and also publish it for end user.

APPS UPDATED Section

  1. Update option to update this app in the current instance.
  2. Update & Release option if this app has been modified and published in other instance. This option will update this app in current instance and also publish it for end user.

APPS DELETED Section

  1. This section lists all the Apps deleted in other instance. You can use Delete option to remove this app from the current instance.

Setting up on supported Git providers

Adding SSH Keys to Git Service Accounts

  1. To add this SSH key to your GitHub account, navigate to GitHub > Settings > SSH and GPG Keys > New SSH key.
  1. Provide the required details, including a Title, and paste the SSH key copied from the app in DronaHQ. Click Add SSH key. Confirmation and a password prompt may follow.
info

The default branch for the connection is main for GitHub.

Adding SSH Keys to a particular GitHub Repository

This option is specially helpful for enterprise accounts which do not have access to SSH & GPG Keys option in your personal settings.

  1. To add this SSH key to your GitHub repo, navigate to GitHub -> Repository -> Settings -> Deploy Keys > Add deploy key.
  1. Provide the required details, including a Title, and paste the SSH key copied from the app in DronaHQ. Also enable Allow write access checkbox. Click Add key. Confirmation and a password prompt may follow.

Adding SSH Key in GitLab

  1. To add this SSH key to your GitLab account, go to GitLab > User Settings > SSH Keys.
  1. Provide the necessary details, such as Title and Expiry date, and paste the SSH key copied from the app in DronaHQ. Click Add key.

Adding SSH Key in Bitbucket

  1. To add this SSH key to your Bitbucket account, visit Bitbucket > Settings > SSH Keys (under security) > Add key. Note that you need to add the key at the account level, not the repository level.
  1. Provide the necessary details, including the Label, and paste the SSH key copied from the app in DronaHQ. Click Add key.