Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Dockerfiles for Murfey services and build context for Murfey frontend #450

Merged
merged 39 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2e2a7c0
Duplicated '_midpoint' function from 'murfey.client.contexts.tomo' to…
tieneupin Jan 14, 2025
6988807
Moved 'midpoint' function to 'murfey.util.tomo' to function duplication
tieneupin Jan 14, 2025
a67ae92
Added new optional dependency key for client-side instrument server
tieneupin Jan 14, 2025
45590a9
Replaced remaining instances of 'procrunner' with 'subprocess'
tieneupin Jan 14, 2025
2bb132a
Updated descriptive comments on 'pyproject.toml'
tieneupin Jan 14, 2025
bb0ec71
Implemented sanitisation to satisfy CodeQL warning on uncontrolled co…
tieneupin Jan 14, 2025
b3c8e3d
Added 'jose' as an 'instrument-server' dependency
tieneupin Jan 15, 2025
b55ae5f
Added 'jose' as a 'server' dependency
tieneupin Jan 15, 2025
933cfe6
Package is 'python-jose[cryptography], not 'jose'
tieneupin Jan 15, 2025
72548e2
Updated '_parse_rsync_stdout/stderr()' functions to read stringified …
tieneupin Jan 15, 2025
e35c6fe
Increased large files threshold to 600kB in pre-commit config
tieneupin Jan 15, 2025
087934b
Added Dockerfiles for Murfey services to repo, and add build context …
tieneupin Jan 15, 2025
33820bf
Merged recent changes from 'main' branch
tieneupin Jan 15, 2025
12b77cc
Merged recent changes from 'main' branch
tieneupin Jan 16, 2025
c73adc7
Migrated 'murfey-frontend' container resources to its own repository
tieneupin Jan 16, 2025
b94d5e6
Reverted file size check back to previous amount now that 'murfey-fro…
tieneupin Jan 16, 2025
aa472a4
Optimised build instructions for 'murfey-server' to reduce image size
tieneupin Jan 17, 2025
5f0b774
Further optimised build instructions to reduce size and set necessary…
tieneupin Jan 17, 2025
bfc624a
Made similar changes to 'murfey-instrument-server' Dockerfile
tieneupin Jan 17, 2025
d0dacc3
Optimised 'murfey-rsync' file as well
tieneupin Jan 17, 2025
6c9b4de
Fixed issue with user permissions not transferring correctly between …
tieneupin Jan 20, 2025
35bfb2a
Applied same fix to 'murfey-instrument-server' and corrected section …
tieneupin Jan 20, 2025
0f62d8d
Merged recent changes from 'main' branch
tieneupin Jan 21, 2025
1362b9e
Merged recent changes from 'main' branch
tieneupin Jan 23, 2025
7d9038f
Merged recent changes from 'main' branch
tieneupin Jan 23, 2025
155f4c4
Added IMOD installation to 'murfey-server' image and added libpq-dev …
tieneupin Jan 23, 2025
0517c26
Fixed comments
tieneupin Jan 23, 2025
84d933e
Fixed incorrect environment paths
tieneupin Jan 23, 2025
2a05d27
Merged 0.16.6 changes from 'main' branch
tieneupin Jan 24, 2025
00502e4
Removed confirmed unneeded build dependencies; updated comments
tieneupin Jan 24, 2025
8c1cde1
Merged recent changes from 'main' branch
tieneupin Jan 28, 2025
54cbb81
Added 'rsync' to list of installed packages in instrument server cont…
tieneupin Jan 28, 2025
6ee0440
Formatting
tieneupin Jan 28, 2025
a836a98
Merged recent changes from 'main' branch
tieneupin Jan 30, 2025
17fe304
Merged version bump from 'main'
tieneupin Jan 31, 2025
c349e6e
Skipped checking YAML files containing template expressions
tieneupin Feb 10, 2025
74b116b
Configured Prettier hook to ignore deployment.yaml files as well
tieneupin Feb 10, 2025
dd0b153
Added Helm charts to deploy Murfey's components on a Kubernetes cluster
tieneupin Feb 10, 2025
4bf988a
Enable automated version bumps of Helm chart versions as well
tieneupin Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,23 @@ replace = '__version__ = "{new_version}"'
filename = "pyproject.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'

