Skip to content

Commit

Permalink
feat(docs): add structure and deploy-apis-instance documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Jun 22, 2023
1 parent afcd423 commit c9f2724
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div align="center">

# Prosopography and Networks Workflows

</div>

This repository contains a collection of github workflows that are in use in
various repositories of the Prosopograhy and Networks group at the
[ACDH-CH](https://github.com/acdh-oeaw).

## Workflows

* [deploy-apis-instance.yml](docs/deploy-apis-instance.md)

* poetry-black.yml

* poetry-deptry.yml

* poetry-djlint.yml

* poetry-ruff.yml
60 changes: 60 additions & 0 deletions docs/deploy-apis-instance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# `deploy-apis-instance.yml`

Deploy an APIS instance on the default cluster. Use like this:

```yml
name: deploy
on:
push:

jobs:
deploy:
uses: acdh-oeaw/prosnet-workflows/.github/workflows/deploy-apis-instance.yml@dev
secrets: inherit
```
The repository running this workflow has to contain two things:
* a `pyproject.toml` file
* a `wsgi.py` file

The `pyproject.toml` file should contain the definition of your APIS setup, i.e. something like this:
```toml
[tool.poetry]
name = "some-apis-instance"
version = "0.1.0"
description = "Some APIS instance"
authors = ["Jane Doe"]
license = "MIT"
packages = [{include = "apis_ontology"}]
[tool.poetry.dependencies]
python = ">=3.11,<3.12"
django = ">=4.1,<4.2"
apis-core = { git = "https://github.com/acdh-oeaw/apis-core-rdf.git", branch = "main" }
webpage = { git = "https://github.com/acdh-oeaw/apis-webpage.git", branch = "main" }
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
```

The `pyprojec.toml` above lists a package `apis_ontology` that should be
installed. In this case this should also be part of the repository - but it
could also be located somewhere else.

The `wsgi.py` is used by gunicorn to start the APIS instance. A simple one could look like this (which is basically the default from Djangos `startproject`):

```python
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apis_ontology.settings.server_settings')
application = get_wsgi_application()
```

For the workflow to work, you have to set some environment variables and secrets in the repository (*Settings* -> *Secrets and variables* -> *Actions*):

Variables:
* `APP_NAME`
* `KUBE_NAMESPACE`
* `PUBLIC_URL`
* `SERVICE_ID`

0 comments on commit c9f2724

Please sign in to comment.