Skip to content
Snippets Groups Projects
Commit edd3242c authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

improve deployment of container manager

parent f606fa97
No related branches found
No related tags found
No related merge requests found
...@@ -2,14 +2,17 @@ ...@@ -2,14 +2,17 @@
nomadRoot=${nomadRoot:-/nomad/nomadlab} nomadRoot=${nomadRoot:-/nomad/nomadlab}
buildDocker=1 buildDocker=1
updateDeploy=1 updateDeploy=1
imageType=beaker
target_hostname=${target_hostname:-$HOSTNAME} target_hostname=${target_hostname:-$HOSTNAME}
chownRoot= chownRoot=
tls= tls=
debug=
while test ${#} -gt 0 while test ${#} -gt 0
do do
case "$1" in case "$1" in
--debug)
debug=1
;;
--tls) --tls)
tls=--tls tls=--tls
;; ;;
...@@ -21,10 +24,6 @@ do ...@@ -21,10 +24,6 @@ do
buildDocker="" buildDocker=""
updateDeploy=1 updateDeploy=1
;; ;;
--image-type)
shift
imageType=$1
;;
--target-hostname) --target-hostname)
shift shift
target_hostname=$1 target_hostname=$1
...@@ -38,7 +37,7 @@ do ...@@ -38,7 +37,7 @@ do
chownRoot=$1 chownRoot=$1
;; ;;
*) *)
echo "usage: $0 [--tls] [--nomad-root <pathToNomadRoot>] [--chown-root <pathForPrometheusVolumes>] [--docker-only] [--docker-skip] [--target-hostname hostname]" echo "usage: $0 [--debug] [--tls] [--nomad-root <pathToNomadRoot>] [--chown-root <pathForPrometheusVolumes>] [--docker-only] [--docker-skip] [--target-hostname hostname]"
echo echo
echo "Env variables: NODE_ENV, target_hostname, nomadRoot" echo "Env variables: NODE_ENV, target_hostname, nomadRoot"
echo "Examples:" echo "Examples:"
...@@ -298,10 +297,13 @@ metadata: ...@@ -298,10 +297,13 @@ metadata:
EOF EOF
fi fi
echo " kubectl create -f container-manager-namespace.yaml" echo " kubectl create -f container-manager-namespace.yaml"
echo
for imageType in beaker jupyter creedo remotevis ; do
echo "## Initial setup: create container manager service" echo "## $imageType Initial setup: create container manager service"
if [ -n updateDeploy ]; then if [ -n updateDeploy ]; then
cat >container-manager-service.yaml <<HERE cat >container-manager-service-$imageType.yaml <<HERE
kind: Service kind: Service
apiVersion: v1 apiVersion: v1
metadata: metadata:
...@@ -320,7 +322,7 @@ fi ...@@ -320,7 +322,7 @@ fi
echo " kubectl create -f container-manager-service.yaml" echo " kubectl create -f container-manager-service.yaml"
if [ -n updateDeploy ]; then if [ -n updateDeploy ]; then
cat >container-manager-deploy.yaml <<HERE cat >container-manager-deploy-$imageType.yaml <<HERE
apiVersion: apps/v1beta2 apiVersion: apps/v1beta2
kind: Deployment kind: Deployment
metadata: metadata:
...@@ -352,13 +354,38 @@ spec: ...@@ -352,13 +354,38 @@ spec:
- containerPort: 3003 - containerPort: 3003
env: env:
- name: SESSION_DB_PASSWORD - name: SESSION_DB_PASSWORD
value: "$redisPass" valueFrom:
secretKeyRef:
name: user-settings-db
key: redis-password
- name: NOTEBOOK_INFO_DB_PASSWORD - name: NOTEBOOK_INFO_DB_PASSWORD
value: "$mongoPass" valueFrom:
secretKeyRef:
name: notebook-db-mongo-pwd
key: password
- name: NODE_ENV
value: "$nodeEnv"
- name: NODE_APP_INSTANCE
value: "$imageType"
HERE HERE
if [ -n "$debug" ] ; then
cat >> container-manager-deploy-$imageType.yaml <<EOF
volumeMounts:
- mountPath: /app
name: app-source
volumes:
- name: app-source
hostPath:
path: $nomadRoot/servers/$target_hostname/analytics/$imageType
EOF
fi
fi fi
echo "# For an initial deployment, launch with:" echo "if ! kubectl get deployment nomad-container-manager-$imageType >& /dev/null ; then"
echo "kubectl create --save-config -f container-manager-deploy.yaml" echo " kubectl create --save-config -f container-manager-deploy-$imageType.yaml"
echo "# To simply update the deployment:" echo "else"
echo "kubectl apply -f container-manager-deploy.yaml" echo " kubectl apply -f container-manager-deploy-$imageType.yaml"
echo "fi"
echo
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment