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

feat: add webserver #3

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ddf33e4
feat: add webserver
xgui3783 Apr 29, 2022
ca245c2
fix github yml
xgui3783 Apr 29, 2022
7fff69d
fix docker build
xgui3783 Apr 29, 2022
9f67f90
fix logging
xgui3783 Apr 29, 2022
db396df
add manifest to viewer plugin
xgui3783 May 2, 2022
fed1715
fix manifest key
xgui3783 May 2, 2022
a15feaa
fix docker build script
xgui3783 May 2, 2022
5ec0fd1
added retrieval of mnicoords
xgui3783 May 2, 2022
93837a6
circumvent bug: list tuple [f, f, f] breaks
xgui3783 May 2, 2022
0c913db
fix analysis response
xgui3783 May 2, 2022
434cfd3
feat: use siibra-api for region query exclusively
xgui3783 May 4, 2022
be3075c
Merge remote-tracking branch 'origin/master' into feat_workerFrontend
xgui3783 May 9, 2022
2bb55e9
bugfix: update siibra-api endpoint
xgui3783 May 12, 2022
99bd3d9
feat: add notebook visualization
xgui3783 May 12, 2022
1bd078d
feat: show use different color
xgui3783 May 12, 2022
7c3923e
fix tests
xgui3783 May 12, 2022
94d2184
fix server docker build
xgui3783 May 12, 2022
07cc79c
fix test workflow
xgui3783 May 12, 2022
3169433
fix celery worker
xgui3783 May 12, 2022
b7ab7a4
fix celery conf directory
xgui3783 May 12, 2022
e2348ec
fix server docker build
xgui3783 May 12, 2022
e539b7b
fix server docker build
xgui3783 May 12, 2022
27e400c
fix notebook paths
xgui3783 May 12, 2022
e0cc51e
fix notebook path
xgui3783 May 12, 2022
2987965
fix notebook url
xgui3783 May 13, 2022
fa5387c
cosmetic fixes
xgui3783 May 13, 2022
f561e94
chore: add dependency installal to nb
xgui3783 May 13, 2022
48c3ae3
minor refactor: restructure repo to adhere to tmpl
xgui3783 Jun 24, 2022
60848ed
fix: ci path
xgui3783 Jun 24, 2022
dcf140d
fix: ci path
xgui3783 Jun 24, 2022
2c3bfad
bugfix: updated paths
xgui3783 Jun 24, 2022
4d4d601
bugfix: server add ready endpoint
xgui3783 Jun 24, 2022
290a48e
bugfix: join path
xgui3783 Jun 24, 2022
91edb9c
bugfix: add logger level
xgui3783 Jun 24, 2022
d2a624b
re-enable running in cloud notebooks
xgui3783 Aug 25, 2022
d8ff5b0
chore: check siibra/siibra-jugex version
xgui3783 Aug 25, 2022
77aa747
add warning if in incorrect parc/space, etc
xgui3783 Aug 25, 2022
d1e9298
add legend red vs white
xgui3783 Aug 25, 2022
a11ab0a
chore: fix formatting
xgui3783 Aug 25, 2022
d12d007
version restriction, do not use siibra0.3a30
xgui3783 Aug 26, 2022
be8d1e1
fix typo
xgui3783 Oct 25, 2022
f7722ee
bugfix: siibra-api endpoint
xgui3783 Feb 6, 2023
95df8a0
fix ci (using py3.10)
xgui3783 Feb 6, 2023
ae34f51
fix: adapt new plugin api
xgui3783 Mar 7, 2023
12d55e9
fix: endpoint to ping for searching regions
xgui3783 Apr 19, 2023
687c908
[skip ci] update ci script
xgui3783 Apr 19, 2023
67cf40d
use py3.8
xgui3783 Apr 19, 2023
ea1d222
fix ci
xgui3783 Apr 19, 2023
629b152
fix siibra jugex version, fix pip install
xgui3783 Oct 4, 2023
ca3ded4
feed numpy array to scipy's winsorize
dickscheid Feb 1, 2023
1bb08e7
add redirect debug
xgui3783 Jun 6, 2024
c1dc467
try to fix notebook
xgui3783 Jun 6, 2024
d8b3435
bump version
xgui3783 Jun 6, 2024
b9c5be3
do not log + helm
xgui3783 Nov 11, 2024
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
90 changes: 90 additions & 0 deletions .github/workflows/dockerimgs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: '[docker image]'

