Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • nyx/NyxUI
1 result
Show changes
Commits on Source (2)
Showing
with 310 additions and 53 deletions
......@@ -14,17 +14,22 @@ stages:
STORAGE_DRIVER: vfs
BUILDAH_FORMAT: docker
BUILDAH_ISOLATION: chroot
FQ_IMAGE_NAME: "$CI_REGISTRY_IMAGE/front:$CI_COMMIT_SHORT_SHA"
IMAGE_NAME: front
IMAGE_TAG: "$CI_COMMIT_SHORT_SHA"
REGISTRY_IMAGE: "$CI_REGISTRY_IMAGE/$IMAGE_NAME"
FQ_IMAGE_NAME: "$REGISTRY_IMAGE:$IMAGE_TAG"
BUILD_CONTEXT: "."
CONTAINERFILE: "front/Containerfile"
before_script:
- export REGISTRY_AUTH_FILE="$HOME/auth.json"
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
script:
- buildah build -t "$FQ_IMAGE_NAME" -f "$CONTAINERFILE" "$BUILD_CONTEXT"
- buildah build -t "$FQ_IMAGE_NAME" -f "$CONTAINERFILE" $BUILD_CONTEXT
- buildah push "$FQ_IMAGE_NAME"
- buildah tag "$FQ_IMAGE_NAME" "$REGISTRY_IMAGE:latest"
- buildah push "$REGISTRY_IMAGE:latest"
build on gitlab.pasteur.fr:
build front:
extends: .build-with-buildah
variables:
PUBLIC_URL: "nyx.pasteur.cloud"
......@@ -32,7 +37,7 @@ build on gitlab.pasteur.fr:
- if: ($CI_COMMIT_BRANCH == "main" &&
$CI_PROJECT_ID == $GITLAB_PASTEUR_PROJECT_ID) # gitlab.pasteur.fr only
build dev on gitlab.pasteur.fr:
build dev front:
extends: .build-with-buildah
variables:
PUBLIC_URL: "nyx.dev.pasteur.cloud"
......@@ -40,25 +45,6 @@ build dev on gitlab.pasteur.fr:
- if: ($CI_COMMIT_BRANCH == "dev" &&
$CI_PROJECT_ID == $GITLAB_PASTEUR_PROJECT_ID) # gitlab.pasteur.fr only
.deploy-with-manifests:
stage: deploy
image: docker.io/enix/ci-toolbox:1.21
variables:
APP_NAME: nyxui
FQ_IMAGE_NAME: "$CI_REGISTRY_IMAGE/front:$CI_COMMIT_SHORT_SHA"
script:
- kubectl create secret
docker-registry registry-gitlab
--docker-server=registry-gitlab.pasteur.fr
--docker-username="$DOCKER_USER"
--docker-password="$DOCKER_TOKEN"
--docker-email=kubernetes@pasteur.fr
-n "$KUBE_NAMESPACE"
--dry-run=client -o yaml | kubectl apply -f -
- envsubst < k8s/front-deployment.yaml | kubectl apply -n "$KUBE_NAMESPACE" -f -
- envsubst < k8s/front-service.yaml | kubectl apply -n "$KUBE_NAMESPACE" -f -
- envsubst < k8s/ingress.yaml | kubectl apply -n "$KUBE_NAMESPACE" -f -
.deploy-with-helm:
stage: deploy
image: docker.io/enix/ci-toolbox:1.21
......@@ -81,16 +67,17 @@ build dev on gitlab.pasteur.fr:
deploy to pasteur.cloud:
extends: .deploy-with-helm
variables:
SERVICE_TARGET_PORT: "8080"
IMAGE_SECRETS: "registry-gitlab"
KUBE_NAMESPACE: "nyx-prod"
PUBLIC_URL: "nyx.pasteur.cloud"
INGRESS_CLASS: "external"
INGRESS_URL: "nyx.pasteur.cloud"
SERVICE_PORT: "80"
LIMITS_CPU: "2"
LIMITS_MEMORY: "4Gi"
LIMITS_STORAGE: "1Gi"
LIMITS_MEMORY: "5Gi"
LIMITS_STORAGE: "4Gi"
LT_LIMITS_CPU: "2"
LT_LIMITS_MEMORY: "5Gi"
LT_LIMITS_STORAGE: "2Gi"
environment:
name: k8sprod-02/nyx-prod
url: https://nyx.pasteur.cloud
......@@ -102,16 +89,17 @@ deploy to pasteur.cloud:
deploy to dev.pasteur.cloud:
extends: .deploy-with-helm
variables:
SERVICE_TARGET_PORT: "8080"
IMAGE_SECRETS: "registry-gitlab"
KUBE_NAMESPACE: "nyx-dev"
PUBLIC_URL: "nyx.dev.pasteur.cloud"
INGRESS_CLASS: "internal"
INGRESS_URL: "nyx.dev.pasteur.cloud"
SERVICE_PORT: "80"
LIMITS_CPU: "2"
LIMITS_MEMORY: "4Gi"
LIMITS_STORAGE: "1Gi"
LIMITS_MEMORY: "5Gi"
LIMITS_STORAGE: "4Gi"
LT_LIMITS_CPU: "2"
LT_LIMITS_MEMORY: "5Gi"
LT_LIMITS_STORAGE: "2Gi"
environment:
name: k8sdev-01/nyx-dev
url: https://nyx.dev.pasteur.cloud
......@@ -120,3 +108,16 @@ deploy to dev.pasteur.cloud:
$CI_PROJECT_ID == $GITLAB_PASTEUR_PROJECT_ID) # gitlab.pasteur.fr only
when: manual
build larvatagger backend:
extends: .build-with-buildah
variables:
IMAGE_NAME: "larvatagger"
IMAGE_TAG: "0.20.1-bigfat"
BUILD_CONTEXT: --build-arg LARVATAGGER_IMAGE_TAG=0.20.1-bigfat back
CONTAINERFILE: "back/Containerfile.larvatagger"
rules:
- if: ($CI_COMMIT_BRANCH == "dev" &&
$CI_PROJECT_ID == $GITLAB_PASTEUR_PROJECT_ID) # gitlab.pasteur.fr only
when: manual # on IMAGE_TAG update only; alias latest is used and
allow_failure: true # should be confirmed to work when moving to branch main
name = "NyxUI"
uuid = "2c32e805-e4ca-4d0f-96f6-9d2d6204339d"
authors = ["François Laurent <francois.laurent@pasteur.fr>"]
version = "0.2.0"
version = "0.2.1"
[deps]
Bonito = "824d6782-a2ef-11e9-3a09-e5662e0c26f8"
......
......@@ -7,7 +7,7 @@ Web interface meant to be served at [nyx.pasteur.cloud](https://nyx.pasteur.clou
It features an app catalog, with the following apps:
* an editor for muscular activity programs,
* [LarvaTagger.jl](https://gitlab.pasteur.fr/nyx/larvatagger.jl) without any automating tagging backends.
* [LarvaTagger.jl](https://gitlab.pasteur.fr/nyx/larvatagger.jl) with two automating tagging backends.
## Local installation
......@@ -24,10 +24,11 @@ cp front/Manifest.toml .
juliaup add lts
juliaup default lts
julia --project=. -e 'using Pkg; Pkg.instantiate()'
. back/larvatagger-no-build.sh
julia --project=. routes.jl
```
You may be asked whether to authorize ports 9284 and 9285; please give the app permission.
You may be asked whether to authorize ports 9284, 9285 and 9286; please give the app permission.
From there, in a web browser, open http://localhost:9284/ to access the app.
......@@ -35,4 +36,9 @@ Note that the generated files can be found somewhere in directory *storage/expor
The download buttons in the LarvaTagger app will not work in the web browser.
To make them work, the reverse proxy setup in the container image called *front* is required.
If you have [Podman](https://podman.io/), as an alternative to the above installation procedure, you can simply run `front/build.sh --now` and, once the container is up and running, connect to http://localhost:8080/.
If you have [Podman](https://podman.io/), as an alternative to the above installation procedure, you can simply run the backend and frontend as follows:
```
. back/larvatagger-no-build.sh
front/build.sh --now
```
Once the frontend container is up and running, connect to http://localhost:8080/.
ARG LARVATAGGER_IMAGE_TAG=0.20.1-bigfat
FROM docker.io/flaur/larvatagger:${LARVATAGGER_IMAGE_TAG} as src
FROM debian:bullseye as base
# Python and Curl for Poetry
RUN apt-get update \
&& apt-get install --no-install-recommends -y python3-dev python3-pip curl \
&& rm -rf /var/lib/apt/lists/*
# Unprivileged environment
ARG UID=1001
RUN useradd julia -u ${UID} --user-group --create-home
COPY --chown=julia --from=src /app /app/
USER ${UID}
# Poetry
ENV POETRY_VERSION=1.8.4
ENV POETRY_HOME=/app/poetry
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
ENV PIP_NO_CACHE_DIR=1
RUN curl -sSL https://install.python-poetry.org | python3 -
# Julia
ARG JULIA_VERSION=1.10.9
ENV JULIA_PROJECT=/app
ENV JULIA_DEPOT_PATH=/app/julia
ENV JULIAUP_DEPOT_PATH=/app/juliaup
RUN export HOME="${JULIA_PROJECT}" \
&& curl -fsSL https://install.julialang.org \
| sh -s -- --yes --default-channel "${JULIA_VERSION}" \
&& ${JULIA_PROJECT}/.juliaup/bin/juliaup config versionsdbupdateinterval 0
ENV PATH "${PATH}:${JULIA_PROJECT}/.juliaup/bin:${POETRY_HOME}/bin"
# LarvaTagger.jl/MaggotUBA-adapter/PasteurJanelia-adapter
RUN cd "${JULIA_PROJECT}" \
&& julia -e 'using Pkg; Pkg.instantiate()' \
&& cd MaggotUBA \
&& poetry install --only main \
&& cd ../PasteurJanelia \
&& poetry install --only main
# final stage
COPY --chown=julia larvatagger-entrypoint.sh /app/
ENTRYPOINT ["/app/larvatagger-entrypoint.sh"]
CMD []
#!/bin/sh
CONTAINERFILE=back/Containerfile.larvatagger
if ! [ -f "$CONTAINERFILE" -a -f routes.jl ]; then
echo "Run $0 from the project root directory"
exit 1
fi
IMAGE=larvatagger-backend
podman rmi -f $IMAGE || true
podman build --tag $IMAGE -f "$CONTAINERFILE" back
if [ "$1" = "--now" ]; then
podman run -d -p 9286:9286 $IMAGE
CONTAINER=`podman ps | grep $IMAGE | cut -d' ' -f1`
if [ -n "$CONTAINER" ]; then
echo "podman logs -f $CONTAINER"
sleep 1
podman logs -f $CONTAINER
fi
fi
export LARVATAGGER_BACKEND=http://localhost:9286
#!/bin/sh
if [ -z "$LARVATAGGER_PORT" ]; then
LARVATAGGER_PORT=9286
else
echo "Using environment variable: LARVATAGGER_PORT= $LARVATAGGER_PORT"
fi
if [ -z "$LARVATAGGER_TOKEN_EXPIRY" ]; then
LARVATAGGER_TOKEN_EXPIRY=14400
else
echo "Using environment variable: LARVATAGGER_TOKEN_EXPIRY= $LARVATAGGER_TOKEN_EXPIRY"
fi
julia -e "using LarvaTagger.REST.Server; run_backend(\"/app\", $LARVATAGGER_TOKEN_EXPIRY; host=\"0.0.0.0\", port=$LARVATAGGER_PORT)"
#!/bin/sh
# for tests with lightweight deployment
if [ -z "$LARVATAGGER_PORT" ]; then
LARVATAGGER_PORT=9286
else
echo "Using environment variable: LARVATAGGER_PORT= $LARVATAGGER_PORT"
fi
if [ -z "$LARVATAGGER_IMAGE" ]; then
LARVATAGGER_IMAGE=docker.io/flaur/larvatagger:0.20-bigfat
else
echo "Using environment variable: LARVATAGGER_IMAGE= $LARVATAGGER_IMAGE"
fi
if [ -z "$LARVATAGGER_TOKEN_EXPIRY" ]; then
LARVATAGGER_TOKEN_EXPIRY=3600
else
echo "Using environment variable: LARVATAGGER_TOKEN_EXPIRY= $LARVATAGGER_TOKEN_EXPIRY"
fi
podman run -d -p $LARVATAGGER_PORT:9285 --entrypoint=julia $LARVATAGGER_IMAGE --project=/app \
-e "using LarvaTagger.REST.Server; run_backend(\"/app\", $LARVATAGGER_TOKEN_EXPIRY; host=\"0.0.0.0\")"
CONTAINER=`podman ps | grep $LARVATAGGER_IMAGE | cut -d' ' -f1`
if ! [ -z "$CONTAINER" ]; then
echo "To monitor the LarvaTagger backend:"
echo "podman logs -f $CONTAINER"
fi
export LARVATAGGER_BACKEND=http://localhost:$LARVATAGGER_PORT
......@@ -16,7 +16,7 @@ ENV JULIA_PROJECT /app
ENV JULIA_DEPOT_PATH /app/julia
ENV JULIAUP_DEPOT_PATH /app/juliaup
ARG JULIA_VERSION=1.10.8
ARG JULIA_VERSION=1.10.9
# UID/GID should match with same arguments defined in:
# https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/mainline/debian/Dockerfile
......
......@@ -6,7 +6,7 @@ COPY ./NyxUI.jl/front/proxy.conf /etc/nginx/conf.d/default.conf
ENV JULIAUP_DEPOT_PATH /juliaup
ENV JULIA_DEPOT_PATH /julia
ARG JULIA_VERSION=1.10.8
ARG JULIA_VERSION=1.10.9
RUN curl -fsSL https://install.julialang.org \
| sh -s -- --yes --default-channel $JULIA_VERSION
......
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.8"
julia_version = "1.10.9"
manifest_format = "2.0"
project_hash = "f30a6bd140cd9f9b66d3656725e83b8d83e18ee6"
......@@ -833,12 +833,12 @@ uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.4.0"
[[deps.LarvaTagger]]
deps = ["Bonito", "Colors", "Dates", "DocOpt", "Format", "LinearAlgebra", "Logging", "Makie", "Meshes", "NearestNeighbors", "NyxWidgets", "Observables", "ObservationPolicies", "OrderedCollections", "PlanarLarvae", "Random", "StaticArrays", "Statistics", "TidyObservables", "WGLMakie"]
git-tree-sha1 = "c9c185beb0bf417ed98afe9b8b9da557a0b886b7"
deps = ["Bonito", "Colors", "Dates", "DocOpt", "Format", "HTTP", "JSON3", "LinearAlgebra", "Logging", "Makie", "Meshes", "NearestNeighbors", "NyxWidgets", "Observables", "ObservationPolicies", "OrderedCollections", "Oxygen", "PlanarLarvae", "Random", "StaticArrays", "Statistics", "TidyObservables", "WGLMakie"]
git-tree-sha1 = "0b405b69b603ef4df736142907a32ab81df20215"
repo-rev = "main"
repo-url = "https://gitlab.pasteur.fr/nyx/larvatagger.jl"
uuid = "8b3b36f1-dfed-446e-8561-ea19fe966a4d"
version = "0.19.1"
version = "0.20.1"
[[deps.LazyArtifacts]]
deps = ["Artifacts", "Pkg"]
......@@ -1182,7 +1182,7 @@ version = "3.2.4+0"
[[deps.OpenLibm_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "05823500-19ac-5b8b-9628-191a04bc5112"
version = "0.8.1+2"
version = "0.8.1+4"
[[deps.OpenMPI_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML", "Zlib_jll"]
......@@ -1219,6 +1219,12 @@ git-tree-sha1 = "12f1439c4f986bb868acda6ea33ebc78e19b95ad"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.7.0"
[[deps.Oxygen]]
deps = ["DataStructures", "Dates", "HTTP", "JSON3", "MIMEs", "Reexport", "RelocatableFolders", "Requires", "Sockets", "Statistics", "StructTypes"]
git-tree-sha1 = "2ad010b0de6172faf1d09ed5e0837eb0b7355bd8"
uuid = "df9a0d86-3283-4920-82dc-4555fc0d1d8b"
version = "1.5.16"
[[deps.PCRE2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
......
......@@ -18,7 +18,7 @@ podman build --tag $IMAGE -f "$CONTAINERFILE" .. # --no-cache
#mkdir -p public
podman run -d -p 8081:80 -p 9484:9284 -p 9485:9285 \
$IMAGE
-e LARVATAGGER_BACKEND $IMAGE
CONTAINER=`podman ps | grep $IMAGE | cut -d' ' -f1`
......
......@@ -14,7 +14,7 @@ podman rmi -f $IMAGE || true
podman build --tag $IMAGE -f "$CONTAINERFILE" .
if [ "$1" = "--now" ]; then
podman run -d -p 8080:8080 $IMAGE
podman run -d -p 8080:8080 -e LARVATAGGER_BACKEND $IMAGE
CONTAINER=`podman ps | grep $IMAGE | cut -d' ' -f1`
......
......@@ -2,6 +2,17 @@
set -m
cd /app
if [ -f "front/.env" ]; then
echo "Found dotenv file:"
echo "------------------"
cat front/.env
echo "------------------"
export `cat front/.env | xargs`
fi
LARVATAGGER_BACKEND=`echo $LARVATAGGER_BACKEND | sed "s/localhost/host.containers.internal/"`
/docker-entrypoint.sh nginx -g "daemon off;" &>/dev/null &
NGINX_PID=$!
......
......@@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.2.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.0"
appVersion: "0.2.1"
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "nyxui.name" . }}-front-config
labels:
{{- include "nyxui.labels" . | nindent 4 }}
data:
.env: |
LARVATAGGER_BACKEND=http://{{ include "nyxui.name" . }}-larvatagger:{{ .Values.service.port }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "nyxui.name" . }}
name: {{ include "nyxui.name" . }}-front
labels:
{{- include "nyxui.labels" . | nindent 4 }}
spec:
......@@ -19,6 +19,7 @@ spec:
{{- end }}
labels:
{{- include "nyxui.labels" . | nindent 8 }}
app.kubernetes.io/component: front
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
......@@ -45,13 +46,19 @@ spec:
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
{{- toYaml .Values.front.resources | nindent 12 }}
volumeMounts:
- name: front-config
mountPath: /app/front/.env
subPath: .env
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
- name: front-config
configMap:
name: nyxui-front-config
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
......
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "nyxui.name" . }}-larvatagger
labels:
{{- include "nyxui.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "nyxui.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "nyxui.labels" . | nindent 8 }}
app.kubernetes.io/component: larvatagger
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "nyxui.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.larvatagger.image.repository }}/{{ .Values.larvatagger.image.name }}:{{ .Values.larvatagger.image.tag }}"
imagePullPolicy: {{ .Values.larvatagger.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.larvatagger.service.targetPort }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.larvatagger.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
......@@ -49,11 +49,11 @@ spec:
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
name: {{ .serviceName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
serviceName: {{ .serviceName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
......
apiVersion: v1
kind: Service
metadata:
name: {{ include "nyxui.name" . }}
name: {{ include "nyxui.name" . }}-front
labels:
{{- include "nyxui.labels" . | nindent 4 }}
spec:
......@@ -13,3 +13,4 @@ spec:
name: http
selector:
{{- include "nyxui.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: front
apiVersion: v1
kind: Service
metadata:
name: {{ include "nyxui.name" . }}-larvatagger
labels:
{{- include "nyxui.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "nyxui.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: larvatagger