Skip to content

Commit 2f2331a

Browse files
committed
Add ISCIII Beacon Podman deployment
1 parent dcd0a03 commit 2f2331a

32 files changed

Lines changed: 1756 additions & 544 deletions

.env.example

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# =============================================================================
2+
# Beacon v2 deployment
3+
# =============================================================================
4+
5+
APP_NAME=beacon
6+
7+
# Repository and persistent bind mounts
8+
APP_ROOT=/opt/containers_apps/beacon/beacon2-pi-api
9+
BIND_ROOT=/srv/containers/bind/beacon
10+
11+
# Logs
12+
APP_LOG_DIR=/var/log/local/beacon/apps
13+
APACHE_LOG_DIR=/var/log/local/beacon/apache
14+
15+
# Public endpoint
16+
PUBLIC_SCHEME=http
17+
PUBLIC_HOST=beaconaf-isciiiciber.isciiides.es
18+
PUBLIC_PORT=8443
19+
20+
# Published ports
21+
BEACON_API_PORT=5050
22+
ADMIN_UI_PORT=3001
23+
TEMPLATE_UI_PORT=3000
24+
KEYCLOAK_PORT=8082
25+
KEYCLOAK_HTTPS_PORT=9991
26+
MONGO_PORT=8085
27+
MONGO_EXPRESS_PORT=8081
28+
29+
# Container images
30+
TEMPLATE_UI_IMAGE=ghcr.io/ega-archive/beacon-template-ui:main
31+
MONGO_IMAGE=docker.io/library/mongo:8.2.3
32+
POSTGRES_IMAGE=docker.io/library/postgres:15
33+
KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:18.0.0
34+
MONGO_EXPRESS_IMAGE=docker.io/library/mongo-express
35+
APACHE_IMAGE=registry.access.redhat.com/ubi9/httpd-24
36+
37+
# Container names
38+
BEACON_CONTAINER=beaconprod
39+
ADMIN_UI_CONTAINER=admin-ui
40+
TEMPLATE_UI_CONTAINER=template-ui
41+
MONGO_CONTAINER=mongoprod
42+
POSTGRES_CONTAINER=idp-db
43+
KEYCLOAK_CONTAINER=idp
44+
MONGO_EXPRESS_CONTAINER=mongo-express
45+
APACHE_CONTAINER=apache-beacon
46+
47+
# Rootless container users
48+
MONGO_UID=999
49+
MONGO_GID=999
50+
POSTGRES_UID=999
51+
POSTGRES_GID=999
52+
BEACON_UID=10001
53+
BEACON_GID=0
54+
APACHE_UID=1001
55+
APACHE_GID=0
56+
57+
# MongoDB
58+
MONGO_DATABASE=beacon
59+
MONGO_AUTH_SOURCE=admin
60+
MONGO_ROOT_USERNAME=root
61+
MONGO_ROOT_PASSWORD=CHANGE_ME
62+
63+
# PostgreSQL
64+
POSTGRES_DB=keycloak
65+
POSTGRES_USER=admin
66+
POSTGRES_PASSWORD=CHANGE_ME
67+
68+
# Keycloak
69+
KEYCLOAK_ADMIN=admin
70+
KEYCLOAK_ADMIN_PASSWORD=CHANGE_ME
71+
KEYCLOAK_RELATIVE_PATH=/auth
72+
73+
# Admin UI / Django
74+
SECRET_KEY=CHANGE_ME_GENERATE_A_STABLE_SECRET
75+
SQL_DATABASE=/data/db.sqlite3
76+
77+
# Mongo seed data inside the MongoDB container
78+
79+
# MongoDB connection used by Beacon API
80+
MONGO_HOST=mongo
81+
MONGO_INTERNAL_PORT=27017
82+
MONGO_CERTIFICATE=
83+
MONGO_CAFILE=
84+
MONGO_CLUSTER=false
85+
86+
# Admin UI container user
87+
ADMIN_UI_UID=100
88+
ADMIN_UI_GID=101
89+
90+
# Mongo Express web authentication
91+
92+
# Public hostname for the API-only virtual host
93+
API_PUBLIC_HOST=apibeacon-isciiiciber.isciiides.es

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ beacon/connections/mongo/data/db/*
1313
adminui/adminclient/migrations/*
1414
adminui/node_modules
1515
*.vcf.bgz
16-
beacon/conf/conf.py
16+
beacon/conf/conf.py
17+
# Local certificates and persistent container data
18+
certs/
19+
beacon/connections/mongo/data/db/
20+
beacon/connections/mongo/data/configdb/
21+
postgres/data/

adminui/Dockerfile

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,75 @@
1-
FROM python:3.13-slim-bookworm as builder
1+
FROM python:3.13-slim-bookworm AS builder
22

33
RUN apt-get update \
4-
&& apt-get -y install g++ ca-certificates curl gnupg \
5-
&& apt-get clean
4+
&& apt-get install -y --no-install-recommends \
5+
g++ \
6+
ca-certificates \
7+
curl \
8+
gnupg \
9+
&& rm -rf /var/lib/apt/lists/*
610

711
ENV NODE_MAJOR=20
8-
RUN mkdir -p /etc/apt/keyrings && \
9-
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
10-
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
11-
apt-get update && apt-get install nodejs -y
12+
13+
RUN mkdir -p /etc/apt/keyrings \
14+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
15+
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
16+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" \
17+
> /etc/apt/sources.list.d/nodesource.list \
18+
&& apt-get update \
19+
&& apt-get install -y nodejs \
20+
&& rm -rf /var/lib/apt/lists/*
1221

1322
WORKDIR /usr/src/app
1423

15-
ENV PYTHONDONTWRITEBYTECODE 1
16-
ENV PYTHONUNBUFFERED 1
24+
ENV PYTHONDONTWRITEBYTECODE=1
25+
ENV PYTHONUNBUFFERED=1
1726

18-
COPY . .
19-
RUN pip install --upgrade pip && pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements.txt
27+
COPY requirements.txt .
28+
29+
RUN pip install --upgrade pip \
30+
&& pip wheel --wheel-dir /wheels -r requirements.txt
31+
32+
RUN pip install --no-cache-dir /wheels/*
2033

2134
COPY package.json package-lock.json ./
22-
RUN npm install
2335

24-
RUN pip install -r requirements.txt && npm run tailwind:build && python manage.py collectstatic --noinput
36+
RUN npm ci
2537

26-
FROM python:3.13-slim-bookworm
38+
COPY . .
2739

28-
RUN apt-get update && apt-get upgrade -y && apt-get clean
40+
RUN npm run tailwind:build
2941

30-
RUN mkdir -p /home/app
42+
RUN python manage.py collectstatic --noinput
3143

32-
RUN addgroup --system app && adduser --system --group app
44+
FROM python:3.13-slim-bookworm
45+
46+
RUN apt-get update \
47+
&& apt-get upgrade -y \
48+
&& rm -rf /var/lib/apt/lists/*
49+
50+
RUN addgroup --system app \
51+
&& adduser --system --group app
3352

3453
ENV HOME=/home/app
3554
ENV APP_HOME=/home/app/web
36-
RUN mkdir $APP_HOME
55+
56+
RUN mkdir -p $APP_HOME
57+
3758
WORKDIR $APP_HOME
3859

39-
ENV PYTHONDONTWRITEBYTECODE 1
40-
ENV PYTHONUNBUFFERED 1
41-
ENV ENVIRONMENT prod
42-
ENV TESTING 0
43-
ENV PYTHONPATH $APP_HOME
60+
ENV PYTHONDONTWRITEBYTECODE=1
61+
ENV PYTHONUNBUFFERED=1
62+
ENV ENVIRONMENT=prod
63+
ENV TESTING=0
64+
ENV PYTHONPATH=$APP_HOME
4465

45-
COPY --from=builder /usr/src/app/wheels /wheels
66+
COPY --from=builder /wheels /wheels
4667
COPY --from=builder /usr/src/app/requirements.txt .
47-
COPY --from=builder /usr/src/app/media $APP_HOME/media
48-
RUN pip install --upgrade pip
49-
RUN pip install --no-cache /wheels/*
5068

51-
COPY . $APP_HOME
69+
RUN pip install --upgrade pip \
70+
&& pip install --no-cache-dir /wheels/*
71+
72+
COPY --from=builder /usr/src/app $APP_HOME
5273

5374
RUN chown -R app:app $HOME
5475

adminui/adminbackend/forms/admin_settings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ def __init__(self, *args, **kwargs):
3333
super(AdminForm, self).__init__(*args, **kwargs)
3434
# assign a (computed, I assume) default value to the choice field
3535
self.fields['Email'].widget.attrs['readonly'] = True
36+
37+
groups = Group.objects.all()
38+
self.fields['Groups'].choices = [(group.name, group.name) for group in groups]
3639

3740
Email = forms.EmailField()
38-
groups = Group.objects.all()
39-
groups_choices=[(group.name,group.name) for group in groups]
40-
Groups = forms.ChoiceField(choices=groups_choices)
41+
Groups = forms.ChoiceField(choices=[])

0 commit comments

Comments
 (0)