on:
push:
branches:
- feat_workerFrontend
# release:
# types:
# - published

jobs:
build-docker-img:
runs-on: ubuntu-latest

strategy:
matrix:
dockerfile: ['./http.server.dockerfile', './http.worker.dockerfile']
include:
- dockerfile: ./http.server.dockerfile
dockerimg: siibra-jugex-server
- dockerfile: ./http.worker.dockerfile
dockerimg: siibra-jugex-worker
steps:
- uses: actions/checkout@v2
- name: 'Setup tags'
run: |
VERSION=$(grep -Po '^__version__.*?"\K[\w.]+' http_wrapper/__init__.py)
echo "Setting version to $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV

DOCKER_IMGSTREAM=${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_NSP }}/${{ matrix.dockerimg }}
echo "Setting docker image stream to $DOCKER_IMGSTREAM"
echo "DOCKER_IMGSTREAM=$DOCKER_IMGSTREAM" >> $GITHUB_ENV

- name: 'Build docker image'
run: |
DOCKER_BUILT_TAG=$DOCKER_IMGSTREAM:$VERSION
echo "Building $DOCKER_BUILT_TAG"
docker build \
-t $DOCKER_BUILT_TAG \
-f ${{ matrix.dockerfile }} \
.
echo "Successfully built $DOCKER_BUILT_TAG"
echo "DOCKER_BUILT_TAG=$DOCKER_BUILT_TAG" >> $GITHUB_ENV

- name: 'Push to docker registry'
run: |
echo "Login to docker registry"
docker login \
-u '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_USER }}' \
-p '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_PWSD }}' \
${{ secrets.EBRAINS_DOCKER_REG }}
echo "Pushing $DOCKER_BUILT_TAG"
docker push $DOCKER_BUILT_TAG

- name: 'Tag versioned tag to registry'
run: |

echo "Login to docker registry"
docker login \
-u '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_USER }}' \
-p '${{ secrets.EBRAINS_DOCKER_REG_SIIBRA_TOOLBOX_PUSHER_PWSD }}' \
${{ secrets.EBRAINS_DOCKER_REG }}

BREAK=5
while [[ "$VERSION" == *"."* ]]
do
if [[ "$BREAK" == "0" ]]
then
echo "Fuse broke!"
exit 1
fi
VERSIONED_DOCKERTAG=$DOCKER_IMGSTREAM:$VERSION
echo "tagging and pushing $VERSIONED_DOCKERTAG"
docker tag $DOCKER_BUILT_TAG $VERSIONED_DOCKERTAG
docker push $VERSIONED_DOCKERTAG

echo "Push successful... Incrementing version & break"
VERSION=$(echo $VERSION | sed -e 's/\.\w*$//g')
BREAK=$(( "$BREAK" - 1 ))
done
echo "Done"


deploy-on-ebrains:
runs-on: ubuntu-latest
needs: build-docker-img
steps:
- name: "skip for now"
run: "echo skip for now"
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: '[unit test]'

on: [ push ]

jobs:
unit-tests:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
test_path: ['siibra_jugex', 'http_wrapper']
include:
- test_path: siibra_jugex
pip_install: '.'
- test_path: http_wrapper
pip_install: '-r ./http_wrapper/requirements-server.txt'
pip_install_extra: 'requests .'

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: "Install testing libraries"
run: pip install pytest

- name: "Install dependencies defined in matrix.pip_install"
if: ${{ matrix.pip_install }}
run: pip install ${{ matrix.pip_install }}

- name: "Install dependencies defined in matrix.pip_install_extra"
if: ${{ matrix.pip_install_extra }}
run: pip install ${{ matrix.pip_install_extra }}

