-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* containerize gantry and move from spack to requirements.txt * virtualenv loading is not user-agnostic * add a few more env variables to docs * adding spack environment back * preserve pyproject.toml changes for another PR * fix: Dockerfile prune unnecessary FROM * doc updates * revert spack changes fully * make .gitignore changes null
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# from https://github.com/GoogleContainerTools/distroless/blob/main/examples/python3-requirements/Dockerfile | ||
|
||
# Build a virtualenv using the appropriate Debian release | ||
# * Install python3-venv for the built-in Python3 venv module (not installed by default) | ||
# * Install gcc libpython3-dev to compile C Python modules | ||
# * In the virtualenv: Update pip setuputils and wheel to support building new packages | ||
FROM debian:12-slim AS build | ||
RUN apt-get update && \ | ||
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \ | ||
python3 -m venv /venv && \ | ||
/venv/bin/pip install --upgrade pip setuptools wheel | ||
COPY requirements.txt /requirements.txt | ||
RUN /venv/bin/pip install --disable-pip-version-check -r /requirements.txt | ||
|
||
# Copy the virtualenv into a distroless image | ||
FROM gcr.io/distroless/python3-debian12:nonroot | ||
COPY --from=build /venv /venv | ||
COPY ./gantry /app/gantry | ||
WORKDIR /app | ||
ENTRYPOINT ["/venv/bin/python", "-m", "gantry"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Deploy | ||
|
||
Gantry is distributed via containers. You can build an image using your favorite container engine: | ||
|
||
```bash | ||
podman build -t gantry . | ||
``` | ||
|
||
In order for the application to run, you'll need to supply two things to the image: environment variables and a database file. | ||
|
||
When running locally, you can get by with supplying an env file and volume, like so: | ||
|
||
```bash | ||
podman run -it -p 8080:8080 --env-file .env -v LOCAL_DB_PATH:DB_FILE gantry | ||
``` | ||
|
||
Where `LOCAL_DB_PATH` is the absolute path to the database file on your local system. `DB_FILE` is where you would like the application to access the database. Make sure this lines up with your environment. | ||
|
||
When running Gantry within Kubernetes, you could use [persistent volumes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/). The only requirement is that the database should exist outside the container for backup and persistence purposes. | ||
|
||
## Environment | ||
|
||
The following variables should be exposed to the container. Those **bolded** are required and do not have defaults set in the application. | ||
|
||
- **`PROMETHEUS_URL`** - should end in `/api/v1` | ||
- `PROMETHEUS_COOKIE` - only needed when Prometheus requires authentication | ||
- **`GITLAB_URL`** - should end in the endpoint for the Spack project API: `/api/v4/projects/2` | ||
- **`GITLAB_API_TOKEN`** - this token should have API read access | ||
- **`GITLAB_WEBHOOK_TOKEN`** - coordinate this value with the collection webhook | ||
- **`DB_FILE`** - path where the application can access the SQLite file | ||
- `MAX_GET_SIZE` - the maximum `GET` request (in bytes), default is 8MB | ||
- `GANTRY_HOST` - web app hostname, default is `localhost` | ||
- `GANTRY_PORT` - web app port, default is `8080` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
aiohttp==3.9.3 | ||
aiosignal==1.3.1 | ||
aiosqlite==0.19.0 | ||
attrs==23.2.0 | ||
frozenlist==1.4.1 | ||
idna==3.6 | ||
multidict==6.0.5 | ||
yarl==1.9.4 |