Skip to content

Commit 4850dd6

Browse files
keithrfungrkorsak
andauthored
📝 Improve Documentation (#84)
* 📝. Add Docker Documentation * Link DockerHub images in the README badges Co-authored-by: Ryan Korsak <rkorsak@gmail.com>
1 parent 2d559ce commit 4850dd6

File tree

3 files changed

+66
-12
lines changed

3 files changed

+66
-12
lines changed

README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
# 🗳️ ElectionGuard Web API
44

5-
![docker version](https://img.shields.io/docker/v/electionguard/electionguard-web-api) ![docker pulls](https://img.shields.io/docker/pulls/electionguard/electionguard-web-api) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/microsoft/electionguard-web-api.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/microsoft/electionguard-web-api/context:python) [![Total alerts](https://img.shields.io/lgtm/alerts/g/microsoft/electionguard-web-api.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/microsoft/electionguard-web-api/alerts/) [![Documentation Status](https://readthedocs.org/projects/electionguard-web-api/badge/?version=latest)](https://electionguard-web-api.readthedocs.io) [![license](https://img.shields.io/github/license/microsoft/electionguard-web-api)](LICENSE)
5+
[![docker version](https://img.shields.io/docker/v/electionguard/electionguard-web-api)](https://hub.docker.com/r/electionguard/electionguard-web-api) [![docker pulls](https://img.shields.io/docker/pulls/electionguard/electionguard-web-api)](https://hub.docker.com/r/electionguard/electionguard-web-api) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/microsoft/electionguard-web-api.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/microsoft/electionguard-web-api/context:python) [![Total alerts](https://img.shields.io/lgtm/alerts/g/microsoft/electionguard-web-api.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/microsoft/electionguard-web-api/alerts/) [![Documentation Status](https://readthedocs.org/projects/electionguard-web-api/badge/?version=latest)](https://electionguard-web-api.readthedocs.io) [![license](https://img.shields.io/github/license/microsoft/electionguard-web-api)](LICENSE)
66

7-
This is a python API that utilizes [`electionguard-python`](https://github.com/microsoft/electionguard-python) to perform ballot encryption, casting, spoiling, and tallying. This API is implemented using [FastAPI](https://fastapi.tiangolo.com/#interactive-api-docs).
7+
This is a python API that provides a **thin**, **stateless** wrapper around the [`electionguard-python`](https://github.com/microsoft/electionguard-python) library to perform ballot encryption, casting, spoiling, and tallying. This API is implemented using [FastAPI](https://fastapi.tiangolo.com/#interactive-api-docs).
8+
9+
If you aren't familiar with ElectionGuard and its concepts, [take a stroll through the official documentation](https://microsoft.github.io/electionguard-python/) first!
810

911
## 👯‍♀️ Two APIs in One
1012

@@ -23,11 +25,36 @@ In practice, you will likely need to run at least one instance of each mode. We
2325
2426
- 🐳🐍 [GNU Make](https://www.gnu.org/software/make/manual/make.html) is used to simplify the commands and GitHub Actions. This approach is recommended to simplify the command line experience. This is built in for MacOS and Linux. For Windows, setup is simpler with [Chocolatey](https://chocolatey.org/install) and installing the provided [make package](https://chocolatey.org/packages/make). The other Windows option is [manually installing make](http://gnuwin32.sourceforge.net/packages/make.htm).
2527
- 🐍 [Python 3.8](https://www.python.org/downloads/) is <ins>**required**</ins> to develop this API. If developer uses multiple versions of python, [pyenv](https://github.com/pyenv/pyenv) is suggested to assist version management.
26-
- 🐍 [poetry](https://python-poetry.org/docs/) is used to configure the python environment. This can be installed via pip or pipx.
2728

2829
## 🐳 Running with Docker
2930

30-
If you run Docker and want to get started quickly, we provide a Dockerfile and docker-compose.yml.
31+
### The official Docker image
32+
33+
We host a Docker image on both [Github Packages](https://github.com/microsoft/electionguard-web-api/packages/397920) and [DockerHub](https://hub.docker.com/r/electionguard/electionguard-web-api).
34+
35+
**Note:** _GitHub Packages requires authentication to retrieve the package. This requires a GitHub Access Token and using `docker login`. [Follow GitHub instructions](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-with-a-personal-access-token)._
36+
37+
```bash
38+
# Pull the image from DockerHub
39+
docker pull docker.pkg.github.com/microsoft/electionguard-web-api/electionguard-web-api:main
40+
41+
# Start a container for the API in mediator mode, exposed on port 80 of the host machine
42+
docker run -d -p 80:8000 --env API_MODE=mediator docker.pkg.github.com/microsoft/electionguard-web-api/electionguard-web-api:main
43+
```
44+
45+
OR
46+
47+
```bash
48+
# Pull the image from DockerHub
49+
docker pull electionguard/electionguard-web-api:latest
50+
51+
# Start a container for the API in mediator mode, exposed on port 80 of the host machine
52+
docker run -d -p 80:8000 --env API_MODE=mediator electionguard/electionguard-web-api:latest
53+
```
54+
55+
### Developing locally with Docker
56+
57+
If you run Docker and want to run the code locally without Python dependencies, we provide a Dockerfile and docker-compose.yml.
3158

3259
Run both APIs at the same time:
3360

docs/index.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
![docker version](https://img.shields.io/docker/v/electionguard/electionguard-web-api) ![docker pulls](https://img.shields.io/docker/pulls/electionguard/electionguard-web-api) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/microsoft/electionguard-web-api.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/microsoft/electionguard-web-api/context:python) [![Total alerts](https://img.shields.io/lgtm/alerts/g/microsoft/electionguard-web-api.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/microsoft/electionguard-web-api/alerts/) [![Documentation Status](https://readthedocs.org/projects/electionguard-web-api/badge/?version=latest)](https://electionguard-web-api.readthedocs.io) [![license](https://img.shields.io/github/license/microsoft/electionguard-web-api)](LICENSE)
66

7-
This is a python API that utilizes [`electionguard-python`](https://github.com/microsoft/electionguard-python) to perform ballot encryption, casting, spoiling, and tallying. This API is implemented using [FastAPI](https://fastapi.tiangolo.com/#interactive-api-docs).
7+
This is a python API that provides a **thin**, **stateless** wrapper around the [`electionguard-python`](https://github.com/microsoft/electionguard-python) library to perform ballot encryption, casting, spoiling, and tallying. This API is implemented using [FastAPI](https://fastapi.tiangolo.com/#interactive-api-docs).
8+
9+
If you aren't familiar with ElectionGuard and its concepts, [take a stroll through the official documentation](https://microsoft.github.io/electionguard-python/) first!
810

911
## 👯‍♀️ Two APIs in One
1012

@@ -23,11 +25,36 @@ In practice, you will likely need to run at least one instance of each mode. We
2325
2426
- 🐳🐍 [GNU Make](https://www.gnu.org/software/make/manual/make.html) is used to simplify the commands and GitHub Actions. This approach is recommended to simplify the command line experience. This is built in for MacOS and Linux. For Windows, setup is simpler with [Chocolatey](https://chocolatey.org/install) and installing the provided [make package](https://chocolatey.org/packages/make). The other Windows option is [manually installing make](http://gnuwin32.sourceforge.net/packages/make.htm).
2527
- 🐍 [Python 3.8](https://www.python.org/downloads/) is <ins>**required**</ins> to develop this API. If developer uses multiple versions of python, [pyenv](https://github.com/pyenv/pyenv) is suggested to assist version management.
26-
- 🐍 [poetry](https://python-poetry.org/docs/) is used to configure the python environment. This can be installed via pip or pipx.
2728

2829
## 🐳 Running with Docker
2930

30-
If you run Docker and want to get started quickly, we provide a Dockerfile and docker-compose.yml.
31+
### The official Docker image
32+
33+
We host a Docker image on both [Github Packages](https://github.com/microsoft/electionguard-web-api/packages/397920) and [DockerHub](https://hub.docker.com/r/electionguard/electionguard-web-api).
34+
35+
**Note:** _GitHub Packages requires authentication to retrieve the package. This requires a GitHub Access Token and using `docker login`. [Follow GitHub instructions](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-with-a-personal-access-token)._
36+
37+
```bash
38+
# Pull the image from DockerHub
39+
docker pull docker.pkg.github.com/microsoft/electionguard-web-api/electionguard-web-api:main
40+
41+
# Start a container for the API in mediator mode, exposed on port 80 of the host machine
42+
docker run -d -p 80:8000 --env API_MODE=mediator docker.pkg.github.com/microsoft/electionguard-web-api/electionguard-web-api:main
43+
```
44+
45+
OR
46+
47+
```bash
48+
# Pull the image from DockerHub
49+
docker pull electionguard/electionguard-web-api:latest
50+
51+
# Start a container for the API in mediator mode, exposed on port 80 of the host machine
52+
docker run -d -p 80:8000 --env API_MODE=mediator electionguard/electionguard-web-api:latest
53+
```
54+
55+
### Developing locally with Docker
56+
57+
If you run Docker and want to run the code locally without Python dependencies, we provide a Dockerfile and docker-compose.yml.
3158

3259
Run both APIs at the same time:
3360

mkdocs.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
site_name: ElectionGuard Web Api
22
# site_description:
33
site_author: Microsoft
4-
# google_analytics:
4+
# google_analytics:
55
# remote_branch: for gh-deploy to GithubPages
66
# remote_name: for gh-deploy to Github Pages
7-
copyright: '© Microsoft 2020'
8-
docs_dir: 'docs'
7+
copyright: "© Microsoft 2020"
8+
docs_dir: "docs"
99
repo_url: https://github.com/microsoft/electionguard-web-api/
1010
nav:
11-
- Home: index.md
12-
theme: readthedocs
11+
- Home: index.md
12+
theme: readthedocs

0 commit comments

Comments
 (0)