- name: "Run tests at test/${{ matrix.test_path }}"
run: pytest test/${{ matrix.test_path }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ dist
examples/*.json
upload_to_pypi.sh
venv
.vscode
.env
secret*
42 changes: 42 additions & 0 deletions .helm/adhoc/cert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: siibra-jugex-certificate
spec:
isCA: false
commonName: siibra-jugex.apps.tc.humanbrainproject.eu
dnsNames:
- siibra-jugex.apps.tc.humanbrainproject.eu
issuerRef:
kind: ClusterIssuer
name: letsencrypt-production-issuer-1
privateKey:
algorithm: RSA
encoding: PKCS1
size: 2048
renewBefore: 120h0m0s
secretName: siibra-jugex-prod-secret
usages:
- server auth
---

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: neurogenpy-certificate
spec:
isCA: false
commonName: ngpy.apps.hbp.eu
dnsNames:
- ngpy.apps.hbp.eu
issuerRef:
kind: ClusterIssuer
name: letsencrypt-production-issuer-1
privateKey:
algorithm: RSA
encoding: PKCS1
size: 2048
renewBefore: 120h0m0s
secretName: neurogenpy-prod-secret
usages:
- server auth
10 changes: 10 additions & 0 deletions .helm/adhoc/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: jugex-toolbox
data:
SIIBRA_TOOLBOX_LOG_DIR: /siibra-tool-log
SIIBRA_TOOLBOX_DATA_DIR: /siibra-tool-data
SIIBRA_JURGEX_CELERY_BROKER: redis://redis:6379
SIIBRA_JURGEX_CELERY_RESULT: redis://redis:6379
SIIBRA_CACHEDIR: /siibra-tool-data/tmp
30 changes: 30 additions & 0 deletions .helm/adhoc/cron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: cronjob-trim-old-log-usage
spec:
# run two month
schedule: "41 1 */5 */2 *"
concurrencyPolicy: Replace
jobTemplate:
spec:
template:
spec:
containers:
- name: cronjob-trim-old-log-usage
image: docker-registry.ebrains.eu/monitoring/kubectl:v1.29.2
imagePullPolicy: Always
command:
- /bin/ash
- -c
# delete all files over 30 days of modification date
- "find /siibra-tool-log -mindepth 1 -maxdepth 1 -mtime +30 -delete"
volumeMounts:
- mountPath: /siibra-tool-log
name: log-volume

restartPolicy: OnFailure
volumes:
- name: log-volume
persistentVolumeClaim:
claimName: log-volume-claim-2
60 changes: 60 additions & 0 deletions .helm/adhoc/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: redis
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: redis
spec:
containers:
- image: docker-registry.ebrains.eu/monitoring/redis:alpine3.17
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- redis-cli
- ping
failureThreshold: 3
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 1
name: redis
ports:
- containerPort: 6379
protocol: TCP
readinessProbe:
exec:
command:
- redis-cli
- ping
failureThreshold: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 200m
memory: 1Gi
requests:
cpu: 100m
memory: 128Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
33 changes: 33 additions & 0 deletions .helm/adhoc/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jugex-toolbox
spec:
rules:
- host: siibra-jugex.apps.tc.humanbrainproject.eu
http:
paths:
- backend:
service:
name: jugex-toolbox
port:
number: 6001
path: /
pathType: ImplementationSpecific
- host: ngpy.apps.hbp.eu
http:
paths:
- backend:
service:
name: neurogenpy-toolbox
port:
number: 6001
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- siibra-jugex.apps.tc.humanbrainproject.eu
secretName: siibra-jugex-prod-secret
- hosts:
- ngpy.apps.hbp.eu
secretName: neurogenpy-prod-secret
27 changes: 27 additions & 0 deletions .helm/adhoc/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
type: longhorn-pvc
name: data-volume-claim
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 16Gi
storageClassName: longhorn-1
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
type: longhorn-pvc
name: log-volume-claim-2
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 4Gi
storageClassName: longhorn-1
14 changes: 14 additions & 0 deletions .helm/adhoc/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: redis
name: redis
spec:
ports:
- port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis
type: ClusterIP
16 changes: 16 additions & 0 deletions .helm/deploy_neurogenpy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /bin/bash

SERVER_IMG="docker-registry.ebrains.eu/siibra-toolbox/neurogenpy"
WORKER_IMG="docker-registry.ebrains.eu/siibra-toolbox/neurogenpy"
SERVER_TAG="server"
WORKER_TAG="worker"

helm install neurogenpy ./toolbox \
--set image.serverRepository=$SERVER_IMG \
--set image.workerRepository=$WORKER_IMG \
--set image.serverTag=$SERVER_TAG \
--set image.workerTag=$WORKER_TAG \
--set workerResources.limits.memory=4Gi \
--set envObj.NEUROGENPY_CELERY_BROKER=redis://redis:6379 \
--set envObj.NEUROGENPY_CELERY_RESULT=redis://redis:6379

Loading
Loading