Merge pull request #21 from open-datastudio/staroid
Add starod / skaffold integration.
This commit is contained in:
commit
1bf52b7f8a
1
.staroid/Dockerfile.staroid
Normal file
1
.staroid/Dockerfile.staroid
Normal file
@ -0,0 +1 @@
|
|||||||
|
RUN conda install cudnn=7.6.5 --yes
|
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).
|
||||||
|
|
||||||
|
[![Run](https://staroid.com/api/run/button.svg)](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`
|
21
.staroid/build.sh
Executable file
21
.staroid/build.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
# apply staroid patch
|
||||||
|
cat ../.staroid/Dockerfile.staroid >> Dockerfile
|
||||||
|
|
||||||
|
# print Dockerfile
|
||||||
|
cat Dockerfile
|
||||||
|
|
||||||
|
# build
|
||||||
|
docker build -f Dockerfile -t $IMAGE .
|
||||||
|
|
||||||
|
if $PUSH_IMAGE; then
|
||||||
|
docker push $IMAGE
|
||||||
|
fi
|
68
.staroid/k8s.yaml
Normal file
68
.staroid/k8s.yaml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
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 # see https://docs.staroid.com/ske/pod.html#pod for more available options
|
||||||
|
pod.staroid.com/spot: "false"
|
||||||
|
pod.staroid.com/instance-type: gpu-1
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: true
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 1000 # staroid requires non-root container
|
||||||
|
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"
|
||||||
|
- >-
|
||||||
|
jupyter-lab --ip='*' --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*'
|
||||||
|
env:
|
||||||
|
- name: JUPYTER_ENABLE_LAB
|
||||||
|
value: "yes"
|
||||||
|
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 # see https://docs.staroid.com/ske/storage.html for available scope
|
||||||
|
storage.staroid.com/file-manager: "1000:100" # <uid:gid> of file manager pod. This will display file manager button on staroid management console
|
||||||
|
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:
|
||||||
|
- .staroid/k8s.yaml
|
||||||
|
profiles:
|
||||||
|
- name: minikube
|
||||||
|
patches:
|
||||||
|
- op: add
|
||||||
|
path: /deploy/kubectl/manifests/0
|
||||||
|
value: .staroid/minikube.yaml
|
33
.staroid/staroid.yaml
Normal file
33
.staroid/staroid.yaml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# 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:
|
||||||
|
file: .staroid/skaffold.yaml
|
||||||
|
ingress:
|
||||||
|
- serviceName: jupyter
|
||||||
|
port: 8888
|
||||||
|
deploy:
|
||||||
|
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"]
|
Loading…
Reference in New Issue
Block a user