This application is hosted on Heroku, but it can also be executed in production mode locally.
It is designed to do the following:
- Use a cron schedule to execute the main
hubcap.pyscript at the beginning of every hour - The
hubcap.pyscript creates a temporary directory to hold cloned git repositories (default is/target) hubcap.pycreates a JSON spec file for each git repo + git tag combo within the/target/hub.getdbt.com/data/packages/directory (by default)- It opens pull requests against dbt-labs/hub.getdbt.com for any new versions of dbt packages
The commands below assume a production application named dbt-hubcap. Replace with dbt-hubcap-staging for the staging version of the application.
- Use the Heroku Scheduler to set the following cron schedule:
- Job:
python3 hubcap.py - Schedule: Every hour at :00
- Dyno size: Hobby / Standard-1X
- Job:
- Configure environment variables: Settings > Config Vars > Reveal Config Vars
CONFIG: copy format fromconfig.example.jsonand adjust values as neededGIT_EXEC_PATH:/app/.apt/usr/lib/git-core
- Setup
gitto be available at app run time. See these instructions for context.heroku buildpacks:add --index 1 heroku-community/apt --app dbt-hubcap
- (Re-)deploy the application using the instructions below. See these instructions for context.
It is possible to configure automatic deploys from GitHub to deploy automatically whenever a specific branch is pushed to: Deploy > Deployment method > GitHub > Connect to GitHub.
All of the following steps can be performed locally to initiate a remote deploy on Heroku.
Download and install the Heroku CLI.
If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key.
heroku loginTo deploy or re-deploy the latest changes:
git clone [email protected]:dbt-labs/hubcap.git
cd hubcap
git pull origin
git checkout main
heroku git:remote -a dbt-hubcap
git push heroku main:mainFor off-schedule ad hoc executions, run the following from the deploy directory above:
heroku run python3 hubcap.pyheroku is the remote that Heroku will use for deploys. origin is the source code hosted on GitHub.
Pulling from origin will get the latest code in GitHub. Pushing to heroku will deploy that latest code to the Heroku app.
You can use the following command to list the tracked repositories:
git remote -vThe result should be something like the following:
heroku https://git.heroku.com/dbt-hubcap.git (fetch)
heroku https://git.heroku.com/dbt-hubcap.git (push)
origin [email protected]:dbt-labs/hubcap.git (fetch)
origin [email protected]:dbt-labs/hubcap.git (push)