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.py
script at the beginning of every hour - The
hubcap.py
script creates a temporary directory to hold cloned git repositories (default is/target
) hubcap.py
creates 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 the
CONFIG
environment variable: Settings > Config Vars > Reveal Config VarsCONFIG
: copy format fromconfig.example.json
and adjust values as needed
- (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 login
To 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:main
For off-schedule ad hoc executions, run the following from the deploy directory above:
heroku run python3 hubcap.py
heroku
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 -v
The 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)