-
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
- Loading branch information
Showing
7 changed files
with
66 additions
and
27 deletions.
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 |
---|---|---|
@@ -1,17 +1,8 @@ | ||
#------------------------------------------------------------------------ | ||
# Load Development Spack Environment (If Spack is installed.) | ||
# | ||
# Run 'direnv allow' from within the cloned repository to automatically | ||
# load the spack environment when you enter the directory. | ||
#------------------------------------------------------------------------ | ||
if type spack &>/dev/null; then | ||
. $SPACK_ROOT/share/spack/setup-env.sh | ||
spack env activate -d . | ||
fi | ||
source $HOME/.venvs/gantry/bin/activate | ||
|
||
#------------------------------------------------------------------------ | ||
# Load Environment Variables from .env (if files exists) | ||
#------------------------------------------------------------------------ | ||
if [ -e .env ]; then | ||
source .env | ||
fi | ||
fi |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
__pycache__ | ||
.env | ||
spack.lock | ||
.spack-env | ||
db/*.db |
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,23 @@ | ||
# 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 | ||
|
||
# Build the virtualenv as a separate step: Only re-execute this step when requirements.txt changes | ||
FROM build AS build-venv | ||
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 /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,28 @@ | ||
# 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 DB_PATH:/db gantry | ||
``` | ||
|
||
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 |
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 |
---|---|---|
|
@@ -2,3 +2,8 @@ | |
profile = "black" | ||
skip_gitignore = true | ||
color_output = true | ||
|
||
dependencies = [ | ||
"aiohttp", | ||
"aiosqlite" | ||
] |
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 |
This file was deleted.
Oops, something went wrong.