Skip to main content

GitHub Integration

Modern platform services able to fetch your code from GitHub and deploy it to the cloud. This page explains how to integrate your GitHub repository to DOM Cloud.

Cloning from a Private Repository

While cloning from a public repository won't take additional steps, a private repository requires a few more steps so we can clone it from our servers.

DOM Cloud gives you SSH access and with that alone, you can clone your repo in ~/public_html yourself just like how would you clone a private repo from your local terminal.

With that said, there's a secure way and less but quicker one.

Secure Way (with Deploy Keys)

Deploy keys are SSH keys that grant read-only (or read-write) access to a repository. They are ideal for production servers because it will only allow access to a single repository, your other private repositories won't be exposed.

When you enter a GitHub private repo URL, you'll be prompted to click the Attach deploy key button.

Then a dialog box appear to let you enter the newly generated key to your repo. This is a valid public key from ssh-keygen that need to be inserted to be one of your repo's deploy key. Click Open repository's deploy key configuration for a quick shortcut.

Then click I have added this public key to finish the setup. A private key will be inserted as part of deployment script. You don't have to do anything for that.

info

To enable editing and pushing new commits to a private repo directly from inside the server, check the Allow write access box.

Git Token (less secure)

You can use a Git token to clone your private repository. This is less secure because it will give access to all your private repositories.

All you have to do is create a Personal Access Token with repo scope, and use it as your password when cloning your repository.

source: https://:<your-github-token-here>@github.com/yourusername/yourrepo.git

Webhook

DOM Cloud provides public endpoint available to perform remote control for certain github events, this feature can be leveraged using GitHub action. Most of the time this feature is useful for keep syncing files between GitHub repo and files on DOM Cloud.

To begin setup the webhook, go to Deploy tab and write the commands you want to execute and click "Setup Webhook". You'll be prompted with this dialog:

image

The YAML file generated is a GitHub CI File that uses workflow-webhook and the commands to run are in list of data prop in the end of file. Now, put this file to .github/workflows/domcloud.yml (can be any filename) and before you push it to GitHub, add these WEBHOOK_SECRET, WEBHOOK_AUTH to Repository Secrets. Note you might need to change "main" to your repo's desired main branch.

Note if your host domain URL, username, or password is changed, then you need to update these variables accordingly. Changing the data prop doesn't change secrets. Maximum webhook calls is 50 times a day for a website.

An example of working Webhook is DOM Cloud's Bridge repo, applying git pull of the software to all DOM Cloud servers once a commit has been pushed.

If you wanted to build your app binaries via CI instead of from server, you can see this example repo. Doing it this way is beneficial to save your storage quota.