Skip to content

Commit 42b31d2

Browse files
authored
Added Dockerfiles and Helm charts needed to build and deploy containers to run a Murfey data transfer and processing environment
1 parent 1dd1c29 commit 42b31d2

File tree

12 files changed

+378
-0
lines changed

12 files changed

+378
-0
lines changed

.bumpversion.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,23 @@ replace = '__version__ = "{new_version}"'
1212
filename = "pyproject.toml"
1313
search = 'version = "{current_version}"'
1414
replace = 'version = "{new_version}"'
15+
16+
[[tool.bumpversion.files]]
17+
filename = "Helm/Chart.yaml"
18+
search = 'version: {current_version}'
19+
replace = 'version: {new_version}'
20+
21+
[[tool.bumpversion.files]]
22+
filename = "Helm/charts/murfey-instrument-server-clem/Chart.yaml"
23+
search = 'version: {current_version}'
24+
replace = 'version: {new_version}'
25+
26+
[[tool.bumpversion.files]]
27+
filename = "Helm/charts/murfey-rsync/Chart.yaml"
28+
search = 'version: {current_version}'
29+
replace = 'version: {new_version}'
30+
31+
[[tool.bumpversion.files]]
32+
filename = "Helm/charts/murfey-server/Chart.yaml"
33+
search = 'version: {current_version}'
34+
replace = 'version: {new_version}'

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ repos:
2020
name: Verifying JSON file syntax
2121
- id: check-yaml
2222
name: Verifying YAML file syntax
23+
exclude: Helm/charts/.*?/templates/deployment\.yaml
2324
args: [--allow-multiple-documents]
2425
- id: check-toml
2526
name: Verifying TOML file syntax
@@ -103,4 +104,5 @@ repos:
103104
hooks:
104105
- id: prettier
105106
name: Formatting other file types according to Prettier
107+
exclude: Helm/charts/.*?/templates/deployment\.yaml
106108
# types_or: [css, html, json, yaml]
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Build command template
2+
# podman build --build-arg groupid=<groupid> --build-arg userid=<userid> --build-arg groupname=<groupname> --no-cache -f path/to/Dockerfiles/murfey-instrument-server -t murfey-instrument-server:<version> path/to/python-murfey
3+
4+
# Set up the base image to build with
5+
FROM docker.io/library/python:3.12.8-slim-bullseye AS base
6+
7+
# Install Vim in base image
8+
RUN apt-get update && \
9+
apt-get upgrade -y && \
10+
apt-get install -y --no-install-recommends \
11+
rsync \
12+
vim \
13+
&& \
14+
apt-get autoremove && \
15+
rm -rf /var/lib/apt/lists/*
16+
17+
18+
# Build Murfey in a branch image
19+
FROM base as build
20+
COPY ./ /python-murfey/
21+
RUN apt-get update && \
22+
apt-get upgrade -y && \
23+
apt-get install -y --no-install-recommends \
24+
build-essential \
25+
busybox \
26+
net-tools \
27+
libpq-dev \
28+
&& \
29+
busybox --install && \
30+
python -m venv /venv && \
31+
/venv/bin/python -m pip install --upgrade \
32+
pip \
33+
build \
34+
importlib-metadata && \
35+
/venv/bin/python -m pip install /python-murfey[client,instrument-server]
36+
37+
38+
# Transfer completed Murfey build to base image
39+
FROM base
40+
41+
# Define external build arguments
42+
ARG groupid
43+
ARG groupname
44+
ARG userid
45+
46+
# Copy completed Murfey build across and set user and group permissions
47+
COPY --from=build /venv/ /venv/
48+
RUN groupadd -r -g "${groupid}" "${groupname}" && \
49+
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
50+
chown -R "${userid}":"${groupid}" /venv && \
51+
chmod -R a+x /venv
52+
ENV PATH=/venv/bin:$PATH
53+
USER "${userid}":"${groupid}"

Dockerfiles/murfey-rsync

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Template build command
2+
# podman build --build-arg groupid=<groupid> --build-arg userid=<userid> --build-arg groupname=<groupname> --no-cache -f path/to/Dockerfiles/murfey-rsync
3+
4+
FROM docker.io/library/alpine:3.20
5+
# FROM alpine:3.14
6+
7+
ARG groupid
8+
ARG groupname
9+
ARG userid
10+
11+
# Add any system dependencies for the developer/build environment here
12+
RUN apk add --no-cache rsync && \
13+
addgroup -S -g "${groupid}" "${groupname}" && \
14+
adduser -S "${groupname}" -G "${groupname}" -u "${userid}" -s /bin/sh

Dockerfiles/murfey-server

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Template build command
2+
# podman build --build-arg groupid=<groupid> --build-arg userid=<userid> --build-arg groupname=<groupname> --no-cache -f path/to/Dockerfiles/murfey-server -t murfey-server:<version> path/to/python-murfey
3+
4+
# Set up the base image to build with
5+
FROM docker.io/library/python:3.12.8-slim-bullseye AS base
6+
7+
# Install Vim and PostgreSQL dependencies in base image
8+
RUN apt-get update && \
9+
apt-get upgrade -y && \
10+
apt-get install -y --no-install-recommends \
11+
libpq-dev \
12+
vim \
13+
&& \
14+
apt-get autoremove && \
15+
rm -rf /var/lib/apt/lists/*
16+
17+
18+
# Build Murfey and IMOD in a branch image
19+
FROM base as build
20+
COPY ./ /python-murfey/
21+
RUN apt-get update && \
22+
apt-get upgrade -y && \
23+
apt-get install -y --no-install-recommends \
24+
build-essential \
25+
busybox \
26+
curl \
27+
net-tools \
28+
&& \
29+
busybox --install && \
30+
python -m venv /venv && \
31+
/venv/bin/python -m pip install --upgrade \
32+
pip \
33+
build \
34+
importlib-metadata \
35+
psycopg2-binary \
36+
&& \
37+
/venv/bin/python -m pip install /python-murfey[server] && \
38+
curl https://bio3d.colorado.edu/imod/AMD64-RHEL5/imod_5.1.0_RHEL8-64_CUDA12.0.sh > imod_5.1.0_RHEL8-64_CUDA12.0.sh && \
39+
chmod +x imod_5.1.0_RHEL8-64_CUDA12.0.sh && \
40+
mkdir imod && \
41+
./imod_5.1.0_RHEL8-64_CUDA12.0.sh -dir imod -skip -y
42+
43+
44+
# Transfer completed builds to base image
45+
FROM base
46+
47+
# Pass external build arguments to this stage
48+
ARG groupid
49+
ARG groupname
50+
ARG userid
51+
52+
# Copy completed Murfey and IMOD builds across and set user and group permissions
53+
COPY --from=build /venv/ /venv/
54+
COPY --from=build /imod/ /imod/
55+
RUN groupadd -r -g "${groupid}" "${groupname}" && \
56+
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
57+
chown -R "${userid}":"${groupid}" /venv && \
58+
chmod -R a+x /venv
59+
ENV PATH=/venv/bin:/imod/IMOD/bin:$PATH
60+
ENV IMOD_DIR=/imod/IMOD
61+
USER "${userid}":"${groupid}"

Helm/Chart.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
name: murfey-services
3+
description: Umbrella Helm chart for deploying the servers and daemons needed to enable Murfey to transfer and process data
4+
version: 0.16.9
5+
dependencies:
6+
- name: murfey-instrument-server-clem
7+
- name: murfey-server
8+
- name: murfey-rsync
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
name: murfey-instrument-server-clem
3+
description: Helm chart for deploying a Murfey instrument server, which executes orders to detect, modify, and transfer files on the instrument PC, and notifies the backend server about transferred files
4+
version: 0.16.9
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ .Values.appName }}
5+
namespace: {{ .Values.global.namespace }}
6+
labels:
7+
app: {{ .Values.appName }}
8+
spec:
9+
type: LoadBalancer
10+
externalTrafficPolicy: Cluster
11+
ports:
12+
{{- toYaml .Values.servicePorts | nindent 2 }}
13+
selector:
14+
app: {{ .Values.appName }}
15+
---
16+
apiVersion: apps/v1
17+
kind: Deployment
18+
metadata:
19+
name: {{ .Values.appName }}
20+
namespace: {{ .Values.global.namespace }}
21+
labels:
22+
app: {{ .Values.appName }}
23+
spec:
24+
replicas: {{ .Values.replicas }}
25+
selector:
26+
matchLabels:
27+
app: {{ .Values.appName }}
28+
template:
29+
metadata:
30+
labels:
31+
app: {{ .Values.appName }}
32+
spec:
33+
securityContext:
34+
runAsUser: {{ .Values.global.runAsUser }}
35+
runAsGroup: {{ .Values.global.runAsGroup }}
36+
volumes:
37+
# Mount config files from secrets
38+
- name: murfey-client-config
39+
secret:
40+
secretName: {{ .Values.global.murfeyClientConfigCLEMSecretName }}
41+
items:
42+
- key: {{ .Values.global.murfeyClientConfigCLEMFileName }}
43+
path: .murfey
44+
# Mount data directories
45+
{{- toYaml .Values.extraVolumes | nindent 8 }}
46+
containers:
47+
- name: {{ .Values.appName }}
48+
image: {{ .Values.image }}
49+
imagePullPolicy: Always
50+
securityContext:
51+
privileged: false
52+
volumeMounts:
53+
# Mount Murfey client config
54+
- name: murfey-client-config
55+
mountPath: /murfey/config/.murfey
56+
subPath: .murfey
57+
readOnly: false
58+
# Mount data directories
59+
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
60+
env:
61+
- name: MURFEY_CLIENT_CONFIG_HOME
62+
value: "/tmp"
63+
ports:
64+
- containerPort: {{ .Values.containerPort }}
65+
command:
66+
{{- toYaml .Values.command | nindent 12 }}
67+
args:
68+
{{- toYaml .Values.args | nindent 12 }}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
name: murfey-rsync
3+
description: Helm chart for deploying an rsync daemon, which is responsible for executing the transfer of files from the client storage directory to the server storage system
4+
version: 0.16.9
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ .Values.appName }}
5+
spec:
6+
ports:
7+
{{- toYaml .Values.servicePorts | nindent 2 }}
8+
selector:
9+
app: {{ .Values.appName }}
10+
type: ClusterIP
11+
---
12+
apiVersion: apps/v1
13+
kind: Deployment
14+
metadata:
15+
name: {{ .Values.appName }}
16+
namespace: {{ .Values.global.namespace }}
17+
spec:
18+
replicas: 1
19+
selector:
20+
matchLabels:
21+
app: {{ .Values.appName }}
22+
template:
23+
metadata:
24+
labels:
25+
app: {{ .Values.appName }}
26+
spec:
27+
securityContext:
28+
runAsUser: {{ .Values.global.runAsUser }}
29+
runAsGroup: {{ .Values.global.runAsGroup }}
30+
volumes:
31+
- name: rsyncd-conf
32+
secret:
33+
secretName: {{ .Values.global.rsyncConfigSecretName }}
34+
items:
35+
- key: {{ .Values.global.rsyncConfigFileName }}
36+
path: rsyncd.conf
37+
# Mount data directories
38+
{{- toYaml .Values.extraVolumes | nindent 8 }}
39+
containers:
40+
- name: {{ .Values.appName }}
41+
image: {{ .Values.image }}
42+
imagePullPolicy: Always
43+
resources:
44+
requests:
45+
cpu: {{ .Values.cpuRequest }}
46+
limits:
47+
cpu: {{ .Values.cpuLimit }}
48+
memory: {{ .Values.memoryLimit }}
49+
volumeMounts:
50+
# Mount rsync config files
51+
- name: rsyncd-conf
52+
mountPath: /murfey/rsync/rsyncd.conf
53+
subPath: rsyncd.conf
54+
readOnly: true
55+
# Mount data directories
56+
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
57+
ports:
58+
- containerPort: {{ .Values.containerPort }}
59+
command:
60+
{{- toYaml .Values.command | nindent 12 }}
61+
args:
62+
{{- toYaml .Values.args | nindent 12 }}

0 commit comments

Comments
 (0)