COVID Policy Modelling Model Connector How-To: Publishing your connector
In this section, you will build and publish your connector. After completion, your connector will be available for others to use.
COVID Policy Modelling Model Connector Template
In this how-to you will build a model connector for the COVID-UI system, using a model of your choice. After completion of the how-to, you should be able to add your specific model connector to a deployment of COVID-UI.
Contents
- COVID Policy Modelling Model Connector How-To: Publishing your connector
- COVID Policy Modelling Model Connector Template
Assumptions
The main body of these instructions assume the following:
- The connector will be developed in a separate source repository to the model.
- The connector will be hosted on GitHub, and use GitHub Actions and GitHub Packages Container Registry
- The connector will be developed publicly.
The instructions also contain additional notes to support any of the following:
- The connector will be developed privately.
Publishing your connector
-
Push your code:
$ git push
-
In your browser, go to the URL: https://github.com/<OWNER>/<MODEL>/connector. You should see your latest code listed.
-
Click the “Actions” tab. Listed on the page, you should see a line for your latest commit, next to either a yellow circle, a green circle with a tick or a red circle with a cross.
- If the circle is yellow, your connector is being built, and you should wait until it changes to red or green, which should take a minute or two.
- If the circle is red, something has went wrong. Click on your commit, then “publish”, and you should be shown an error. Try to figure out what has went wrong, fix the code, then commit and push again.
- If the circle is green, your connector has been built successfully.
-
Click the “Code” tab. Under the “Packages” heading, you should now see your connector listed as “<MODEL>-connector/<MODEL>-connector”.
- Click on “Packages” then select the package for your connector.
Select “Package settings”, then under “Danger Zone”, select “Change visibility”, and set the visibility to “Public”.
Enter the repository name to confirm.
- If your connector will be developed privately, refer to the notes below.
-
Test you can access your package now.
$ docker pull ghcr.io/<OWNER>/<MODEL>-connector/<MODEL>-connector ... Using default tag: latest latest: Pulling from <OWNER/<MODEL>-connector/<MODEL>-connector ... Status: Downloaded newer image for ghcr.io/<OWNER>/<MODEL>-connector/<MODEL>-connector:latest ghcr.io/<USERNAME>/<MODEL>-connector/<MODEL>-connector:latest
-
Choose an appropriate version number (e.g. v0.0.1), tag your model connector and push the tag.
$ git tag v<VERSION> $ git push --tags
-
Return to the “Actions” tab, and you should see a line for your tag. Wait again for it to be built successfully.
-
Test you can access the tagged version of your package.
$ docker pull ghcr.io/<OWNER>/<MODEL>-connector/<MODEL>-connector:<VERSION> ...
Next steps
Follow the steps for deploying your connector.
Additional steps for alternative approaches
The connector will be developed privately
Do not carry out the step to make your package public.
Instead you must give read access to the @covid-policy-modelling-bot user, either directly or by giving it read access to the repository and selecting to inherit those permissions in the package.
When later accessing your package, you may first be required to log in to the GitHub Packages Container Registry using docker login ghcr.io
.