[[tool.bumpversion.files]]
filename = "Helm/Chart.yaml"
search = 'version: {current_version}'
replace = 'version: {new_version}'

[[tool.bumpversion.files]]
filename = "Helm/charts/murfey-instrument-server-clem/Chart.yaml"
search = 'version: {current_version}'
replace = 'version: {new_version}'

[[tool.bumpversion.files]]
filename = "Helm/charts/murfey-rsync/Chart.yaml"
search = 'version: {current_version}'
replace = 'version: {new_version}'

[[tool.bumpversion.files]]
filename = "Helm/charts/murfey-server/Chart.yaml"
search = 'version: {current_version}'
replace = 'version: {new_version}'
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ repos:
name: Verifying JSON file syntax
- id: check-yaml
name: Verifying YAML file syntax
exclude: Helm/charts/.*?/templates/deployment\.yaml
args: [--allow-multiple-documents]
- id: check-toml
name: Verifying TOML file syntax
Expand Down Expand Up @@ -103,4 +104,5 @@ repos:
hooks:
- id: prettier
name: Formatting other file types according to Prettier
exclude: Helm/charts/.*?/templates/deployment\.yaml
# types_or: [css, html, json, yaml]
53 changes: 53 additions & 0 deletions Dockerfiles/murfey-instrument-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Build command template
# 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

# Set up the base image to build with
FROM docker.io/library/python:3.12.8-slim-bullseye AS base

