Skip to content

sahil28297/deployer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deployer

Deploy test instances on DigitalOcean by commenting on a PR on GitHub.

Prerequisite

  • DigitalOcean account and DigitalOcean access token.
  • Snapshot ID of a droplet which will be used as base image of the test instance.
  • GitHub credentials and an access token with 'repo' access.

Setup

  • Setup a Frappe Bench environment and install this app to your site.

  • Set the webhook URL in GitHub to point to this method:

    https://[hostname]/api/method/deployer.deployer.doctype.deployer_instance.deploy_handler.handle_event
    

    and content_type as application/json

  • Add the webhook secret to common_site_config.json as:

    {
        "deployer_secret": "your-webhook-secret-key"
    }
    

    ensure that the secret key is the same as the one provided to GitHub

Site Configurations

Login to the site where deployer app is installed. Open Deployer Config doctype and fill in the fields accordingly and click on Save.

deployer_config

  • Max Instances: Maximum number of test instances that can be active at any particular time (eg.: 10).

  • Allowed Requesters: List of GitHub username who are allowed to create a test instance. Any other user commenting on the PR won't trigger the deployer. eg.:

    sahil28297
    thunderbottom
    .....
    .....
    
  • Bot Username: GitHub username of the bot that will be used in the command to trigger the deploy.

  • Bot Password: GitHub password of the above mentioned bot.

  • GitHub Access Token: GitHub Access Token of the above mentioned bot with repo access.

  • Branch Whitelist: List of branches on GitHub where the PRs are sent. Deployer will trigger a deploy only for the PRs that are sent on these whitelisted branches.

  • Digital Ocean Access Token: API key for the DigitalOcean account.

  • Digital Ocean Snapshot ID: snapshot id of the snapshot/image which will be used as the base image of the test instance.

Usage

  • Open the PR on your browser for which the test instance is to be deployed.
  • Comment on the PR the following command @bot_username create instance where bot_username is the GitHub username of the bot entered in the Deployer Config DocType. Screenshot from 2020-11-26 16-00-30
  • An instance will be created on DigitalOcean under the default Project. The deployer will then pull the changes in your PR on the test instance, run bench setup requirements, bench build, bench migrate, bench restart on that bench, and add a check to your PR on GitHub, clicking on 'details' will redirect you to the created instance on your browser. Screenshot from 2020-11-26 16-01-51

Built using Frappe Framework

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published