add starod integration
This commit is contained in:
		
							
								
								
									
										18
									
								
								.staroid/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.staroid/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					## gpu-jupyter on staroid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This directory contains files to deploy gpu-jupyter project on [staroid](https://staroid.com).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[](https://staroid.com/api/run)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Development
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Run locally with [skaffold](https://skaffold.dev) command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					$ git clone https://github.com/iot-salzburg/gpu-jupyter.git
 | 
				
			||||||
 | 
					$ cd gpu-jupyter
 | 
				
			||||||
 | 
					$ skaffold dev -f .staroid/skaffold.yaml --port-forward -p minikube
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					and browse `http://localhost:8888`
 | 
				
			||||||
							
								
								
									
										18
									
								
								.staroid/build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										18
									
								
								.staroid/build.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					# Custom builder script for Skaffold
 | 
				
			||||||
 | 
					# https://skaffold.dev/docs/pipeline-stages/builders/custom/
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# generate Dockerfile
 | 
				
			||||||
 | 
					./generate-Dockerfile.sh -s --no-datascience-notebook --no-useful-packages
 | 
				
			||||||
 | 
					cd .build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# print Dockerfile
 | 
				
			||||||
 | 
					cat Dockerfile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# build
 | 
				
			||||||
 | 
					docker build -f Dockerfile -t $IMAGE .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if $PUSH_IMAGE; then
 | 
				
			||||||
 | 
					  docker push $IMAGE
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
							
								
								
									
										76
									
								
								.staroid/k8s.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								.staroid/k8s.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,76 @@
 | 
				
			|||||||
 | 
					apiVersion: apps/v1
 | 
				
			||||||
 | 
					kind: Deployment
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: jupyter-deployment
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  replicas: 1
 | 
				
			||||||
 | 
					  strategy:
 | 
				
			||||||
 | 
					    type: "Recreate"
 | 
				
			||||||
 | 
					  selector:
 | 
				
			||||||
 | 
					    matchLabels:
 | 
				
			||||||
 | 
					      app: jupyter
 | 
				
			||||||
 | 
					  template:
 | 
				
			||||||
 | 
					    metadata:
 | 
				
			||||||
 | 
					      labels:
 | 
				
			||||||
 | 
					        app: jupyter
 | 
				
			||||||
 | 
					        pod.staroid.com/isolation: dedicated
 | 
				
			||||||
 | 
					        pod.staroid.com/spot: "false"
 | 
				
			||||||
 | 
					        pod.staroid.com/instance-type: gpu-1
 | 
				
			||||||
 | 
					    spec:
 | 
				
			||||||
 | 
					      automountServiceAccountToken: true
 | 
				
			||||||
 | 
					      securityContext:
 | 
				
			||||||
 | 
					        runAsUser: 1000 # will be overrided by staroid
 | 
				
			||||||
 | 
					        runAsGroup: 100 # writable directories are accessible with GID 100. see https://github.com/jupyter/docker-stacks/blob/master/base-notebook/Dockerfile
 | 
				
			||||||
 | 
					      containers:
 | 
				
			||||||
 | 
					      - name: jupyter
 | 
				
			||||||
 | 
					        image: jupyter
 | 
				
			||||||
 | 
					        command:
 | 
				
			||||||
 | 
					        - "bash"
 | 
				
			||||||
 | 
					        - "-c"
 | 
				
			||||||
 | 
					        - >-
 | 
				
			||||||
 | 
					          mkdir -p ~/.ssh && chmod 700 ~/.ssh &&
 | 
				
			||||||
 | 
					          echo -n "$(echo $MLFLOW_TRACKING_URI | sed 's/.*\(mlflow[^:]*\).*/\1/g') " >> ~/.ssh/known_hosts &&
 | 
				
			||||||
 | 
					          echo $MLFLOW_ARTIFACT_STORE_RSA_PUB | base64 --decode >> ~/.ssh/known_hosts &&
 | 
				
			||||||
 | 
					          echo $MLFLOW_ARTIFACT_STORE_RSA_PRI | base64 --decode >> ~/.ssh/id_rsa &&
 | 
				
			||||||
 | 
					          chmod 600 ~/.ssh/* &&
 | 
				
			||||||
 | 
					          jupyter-lab --ip='*' --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*'
 | 
				
			||||||
 | 
					        env:
 | 
				
			||||||
 | 
					        - name: JUPYTER_ENABLE_LAB
 | 
				
			||||||
 | 
					          value: "yes"
 | 
				
			||||||
 | 
					        envFrom:
 | 
				
			||||||
 | 
					        - configMapRef:
 | 
				
			||||||
 | 
					            name: mlflow-env
 | 
				
			||||||
 | 
					        volumeMounts:
 | 
				
			||||||
 | 
					          - name: work-volume
 | 
				
			||||||
 | 
					            mountPath: /home/jovyan/work
 | 
				
			||||||
 | 
					      volumes:
 | 
				
			||||||
 | 
					        - name: work-volume
 | 
				
			||||||
 | 
					          persistentVolumeClaim:
 | 
				
			||||||
 | 
					            claimName: work
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					kind: Service
 | 
				
			||||||
 | 
					apiVersion: v1
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: jupyter
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  ports:
 | 
				
			||||||
 | 
					  - name: http
 | 
				
			||||||
 | 
					    port: 8888
 | 
				
			||||||
 | 
					  selector:
 | 
				
			||||||
 | 
					    app: jupyter
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					apiVersion: v1
 | 
				
			||||||
 | 
					kind: PersistentVolumeClaim
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: work
 | 
				
			||||||
 | 
					  annotations:
 | 
				
			||||||
 | 
					    storage.staroid.com/scope: Instance
 | 
				
			||||||
 | 
					    storage.staroid.com/file-manager: "1000:100"
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  storageClassName: nfs
 | 
				
			||||||
 | 
					  accessModes:
 | 
				
			||||||
 | 
					    - ReadWriteMany
 | 
				
			||||||
 | 
					  volumeMode: Filesystem
 | 
				
			||||||
 | 
					  resources:
 | 
				
			||||||
 | 
					    requests:
 | 
				
			||||||
 | 
					      storage: 1Gi
 | 
				
			||||||
							
								
								
									
										19
									
								
								.staroid/minikube.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								.staroid/minikube.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					apiVersion: v1
 | 
				
			||||||
 | 
					kind: PersistentVolume
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: jupyter-work-pv
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  accessModes:
 | 
				
			||||||
 | 
					    - ReadWriteMany
 | 
				
			||||||
 | 
					  capacity:
 | 
				
			||||||
 | 
					    storage: 1Gi
 | 
				
			||||||
 | 
					  hostPath:
 | 
				
			||||||
 | 
					    path: ./jupyter-work-pv
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					kind: StorageClass
 | 
				
			||||||
 | 
					apiVersion: storage.k8s.io/v1
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: nfs
 | 
				
			||||||
 | 
					  labels:
 | 
				
			||||||
 | 
					    addonmanager.kubernetes.io/mode: EnsureExists
 | 
				
			||||||
 | 
					provisioner: k8s.io/minikube-hostpath
 | 
				
			||||||
							
								
								
									
										18
									
								
								.staroid/skaffold.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.staroid/skaffold.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					apiVersion: skaffold/v2beta1
 | 
				
			||||||
 | 
					kind: Config
 | 
				
			||||||
 | 
					build:
 | 
				
			||||||
 | 
					  artifacts:
 | 
				
			||||||
 | 
					    - image: jupyter
 | 
				
			||||||
 | 
					      context: .
 | 
				
			||||||
 | 
					      custom:
 | 
				
			||||||
 | 
					        buildCommand: .staroid/build.sh
 | 
				
			||||||
 | 
					deploy:
 | 
				
			||||||
 | 
					  kubectl:
 | 
				
			||||||
 | 
					    manifests:
 | 
				
			||||||
 | 
					      - k8s.yaml
 | 
				
			||||||
 | 
					profiles:
 | 
				
			||||||
 | 
					  - name: minikube
 | 
				
			||||||
 | 
					    patches:
 | 
				
			||||||
 | 
					      - op: add
 | 
				
			||||||
 | 
					        path: /deploy/kubectl/manifests/0
 | 
				
			||||||
 | 
					        value: minikube.yaml
 | 
				
			||||||
							
								
								
									
										35
									
								
								.staroid/staroid.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								.staroid/staroid.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					# See https://docs.staroid.com/references/staroid_yaml.html for more configuration detail
 | 
				
			||||||
 | 
					apiVersion: beta/v1
 | 
				
			||||||
 | 
					starRank:
 | 
				
			||||||
 | 
					  rate: 1.0 # set community rate here. https://staroid.com/site/starrank
 | 
				
			||||||
 | 
					build:
 | 
				
			||||||
 | 
					  skaffold: {}
 | 
				
			||||||
 | 
					ingress:
 | 
				
			||||||
 | 
					- serviceName: jupyter
 | 
				
			||||||
 | 
					  port: 8888
 | 
				
			||||||
 | 
					deploy:
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					  - project: open-datastudio/mlflow-server
 | 
				
			||||||
 | 
					    level: OPTIONAL
 | 
				
			||||||
 | 
					  paramGroups:
 | 
				
			||||||
 | 
					  - name: Configurations
 | 
				
			||||||
 | 
					    params:
 | 
				
			||||||
 | 
					    - name: "Instance type"
 | 
				
			||||||
 | 
					      description: "GPU instance is supported only in AWS for now"
 | 
				
			||||||
 | 
					      type: STRING
 | 
				
			||||||
 | 
					      defaultValue: gpu-1
 | 
				
			||||||
 | 
					      options:
 | 
				
			||||||
 | 
					      - name: gpu-1 (8CPU, 61GB Mem, 1 GPU - Tesla V100 16GB Mem)
 | 
				
			||||||
 | 
					        value: gpu-1
 | 
				
			||||||
 | 
					      paths:
 | 
				
			||||||
 | 
					      - Deployment:jupyter-deployment:spec.template.metadata.labels["pod.staroid.com/instance-type"]
 | 
				
			||||||
 | 
					    - name: "Spot instance"
 | 
				
			||||||
 | 
					      type: STRING
 | 
				
			||||||
 | 
					      defaultValue: "false"
 | 
				
			||||||
 | 
					      options:
 | 
				
			||||||
 | 
					      - name: "false"
 | 
				
			||||||
 | 
					        value: "false"
 | 
				
			||||||
 | 
					      - name: "true"
 | 
				
			||||||
 | 
					        value: "true"
 | 
				
			||||||
 | 
					      paths:
 | 
				
			||||||
 | 
					      - Deployment:jupyter-deployment:spec.template.metadata.labels["pod.staroid.com/spot"]
 | 
				
			||||||
		Reference in New Issue
	
	Block a user