# Install Vim in base image
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
rsync \
vim \
&& \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/*


# Build Murfey in a branch image
FROM base as build
COPY ./ /python-murfey/
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
busybox \
net-tools \
libpq-dev \
&& \
busybox --install && \
python -m venv /venv && \
/venv/bin/python -m pip install --upgrade \
pip \
build \
importlib-metadata && \
/venv/bin/python -m pip install /python-murfey[client,instrument-server]


# Transfer completed Murfey build to base image
FROM base

# Define external build arguments
ARG groupid
ARG groupname
ARG userid

# Copy completed Murfey build across and set user and group permissions
COPY --from=build /venv/ /venv/
RUN groupadd -r -g "${groupid}" "${groupname}" && \
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
chown -R "${userid}":"${groupid}" /venv && \
chmod -R a+x /venv
ENV PATH=/venv/bin:$PATH
USER "${userid}":"${groupid}"
14 changes: 14 additions & 0 deletions Dockerfiles/murfey-rsync
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Template build command
# podman build --build-arg groupid=<groupid> --build-arg userid=<userid> --build-arg groupname=<groupname> --no-cache -f path/to/Dockerfiles/murfey-rsync

FROM docker.io/library/alpine:3.20
# FROM alpine:3.14

ARG groupid
ARG groupname
ARG userid

# Add any system dependencies for the developer/build environment here
RUN apk add --no-cache rsync && \
addgroup -S -g "${groupid}" "${groupname}" && \
adduser -S "${groupname}" -G "${groupname}" -u "${userid}" -s /bin/sh
61 changes: 61 additions & 0 deletions Dockerfiles/murfey-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Template build command
# 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

# Set up the base image to build with
FROM docker.io/library/python:3.12.8-slim-bullseye AS base

# Install Vim and PostgreSQL dependencies in base image
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
libpq-dev \
vim \
&& \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/*


# Build Murfey and IMOD in a branch image
FROM base as build
COPY ./ /python-murfey/
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
busybox \
curl \
net-tools \
&& \
busybox --install && \
python -m venv /venv && \
/venv/bin/python -m pip install --upgrade \
pip \
build \
importlib-metadata \
psycopg2-binary \
&& \
/venv/bin/python -m pip install /python-murfey[server] && \
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 && \
chmod +x imod_5.1.0_RHEL8-64_CUDA12.0.sh && \
mkdir imod && \
./imod_5.1.0_RHEL8-64_CUDA12.0.sh -dir imod -skip -y


# Transfer completed builds to base image
FROM base

# Pass external build arguments to this stage
ARG groupid
ARG groupname
ARG userid

# Copy completed Murfey and IMOD builds across and set user and group permissions
COPY --from=build /venv/ /venv/
COPY --from=build /imod/ /imod/
RUN groupadd -r -g "${groupid}" "${groupname}" && \
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
chown -R "${userid}":"${groupid}" /venv && \
chmod -R a+x /venv
ENV PATH=/venv/bin:/imod/IMOD/bin:$PATH
ENV IMOD_DIR=/imod/IMOD
USER "${userid}":"${groupid}"
8 changes: 8 additions & 0 deletions Helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
name: murfey-services
description: Umbrella Helm chart for deploying the servers and daemons needed to enable Murfey to transfer and process data
version: 0.16.9
dependencies:
- name: murfey-instrument-server-clem
- name: murfey-server
- name: murfey-rsync
4 changes: 4 additions & 0 deletions Helm/charts/murfey-instrument-server-clem/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
name: murfey-instrument-server-clem
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
version: 0.16.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.appName }}
namespace: {{ .Values.global.namespace }}
labels:
app: {{ .Values.appName }}
spec:
type: LoadBalancer
externalTrafficPolicy: Cluster
ports:
{{- toYaml .Values.servicePorts | nindent 2 }}
selector:
app: {{ .Values.appName }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.appName }}
namespace: {{ .Values.global.namespace }}
labels:
app: {{ .Values.appName }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: {{ .Values.appName }}
template:
metadata:
labels:
app: {{ .Values.appName }}
spec:
securityContext:
runAsUser: {{ .Values.global.runAsUser }}
runAsGroup: {{ .Values.global.runAsGroup }}
volumes:
# Mount config files from secrets
- name: murfey-client-config
secret:
secretName: {{ .Values.global.murfeyClientConfigCLEMSecretName }}
items:
- key: {{ .Values.global.murfeyClientConfigCLEMFileName }}
path: .murfey
# Mount data directories
{{- toYaml .Values.extraVolumes | nindent 8 }}
containers:
- name: {{ .Values.appName }}
image: {{ .Values.image }}
imagePullPolicy: Always
securityContext:
privileged: false
volumeMounts:
# Mount Murfey client config
- name: murfey-client-config
mountPath: /murfey/config/.murfey
subPath: .murfey
readOnly: false
# Mount data directories
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
env:
- name: MURFEY_CLIENT_CONFIG_HOME
value: "/tmp"
ports:
- containerPort: {{ .Values.containerPort }}
command:
{{- toYaml .Values.command | nindent 12 }}
args:
{{- toYaml .Values.args | nindent 12 }}
4 changes: 4 additions & 0 deletions Helm/charts/murfey-rsync/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
name: murfey-rsync
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
version: 0.16.9
62 changes: 62 additions & 0 deletions Helm/charts/murfey-rsync/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.appName }}
spec:
ports:
{{- toYaml .Values.servicePorts | nindent 2 }}
selector:
app: {{ .Values.appName }}
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.appName }}
namespace: {{ .Values.global.namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Values.appName }}
template:
metadata:
labels:
app: {{ .Values.appName }}
spec:
securityContext:
runAsUser: {{ .Values.global.runAsUser }}
runAsGroup: {{ .Values.global.runAsGroup }}
volumes:
- name: rsyncd-conf
secret:
secretName: {{ .Values.global.rsyncConfigSecretName }}
items:
- key: {{ .Values.global.rsyncConfigFileName }}
path: rsyncd.conf
# Mount data directories
{{- toYaml .Values.extraVolumes | nindent 8 }}
containers:
- name: {{ .Values.appName }}
image: {{ .Values.image }}
imagePullPolicy: Always
resources:
requests:
cpu: {{ .Values.cpuRequest }}
limits:
cpu: {{ .Values.cpuLimit }}
memory: {{ .Values.memoryLimit }}
volumeMounts:
# Mount rsync config files
- name: rsyncd-conf
mountPath: /murfey/rsync/rsyncd.conf
subPath: rsyncd.conf
readOnly: true
# Mount data directories
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
ports:
- containerPort: {{ .Values.containerPort }}
command:
{{- toYaml .Values.command | nindent 12 }}
args:
{{- toYaml .Values.args | nindent 12 }}
4 changes: 4 additions & 0 deletions Helm/charts/murfey-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
name: murfey-server
description: Helm chart for deploying a Murfey backend server, which is responsible for orchestrating the data transfer and processing workflow between the client PC and the storage system
version: 0.16.9
Loading