├── docs └── architecture.png ├── BOXED.yaml ├── InitNode.sh ├── eos-storage-fst.sh ├── eos-storage-mq.yaml ├── eos-storage-fst.template.yaml ├── eos-storage-mgm.yaml ├── LDAP.yaml ├── etc └── common.sh ├── SWAN_SingleHost.yaml ├── SWAN.yaml ├── CERNBOX.yaml ├── LICENSE └── README.md /docs/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sciencebox/kuboxed/HEAD/docs/architecture.png -------------------------------------------------------------------------------- /BOXED.yaml: -------------------------------------------------------------------------------- 1 | ### NAMESPACE ### 2 | apiVersion: v1 3 | kind: Namespace 4 | metadata: 5 | name: boxed 6 | 7 | -------------------------------------------------------------------------------- /InitNode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ### Usage ### 4 | # 5 | # Please define an environment variable named KUBE_NODE_TYPE to distinguish between master and worker nodes 6 | # E.g., export KUBE_NODE_TYPE=worker 7 | # Run ./InitNode.sh to install the required software 8 | # 9 | # The master node will provide further instructions on how to have other nodes joining the cluster 10 | # Please run the required commands on worker nodes and check their status from the master with `kubectl get nodes` 11 | # 12 | ### 13 | 14 | source etc/common.sh 15 | 16 | # TODO: Currently only centos7 is supported 17 | export HOST_OS="centos7" 18 | 19 | need_root 20 | check_kube_node_type 21 | check_host_os_type 22 | install_basics 23 | install_docker 24 | install_kubernetes 25 | configure_iptables 26 | set_kubelet_cgroup_driver 27 | start_kube_masternode # Depends on KUBE_NODE_TYPE 28 | 29 | -------------------------------------------------------------------------------- /eos-storage-fst.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | set -o errexit # Bail out on errors 4 | CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 5 | 6 | 7 | if [ "$#" -ne 5 ]; then 8 | echo "ERROR: Illegal number of parameters." 9 | echo "Syntax: eos-storage-fst.sh " 10 | echo "Example: eos-storage-fst.sh 1 eos-mgm.eos-mgm.boxed.svc.cluster.local eos-mq.eos-mq.boxed.svc.cluster.local docker default" 11 | exit 1 12 | fi 13 | 14 | 15 | FST_BASENAME="eos-fst" 16 | FST_NUMBER=$1 17 | FST_NAME=${FST_BASENAME}${FST_NUMBER} 18 | FST_CONTAINER_NAME=`echo ${FST_BASENAME} | tr '[:lower:]' '[:upper:]'`${FST_NUMBER} 19 | MGM_ALIAS=$2 20 | MQ_ALIAS=$3 21 | GEOTAG=$4 22 | SCHEDULING_GROUP=$5 23 | 24 | FNAME="eos-storage-fst${FST_NUMBER}.yaml" 25 | cp $CWD/eos-storage-fst.template.yaml $CWD/$FNAME 26 | sed -i "s/%%%FST_NAME%%%/"${FST_NAME}"/" $CWD/$FNAME 27 | sed -i "s/%%%FST_NUMBER%%%/${FST_NUMBER}/" $CWD/$FNAME 28 | sed -i "s/%%%FST_CONTAINER_NAME%%%/${FST_CONTAINER_NAME}/" $CWD/$FNAME 29 | sed -i "s/%%%MGM_ALIAS%%%/${MGM_ALIAS}/" $CWD/$FNAME 30 | sed -i "s/%%%MQ_ALIAS%%%/${MQ_ALIAS}/" $CWD/$FNAME 31 | sed -i "s/%%%FST_GEOTAG%%%/${GEOTAG}/" $CWD/$FNAME 32 | sed -i "s/%%%FST_SCHEDULING_GROUP%%%/${SCHEDULING_GROUP}/" $CWD/$FNAME 33 | 34 | -------------------------------------------------------------------------------- /eos-storage-mq.yaml: -------------------------------------------------------------------------------- 1 | ### POD ### 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: &name eos-mq 6 | namespace: boxed 7 | labels: 8 | app: *name 9 | spec: 10 | restartPolicy: Always 11 | hostname: *name 12 | subdomain: *name 13 | #hostNetwork: true 14 | nodeSelector: 15 | nodeApp: *name 16 | containers: 17 | - name: eos-storage 18 | image: gitlab-registry.cern.ch/cernbox/boxedhub/eos-storage:v0.9 19 | imagePullPolicy: IfNotPresent 20 | #ports: 21 | #- containerPort: 1097 22 | volumeMounts: 23 | - name: &vm_logs mq-logs 24 | mountPath: /var/log/eos 25 | env: 26 | ### PodInfo ### 27 | - name: PODINFO_NAME 28 | valueFrom: 29 | fieldRef: 30 | fieldPath: metadata.name 31 | - name: PODINFO_NAMESPACE 32 | valueFrom: 33 | fieldRef: 34 | fieldPath: metadata.namespace 35 | - name: PODINFO_IP 36 | valueFrom: 37 | fieldRef: 38 | fieldPath: status.podIP 39 | - name: PODINFO_NODE_IP 40 | valueFrom: 41 | fieldRef: 42 | fieldPath: status.hostIP 43 | - name: PODINFO_NODE_NAME 44 | valueFrom: 45 | fieldRef: 46 | fieldPath: spec.nodeName 47 | ### 48 | - name: THIS_CONTAINER 49 | value: "EOS-MQ" 50 | - name: DEPLOYMENT_TYPE 51 | value: "kubernetes" 52 | - name: EOS_ROLE 53 | value: "mq" 54 | securityContext: 55 | privileged: true 56 | capabilities: 57 | add: ["SYS_PTRACE"] 58 | volumes: 59 | - name: *vm_logs 60 | hostPath: 61 | path: /var/kubeVolumes/mq_logs 62 | type: DirectoryOrCreate 63 | --- 64 | ### SERVICE ### 65 | apiVersion: v1 66 | kind: Service 67 | metadata: 68 | name: &name eos-mq 69 | namespace: boxed 70 | spec: 71 | selector: 72 | app: *name 73 | clusterIP: None # Need headless service to resolve to Pod IP 74 | ports: 75 | - name: xrootd-mq 76 | protocol: TCP 77 | port: 1097 78 | targetPort: 1097 79 | #type: NodePort 80 | -------------------------------------------------------------------------------- /eos-storage-fst.template.yaml: -------------------------------------------------------------------------------- 1 | ### POD ### 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: &name %%%FST_NAME%%% 6 | namespace: boxed 7 | labels: 8 | app: *name 9 | spec: 10 | restartPolicy: Always 11 | hostname: *name 12 | subdomain: *name 13 | #hostNetwork: true 14 | nodeSelector: 15 | nodeApp: *name 16 | containers: 17 | - name: eos-storage 18 | image: gitlab-registry.cern.ch/cernbox/boxedhub/eos-storage:v0.9 19 | imagePullPolicy: IfNotPresent 20 | #ports: 21 | #- containerPort: 1095 22 | #- containerPort: 8001 23 | volumeMounts: 24 | - name: &vm_userdata fst-userdata 25 | mountPath: &fst_mountpoint /mnt/fst_userdata 26 | - name: &vm_logs fst-logs 27 | mountPath: /var/log/eos 28 | env: 29 | ### PodInfo ### 30 | - name: PODINFO_NAME 31 | valueFrom: 32 | fieldRef: 33 | fieldPath: metadata.name 34 | - name: PODINFO_NAMESPACE 35 | valueFrom: 36 | fieldRef: 37 | fieldPath: metadata.namespace 38 | - name: PODINFO_IP 39 | valueFrom: 40 | fieldRef: 41 | fieldPath: status.podIP 42 | - name: PODINFO_NODE_IP 43 | valueFrom: 44 | fieldRef: 45 | fieldPath: status.hostIP 46 | - name: PODINFO_NODE_NAME 47 | valueFrom: 48 | fieldRef: 49 | fieldPath: spec.nodeName 50 | ### 51 | - name: THIS_CONTAINER 52 | value: "%%%FST_CONTAINER_NAME%%%" 53 | - name: DEPLOYMENT_TYPE 54 | value: "kubernetes" 55 | - name: EOS_ROLE 56 | value: "fst" 57 | - name: FST_MOUNTPOINT # Path where the FST writes data. This should be a mapped to a Docker Volume, 58 | value: *fst_mountpoint # an Open Stack Volume, or a bare-metal disk mountpoint to make storage persistent. 59 | - name: EOS_MGM_ALIAS 60 | value: "%%%MGM_ALIAS%%%" 61 | - name: EOS_MQ_ALIAS 62 | value: "%%%MQ_ALIAS%%%" 63 | - name: FST_GEOTAG 64 | value: "%%%FST_GEOTAG%%%" 65 | - name: FST_SCHEDULING_GROUP 66 | value: "%%%FST_SCHEDULING_GROUP%%%" 67 | ### 68 | securityContext: 69 | privileged: true 70 | capabilities: 71 | add: ["SYS_PTRACE"] 72 | volumes: 73 | - name: *vm_userdata 74 | hostPath: 75 | path: /mnt/fst_userdata 76 | type: Directory 77 | - name: *vm_logs 78 | hostPath: 79 | path: /var/kubeVolumes/fst_logs 80 | type: DirectoryOrCreate 81 | --- 82 | ### SERVICE ### 83 | apiVersion: v1 84 | kind: Service 85 | metadata: 86 | name: &name %%%FST_NAME%%% 87 | namespace: boxed 88 | spec: 89 | selector: 90 | app: *name 91 | clusterIP: None # Need headless to resolve to Pod IP 92 | ports: 93 | - name: xrootd-fst 94 | protocol: TCP 95 | port: 1095 96 | targetPort: 1095 97 | - name: xrootd-8001 98 | protocol: TCP 99 | port: 8001 100 | targetPort: 8001 101 | -------------------------------------------------------------------------------- /eos-storage-mgm.yaml: -------------------------------------------------------------------------------- 1 | ### POD ### 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: &name eos-mgm 6 | namespace: boxed 7 | labels: 8 | app: *name 9 | spec: 10 | restartPolicy: Always 11 | hostname: *name 12 | subdomain: *name 13 | #hostNetwork: true 14 | nodeSelector: 15 | nodeApp: *name 16 | containers: 17 | - name: eos-storage 18 | image: gitlab-registry.cern.ch/cernbox/boxedhub/eos-storage:v0.9 19 | imagePullPolicy: IfNotPresent 20 | #ports: 21 | #- containerPort: 1094 22 | #- containerPort: 1096 23 | #- containerPort: 8000 24 | volumeMounts: 25 | - name: &vm_namespace mgm-namepsace 26 | mountPath: /var/eos 27 | - name: &vm_logs mgm-logs 28 | mountPath: /var/log/eos 29 | env: 30 | ### PodInfo ### 31 | - name: PODINFO_NAME 32 | valueFrom: 33 | fieldRef: 34 | fieldPath: metadata.name 35 | - name: PODINFO_NAMESPACE 36 | valueFrom: 37 | fieldRef: 38 | fieldPath: metadata.namespace 39 | - name: PODINFO_IP 40 | valueFrom: 41 | fieldRef: 42 | fieldPath: status.podIP 43 | - name: PODINFO_NODE_IP 44 | valueFrom: 45 | fieldRef: 46 | fieldPath: status.hostIP 47 | - name: PODINFO_NODE_NAME 48 | valueFrom: 49 | fieldRef: 50 | fieldPath: spec.nodeName 51 | ### 52 | - name: THIS_CONTAINER 53 | value: "EOS-MGM" 54 | - name: DEPLOYMENT_TYPE 55 | value: "kubernetes" 56 | ### LDAP parameters 57 | - name: LDAP_URI 58 | value: "ldap://ldap.boxed.svc.cluster.local" 59 | - name: LDAP_PORT 60 | value: "389" 61 | - name: LDAP_BASE_DN 62 | value: "dc=example,dc=org" 63 | - name: LDAP_BIND_DN 64 | value: "cn=readuser,dc=example,dc=org" 65 | - name: LDAP_BIND_PASSWORD 66 | value: "readuser" 67 | ### EOS parameters 68 | - name: EOS_ROLE 69 | value: "mgm" 70 | - name: EOS_MGM_MASTER1 71 | value: "eos-mgm.eos-mgm.boxed.svc.cluster.local" 72 | - name: EOS_MGM_MASTER2 73 | value: "eos-mgm.eos-mgm.boxed.svc.cluster.local" 74 | - name: EOS_MGM_ALIAS 75 | value: "eos-mgm.eos-mgm.boxed.svc.cluster.local" 76 | - name: EOS_MQ_ALIAS 77 | #value: "eos-mq.eos-mq.boxed.svc.cluster.local" 78 | value: "eos-mgm.eos-mgm.boxed.svc.cluster.local" # If colocated with mgm 79 | - name: EOS_PREFIX 80 | value: "/eos/docker/user/" 81 | - name: EOS_METADATADIR 82 | value: "/eos/docker/user/.sys.dav.hide#.user.metadata/" 83 | - name: EOS_RECYCLEDIR 84 | value: "/eos/docker/proc/recycle/" 85 | securityContext: 86 | #privileged: true 87 | capabilities: 88 | add: ["SYS_PTRACE"] 89 | volumes: 90 | - name: *vm_namespace 91 | hostPath: 92 | path: /mnt/eos_namespace 93 | type: Directory 94 | - name: *vm_logs 95 | hostPath: 96 | path: /var/kubeVolumes/mgm_logs 97 | type: DirectoryOrCreate 98 | --- 99 | ### SERVICE ### 100 | apiVersion: v1 101 | kind: Service 102 | metadata: 103 | name: &name eos-mgm 104 | namespace: boxed 105 | spec: 106 | selector: 107 | app: *name 108 | clusterIP: None # Need headless to resolve to Pod IP 109 | ports: 110 | - name: xrootd-mgm 111 | protocol: TCP 112 | port: 1094 113 | targetPort: 1094 114 | - name: xrootd-sync 115 | protocol: TCP 116 | port: 1096 117 | targetPort: 1096 118 | - name: xrootd-http 119 | protocol: TCP 120 | port: 8000 121 | targetPort: 8000 122 | 123 | -------------------------------------------------------------------------------- /LDAP.yaml: -------------------------------------------------------------------------------- 1 | ### LDAP Server -- Deployment ### 2 | apiVersion: apps/v1beta1 3 | kind: Deployment 4 | metadata: 5 | name: &name ldap 6 | namespace: boxed 7 | labels: 8 | app: *name 9 | spec: 10 | replicas: 1 11 | template: 12 | metadata: 13 | labels: 14 | app: *name 15 | name: *name 16 | spec: 17 | terminationGracePeriodSeconds: 60 18 | nodeSelector: 19 | nodeApp: eos-mgm 20 | containers: 21 | - name: ldap 22 | image: gitlab-registry.cern.ch/cernbox/boxedhub/ldap:v0.2 23 | imagePullPolicy: IfNotPresent 24 | #ports: 25 | #- containerPort: 389 26 | #- containerPort: 636 27 | volumeMounts: 28 | - name: &vm_userdb ldap-userdb 29 | mountPath: /var/lib/ldap 30 | - name: &vm_config ldap-config 31 | mountPath: /etc/ldap/slapd.d 32 | env: 33 | ### PodInfo ### 34 | - name: PODINFO_NAMESPACE 35 | valueFrom: 36 | fieldRef: 37 | fieldPath: metadata.namespace 38 | - name: PODINFO_NAME 39 | valueFrom: 40 | fieldRef: 41 | fieldPath: metadata.name 42 | - name: PODINFO_IP 43 | valueFrom: 44 | fieldRef: 45 | fieldPath: status.podIP 46 | - name: PODINFO_NODE_NAME 47 | valueFrom: 48 | fieldRef: 49 | fieldPath: spec.nodeName 50 | - name: PODINFO_NODE_IP 51 | valueFrom: 52 | fieldRef: 53 | fieldPath: status.hostIP 54 | ### 55 | - name: THIS_CONTAINER 56 | value: "LDAP" 57 | - name: DEPLOYMENT_TYPE 58 | value: "kubernetes" 59 | - name: LDAP_ENDPOINT 60 | #value: "ldap.boxed.svc.cluster.local" 61 | value: "localhost" 62 | - name : LDAP_TLS_VERIFY_CLIENT 63 | value: "try" 64 | ## 65 | # Environment variables to configure new LDAP Server 66 | # NOTE: These variables are considered only at the first run of the LDAP server. 67 | # * LDAP_BASE_DN is inferred from LDAP_DOMAIN, if left empty. 68 | # * Admin user "admin" is created by default. Her password can be customized. 69 | # * A read-only user can be added by setting "LDAP_READONLY_USER" to True 70 | # and specifing her username and password. 71 | - name: LDAP_ORGANISATION 72 | value: "Example Inc." 73 | - name: LDAP_DOMAIN 74 | value: "example.org" 75 | - name: LDAP_BASE_DN 76 | value: "dc=example,dc=org" 77 | - name: LDAP_ADMIN_PASSWORD 78 | value: "admin" 79 | - name: LDAP_READONLY_USER 80 | value: "true" 81 | - name: LDAP_READONLY_USER_USERNAME 82 | value: "readuser" 83 | - name: LDAP_READONLY_USER_PASSWORD 84 | value: "readuser" 85 | ## 86 | # Additional environment variables needed by the `adduser.sh` script 87 | # and by Custom Authenticators in CERNBox // SWAN. 88 | # Please consider using the same variable names for consistency. 89 | - name: LDAP_URI 90 | value: "ldap://127.0.0.1" 91 | - name: LDAP_PORT 92 | value: "389" 93 | - name: LDAP_ADMIN_BIND_DN 94 | value: "cn=admin,dc=example,dc=org" 95 | - name: LDAP_ADMIN_BIND_PASSWORD 96 | value: "admin" 97 | ## 98 | volumes: 99 | - name: *vm_userdb 100 | hostPath: 101 | path: /mnt/ldap/userdb 102 | type: Directory 103 | - name: *vm_config 104 | hostPath: 105 | path: /mnt/ldap/config 106 | type: Directory 107 | --- 108 | ### SERVICE ### 109 | apiVersion: v1 110 | kind: Service 111 | metadata: 112 | name: &name ldap 113 | namespace: boxed 114 | spec: 115 | selector: 116 | app: *name 117 | ports: 118 | - name: ldap 119 | protocol: TCP 120 | port: 389 121 | targetPort: 389 122 | - name: ldaps 123 | protocol: TCP 124 | port: 636 125 | targetPort: 636 126 | type: ClusterIP 127 | -------------------------------------------------------------------------------- /etc/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Shared variables and functions 3 | 4 | 5 | # ----- Variables ----- # 6 | SUPPORTED_HOST_OS=(centos7) 7 | SUPPORTED_NODE_TYPES=(master worker) 8 | 9 | BASIC_SOFTWARE="wget git sudo " 10 | 11 | DOCKER_VERSION="-17.03.2.ce" 12 | KUBE_VERSION="-1.9.5-0" 13 | 14 | OS_RELEASE="/etc/os-release" 15 | 16 | # Versions 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | # ----- Functions ----- # 25 | 26 | # Check to be root 27 | need_root () 28 | { 29 | if [ "$EUID" -ne 0 ]; then 30 | echo "Please run as root" 31 | exit 1 32 | fi 33 | } 34 | 35 | 36 | 37 | # Disable SELinux if needed 38 | disable_selinux () 39 | { 40 | test $(getenforce) == "Disabled" || setenforce 0 41 | } 42 | 43 | 44 | 45 | # (try to) Detect the OS 46 | detect_os () 47 | { 48 | # TODO: not used 49 | source $OS_RELEASE 50 | echo $ID$VERSION_ID 51 | } 52 | 53 | 54 | 55 | # Check if the node type was properly set 56 | check_kube_node_type () 57 | { 58 | if [[ -z $KUBE_NODE_TYPE ]]; then 59 | echo "ERROR: KUBE_NOTE_TYPE not set." 60 | echo "Please set the node type with 'export KUBE_NODE_TYPE='" 61 | echo "Cannot continue." 62 | exit -1 63 | fi 64 | 65 | # If the env var is set, check to have a valid name 66 | for ntype in ${SUPPORTED_NODE_TYPES[*]}; 67 | do 68 | if [[ "$ntype" == "$KUBE_NODE_TYPE" ]]; then 69 | echo "Configuring this machine as ${ntype}." 70 | return 71 | fi 72 | done 73 | 74 | echo "ERROR: Invalid node type set." 75 | echo "Please set the node type with 'export KUBE_NODE_TYPE='" 76 | echo "Cannot continue." 77 | exit -1 78 | } 79 | 80 | 81 | 82 | # Check if the host OS is supported 83 | check_host_os_type () 84 | { 85 | if [[ -z $HOST_OS ]]; then 86 | echo "ERROR: HOST_OS not set." 87 | echo "Cannot continue." 88 | exit -1 89 | fi 90 | 91 | # If the env var is set, check to have a supported OS 92 | for ostype in ${SUPPORTED_HOST_OS[*]}; 93 | do 94 | if [[ "$ostype" == "$HOST_OS" ]]; then 95 | return 96 | fi 97 | done 98 | 99 | echo "ERROR: Unsupported host os." 100 | echo "Supported OS: ${SUPPORTED_HOST_OS[*]}" 101 | echo "Cannot continue." 102 | exit -1 103 | } 104 | 105 | 106 | 107 | # Configure iptables to make the master reachable on TCP 6443 and TCP 10250 108 | configure_iptables () 109 | { 110 | # Completely disable iptables and firewalld 111 | # There are issues with the DNS container and flannel 112 | # k8s.io/dns/vendor/k8s.io/client-go/tools/cache/reflector.go:94: Failed to list *v1.Endpoints: Get https://10.96.0.1:443/api/v1/endpoints?resourceVersion=0: dial tcp 10.96.0.1:443: getsockopt: no route to host 113 | 114 | #TODO: Implement for Ubuntu 115 | systemctl stop iptables && systemctl disable iptables 116 | systemctl stop firewalld && systemctl disable firewalld 117 | 118 | # Properly set bridge-nf-call when SELinux is enforcing and firewalld is running 119 | sysctl net.bridge.bridge-nf-call-iptables=1 120 | sysctl net.bridge.bridge-nf-call-ip6tables=1 121 | 122 | # Set policy on FORWARD chain 123 | iptables --policy FORWARD ACCEPT # See issue: https://github.com/kubernetes/kubernetes/issues/40182 124 | 125 | : ''' 126 | # Could be of inspiration to configure at a finer grain, instead of disabling entire services 127 | TCP_PORTS_MASTER="2379 2380 6443 10250 10251 10252 10255 " 128 | TCP_PORTS_WORKER=" 10250 10255 " 129 | IFACE="eth0" 130 | 131 | echo "" 132 | echo "Configuring iptables..." 133 | 134 | # Different ports to be opened according to the node type 135 | if [[ "$1" == "master" ]]; then 136 | TCP_PORTS=$TCP_PORTS_MASTER 137 | elif [[ "$1" == "worker" ]]; then 138 | TCP_PORTS=$TCP_PORTS_WORKER 139 | else 140 | echo "WARNING: unknown node type. iptables left unchanged." 141 | TCP_PORTS="" 142 | fi 143 | 144 | # Add rules to iptables 145 | for port in $TCP_PORTS 146 | do 147 | iptables -I INPUT -i $IFACE -p tcp --dport $port -j ACCEPT 148 | done 149 | 150 | # Properly set bridge-nf-call when SELinux is enforcing and firewalld is running 151 | sysctl net.bridge.bridge-nf-call-iptables=1 152 | sysctl net.bridge.bridge-nf-call-ip6tables=1 153 | ''' 154 | } 155 | 156 | 157 | 158 | 159 | # Install the basic software 160 | install_basics() 161 | { 162 | echo "" 163 | echo "Installing the basics..." 164 | 165 | if [[ "$HOST_OS" == "centos7" ]]; then 166 | yum install -y $BASIC_SOFTWARE 167 | elif [[ "$HOST_OS" == "ubuntu" ]]; then 168 | apt-get install -y $BASIC_SOFTWARE 169 | else 170 | echo "Unknown OS. Cannot continue." 171 | exit 1 172 | fi 173 | } 174 | 175 | 176 | 177 | # Install Docker 178 | install_docker() 179 | { 180 | echo "" 181 | echo "Installing Docker..." 182 | 183 | if [[ "$HOST_OS" == "centos7" ]]; then 184 | mkdir -p /var/lib/docker 185 | yum install -y yum-utils \ 186 | device-mapper-persistent-data \ 187 | lvm2 188 | yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 189 | disable_selinux 190 | # See dependency issue: https://github.com/moby/moby/issues/33930 191 | yum install -y --setopt=obsoletes=0 \ 192 | docker-ce${DOCKER_VERSION} \ 193 | docker-ce-selinux${DOCKER_VERSION} 194 | systemctl enable docker && systemctl start docker 195 | systemctl status docker 196 | 197 | elif [[ "$HOST_OS" == "ubuntu" ]]; then 198 | echo "" 199 | # TODO: To be implemented 200 | 201 | else 202 | echo "Unknown OS. Cannot continue." 203 | exit 1 204 | fi 205 | } 206 | 207 | 208 | 209 | # Install Kubernetes 210 | install_kubernetes () 211 | { 212 | echo "" 213 | echo "Installing kubernetes..." 214 | 215 | if [[ "$HOST_OS" == "centos7" ]]; then 216 | cat < /etc/yum.repos.d/kubernetes.repo 217 | [kubernetes] 218 | name=Kubernetes 219 | baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 220 | enabled=1 221 | gpgcheck=1 222 | repo_gpgcheck=1 223 | gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg 224 | https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg 225 | EOF 226 | 227 | disable_selinux 228 | yum install -y \ 229 | kubelet${KUBE_VERSION} \ 230 | kubeadm${KUBE_VERSION} \ 231 | kubectl${KUBE_VERSION} 232 | systemctl enable kubelet && systemctl start kubelet 233 | systemctl status kubelet 234 | 235 | elif [[ "$HOST_OS" == "ubuntu" ]]; then 236 | apt-get update && apt-get install -y apt-transport-https 237 | wget -q https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - 238 | cat </etc/apt/sources.list.d/kubernetes.list 239 | deb http://apt.kubernetes.io/ kubernetes-xenial main 240 | EOF 241 | apt-get update 242 | apt-get install -y kubelet kubeadm 243 | 244 | else 245 | echo "Unknown OS. Cannot continue." 246 | exit 1 247 | fi 248 | } 249 | 250 | 251 | 252 | # Configure kubelet with the cgroup driver used by docker 253 | set_kubelet_cgroup_driver () 254 | { 255 | #TODO: Implement for Ubuntu 256 | 257 | echo "" 258 | echo "Configuring cgroup driver for kubelet service..." 259 | 260 | CGROUP_DRIVER=`docker info | grep -i cgroup | cut -d : -f 2 | tr -d " "` 261 | if [[ ! -f /etc/systemd/system/kubelet.service.d/10-kubeadm.conf.MASTER ]]; then 262 | cp /etc/systemd/system/kubelet.service.d/10-kubeadm.conf /etc/systemd/system/kubelet.service.d/10-kubeadm.conf.MASTER 263 | sed -i "s/Environment=\"KUBELET_CGROUP_ARGS=--cgroup-driver=systemd\"/\n\#Environment=\"KUBELET_CGROUP_ARGS=--cgroup-driver=systemd\"\nEnvironment=\"KUBELET_CGROUP_ARGS=--cgroup-driver=${CGROUP_DRIVER}\"\n/" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf 264 | else 265 | sed "s/Environment=\"KUBELET_CGROUP_ARGS=--cgroup-driver=systemd\"/\n\#Environment=\"KUBELET_CGROUP_ARGS=--cgroup-driver=systemd\"\nEnvironment=\"KUBELET_CGROUP_ARGS=--cgroup-driver=${CGROUP_DRIVER}\"\n/" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf.MASTER > /etc/systemd/system/kubelet.service.d/10-kubeadm.conf 266 | fi 267 | 268 | systemctl daemon-reload 269 | service kubelet restart 270 | } 271 | 272 | 273 | 274 | # Start the cluster with Flannel pod network 275 | start_kube_masternode () 276 | { 277 | #TODO: Implement for Ubuntu 278 | 279 | if [[ "$KUBE_NODE_TYPE" == "master" ]]; then 280 | echo "" 281 | echo "Initializing the cluster..." 282 | kubeadm init --pod-network-cidr=10.244.0.0/16 --token-ttl 0 283 | 284 | # This can be run as any user (root works as well) 285 | mkdir -p $HOME/.kube 286 | sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config 287 | sudo chown $(id -u):$(id -g) $HOME/.kube/config 288 | 289 | # Use the Flannel pod network 290 | echo "" 291 | echo "Installing the Flannel pod network..." 292 | kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml 293 | 294 | # Restart kubelet to mak sure it picks up the extra config files 295 | # NOTE: This is mission-critical for hostPort and iptables mapping on kubernetes managed containers 296 | systemctl daemon-reload 297 | service kubelet restart 298 | fi 299 | } 300 | 301 | 302 | -------------------------------------------------------------------------------- /SWAN_SingleHost.yaml: -------------------------------------------------------------------------------- 1 | ### SWAN ### 2 | 3 | ### 4 | # Run all the SWAN containers on a single node: 5 | # - jupyterhub 6 | # - cmvfs 7 | # - eos-fuse mount 8 | # - single-user servers 9 | # 10 | # The deployment with Kuberentes Spawner and DaemonSets for CVMFS and EOS-FUSE should be preferred 11 | ### 12 | 13 | 14 | ## SECRETS ### 15 | # 16 | ### SSL certificates ### 17 | # Note: These certificates are self-signed and for testing purposes only. Please replace them with proper certificates. 18 | # 19 | # Note: All Kubernetes secrets must be base64 encoded. Please encode your certificates with 20 | # `cat /path/to/your/certificate.key | base64 -w 0` for Linux-based systems 21 | # More details available here: https://kubernetes.io/docs/concepts/configuration/secret/ 22 | ### 23 | apiVersion: v1 24 | kind: Secret 25 | metadata: 26 | name: swan-certs 27 | namespace: boxed 28 | type: Opaque 29 | data: 30 | boxed.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBem5HeDErQ2FyalBWOVM3bWFQK3pqWlZhaXZZdm5acllBQlNIUnoyNis5emE5a1dsCkVUeWxpMzdiVnd0OEdQQnZtZ3RqVU1yK25WTFlETU42K2o0Y1Vrem1RMnFHa0hXN1Q2T3BOM2FNTUVFZ2VnQWUKYzkvU2dQdE9EZUlXK3paaUJUNW80SmpKNDgzRVc1cURDUkQxenRiSnl3WVAv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YUFBTUEwR0NTcUdTSWIzCkRRRUJDd1VBQTRJQkFRQVBzSDB0TGd6TzRjMERDd296Uzl5Y2FmTVY5QWRDYkNIdTJHL3BPdGhnaStWNkY2aTcKMURLMWRuelpXWjhFQVEwaW4wWkFtdlVIVVRsWEdGQ3B5b2hKbGtnczdpd3FRT3A3UjNiQnZhS0hxQitCMWpTZApoSjlwaElzSkFnVXFqVXE2ei9oUDV5RU40OW43YWIreWEzREp5Zm1iR2YxSmNVOC9COE5Hc0JBLzBJc0NRa2NxCmFFTFVncDFCWlg3TFpwSlFwaUVHWnBCME1DUzMvdUV0Z2EyQTJQZHEyWnlDb1NOV3d5dEFvN2lOa3JZdG4rd1AKa1lZWldCZkFjZGZNOVNQaVBnRXRmNnJzRWFBR0J4KzVicDBma0Rtbm1RUE9OZ2ZhT211UEMzZk9XRGdTMmtSQQowZnVRWFU2MjlFOEdpUEQ2QXZCemptcTc1M0VVVzZNanlUQkQKLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0tCg== 33 | # 34 | ### 35 | 36 | 37 | ### DEPLOYMENT ### 38 | apiVersion: apps/v1beta1 39 | kind: Deployment 40 | metadata: 41 | name: &name swan 42 | namespace: boxed 43 | labels: 44 | app: *name 45 | spec: 46 | replicas: 1 47 | template: 48 | metadata: 49 | labels: 50 | app: *name 51 | name: *name 52 | spec: 53 | terminationGracePeriodSeconds: 300 54 | hostPID: true 55 | #hostIPC: true 56 | nodeSelector: 57 | nodeApp: *name 58 | hostNetwork: true 59 | dnsPolicy: ClusterFirstWithHostNet 60 | 61 | containers: 62 | ### 63 | # 1. Fuse mount for EOS 64 | - name: eos-fuse 65 | image: gitlab-registry.cern.ch/cernbox/boxedhub/eos-fuse:v0.8 66 | imagePullPolicy: IfNotPresent 67 | securityContext: 68 | privileged: true 69 | capabilities: 70 | add: ["SYS_ADMIN"] 71 | volumeMounts: 72 | - name: &vm_cgroup cgroup 73 | mountPath: /sys/fs/cgroup 74 | - name: &vm_rdv-eos rdv-eos 75 | mountPath: /eos:shared 76 | - name: &vm_logs-eosfuse eosfuse-logs 77 | mountPath: /var/log/eos/fuse 78 | env: 79 | ### PodInfo ### 80 | - name: PODINFO_NAMESPACE 81 | valueFrom: 82 | fieldRef: 83 | fieldPath: metadata.namespace 84 | - name: PODINFO_NAME 85 | valueFrom: 86 | fieldRef: 87 | fieldPath: metadata.name 88 | - name: PODINFO_IP 89 | valueFrom: 90 | fieldRef: 91 | fieldPath: status.podIP 92 | - name: PODINFO_NODE_NAME 93 | valueFrom: 94 | fieldRef: 95 | fieldPath: spec.nodeName 96 | - name: PODINFO_NODE_IP 97 | valueFrom: 98 | fieldRef: 99 | fieldPath: status.hostIP 100 | ### 101 | - name: THIS_CONTAINER 102 | value: "EOS-FUSE" 103 | - name: DEPLOYMENT_TYPE 104 | value: "kubernetes" 105 | - name: LDAP_ENDPOINT 106 | value: "ldap.boxed.svc.cluster.local" 107 | - name: EOS_MGM_ENDPOINT 108 | value: "eos-mgm.eos-mgm.boxed.svc.cluster.local" 109 | - name: EOS_INSTANCE_NAME # Required to unmount (eventual) previous mountpoints 110 | value: "eosdocker" # See eos-fuse.d/start.sh --> mounted_folders=... 111 | - name: EOS_FOLDER 112 | value: "/eos" 113 | lifecycle: 114 | preStop: 115 | exec: 116 | command: ["service", "eosd", "stop"] # Cleans the mount point on the host machine 117 | # It does not work if the container is abruptly killed 118 | 119 | ### 120 | # 2. CVMFS (and squid proxy) for ROOT 121 | - name: cvmfs 122 | image: gitlab-registry.cern.ch/cernbox/boxedhub/cvmfs:v0.5 123 | imagePullPolicy: IfNotPresent 124 | securityContext: 125 | privileged: true 126 | capabilities: 127 | add: ["SYS_ADMIN"] 128 | volumeMounts: 129 | - name: &vm_devfuse devfuse 130 | mountPath: /dev/fuse 131 | - name: &vm_rdv-cvmfs rdv-cvmfs 132 | mountPath: /cvmfs:shared 133 | env: 134 | ### PodInfo ### 135 | - name: PODINFO_NAMESPACE 136 | valueFrom: 137 | fieldRef: 138 | fieldPath: metadata.namespace 139 | - name: PODINFO_NAME 140 | valueFrom: 141 | fieldRef: 142 | fieldPath: metadata.name 143 | - name: PODINFO_IP 144 | valueFrom: 145 | fieldRef: 146 | fieldPath: status.podIP 147 | - name: PODINFO_NODE_NAME 148 | valueFrom: 149 | fieldRef: 150 | fieldPath: spec.nodeName 151 | - name: PODINFO_NODE_IP 152 | valueFrom: 153 | fieldRef: 154 | fieldPath: status.hostIP 155 | ### 156 | env: 157 | - name: THIS_CONTAINER 158 | value: "CVMFS" 159 | - name: DEPLOYMENT_TYPE 160 | value: "kubernetes" 161 | - name: CVMFS_FOLDER 162 | value: "/cvmfs" 163 | 164 | ### 165 | # 3. JupyterHub 166 | - name: jupyterhub 167 | image: gitlab-registry.cern.ch/swan/docker-images/jupyterhub:v1.9 168 | imagePullPolicy: IfNotPresent 169 | #securityContext: 170 | # capabilities: 171 | # add: ["NET_ADMIN"] # Enable jupyterhub container to configure iptables 172 | ports: 173 | - name: http 174 | protocol: TCP 175 | hostPort: &HTTP_PORT 80 176 | containerPort: *HTTP_PORT 177 | - name: https 178 | protocol: TCP 179 | hostPort: &HTTPS_PORT 443 180 | containerPort: *HTTPS_PORT 181 | volumeMounts: 182 | - name: &vm_swan-certs swan-certs 183 | mountPath: /etc/boxed/certs 184 | - name: &vm_docker-socket docker-socket 185 | mountPath: /var/run/docker.sock 186 | - name: &vm_logs-jupyterhub jupyterhub-logs 187 | mountPath: /var/log/jupyterhub 188 | - name: &vm_logs-httpd httpd-logs 189 | mountPath: /var/log/httpd 190 | - name: &vm_logs-shibboleth shibboleth-logs 191 | mountPath: /var/log/shibboleth 192 | #- name: rdv-eos # See notes on EOS-FUSE and CVMFS mounts 193 | # mountPath: /eos:shared 194 | #- name: rdv-cvmfs 195 | # mountPath: /cvmfs:shared 196 | env: 197 | ### PodInfo ### 198 | - name: PODINFO_NAMESPACE 199 | valueFrom: 200 | fieldRef: 201 | fieldPath: metadata.namespace 202 | - name: PODINFO_NAME 203 | valueFrom: 204 | fieldRef: 205 | fieldPath: metadata.name 206 | - name: PODINFO_IP 207 | valueFrom: 208 | fieldRef: 209 | fieldPath: status.podIP 210 | - name: PODINFO_NODE_NAME 211 | valueFrom: 212 | fieldRef: 213 | fieldPath: spec.nodeName 214 | - name: PODINFO_NODE_IP 215 | valueFrom: 216 | fieldRef: 217 | fieldPath: status.hostIP 218 | ### 219 | - name: THIS_CONTAINER 220 | value: "JUPYTERHUB" 221 | - name: DEPLOYMENT_TYPE 222 | value: "kubernetes" 223 | - name: HTTP_PORT 224 | value: "80" 225 | - name: HTTPS_PORT 226 | value: "443" 227 | - name: HOSTNAME # Assume JupyterHub is exposed directly on the host where it runs 228 | valueFrom: # No Kubernetes services defined 229 | fieldRef: # Entrypoint will be: https:// 230 | fieldPath: spec.nodeName 231 | - name: AUTH_TYPE 232 | value: "local" 233 | - name: LDAP_ENDPOINT 234 | value: "ldap.boxed.svc.cluster.local" 235 | - name: CONTAINER_IMAGE 236 | value: "gitlab-registry.cern.ch/swan/docker-images/systemuser:v5.2.0" 237 | - name: DOCKER_NETWORK_NAME 238 | value: "jupyternet" 239 | - name: CVMFS_FOLDER 240 | value: "/cvmfs" 241 | - name: EOS_USER_PATH # This must bring to the folder with the list of initials of users 242 | value: "/eos/docker/user" # E.g., "/eos/docker/user" --(will be mapped to)--> "/eos/user" in the container 243 | - name: CERNBOXGATEWAY_HOSTNAME # Hostname of CERNBox for Sharing API 244 | value: "up2kube-cernbox.cern.ch" 245 | # - name: SPAWNER_FORM 246 | # value: "simple" 247 | #### Customization 248 | #- name: CUSTOMIZATION_REPO 249 | # value: "https://.git" 250 | 251 | # Volumes declaration 252 | volumes: 253 | - name: *vm_swan-certs 254 | secret: 255 | secretName: swan-certs 256 | defaultMode: 0644 257 | - name: *vm_devfuse # For CVMFS 258 | hostPath: 259 | path: /dev/fuse 260 | - name: *vm_cgroup # For EOS-FUSE mount 261 | emptyDir: {} # Fooling systemd to init the eosd service 262 | #hostPath: 263 | # path: /sys/fs/cgroup 264 | - name: *vm_docker-socket # For JupyterHub to start single-user containers 265 | hostPath: 266 | path: /var/run/docker.sock 267 | - name: *vm_rdv-eos 268 | hostPath: 269 | path: /eos # See notes on EOS-FUSE and CVMFS mounts 270 | - name: *vm_rdv-cvmfs 271 | hostPath: 272 | path: /cvmfs # See notes on EOS-FUSE and CVMFS mounts 273 | - name: *vm_logs-eosfuse 274 | hostPath: 275 | path: /var/kubeVolumes/eosfuse_logs 276 | type: DirectoryOrCreate 277 | - name: *vm_logs-jupyterhub 278 | hostPath: 279 | path: /var/kubeVolumes/jupyterhub_logs 280 | type: DirectoryOrCreate 281 | - name: *vm_logs-httpd 282 | hostPath: 283 | path: /var/kubeVolumes/httpd_logs 284 | type: DirectoryOrCreate 285 | - name: *vm_logs-shibboleth 286 | hostPath: 287 | path: /var/kubeVolumes/shibboleth_logs 288 | type: DirectoryOrCreate 289 | 290 | --- 291 | ### SERVICE ### 292 | # Note: Only needed when hostNetwork is not used, 293 | # otherwise JupyterHub is directly accessible on {HTTP, HTTPS}_PORTS 294 | apiVersion: v1 295 | kind: Service 296 | metadata: 297 | name: &name swan 298 | namespace: boxed 299 | spec: 300 | selector: 301 | app: *name 302 | ports: 303 | - name: http 304 | protocol: TCP 305 | port: 80 306 | targetPort: 80 307 | nodePort: 30080 308 | protocol: TCP 309 | - name: https 310 | protocol: TCP 311 | port: 443 312 | targetPort: 443 313 | nodePort: 30443 314 | type: NodePort 315 | 316 | ### 317 | ### Notes on EOS-FUSE and CVMFS mounts ### 318 | # eos-fuse and cvmfs containers mount EOS and CVMFS via fuse mount. 319 | # In order to export such mounts to the host machine or to other containers, 320 | # they must EXPLICITLY be mounted as shared (or rshared). 321 | # Default configuration for Kubernetes is rprivate, which does not allow 322 | # mount propagation. 323 | # 324 | # Moreover, EOS and CVMFS mounts must be available on the host machine 325 | # because we leverage on the daemon running on the host to start 326 | # single-user's containers. 327 | # 1--> It is useless to mount EOS/CVMFS on the jupyterhub container as 328 | # there is no docker daemon running there. 329 | # 2--> The daemon on the host has the context of the host and 330 | # not the context of the jupyterhub container. 331 | # As a side effect, EOS and CVMFS will be visible on the host machine. 332 | ### 333 | ### 334 | -------------------------------------------------------------------------------- /SWAN.yaml: -------------------------------------------------------------------------------- 1 | ### SWAN ### 2 | # 3 | # SWAN service 4 | # Deploys: 5 | # * JupyterHub to spawn, manage, and proxy multiple Jupyter sessions for single users 6 | # * EOS client for fuse-mounting user's home directory 7 | # * CVMFS client to fetch scientific libraries on-demand 8 | # * Cluster wise squid proxy for CVMFS (cvmfssquid) 9 | # * Image puller to pull single-user container image beforehand 10 | ### 11 | 12 | 13 | ### 14 | # Deployment with KubeSpawner and a cluster-wise SQUID proxy for CVMFS 15 | ### 16 | 17 | 18 | ### SECRETS ### 19 | # 20 | ### 1.SSL certificates ### 21 | # Note: These certificates are self-signed and for testing purposes only. Please replace them with proper certificates. 22 | # 23 | # Note: All Kubernetes secrets must be base64 encoded. Please encode your certificates with 24 | # `cat /path/to/your/certificate.key | base64 -w 0` for Linux-based systems 25 | # More details available here: https://kubernetes.io/docs/concepts/configuration/secret/ 26 | ### 27 | apiVersion: v1 28 | kind: Secret 29 | metadata: 30 | name: swan-certs 31 | namespace: boxed 32 | type: Opaque 33 | data: 34 | boxed.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBem5HeDErQ2FyalBWOVM3bWFQK3pqWlZhaXZZdm5acllBQlNIUnoyNis5emE5a1dsCkVUeWxpMzdiVnd0OEdQQnZtZ3RqVU1yK25WTFlETU42K2o0Y1Vrem1RMnFHa0hXN1Q2T3BOM2FNTUVFZ2VnQWUKYzkvU2dQdE9EZUlXK3paaUJUNW80SmpKNDgzRVc1cURDUkQxenRiSnl3WVAvR1ZLTlFpS0RaR3hwU3MxMXYzTgowWGwvM1pGK1J6KzA1dW5uaEIrT2NaT0JKNHUrSlozK2tGbFR5YU5GdENHd2R1N09jWUl3dE1nMXpmWXZp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KMURLMWRuelpXWjhFQVEwaW4wWkFtdlVIVVRsWEdGQ3B5b2hKbGtnczdpd3FRT3A3UjNiQnZhS0hxQitCMWpTZApoSjlwaElzSkFnVXFqVXE2ei9oUDV5RU40OW43YWIreWEzREp5Zm1iR2YxSmNVOC9COE5Hc0JBLzBJc0NRa2NxCmFFTFVncDFCWlg3TFpwSlFwaUVHWnBCME1DUzMvdUV0Z2EyQTJQZHEyWnlDb1NOV3d5dEFvN2lOa3JZdG4rd1AKa1lZWldCZkFjZGZNOVNQaVBnRXRmNnJzRWFBR0J4KzVicDBma0Rtbm1RUE9OZ2ZhT211UEMzZk9XRGdTMmtSQQowZnVRWFU2MjlFOEdpUEQ2QXZCemptcTc1M0VVVzZNanlUQkQKLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0tCg== 37 | # 38 | --- 39 | ### 40 | # 2.EOS Keytab 41 | # Note: This is specific to the EOS instance to connect to. Should be kept secret for production instances 42 | # 43 | 44 | # The EOS Keytab secret is currently commented out. 45 | # If in the need of specifing a custom keytab, proceed as follows: 46 | # a. base64 encode it and copy the result in the 'eos.keytab' variable below 47 | # b. uncomment what follows, from ''apiVersion: v1' to ' eos.keytab: %%% THIS IS ONLY A PLACE HOLDER %%%' 48 | # c. uncomment the volumeMount and the volume definition for 'eos-keytab' in the eos-fuse resource specification 49 | # d. uncomment the env var EOS_GATEWAY_KEYTAB_FILE definition in the eos-fuse resource specification 50 | # e. redeploy the services for the changes to take effect 51 | # 52 | ##apiVersion: v1 53 | ##kind: Secret 54 | ##metadata: 55 | ## name: eos-keytab 56 | ## namespace: boxed 57 | ##type: Opaque 58 | ##data: 59 | ## eos.keytab: %%% THIS IS ONLY A PLACE HOLDER %%% 60 | # 61 | 62 | 63 | ### CLUSTER ROLE BINDINGS ### 64 | # 65 | # NOTE: SWAN requires access to the Kubernetes cluster resources and the ability 66 | # to list and start containers in the namespace where it is deployed. 67 | # In order to achieve this, please review your cluster configuration and, if needed, 68 | # configure the default service account for the namespace as an admin of the cluster. 69 | # 70 | # Example with namespace "boxed": 71 | # `kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=boxed:default` 72 | # 73 | # The binding between the default service account for namespace "boxed" and its role 74 | # of cluster administrator is automated in what follows: 75 | ### 76 | --- 77 | apiVersion: rbac.authorization.k8s.io/v1 78 | kind: ClusterRoleBinding 79 | metadata: 80 | creationTimestamp: null 81 | name: add-on-cluster-admin 82 | roleRef: 83 | apiGroup: rbac.authorization.k8s.io 84 | kind: ClusterRole 85 | name: cluster-admin 86 | subjects: 87 | - kind: ServiceAccount 88 | name: default 89 | namespace: boxed 90 | # 91 | ### 92 | 93 | 94 | ### PODS ### 95 | --- 96 | # Jupyterhub -- Deployment 97 | apiVersion: apps/v1beta1 98 | kind: Deployment 99 | metadata: 100 | name: &name swan 101 | namespace: &namespace boxed 102 | labels: 103 | app: *name 104 | spec: 105 | replicas: 1 106 | template: 107 | metadata: 108 | labels: 109 | app: *name 110 | name: *name 111 | spec: 112 | terminationGracePeriodSeconds: 60 113 | nodeSelector: 114 | nodeApp: *name 115 | hostNetwork: true 116 | dnsPolicy: ClusterFirstWithHostNet 117 | containers: 118 | - name: jupyterhub 119 | image: gitlab-registry.cern.ch/swan/docker-images/jupyterhub:v1.9 120 | imagePullPolicy: IfNotPresent 121 | ports: 122 | - name: http 123 | protocol: TCP 124 | hostPort: &HTTP_PORT 80 125 | containerPort: *HTTP_PORT 126 | - name: https 127 | protocol: TCP 128 | hostPort: &HTTPS_PORT 443 129 | containerPort: *HTTPS_PORT 130 | volumeMounts: 131 | - name: &vm_swan-certs swan-certs 132 | mountPath: /etc/boxed/certs 133 | - name: &vm_JHconfig jupyterhub-data 134 | mountPath: /srv/jupyterhub/jupyterhub_data 135 | - name: &vm_logs-jupyterhub jupyterhub-logs 136 | mountPath: /var/log/jupyterhub 137 | - name: &vm_logs-httpd httpd-logs 138 | mountPath: /var/log/httpd 139 | - name: &vm_logs-shibboleth shibboleth-logs 140 | mountPath: /var/log/shibboleth 141 | env: 142 | - name: PODINFO_NAMESPACE 143 | valueFrom: 144 | fieldRef: 145 | fieldPath: metadata.namespace 146 | - name: PODINFO_NAME 147 | valueFrom: 148 | fieldRef: 149 | fieldPath: metadata.name 150 | - name: PODINFO_IP 151 | valueFrom: 152 | fieldRef: 153 | fieldPath: status.podIP 154 | - name: PODINFO_NODE_NAME 155 | valueFrom: 156 | fieldRef: 157 | fieldPath: spec.nodeName 158 | - name: PODINFO_NODE_IP 159 | valueFrom: 160 | fieldRef: 161 | fieldPath: status.hostIP 162 | - name: THIS_CONTAINER 163 | value: "JUPYTERHUB" 164 | - name: DEPLOYMENT_TYPE 165 | value: "kubespawner" 166 | #- name: HOSTNAME # Use this configuration only if the linux hostname matches the chosen domain name 167 | # valueFrom: # at the DNS (e.g., no aliases are defined) 168 | # fieldRef: # Otherwise, please specify manually the hostname below. 169 | # fieldPath: spec.nodeName 170 | - name: HOSTNAME # Assume JupyterHub is exposed via hostNetwork on the node where it runs 171 | value: "up2kube-swan.cern.ch" # URL to reach SWAN will be: https:// 172 | - name: HTTP_PORT 173 | value: "80" 174 | - name: HTTPS_PORT 175 | value: "443" 176 | ### LDAP parameters 177 | - name: LDAP_URI 178 | value: "ldap://ldap.boxed.svc.cluster.local" 179 | - name: LDAP_PORT 180 | value: "389" 181 | - name: LDAP_BASE_DN 182 | value: "dc=example,dc=org" 183 | - name: LDAP_BIND_DN 184 | value: "cn=readuser,dc=example,dc=org" 185 | - name: LDAP_BIND_PASSWORD 186 | value: "readuser" 187 | ### JupyterHub configuration 188 | - name: AUTH_TYPE 189 | value: "local" 190 | #value: "shibboleth" 191 | - name: CONTAINER_IMAGE 192 | value: "gitlab-registry.cern.ch/swan/docker-images/systemuser:v5.2.0" 193 | ### KubeSpawner parameters 194 | - name: NAMESPACE 195 | value: *namespace 196 | - name: NODE_SELECTOR_KEY 197 | value: "nodeApp" 198 | - name: NODE_SELECTOR_VALUE 199 | value: "swan-users" 200 | ### Mounts for single-user containers 201 | - name: CVMFS_FOLDER 202 | value: "/cvmfs" 203 | - name: EOS_USER_PATH # This must bring to the folder with the list of initials of users 204 | value: "/eos/docker/user" # E.g., "/eos/docker/user" --(will be mapped to)--> "/eos/user" in the container 205 | - name: CERNBOXGATEWAY_HOSTNAME # Hostname of CERNBox for Sharing API 206 | value: "up2kube-cernbox.cern.ch" 207 | # - name: SPAWNER_FORM 208 | # value: "simple" 209 | #### Customization 210 | #- name: CUSTOMIZATION_REPO 211 | # value: "https://.git" 212 | #- name: CUSTOMIZATION_COMMIT 213 | # value: "" 214 | #- name: CUSTOMIZATION_SCRIPT 215 | # value: "" 216 | #- name: SSO_LOGOUT_URL 217 | # value: "https://swan.web.cern.ch" 218 | volumes: 219 | - name: *vm_swan-certs 220 | secret: 221 | secretName: swan-certs 222 | defaultMode: 0644 223 | - name: *vm_JHconfig 224 | hostPath: 225 | path: /mnt/jupyterhub_data 226 | type: Directory 227 | - name: *vm_logs-jupyterhub 228 | hostPath: 229 | path: /var/kubeVolumes/jupyterhub_logs 230 | type: DirectoryOrCreate 231 | - name: *vm_logs-httpd 232 | hostPath: 233 | path: /var/kubeVolumes/httpd_logs 234 | type: DirectoryOrCreate 235 | - name: *vm_logs-shibboleth 236 | hostPath: 237 | path: /var/kubeVolumes/shibboleth_logs 238 | type: DirectoryOrCreate 239 | 240 | --- 241 | # SQUID Proxy for CVMFS -- Deployment 242 | apiVersion: apps/v1beta1 243 | kind: Deployment 244 | metadata: 245 | name: &name cvmfssquid 246 | namespace: &namespace boxed 247 | labels: 248 | app: *name 249 | spec: 250 | replicas: 1 251 | template: 252 | metadata: 253 | labels: 254 | app: *name 255 | name: *name 256 | spec: 257 | terminationGracePeriodSeconds: 60 258 | nodeSelector: 259 | nodeApp: swan 260 | containers: 261 | - name: cvmfssquid 262 | image: gitlab-registry.cern.ch/cernbox/boxedhub/cvmfssquid:v0 263 | imagePullPolicy: IfNotPresent 264 | env: 265 | ### PodInfo ### 266 | - name: PODINFO_NAMESPACE 267 | valueFrom: 268 | fieldRef: 269 | fieldPath: metadata.namespace 270 | - name: PODINFO_NAME 271 | valueFrom: 272 | fieldRef: 273 | fieldPath: metadata.name 274 | - name: PODINFO_IP 275 | valueFrom: 276 | fieldRef: 277 | fieldPath: status.podIP 278 | - name: PODINFO_NODE_NAME 279 | valueFrom: 280 | fieldRef: 281 | fieldPath: spec.nodeName 282 | - name: PODINFO_NODE_IP 283 | valueFrom: 284 | fieldRef: 285 | fieldPath: status.hostIP 286 | - name: DEPLOYMENT_TYPE 287 | value: "kubernetes" 288 | 289 | --- 290 | # CVMFS client, EOS fuse gateway, and Image puller -- DaemonSet 291 | # 292 | # Note: Deploy EOS Fuse and CVMFS daemons on all the nodes where 293 | # single-user sessions can land. Such nodes are identified 294 | # via NodeSelector key-value provided by Kubernetes. 295 | # Default is: "nodeApp: swan-users" 296 | # 297 | # Note: Image puller is used to download the single-user 298 | # container image before the first request from the user comes. 299 | # This image is usually 3GB+ in size and, if not already 300 | # available locally, would require several minutes to download. 301 | # 302 | apiVersion: extensions/v1beta1 303 | kind: DaemonSet 304 | metadata: 305 | name: &daemons swan-daemons 306 | namespace: &namespace boxed 307 | labels: 308 | app: *daemons 309 | spec: 310 | template: 311 | metadata: 312 | labels: 313 | app: *daemons 314 | name: *daemons 315 | spec: 316 | hostPID: true 317 | terminationGracePeriodSeconds: 60 318 | nodeSelector: 319 | nodeApp: "swan-users" 320 | containers: 321 | ### 322 | # 1. EOS-FUSE 323 | - name: eos-fuse 324 | image: gitlab-registry.cern.ch/cernbox/boxedhub/eos-fuse:v0.8 325 | imagePullPolicy: IfNotPresent 326 | securityContext: 327 | privileged: true 328 | capabilities: 329 | add: ["SYS_ADMIN"] 330 | volumeMounts: 331 | - name: &vm_cgroup cgroup 332 | mountPath: /sys/fs/cgroup 333 | ##- name: &vm_eos-keytab eos-keytab 334 | ## mountPath: /etc/boxed/eos_secrets 335 | - name: &vm_rdv-eos rdv-eos 336 | mountPath: /eos:shared 337 | - name: &vm_logs-eosfuse eosfuse-logs 338 | mountPath: /var/log/eos/fuse 339 | env: 340 | - name: PODINFO_NAMESPACE 341 | valueFrom: 342 | fieldRef: 343 | fieldPath: metadata.namespace 344 | - name: PODINFO_NAME 345 | valueFrom: 346 | fieldRef: 347 | fieldPath: metadata.name 348 | - name: PODINFO_IP 349 | valueFrom: 350 | fieldRef: 351 | fieldPath: status.podIP 352 | - name: PODINFO_NODE_NAME 353 | valueFrom: 354 | fieldRef: 355 | fieldPath: spec.nodeName 356 | - name: PODINFO_NODE_IP 357 | valueFrom: 358 | fieldRef: 359 | fieldPath: status.hostIP 360 | - name: THIS_CONTAINER 361 | value: "EOS-FUSE" 362 | - name: DEPLOYMENT_TYPE 363 | value: "kubernetes" 364 | ### LDAP parameters 365 | - name: LDAP_URI 366 | value: "ldap://ldap.boxed.svc.cluster.local" 367 | - name: LDAP_PORT 368 | value: "389" 369 | - name: LDAP_BASE_DN 370 | value: "dc=example,dc=org" 371 | - name: LDAP_BIND_DN 372 | value: "cn=readuser,dc=example,dc=org" 373 | - name: LDAP_BIND_PASSWORD 374 | value: "readuser" 375 | ### EOS parameters 376 | - name: EOS_MGM_ALIAS 377 | value: "eos-mgm.boxed.svc.cluster.local" 378 | - name: EOS_FOLDER 379 | value: "/eos" 380 | ##- name: EOS_GATEWAY_KEYTAB_FILE 381 | ## value: "/etc/boxed/eos_secrets/eos.keytab" 382 | - name: EOS_GATEWAY_SELF_REGISTRATION 383 | value: "true" 384 | - name: EOS_GATEWAY_AUTH 385 | value: "unix" 386 | lifecycle: 387 | preStop: 388 | exec: 389 | command: ["bash", "/root/stop.sh"] 390 | ### 391 | # 2. CVMFS 392 | - name: cvmfs 393 | image: gitlab-registry.cern.ch/cernbox/boxedhub/cvmfs:v0.5 394 | imagePullPolicy: IfNotPresent 395 | securityContext: 396 | privileged: true 397 | capabilities: 398 | add: ["SYS_ADMIN"] 399 | volumeMounts: 400 | - name: &vm_devfuse devfuse 401 | mountPath: /dev/fuse 402 | - name: &vm_rdv-cvmfs rdv-cvmfs 403 | mountPath: /cvmfs:shared 404 | env: 405 | - name: PODINFO_NAMESPACE 406 | valueFrom: 407 | fieldRef: 408 | fieldPath: metadata.namespace 409 | - name: PODINFO_NAME 410 | valueFrom: 411 | fieldRef: 412 | fieldPath: metadata.name 413 | - name: PODINFO_IP 414 | valueFrom: 415 | fieldRef: 416 | fieldPath: status.podIP 417 | - name: PODINFO_NODE_NAME 418 | valueFrom: 419 | fieldRef: 420 | fieldPath: spec.nodeName 421 | - name: PODINFO_NODE_IP 422 | valueFrom: 423 | fieldRef: 424 | fieldPath: status.hostIP 425 | - name: THIS_CONTAINER 426 | value: "CVMFS" 427 | - name: DEPLOYMENT_TYPE 428 | value: "kubernetes" 429 | - name: CVMFS_FOLDER 430 | value: "/cvmfs" 431 | - name: CVMFS_UPSTREAM_CONNECTION 432 | #value: "direct" 433 | #value" "cern" 434 | value: "squid" 435 | - name: CVMFS_SQUID_HOSTNAME 436 | value: "cvmfssquid.boxed.svc.cluster.local" 437 | - name: CVMFS_SQUID_PORT 438 | value: "3128" 439 | - name: SOFTWARE_STACK 440 | value: "LCG_96" 441 | - name: PLATFORM 442 | value: "x86_64-centos7-gcc8-opt" 443 | lifecycle: 444 | preStop: 445 | exec: 446 | command: ["bash", "/root/stop.sh"] 447 | ### 448 | # 3. Image puller 449 | - name: imagepuller 450 | image: gitlab-registry.cern.ch/cernbox/boxedhub/imagepuller:latest 451 | imagePullPolicy: IfNotPresent 452 | volumeMounts: 453 | - name: &vm_docker-socket docker-socket 454 | mountPath: /var/run/docker.sock 455 | env: 456 | - name: PODINFO_NAMESPACE 457 | valueFrom: 458 | fieldRef: 459 | fieldPath: metadata.namespace 460 | - name: PODINFO_NAME 461 | valueFrom: 462 | fieldRef: 463 | fieldPath: metadata.name 464 | - name: PODINFO_IP 465 | valueFrom: 466 | fieldRef: 467 | fieldPath: status.podIP 468 | - name: PODINFO_NODE_NAME 469 | valueFrom: 470 | fieldRef: 471 | fieldPath: spec.nodeName 472 | - name: PODINFO_NODE_IP 473 | valueFrom: 474 | fieldRef: 475 | fieldPath: status.hostIP 476 | - name: THIS_CONTAINER 477 | value: "ImagePuller" 478 | - name: DEPLOYMENT_TYPE 479 | value: "kubernetes" 480 | - name: DAEMON_SET 481 | value: "true" 482 | - name: DOCKER_IMAGES 483 | value: "gitlab-registry.cern.ch/swan/docker-images/systemuser:v5.2.0" 484 | 485 | volumes: 486 | # EOS-FUSE 487 | - name: *vm_cgroup 488 | emptyDir: {} # Fooling systemd to init the eosd service 489 | ##- name: *vm_eos-keytab 490 | ## secret: 491 | ## secretName: eos-keytab 492 | ## defaultMode: 0400 493 | - name: *vm_rdv-eos 494 | hostPath: 495 | path: /eos 496 | - name: *vm_logs-eosfuse 497 | hostPath: 498 | path: /var/kubeVolumes/eosfuse_logs 499 | type: DirectoryOrCreate 500 | # CVMFS 501 | - name: *vm_devfuse 502 | hostPath: 503 | path: /dev/fuse 504 | - name: *vm_rdv-cvmfs 505 | hostPath: 506 | path: /cvmfs 507 | # ImagePuller 508 | - name: *vm_docker-socket # To pull single-user container image 509 | hostPath: 510 | path: /var/run/docker.sock 511 | 512 | 513 | --- 514 | ### SERVICE ### 515 | apiVersion: v1 516 | kind: Service 517 | metadata: 518 | name: &name cvmfssquid 519 | namespace: boxed 520 | spec: 521 | selector: 522 | app: *name 523 | ports: 524 | - name: squid-http 525 | protocol: TCP 526 | port: 3128 527 | targetPort: 3128 528 | type: ClusterIP 529 | 530 | 531 | # NOTE: A kubernetes service to access SWAN in only needed when 532 | # hostNetwork connectivity is not enabled on the cluster node 533 | # where jupyterhub runs. 534 | # Otherwise, JupyterHub is directly accessible on {HTTP, HTTPS}_PORTS 535 | # 536 | # Below, an example of NodePort service that uses the Kubernetes master 537 | # as a gateway for SWAN via ports 30080 and 30443. 538 | # 539 | #apiVersion: v1 540 | #kind: Service 541 | #metadata: 542 | # name: &name swan 543 | # namespace: &namespace boxed 544 | #spec: 545 | # selector: 546 | # app: *name 547 | # ports: 548 | # - name: http 549 | # protocol: TCP 550 | # port: 80 551 | # targetPort: 80 552 | # nodePort: 30080 553 | # - name: https 554 | # protocol: TCP 555 | # port: 443 556 | # targetPort: 443 557 | # nodePort: 30443 558 | # type: NodePort 559 | 560 | -------------------------------------------------------------------------------- /CERNBOX.yaml: -------------------------------------------------------------------------------- 1 | ### CERNBOX ### 2 | # 3 | # CERNBox service 4 | # Deploys: 5 | # * CERNBox web service 6 | # * CERNBox Gateway redirecting traffic to EOS 7 | # * CERNBox MySQL database 8 | ### 9 | 10 | 11 | ### SECRETS ### 12 | # 13 | # Note: All Kubernetes secrets must be base64 encoded. Please encode your certificates with 14 | # `cat /path/to/your/certificate.key | base64 -w 0` for Linux-based systems 15 | # More details available here: https://kubernetes.io/docs/concepts/configuration/secret/ 16 | # 17 | ### 18 | # 1.SSL certificates 19 | # Note: These certificates are self-signed and for testing purposes only. Please replace them with proper certificates. 20 | # 21 | apiVersion: v1 22 | kind: Secret 23 | metadata: 24 | name: cernbox-certs 25 | namespace: boxed 26 | type: Opaque 27 | data: 28 | boxed.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBem5HeDErQ2FyalBWOVM3bWFQK3pqWlZhaXZZdm5acllBQlNIUnoyNis5emE5a1dsCkVUeWxpMzdiVnd0OEdQQnZtZ3RqVU1yK25WTFlETU42K2o0Y1Vrem1RMnFHa0hXN1Q2T3BOM2FNTUVFZ2VnQWUKYzkvU2dQdE9EZUlXK3paaUJUNW80SmpKNDgzRVc1cURDUkQxenRiSnl3WVAvR1ZLTlFpS0RaR3hwU3MxMXYzTgowWGwvM1pGK1J6KzA1dW5uaEIrT2NaT0JKNHUrSlozK2tGbFR5YU5GdENHd2R1N09jWUl3dE1nMXpmWXZpTTFQCnJjYkpUYS9OM1EzR0FHSFBYQzVsZGNyYWFnK1Zib3FtNk83RGk4QzFVNUFMUmRxWE1TMW4yRVpLek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pTZApoSjlwaElzSkFnVXFqVXE2ei9oUDV5RU40OW43YWIreWEzREp5Zm1iR2YxSmNVOC9COE5Hc0JBLzBJc0NRa2NxCmFFTFVncDFCWlg3TFpwSlFwaUVHWnBCME1DUzMvdUV0Z2EyQTJQZHEyWnlDb1NOV3d5dEFvN2lOa3JZdG4rd1AKa1lZWldCZkFjZGZNOVNQaVBnRXRmNnJzRWFBR0J4KzVicDBma0Rtbm1RUE9OZ2ZhT211UEMzZk9XRGdTMmtSQQowZnVRWFU2MjlFOEdpUEQ2QXZCemptcTc1M0VVVzZNanlUQkQKLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0tCg== 31 | # 32 | --- 33 | ### 34 | # 2.EOS Keytab 35 | # Note: This is specific to the EOS instance to connect to. Should be kept secret for production instances 36 | # 37 | 38 | # The EOS Keytab secret is currently commented out. 39 | # If in the need of specifing a custom keytab, proceed as follows: 40 | # a. base64 encode it and copy the result in the 'eos.keytab' variable below 41 | # b. uncomment what follows, from ''apiVersion: v1' to ' eos.keytab: %%% THIS IS ONLY A PLACE HOLDER %%%' 42 | # c. uncomment the volumeMount and the volume definition for 'eos-keytab' in the CERNBox Backend (ownCloud) resource specification 43 | # d. uncomment the env var EOS_GATEWAY_KEYTAB_FILE definition in the CERNBox Backend (ownCloud) resource specification 44 | # e. repeat step c. and d. for CERNBox Gateway (nginx proxy) 45 | # f. redeploy the services for the changes to take effect 46 | # 47 | ##apiVersion: v1 48 | ##kind: Secret 49 | ##metadata: 50 | ## name: eos-keytab 51 | ## namespace: boxed 52 | ##type: Opaque 53 | ##data: 54 | ## eos.keytab: %%% THIS IS ONLY A PLACE HOLDER %%% 55 | # 56 | --- 57 | ### 58 | # 3.MySQL (MariaDB) configuration variables 59 | # Please read more here on the parameters to be configured: https://hub.docker.com/r/library/mariadb/ 60 | # 61 | # Note: The MySQL user and password provided below are either randomly generated or dummy ones. 62 | # Please consider replacing them with proper passwords when deploying the service for the first time. 63 | # You can read more on how to manage user accounts on MySQL here: https://dev.mysql.com/doc/refman/5.7/en/user-account-management.html 64 | # Changing the root password requires to rebuild the cernboxmysql image. Please read more at https://gitlab.cern.ch/cernbox/boxed/tree/master/cernboxmysql.d 65 | # 66 | apiVersion: v1 67 | kind: Secret 68 | metadata: 69 | name: mysql-config 70 | namespace: boxed 71 | type: Opaque 72 | data: 73 | # Random root password: "1qvj1yh2ufc5fizh" 74 | mysql_root_password: MXF2ajF5aDJ1ZmM1Zml6aAo= 75 | # Database user: "cernbox_backend" 76 | mysql_user: Y2VybmJveF9iYWNrZW5kCg== 77 | # Database password: "cernbox_backend_1234567890" 78 | mysql_password: Y2VybmJveF9iYWNrZW5kXzEyMzQ1Njc4OTAK 79 | # 80 | ### 81 | 82 | 83 | ### PODS ### 84 | --- 85 | # MySQL -- Deployment 86 | apiVersion: apps/v1beta1 87 | kind: Deployment 88 | metadata: 89 | name: &name cernboxmysql 90 | namespace: &namespace boxed 91 | labels: 92 | app: *name 93 | spec: 94 | replicas: 1 95 | template: 96 | metadata: 97 | labels: 98 | app: *name 99 | name: *name 100 | spec: 101 | terminationGracePeriodSeconds: 60 102 | restartPolicy: Always 103 | nodeSelector: 104 | # Run together with the CERNBox backend (ownCloud) pod 105 | nodeApp: cernbox 106 | containers: 107 | - name: *name 108 | image: gitlab-registry.cern.ch/cernbox/boxedhub/cernboxmysql:v1.0 109 | imagePullPolicy: IfNotPresent 110 | #ports: 111 | #- name: http 112 | # protocol: TCP 113 | # hostPort: &MYSQL_PORT 3306 114 | # containerPort: *MYSQL_PORT 115 | volumeMounts: 116 | - name: &vm_mysql-config mysql-config 117 | mountPath: /etc/boxed/mysql_secrets 118 | - name: &vm_shares mysql-sharesdb 119 | mountPath: /var/lib/mysql 120 | env: 121 | - name: PODINFO_NAMESPACE 122 | valueFrom: 123 | fieldRef: 124 | fieldPath: metadata.namespace 125 | - name: PODINFO_NAME 126 | valueFrom: 127 | fieldRef: 128 | fieldPath: metadata.name 129 | - name: PODINFO_IP 130 | valueFrom: 131 | fieldRef: 132 | fieldPath: status.podIP 133 | - name: PODINFO_NODE_NAME 134 | valueFrom: 135 | fieldRef: 136 | fieldPath: spec.nodeName 137 | - name: PODINFO_NODE_IP 138 | valueFrom: 139 | fieldRef: 140 | fieldPath: status.hostIP 141 | - name: THIS_CONTAINER 142 | value: "CERNBOXMySQL" 143 | - name: DEPLOYMENT_TYPE 144 | value: "kubernetes" 145 | - name: MYSQL_ROOT_PASSWORD_FILE 146 | value: "/etc/boxed/mysql_secrets/mysql_root_password" 147 | - name: MYSQL_USER_FILE 148 | value: "/etc/boxed/mysql_secrets/mysql_user" 149 | - name: MYSQL_PASSWORD_FILE 150 | value: "/etc/boxed/mysql_secrets/mysql_password" 151 | - name: MYSQL_DATABASE_NAME 152 | # WARNING: Do not change this value, otherwise the cernboxmysql image must be rebuilt 153 | # Please read more at https://gitlab.cern.ch/cernbox/boxed/tree/master/cernboxmysql.d 154 | value: "cernbox" 155 | volumes: 156 | - name: *vm_mysql-config 157 | secret: 158 | secretName: mysql-config 159 | defaultMode: 0644 160 | - name: *vm_shares 161 | hostPath: 162 | path: /mnt/cbox_shares_db/cbox_MySQL 163 | type: Directory 164 | 165 | --- 166 | # CERNBox Backend (ownCloud) -- Deployment 167 | apiVersion: apps/v1beta1 168 | kind: Deployment 169 | metadata: 170 | name: &name cernbox 171 | namespace: &namespace boxed 172 | labels: 173 | app: *name 174 | spec: 175 | replicas: 1 176 | template: 177 | metadata: 178 | labels: 179 | app: *name 180 | name: *name 181 | spec: 182 | terminationGracePeriodSeconds: 60 183 | restartPolicy: Always 184 | nodeSelector: 185 | nodeApp: *name 186 | hostname: *name 187 | subdomain: *name 188 | containers: 189 | - name: *name 190 | image: gitlab-registry.cern.ch/cernbox/boxedhub/cernbox:v1.4 191 | imagePullPolicy: IfNotPresent 192 | #ports: 193 | #- name: http 194 | # protocol: TCP 195 | # hostPort: &MYSQL_PORT 3306 196 | # containerPort: *MYSQL_PORT 197 | volumeMounts: 198 | - name: &vm_cernbox-certs cernbox-certs 199 | mountPath: /etc/boxed/certs 200 | ##- name: &vm_eos-keytab eos-keytab 201 | ## mountPath: /etc/boxed/eos_secrets 202 | - name: &vm_mysql-config mysql-config 203 | mountPath: /etc/boxed/mysql_secrets 204 | - name: &vm_cbox-data cboxbackend-data 205 | mountPath: /var/www/html/cernbox/data 206 | - name: &vm_logs-httpd httpd-logs 207 | mountPath: /var/log/httpd 208 | - name: &vm_logs-shibboleth shibboleth-logs 209 | mountPath: /var/log/shibboleth 210 | env: 211 | - name: PODINFO_NAMESPACE 212 | valueFrom: 213 | fieldRef: 214 | fieldPath: metadata.namespace 215 | - name: PODINFO_NAME 216 | valueFrom: 217 | fieldRef: 218 | fieldPath: metadata.name 219 | - name: PODINFO_IP 220 | valueFrom: 221 | fieldRef: 222 | fieldPath: status.podIP 223 | - name: PODINFO_NODE_NAME 224 | valueFrom: 225 | fieldRef: 226 | fieldPath: spec.nodeName 227 | - name: PODINFO_NODE_IP 228 | valueFrom: 229 | fieldRef: 230 | fieldPath: status.hostIP 231 | - name: THIS_CONTAINER 232 | value: "CERNBOX" 233 | - name: DEPLOYMENT_TYPE 234 | value: "kubernetes" 235 | - name: CERNBOXGATEWAY_HOSTNAME # Hostname of the proxy cernboxgateway 236 | value: "up2kube-cernbox.cern.ch" # It has to match the name of the machine where the proxy is deployed by kubernetes! 237 | - name: HTTPS_PORT 238 | value: "443" 239 | ### LDAP parameters 240 | - name: LDAP_URI 241 | value: "ldap://ldap.boxed.svc.cluster.local" 242 | - name: LDAP_PORT 243 | value: "389" 244 | - name: LDAP_BASE_DN 245 | value: "dc=example,dc=org" 246 | - name: LDAP_BIND_DN 247 | value: "cn=readuser,dc=example,dc=org" 248 | - name: LDAP_BIND_PASSWORD 249 | value: "readuser" 250 | # The following LDAP vars are required only when using User Backends 251 | # that need the ability to store new entries in the LDAP server 252 | - name: LDAP_ADMIN_BIND_DN 253 | value: "cn=admin,dc=example,dc=org" 254 | - name: LDAP_ADMIN_BIND_PASSWORD 255 | value: "admin" 256 | - name: LDAP_ENTRY_NAME_PREFIX 257 | value: "up" 258 | - name: LDAP_ENTRY_UIDNUMBER_START 259 | value: "1001" 260 | ### EOS parameters 261 | - name: EOS_MGM_ALIAS 262 | value: "eos-mgm.eos-mgm.boxed.svc.cluster.local" 263 | - name: EOS_PREFIX 264 | value: "/eos/docker/user/" 265 | - name: EOS_METADATADIR 266 | value: "/eos/docker/user/.sys.dav.hide#.user.metadata/" 267 | - name: EOS_RECYCLEDIR 268 | value: "/eos/docker/proc/recycle/" 269 | - name: EOS_PROJECTPREFIX 270 | value: "/eos/docker/project/" 271 | ##- name: EOS_GATEWAY_KEYTAB_FILE 272 | ## value: "/etc/boxed/eos_secrets/eos.keytab" 273 | - name: EOS_GATEWAY_SELF_REGISTRATION 274 | value: "true" 275 | - name: EOS_GATEWAY_AUTH 276 | value: "unix" 277 | - name: EOS_QUOTAADMIN_SELF_REGISTRATION 278 | value: "true" 279 | ### Default quota for new users 280 | - name: USER_QUOTA_VOLUME 281 | value: "20GB" 282 | - name: USER_QUOTA_INODES 283 | value: "1M" 284 | ### Misc 285 | - name: AUTH_TYPE 286 | value: "local" 287 | #value: "shibboleth" 288 | - name: DATABASE_BACKEND 289 | #value: "sqlite" 290 | value: "mysql" 291 | - name: MYSQL_URI 292 | value: "cernboxmysql.boxed.svc.cluster.local" 293 | - name: MYSQL_DB 294 | value: "cernbox" 295 | - name: MYSQL_PORT 296 | value: "3306" 297 | - name: ADMINS_LIST 298 | value: "" # Whitespace-separated list of users with administrator privileges 299 | - name: INSTANCEID 300 | value: "oc1234" 301 | - name: CBOXGROUPD_SECRET 302 | value: "1234" 303 | - name: CBOXSWANAPID_SECRET 304 | value: "1234" 305 | - name: CBOXSWANAPID_SIGNKEY 306 | value: "1234" 307 | - name: JWTKEY 308 | value: "1234" 309 | - name: WOPI_SECRET 310 | value: "1234" 311 | - name: REVA_USERNAME 312 | value: "1234" 313 | - name: REVA_PASSWORD 314 | value: "1234" 315 | #- name: SSO_LOGOUT_URL 316 | # value: "https://cernbox.web.cern.ch" 317 | ### Customization 318 | #- name: CUSTOMIZATION_REPO 319 | # value: "https://.git" 320 | #- name: CUSTOMIZATION_COMMIT 321 | # value: "" 322 | #- name: CUSTOMIZATION_SCRIPT 323 | # value: "" 324 | lifecycle: 325 | preStop: 326 | exec: 327 | command: ["bash", "/root/stop.sh"] 328 | volumes: 329 | - name: *vm_cernbox-certs 330 | secret: 331 | secretName: cernbox-certs 332 | defaultMode: 0644 333 | ##- name: *vm_eos-keytab 334 | ## secret: 335 | ## secretName: eos-keytab 336 | ## defaultMode: 0400 337 | - name: *vm_mysql-config 338 | secret: 339 | secretName: mysql-config 340 | defaultMode: 0644 341 | - name: *vm_cbox-data 342 | hostPath: 343 | path: /mnt/cbox_shares_db/cbox_data 344 | type: Directory 345 | - name: *vm_logs-httpd 346 | hostPath: 347 | path: /var/kubeVolumes/httpd_logs 348 | type: DirectoryOrCreate 349 | - name: *vm_logs-shibboleth 350 | hostPath: 351 | path: /var/kubeVolumes/shibboleth_logs 352 | type: DirectoryOrCreate 353 | 354 | --- 355 | # CERNBox Gateway (nginx proxy) -- Deployment 356 | apiVersion: apps/v1beta1 357 | kind: Deployment 358 | metadata: 359 | name: &name cernboxgateway 360 | namespace: &namespace boxed 361 | labels: 362 | app: *name 363 | spec: 364 | replicas: 1 365 | template: 366 | metadata: 367 | labels: 368 | app: *name 369 | name: *name 370 | spec: 371 | terminationGracePeriodSeconds: 60 372 | restartPolicy: Always 373 | nodeSelector: 374 | nodeApp: *name 375 | hostname: *name 376 | subdomain: *name 377 | hostNetwork: true 378 | dnsPolicy: ClusterFirstWithHostNet 379 | containers: 380 | - name: *name 381 | image: gitlab-registry.cern.ch/cernbox/boxedhub/cernboxgateway:v1.1 382 | imagePullPolicy: IfNotPresent 383 | ports: 384 | - name: http 385 | protocol: TCP 386 | hostPort: 80 387 | containerPort: 80 388 | - name: https 389 | protocol: TCP 390 | hostPort: 443 391 | containerPort: 443 392 | volumeMounts: 393 | - name: &vm_cernbox-certs cernbox-certs 394 | mountPath: /etc/boxed/certs 395 | ##- name: &vm_eos-keytab eos-keytab 396 | ## mountPath: /etc/boxed/eos_secrets 397 | - name: &vm_logs cboxgateway-logs 398 | mountPath: /var/log/nginx 399 | env: 400 | - name: PODINFO_NAMESPACE 401 | valueFrom: 402 | fieldRef: 403 | fieldPath: metadata.namespace 404 | - name: PODINFO_NAME 405 | valueFrom: 406 | fieldRef: 407 | fieldPath: metadata.name 408 | - name: PODINFO_IP 409 | valueFrom: 410 | fieldRef: 411 | fieldPath: status.podIP 412 | - name: PODINFO_NODE_NAME 413 | valueFrom: 414 | fieldRef: 415 | fieldPath: spec.nodeName 416 | - name: PODINFO_NODE_IP 417 | valueFrom: 418 | fieldRef: 419 | fieldPath: status.hostIP 420 | - name: THIS_CONTAINER 421 | value: "CERNBOXGATEWAY" 422 | - name: DEPLOYMENT_TYPE 423 | value: "kubernetes" 424 | #- name: HOSTNAME # Use this configuration only if the linux hostname matches the chosen domain name 425 | # valueFrom: # at the DNS (e.g., no aliases are defined) 426 | # fieldRef: # Otherwise, please specify manually the hostname below. 427 | # fieldPath: spec.nodeName 428 | - name: HOSTNAME # Assume the gateway is exposed via hostNetwork on the node where it runs 429 | value: "up2kube-cernbox.cern.ch" # URL to reach the landing page will be: https:// 430 | - name: HTTP_PORT 431 | value: "80" 432 | - name: HTTPS_PORT 433 | value: "443" 434 | #- name: CERNBOX_SUBDOMAIN # If the DNS config allows, configure a subdomain to directly access CERNBox 435 | # value: "cernbox.up2kube-cernbox.cern.ch" # The Web UI will be reachable at https:// and at https:///cernbox 436 | - name: ESCAPE_LANDING_PAGE # Force a redirect to https:///cernbox 437 | value: "false" 438 | ### LDAP parameters 439 | - name: LDAP_URI_1 440 | value: "ldap://ldap.boxed.svc.cluster.local" 441 | - name: LDAP_URI_2 442 | value: "ldap://ldap.boxed.svc.cluster.local" 443 | - name: LDAP_BASE_DN 444 | value: "dc=example,dc=org" 445 | - name: LDAP_BIND_DN 446 | value: "cn=readuser,dc=example,dc=org" 447 | - name: LDAP_BIND_PASSWORD 448 | value: "readuser" 449 | ### Nginx upstream servers parameters 450 | - name: EOS_MGM_ALIAS 451 | value: "eos-mgm.eos-mgm.boxed.svc.cluster.local" 452 | - name: EOS_MGM_ALIAS_PORT 453 | value: "8000" 454 | - name: OWNCLOUD_BACKEND 455 | value: "cernbox.cernbox.boxed.svc.cluster.local" 456 | - name: OWNCLOUD_BACKEND_PORT 457 | value: "443" 458 | - name: WEBDAV_CLIENT_CERT_PORT 459 | value: "4443" 460 | - name: SWAN_BACKEND 461 | value: "up2kube-swan.cern.ch" 462 | - name: SWAN_BACKEND_PORT 463 | value: "443" 464 | ### EOS parameters 465 | - name: EOS_PREFIX 466 | value: "/eos/docker/user/" 467 | - name: EOS_BASE 468 | value: "/eos/docker/" 469 | ##- name: EOS_GATEWAY_KEYTAB_FILE 470 | ## value: "/etc/boxed/eos_secrets/eos.keytab" 471 | - name: EOS_GATEWAY_SELF_REGISTRATION 472 | value: "true" 473 | - name: EOS_GATEWAY_AUTH 474 | value: "https" 475 | ### Customization 476 | #- name: CUSTOMIZATION_REPO 477 | # value: "https://.git" 478 | #- name: CUSTOMIZATION_COMMIT 479 | # value: "" 480 | #- name: CUSTOMIZATION_SCRIPT 481 | # value: "" 482 | lifecycle: 483 | preStop: 484 | exec: 485 | command: ["bash", "/root/stop.sh"] 486 | volumes: 487 | - name: *vm_cernbox-certs 488 | secret: 489 | secretName: cernbox-certs 490 | defaultMode: 0644 491 | ##- name: *vm_eos-keytab 492 | ## secret: 493 | ## secretName: eos-keytab 494 | ## defaultMode: 0400 495 | - name: *vm_logs 496 | hostPath: 497 | path: /var/kubeVolumes/cboxgateway_logs 498 | type: DirectoryOrCreate 499 | 500 | 501 | 502 | ### SERVICES ### 503 | --- 504 | # MySQL -- Service # 505 | apiVersion: v1 506 | kind: Service 507 | metadata: 508 | name: &name cernboxmysql 509 | namespace: &namespace boxed 510 | spec: 511 | selector: 512 | app: *name 513 | ports: 514 | - name: http 515 | protocol: TCP 516 | port: 3306 517 | targetPort: 3306 518 | 519 | --- 520 | # CERNBox Backend (ownCloud) -- Service 521 | # Required to setup the gateway on the EOS side 522 | apiVersion: v1 523 | kind: Service 524 | metadata: 525 | name: &name cernbox 526 | namespace: boxed 527 | spec: 528 | selector: 529 | app: *name 530 | clusterIP: None 531 | ports: 532 | - name: http 533 | protocol: TCP 534 | port: 80 535 | targetPort: 80 536 | - name: https 537 | protocol: TCP 538 | port: 443 539 | targetPort: 443 540 | type: ClusterIP 541 | 542 | --- 543 | # CERNBox Gateway (nginx proxy) -- Service 544 | # NOTE: A kubernetes service to access CERNBox in only needed when 545 | # hostNetwork connectivity is not enabled on the cluster node 546 | # where cernboxgateway runs. 547 | # Otherwise, CERNBox is directly accessible on {HTTP, HTTPS}_PORTS 548 | # 549 | # Below, an example of NodePort service that uses the Kubernetes master 550 | # as a gateway for CERNBox via ports 30080 and 30443. 551 | #apiVersion: v1 552 | #kind: Service 553 | #metadata: 554 | # name: &name cernboxgateway 555 | # namespace: boxed 556 | #spec: 557 | # selector: 558 | # app: *name 559 | # ports: 560 | # - name: http 561 | # protocol: TCP 562 | # port: 80 563 | # targetPort: 80 564 | # nodePort: 30080 565 | # - name: https 566 | # protocol: TCP 567 | # port: 443 568 | # targetPort: 443 569 | # nodePort: 30443 570 | # type: NodePort 571 | 572 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to BOXED 2 | ### *KuBoxed -- Scalable Deployment with Kubernetes* 3 | 4 | ----- 5 | 6 | https://cernbox.cern.ch/cernbox/doc/boxed 7 | 8 | Self-contained, containerized package for next-generation cloud storage and computing services for scientific and general-purpose use: 9 | 10 | - CERNBox: https://cernbox.web.cern.ch 11 | - EOS: https://eos.web.cern.ch 12 | - SWAN: https://swan.web.cern.ch 13 | - CVMFS: https://cvmfs.web.cern.ch 14 | 15 | 16 | Packaging by: Enrico Bocchi, Hugo Gonzalez Labrador, Jozsef Makai, Jakub T. Moscicki 17 | 18 | 19 | ----- 20 | 21 | ## System Architecture 22 | The system consists of three service blocks matching the provided services: EOS (red), CERNBOX (green), and SWAN (orange). 23 | 24 | ![System Architecture](https://raw.githubusercontent.com/cernbox/kuboxed/master/docs/architecture.png) 25 | 26 | Each of the three blocks contains multiple Docker containers that are required to run in order to have the services up and available. 27 | In what follows, a short description of the containers required for each service is provided. 28 | 29 | #### EOS 30 | 1. EOS Management Server (MGM): The management node playing the role of the EOS cluster head and storing the namespace (file metadata) information. 31 | 2. EOS File Storage Server (FST): The file server where actual file payload is stored. Multiple instances of the file server container can be executed concurrently so to scale out the storage requirements. 32 | 33 | *Note*: EOS also requires a messaging queue process (MQ) that is in charge of deliverying the messages among the MGM and all the FSTs. Such process can be executed on a separated container or on the MGM container. The configuration provided below executes the MQ process inside the MGM container. 34 | 35 | 36 | #### CERNBox 37 | 1. CERNBox: The CERNBox Web interface providing sharing capabilities and integration with other applications. 38 | 2. CERNBox Gateway: The proxy redirecting Web traffic to CERNBox backend and file transfers to EOS. 39 | 3. CERNBox MySQL: The MySQL (MariaDB) server providing database backend to CERNBox. 40 | 41 | 42 | #### SWAN 43 | 1. JupyterHub: The server providing capabilities to spawn, manage, and proxy multiple Jupyter sessions for single users. 44 | 2. EOS Fuse Client: The EOS Fuse client to access EOS as a mounted file system 45 | 3. CVMFS Client: The CVMFS client to access scientific software libraries and packages from the WLCG grid. 46 | 47 | 48 | #### LDAP 49 | As satellite service, a local LDAP server is required by EOS, CERNBox, and SWAN to fetch user's information. 50 | 51 | 52 | ----- 53 | 54 | ## Deployment Guidelines and Requirements 55 | Boxed in Kubernetes meets the requirement of high availability and scalability for production deployments. 56 | Containers are continuously monitored by the Kubernetes master, which restarts the failed ones, while processes inside each container are monitored by a supervisor daemon. 57 | In addition, Boxed in Kubernetes enables the system administrator to scale out storage (by deploying additional EOS File Storage Servers) and computing power (by deploying additional worker nodes for SWAN). Additional information is provided ahead when describing the deployment steps of each service. 58 | 59 | The minimal requirements for deploying Boxed in a Kubernetes cluster are as follows. 60 | 61 | #### 1. Number of cluster nodes 62 | It is strongly recommended to run the services on 8 (or more) nodes to isolate system components and avoid single points of failure. The Kubernetes master node is not part of the count. 63 | 64 | The provided yaml files for deployment make use of: 65 | 66 | * 1 node for LDAP -- 1 for the local LDAP database to store user's information; 67 | * 1 + N nodes for EOS -- 1 for the Management Server (MGM) and N for N independent File Storage Servers (FST); 68 | * 2 nodes for CERNBox -- 1 for the CERNBox Backend (core ownCloud, Web interface, and MySQL database) and 1 for the CERNBox Gateway (nginx reverse proxy sorting different traffic types); 69 | * 2 nodes for SWAN -- 1 for JupyterHub and 1 playing the role of worker where single-user's sessions are spawned. The worker node executes the containers with the EOS Fuse Client and the CVMFS client. 70 | 71 | 72 | #### 2. Memory 73 | There is no minimum memory requirement as it mostly relates to the foreseen pool of users and system load. 74 | It is however recommended to: 75 | 76 | * Grant as much memory as possible to the node running the EOS Management Server. The current implementation of EOS loads the entire namespace in memory. While for small deployments 8GB of memory can be sufficient, for bigger deployment it is recommended to monitor the memory consumption and possibly relocate the EOS Management Server on a bigger machine. 77 | 78 | * SWAN worker nodes require an amount of memory proportional to the load they have to sustain and the requirements of jobs executed by users. Adding more worker nodes can alleviate the problem to share the load on a larger pool of machines. 79 | 80 | 81 | #### 3. Storage 82 | Persistent storage is key for many components of Boxed. While Kubernetes easily relocates containers to other nodes, this does not hold true for storage. 83 | 84 | Persistent storage is provided by mounting a *hostPath* volume into the container. This implies that some containers of Boxed are bound to specific nodes of the cluster. 85 | To make the container decoupled from the node, it is highly recommended to use external volumes (e.g., Cinder Volumes in OpenStack clusters), which can be detached and reattached to different nodes if required. More details are provided in Preparation section. 86 | 87 | Why not using *PersistentVolumeClaims*? 88 | Please, refer to "Notes on External Capabilities for Network and Persistent Storage" for more information. 89 | 90 | 91 | #### 4. Network 92 | The CERNBox and the SWAN service require to be reachable on usual HTTP and HTTPS ports. 93 | While it would be possible to use the Kubernetes master as a gateway (leveraging on *NodePort* service type), Kubernetes does not allow to expose ports outside the [30000-32767] range. 94 | 95 | Reachability on HTTP and HTTPS ports is achieved by using the *hostNetwork* on the cluster nodes hosting the CERNBox Gateway containers and the JupyterHub container. 96 | 97 | No special requirements exist as far as the network speed is concerned. Just remind all the traffic from/to synchronization clients to the CERNBox service is handled by the CERNBox Gateway container. 98 | 99 | Why not using external aliases or cloud load balancers? Please, read "Notes on External Capabilities for Network and Persistent Storage" for more information. 100 | 101 | 102 | #### *Notes on External Capabilities for Network and Persistent Storage* 103 | 104 | To maximize the compatibility of Boxed with diverse public and private clouds, the provided yaml files for deployment do not take advantage of any externally-provided capability such as ingress controllers, external load balancers, persistent volumes, etc. 105 | Such capabilities are typically available on some IaaS clouds only (e.g., Google Compute Engine, Amazon Web Services) and relying on them would constitute an obstacle for the deployment of Boxed on other clouds. 106 | 107 | 108 | 109 | ----- 110 | 111 | ## Preparation for Deployment 112 | 113 | ### 1. Create the Kubernetes cluster 114 | *You can ignore this step if you have a Kuberenetes cluster already configured. Please, double-check the software versions reported below.* 115 | 116 | In order to have single nodes being part of a Kubernetes cluster, specific software must be installed. 117 | 118 | #### Automatic node configuration 119 | Please, consider running the provided script `InitNode.sh` for CentOS 7 based systems to install all the required packages and configure the node as Master or Worker in the scope of the Kubernetes cluster. 120 | Other Operating Systems will be supported in future. For the time being, please refer to the following "Manual installation" instructions. 121 | 122 | #### Manual Installation 123 | Required software: 124 | 125 | | Software | Min. Version | 126 | | -------- | -------------- | 127 | | sudo | *not-relevant* | 128 | | wget | *not-relevant* | 129 | | git | *not-relevant* | 130 | | Docker | 17.03.2.ce | 131 | | kubelet | 1.8.0 | 132 | | kubeadm | 1.8.0 | 133 | | kubectl | 1.8.0 | 134 | 135 | To install Docker Community Edition (CE), you can refer to the official documentation: https://docs.docker.com/engine/installation/ 136 | 137 | To initialize a Kubernetes cluster via kubeadm, you can refer to the official guide: https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/ 138 | 139 | 140 | #### Kubernetes Network Plugin 141 | Kubernetes requires a third-party network plugin to communicate within the cluster. The deployment of Boxed has been tested with the *Flannel Overlay Network*. 142 | More information available here: https://kubernetes.io/docs/concepts/cluster-administration/networking/#flannel 143 | 144 | 145 | ### 2. Assign containers to cluster nodes 146 | To comply with the persistent storage and network configuration requirements, a univocal assignment between cluster nodes and the containers they run must assured. 147 | Kubernetes provides the ability assign containers to nodes via `kubectl` (https://kubernetes.io/docs/concepts/configuration/assign-pod-node/). 148 | 149 | To label one node, it is sufficient to issue the command: 150 | ```kubectl label node =```. 151 | 152 | 153 | #### Example for assigning a container to a node 154 | 155 | The yaml file describing our test application must include the specification: 156 | ``` 157 | spec: 158 | nodeSelector: 159 | nodeApp: TESTAPP 160 | ``` 161 | 162 | To assign the test application container to the node `testnode.cern.ch`, it is required to label the node consistently: 163 | ``` 164 | kubectl label node testnode.cern.ch nodeApp=TESTAPP 165 | 166 | kubectl get nodes --show-labels 167 | NAME STATUS ROLES AGE VERSION LABELS 168 | testnode.cern.ch Ready 1d v1.8.0 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=testnode.cern.ch,nodeApp=TESTAPP 169 | ``` 170 | 171 | 172 | #### Container assignments required for the deployment of Boxed 173 | The provided yaml files for deployment require several container assignments to cluster nodes. 174 | Even though this can be modified, we recommend following the suggested configuration. Other deployment scenarios have not been tested and might lead to an inconsistent state of services. In case the predefined assignment of containers to nodes cannot be put in place, it is mandatory to satisfy the provisioning of Persistent Volumes and access to Host Network. 175 | 176 | Required assignments of containers to nodes: 177 | 178 | | Container Name | Label Key | Label Value | Special Requirements | Notes | 179 | | -------- | --------- | -------------- | -------------------------- | ----- | 180 | | ldap | nodeApp | ldap | Persistent Storage | 181 | | eos-mgm | nodeApp | eos-mgm | Memory, Persistent Storage | 1 182 | | eos-fst*N* | nodeApp | eos-fst*N* | Persistent Storage | 1, 2 183 | | cernbox | nodeApp | cernbox | Persistent Storage | 3 184 | | cernboxmysql | nodeApp | cernbox | Persistent Storage | 3 185 | | cernboxgateway | nodeApp | cernboxgateway | Host Network | 186 | | swan | nodeApp | swan | Host Network, Persistent Storage | 187 | | swan-daemons | nodeApp | swan-users | Memory | Swan worker nodes for single-user's sessions | 188 | 189 | *Note 1*: Persistent Storage is used by EOS to store users' data (by default, two replicas of files are stored on different FSTs) and metadata (namespace stored on the MGM). The loss of either part causes the loss of user files! 190 | 191 | *Note 2*: It is recommended to run ONLY one FST on a cluster node to avoid the risk of losing or being unable to access users' data due to node failures. FST containers are "cheap" and can run on small-sized Virtual Machines. 192 | 193 | *Note 3*: CERNBox and CERNBox MySQL require Persistent Storage to store sharing information and CERNBox Applications configuration. 194 | 195 | 196 | 197 | ### 3. Prepare Persistent Storage 198 | The provisioning of persistent storage is a required step for several containers deployed with Boxed. 199 | To avoid relying on externally-provided storage (e.g., Google Compute Engine PersistentDisk, Amazon Web Services ElasticBlockStore, Network File System, etc.), we limit ourselves to mount a *hostPath* in the running containers (see "Notes on External Capabilities for Network and Persistent Storage"). Via *hostPath* it is possible to mount any folder available on the node in the container. Remind that *hostPath* is local storage and cannot be automatically relocated together with the container by Kubernetes. 200 | 201 | When deploying Boxed on Virtual Machines (e.g., in a private OpenStack Cloud) it is strongly recommended to attach storage volumes (e.g., a Cinder Volume in OpenStack) to the node and use such volumes in the container. This would allow relocating the storage volume together with the container in case of node failure. This operation is expected to be performed manually by the system administrator as Kubernetes has no knowledge of attached volumes per se. 202 | Please, read more in the section "How to Fail Over a Node with Persistent Storage Attached". 203 | 204 | As a rule of thumb, critical storage (e.g., user account information, user data, sharing database, etc.) should be stored on attached volumes (e.g., Cinder Volumes in OpenStack) and is below identified by a host path in `/mnt//`. Less critical persistent storage is instead required for systems logs, which are typically stored on the cluster node itself in the host path `/var/kubeVolumes/`. 205 | 206 | 207 | #### Required Persistent Storage - **CRITICAL** : 208 | 209 | | Container Name | Usage | Host Path* | Container Path* | Cinder Volume Mount Point* | FS | Size** | Notes | 210 | | -------- | ----------------------------- | -------------------------------- | ------------------------------- | -------------------------- | ---- | ------ | ----- | 211 | | ldap | user database | /mnt/ldap/userdb | /var/lib/ldap | /mnt/ldap/ | ext4 | ~MB | 212 | | ldap | ldap configuration | /mnt/ldap/config | /etc/ldap/slapd.d | /mnt/ldap/ | ext4 | ~MB | 213 | | eos-mgm | namespace | /mnt/eos_namespace | /var/eos | /mnt/mgm_namepsace | ext4 | ~GB | 214 | | eos-fst*N* | user data | /mnt/fst_userdata | /mnt/fst_userdata | /mnt/fst_userdata | xfs | ~TB/PB | Scalable 215 | | cernbox | config + user shares (SQLite) | /mnt/cbox_shares_db/cbox_data | /var/www/html/cernbox/data | /mnt/cbox_shares_db | ext4 | ~MB | 216 | | cernboxmysql | config + user shares (MySQL) | /mnt/cbox_shares_db/cbox_MySQL | /var/lib/mysql | /mnt/cbox_shares_db | ext4 | ~MB | 217 | | swan | user status database | /mnt/jupyterhub_data | /srv/jupyterhub/jupyterhub_data | /mnt/jupyterhub_data | ext4 | ~MB | 218 | 219 | *Note \**: While host paths and mount points can be modified according to site-specific requirements, never modify the container path. 220 | 221 | *Note \*\**: The size reported is the order of magnitude. Actual size depends on system usage, storage requirements, and user pool size. 222 | 223 | **WARNING**: 224 | Subfolders in `/mnt/` are NOT automatically created at the time of deployment. 225 | Please, proceed as follows: 226 | 1. Attach, mount, and format the external volumes to the nodes where containers requiring critical persistent storage will execute; 227 | 2. Create the required subfolders: 228 | * `/mnt/ldap/userdb` and `/mnt/ldap/config` for LDAP; 229 | * `/mnt/cbox_shares_db/cbox_data` and `/mnt/cbox_shares_db/cbox_MySQL` for CERNBox; 230 | 3. Deploy the service (see below "Deployment of Services"). 231 | 232 | If the deployment of services fails, please inspect the pod status and look for errors related to mount of volumes. 233 | 234 | Below, an example of failed deployment for service LDAP because of subfolders not pre-created. 235 | 1. Pod for LDAP hangs in status "ContainerCreating": 236 | ``` 237 | # kubectl -n boxed get pods -o wide -a 238 | NAME READY STATUS RESTARTS AGE IP NODE 239 | ldap 0/1 ContainerCreating 0 7s kubedevel-worker1.cern.ch 240 | ``` 241 | 2. Inspect the Pod status with `# kubectl -n boxed describe pod ldap` and look at the list of events provided at the bottom: 242 | ``` 243 | Events: 244 | Type Reason Age From Message 245 | ---- ------ ---- ---- ------- 246 | Normal Scheduled 3s default-scheduler Successfully assigned ldap to kubedevel-worker1.cern.ch 247 | Normal SuccessfulMountVolume 2s kubelet, kubedevel-worker1.cern.ch MountVolume.SetUp succeeded for volume "default-token-2vvcr" 248 | Warning FailedMount 1s (x3 over 2s) kubelet, kubedevel-worker1.cern.ch MountVolume.SetUp failed for volume "ldap-config" : hostPath type check failed: /mnt/ldap/config is not a directory 249 | Warning FailedMount 1s (x3 over 2s) kubelet, kubedevel-worker1.cern.ch MountVolume.SetUp failed for volume "ldap-userdb" : hostPath type check failed: /mnt/ldap/userdb is not a directory 250 | ``` 251 | 252 | 253 | #### Required Persistent Storage - System Logs : 254 | 255 | | Container Name | Usage | Host Path* | Container Path* | Cinder Volume Mount Point* | FS | Size** | Notes | 256 | | -------- | ----------------------------- | -------------------------------- | ------------------------------- | -------------------------- | ---- | ------ | ----- | 257 | | eos-mgm | MGM logs | /var/kubeVolumes/mgm_logs | /var/log/eos | -- | -- | ~GB | 258 | | eos-mgm | MQ logs (if colocated w/ MGM) | /var/kubeVolumes/mgm_logs | /var/log/eos | -- | -- | ~GB | 259 | | eos-mq | MQ logs | /var/kubeVolumes/mq_logs | /var/log/eos | -- | -- | ~GB | 260 | | eos-fst*N* | FST logs | /var/kubeVolumes/fst_logs | /var/log/eos | -- | -- | ~GB | 261 | | cernbox | cernbox logs | /mnt/cbox_shares_db/cbox_data | /var/www/html/cernbox/data | /mnt/cbox_shares_db | ext4 | ~MB | Colocated with shares db 262 | | cernbox | httpd logs | /var/kubeVolumes/httpd_logs | /var/log/httpd | -- | -- | ~GB | 263 | | cernbox | shibboleth logs | /var/kubeVolumes/shibboleth_logs | /var/log/shibboleth | -- | -- | ~GB | 264 | | cernboxgateway | nginx logs | /var/kubeVolumes/cboxgateway_logs| /var/log/nginx | -- | -- | ~GB | 265 | | swan | JupyterHub logs | /var/kubeVolumes/jupyterhub_logs | /var/log/jupyterhub | -- | -- | ~GB | 266 | | swan | httpd logs | /var/kubeVolumes/httpd_logs | /var/log/httpd | -- | -- | ~GB | 267 | | swan | shibboleth logs | /var/kubeVolumes/shibboleth_logs | /var/log/shibboleth | -- | -- | ~GB | 268 | | swan-daemons | eos-fuse logs | /var/kubeVolumes/eosfuse_logs | /var/log/eos/fuse | -- | -- | ~GB | 269 | 270 | 271 | 272 | ----- 273 | 274 | ## Deployment of Services 275 | 276 | In what follows, it is assumed that the Kubernetes cluster is already up and running, that a sufficient number of nodes are provided for the deployment of Boxed, and that the persistent volumes are already attached and formatted accordingly to the tables above. 277 | 278 | The three services (and single containers for each service) should be deployed in a specific order to satisfy the dependencies among them. Specifically: 279 | 1. All the services (EOS, CERNBox, and SWAN) refer to a common LDAP server to get user information. The LDAP server must, therefore, be the first component deployed in your cluster; 280 | 2. EOS should be the first service being deployed as it constitutes the common backend storage for both CERNBox and SWAN; 281 | 3. CERNBox and SWAN can be deployed independently one of the other. 282 | 283 | In addition, all the services operate in the namespace called `boxed`, which is created on purpose to easily account for the resources consumed by EOS, CERNBox, and SWAN in clusters shared by multiple deployments. 284 | 285 | To deploy the service, from a high-level perspective, it is sufficient to create the resources described in the provided yaml files. Overall, six steps are required: 286 | 1. `BOXED.yaml` 287 | 2. `LDAP.yaml` 288 | 3. `eos-storage-mgm.yaml` 289 | 4. `eos-storage-fstN.yaml` (to be created with the provided script eos-storage-fst.sh) 290 | 5. `CERNBOX.yaml` 291 | 6. `SWAN.yaml` 292 | 293 | It is recommended to follow the detailed instructions below, which contain also results of commands from a working deployment useful for sanity check. 294 | 295 | 296 | 297 | ### 1. Initialization of the namespace and deployment of LDAP server 298 | Create the resources described in `BOXED.yaml`: 299 | ``` 300 | kubectl create -f BOXED.yaml 301 | ``` 302 | This creates the `boxed` namespace and creates secrets for web servers (CERNBox, CERNBox Gateway, JupyterHub). Remind that the provided certificates are self-signed, do not match the hostname of the machine where Boxed is being deployed, and are not trusted. Therefore, web browsers will complain when accessing Boxed webpages. Please, consider replacing them with proper certificates. 303 | 304 | To deploy the LDAP server, create the resources described in `LDAP.yaml` to start the LDAP server. 305 | ``` 306 | kubectl create -f LDAP.yaml 307 | ``` 308 | The LDAP container will be downloaded and run on a node labeled with `nodeApp=ldap`. The container folders `/var/lib/ldap` and `/etc/ldap/slapd.d` must be stored on persistent media. 309 | Also, a Kubernetes service named `ldap` will be created to access the server from other containers of the cluster at `ldap.boxed.svc.cluster.local`. 310 | 311 | Consider adding some demo users to the LDAP server when deploying Boxed for the first time. 312 | The script at `/root/addusers.sh` on the LDAP container will automatically create 10 users accounts and a special user account with administrator privileges. 313 | 314 | To access CERNBox and SWAN services, please use the following user information **(username:password)**: 315 | * user0:test0 316 | * user1:test1 317 | * ... 318 | * user9:test9 319 | 320 | 321 | 322 | ### 2. Deployment of EOS 323 | EOS is deployed using Pods and requires several manual steps to be performed by the system administrator to make the network configuration and the storage persistent. 324 | 325 | 326 | #### a. EOS Management Server (MGM) 327 | Create the EOS Management Server (MGM) via the file `eos-storage-mgm.yaml`. 328 | The EOS-MGM container will be downloaded and run on a node labeled with `nodeApp=eos-mgm`. 329 | Also, a heaedless Kubernetes service will grant access to it at `eos-mgm.boxed.svc.cluster.local`. 330 | Remind the MGM container requires enough memory to store the namespace (actual requirements depend on the number of files and folders stored on EOS) and that the container folder `/var/eos` must be stored on persistent media -- It stores the namespace information. 331 | 332 | 333 | #### b. EOS File Storage Server (FST) 334 | Create multiple EOS File Storage Server (FST) -- **Note: At least two are required!** -- via the provided script `eos-storage-fst.sh`. This script will create yaml descriptors to deploy the FSTs. 335 | Usage: 336 | ``` 337 | bash eos-storage-fst.sh 338 | Syntax: eos-storage-fst.sh 339 | ``` 340 | 341 | For example: 342 | ``` 343 | bash eos-storage-fst.sh 1 eos-mgm.boxed.svc.cluster.local eos-mgm.boxed.svc.cluster.local 344 | ``` 345 | will create the file `eos-storage-fst1.yaml`, allowing for the deployment of the first FST. 346 | Additional FSTs can be created using the procedure with an increasing as parameter. 347 | Adding FSTs to the EOS cluster allows to scale out the storage demands by attaching more and more volumes to the mass end storage service. 348 | 349 | The yaml file for FSTs specifies a headless Kubernetes service, resulting in the ability to reach the FST server, e.g., at `eos-fst1.boxed.svc.cluster.local`. 350 | The EOS-FST*N* container will run on a node labeled with `nodeApp=eos-fst*N*`. 351 | The container folder `/mnt/fst_userdata` must be stored on persistent media -- It stores user data. 352 | 353 | 354 | #### c. Finalize and verify deployment 355 | Verify the container status via `kubectl`: 356 | ``` 357 | kubectl -n boxed get pods -o wide 358 | 359 | NAME READY STATUS RESTARTS AGE IP NODE 360 | eos-fst5 1/1 Running 0 18h 10.244.3.3 up2kube-fst5.cern.ch 361 | eos-fst6 1/1 Running 0 14d 10.244.12.21 up2kube-fst6.cern.ch 362 | eos-fst7 1/1 Running 0 14d 10.244.13.21 up2kube-fst7.cern.ch 363 | eos-fst8 1/1 Running 0 14d 10.244.14.21 up2kube-fst8.cern.ch 364 | eos-mgm 1/1 Running 0 18h 10.244.6.146 up2kube-mgm.cern.ch 365 | ldap 1/1 Running 1 37d 10.244.7.10 up2kube-ldap.cern.ch 366 | ``` 367 | In the above picture, one container with MGM functionalities is running and 4 FSTs containers are provided as file servers. 368 | 369 | Now, get a shell in the MGM container: 370 | `kubectl -n boxed exec -it eos-mgm bash` 371 | 372 | Verify the EOS namespace: 373 | ``` 374 | [root@eos-mgm /]# eos ns 375 | # ------------------------------------------------------------------------------------ 376 | # Namespace Statistic 377 | # ------------------------------------------------------------------------------------ 378 | ALL Files 40 [booted] (0s) 379 | ALL Directories 124 380 | # .................................................................................... 381 | ALL Compactification status=off waitstart=0 interval=0 ratio-file=0.0:1 ratio-dir=0.0:1 382 | # .................................................................................... 383 | ALL Replication mode=master-rw state=master-rw master=eos-mgm.eos-mgm.boxed.svc.cluster.local configdir=/var/eos/config/eos-mgm.eos-mgm.boxed.svc.cluster.local/ config=default active=true 384 | # .................................................................................... 385 | ALL File Changelog Size 206.02 kB 386 | ALL Dir Changelog Size 15.49 MB 387 | # .................................................................................... 388 | ALL avg. File Entry Size 5150 B 389 | ALL avg. Dir Entry Size 124.95 kB 390 | # ------------------------------------------------------------------------------------ 391 | ALL files created since boot 0 392 | ALL container created since boot 0 393 | # ------------------------------------------------------------------------------------ 394 | ALL current file id 106 395 | ALL current container id 135 396 | # ------------------------------------------------------------------------------------ 397 | ALL memory virtual 816.05 MB 398 | ALL memory resident 144.17 MB 399 | ALL memory share 12.30 MB 400 | ALL memory growths 342.13 MB 401 | ALL threads 98 402 | ALL uptime 66859 403 | # ------------------------------------------------------------------------------------ 404 | ``` 405 | 406 | Verify the nodes part of the EOS cluster: 407 | ``` 408 | [root@eos-mgm /]# eos node ls 409 | ┌──────────┬──────────────────────────────────────────────┬────────────────┬──────────┬────────────┬──────┬──────────┬────────┬────────┬────────────────┬─────┐ 410 | │type │ hostport│ geotag│ status│ status│ txgw│ gw-queued│ gw-ntx│ gw-rate│ heartbeatdelta│ nofs│ 411 | └──────────┴──────────────────────────────────────────────┴────────────────┴──────────┴────────────┴──────┴──────────┴────────┴────────┴────────────────┴─────┘ 412 | nodesview eos-fst5.eos-fst5.boxed.svc.cluster.local:1095 eos-docker online on off 0 10 120 2 1 413 | nodesview eos-fst6.eos-fst6.boxed.svc.cluster.local:1095 eos-docker online on off 0 10 120 1 1 414 | nodesview eos-fst7.eos-fst7.boxed.svc.cluster.local:1095 eos-docker online on off 0 10 120 1 1 415 | nodesview eos-fst8.eos-fst8.boxed.svc.cluster.local:1095 eos-docker online on off 0 10 120 3 1 416 | ``` 417 | 418 | Verify the filesystems attached to the nodes: 419 | ``` 420 | [root@eos-mgm /]# eos fs ls 421 | ┌─────────────────────────────────────────┬────┬──────┬────────────────────────────────┬────────────────┬────────────────┬────────────┬──────────────┬────────────┬────────┬────────────────┐ 422 | │host │port│ id│ path│ schedgroup│ geotag│ boot│ configstatus│ drain│ active│ health│ 423 | └─────────────────────────────────────────┴────┴──────┴────────────────────────────────┴────────────────┴────────────────┴────────────┴──────────────┴────────────┴────────┴────────────────┘ 424 | eos-fst5.eos-fst5.boxed.svc.cluster.local 1095 5 /mnt/fst_userdata default.0 eos-docker booting rw nodrain online no smartctl 425 | eos-fst6.eos-fst6.boxed.svc.cluster.local 1095 6 /mnt/fst_userdata default.0 eos-docker booting rw nodrain online no smartctl 426 | eos-fst7.eos-fst7.boxed.svc.cluster.local 1095 7 /mnt/fst_userdata default.0 eos-docker booting rw nodrain online no smartctl 427 | eos-fst8.eos-fst8.boxed.svc.cluster.local 1095 8 /mnt/fst_userdata default.0 eos-docker booting rw nodrain online no smartctl 428 | ``` 429 | 430 | The *boot* column should report `booted` and the *configstatus* should be `rw`. 431 | 432 | 433 | 434 | ### 3. Deployment of CERNBox 435 | 436 | The CERNBox service, composed of the Web interface ("cernbox"), the gateway ("cernboxgateway"), and the database backend ("cernboxmysql"), can be deployed by simply creating the resources described in `CERNBOX.yaml`. The three containers are deployed via resources of type Deployment. 437 | 438 | Before proceeding with the deployment, please remind that: 439 | 440 | - The container responsible for the Web interface ("cernbox") will be downloaded and executed on the node labeled with `nodeApp=cernbox` and the container path `/var/www/html/cernbox/data` must be stored on persistent media; 441 | - In case of deployment with MySQL database backend, the MySQL container ("cernboxmysql") will run on the same node of "cernbox", i.e., the node with label `nodeApp=cernbox`. Container path `/var/lib/mysql` must be stored on persistent media; 442 | - The container running the gateway process ("cernboxgateway") will be downloaded and executed on the node labeled with `nodeApp=cernbox-gateway` and requires access to the hostNetwork of the node. 443 | 444 | 445 | #### Site-specific paramenters 446 | 447 | Few configuration parameters are site-specific and require modifications to the `CERNBOX.yaml` file. 448 | Consider changing, in the environment variable section: 449 | 450 | 1. For "cernbox", the envvar `CERNBOXGATEWAY_HOSTNAME` must match the Fully Qualified Domain Name (FQDN) of the node where the "cernboxgateway" container will execute. Please, adjust it accordingly to your DNS configuration. 451 | 2. For "cernboxgateway", the envvar `HOSTNAME` must match the FQDN of the node where the "cernboxgateway" container will execute. Please, adjust it accordingly to your DNS configuration. 452 | 3. For "cernboxgateway", the envvar `SWAN_BACKEND` must have a value matching the FQDN of the node where the "swan" container will execute (read more in "Deployment of SWAN" section). Please, adjust it accordingly to your DNS configuration. 453 | 3b. Similarly, the envvar `SWAN_BACKEND_PORT` must be equal to the listening port of the JupyterHub service running in the "swan" container. The default setting is 443. If you modify the default settins, please adjust it consistently with your setup. 454 | 455 | 456 | #### Service internals parameters 457 | 458 | It is possible to configure some of the service internals via environment variable switches: 459 | 460 | 1. For "cernbox", the envvar `AUTH_TYPE` can be set to "local" for login via LDAP credentials or to "shibboleth" for login via Single Sign-On and similar technologies. The provided configuration for shibboleth is compatible with CERN SSO and will require modifications to make it work with your SSO solution. 461 | 2. For "cernbox", the envvar `DATABASE_BACKEND` can be set to "SQLite" (so to use the SQLite backend integrated into the "cernbox" container) or to "MySQL" (so to use the external container "cernboxmysql"). The latter configuration is recommended for production-like deployments. 462 | 3. For "cernboxgateway", the envvar `HTTP_PORT` specifies the listening port for HTTP traffic. Same for `HTTPS_PORT` and HTTPS traffic. The default settings are ports 80 and 443, respectively. 463 | 464 | 465 | 466 | ### 4. Deployment of SWAN 467 | 468 | The SWAN service, composed of JupyterHub ("swan"), the EOS fuse client ("eos-fuse"), and the CVMFS client ("cvmfs"), can be deployed by simply creating the resources described in `SWAN.yaml`. 469 | The JupyterHub container is a resource of type Deployment, while the EOS fuse client and the CVMFS client are resources of type DaemonSet. 470 | 471 | Before proceeding with the deployment, please remind that: 472 | 473 | - The SWAN service requires at least one worker node where to run single-user's session. This node should be labeled as "nodeApp=swan-users". Adding more worker nodes provides the ability to scale out the capacity of the service according to the number of concurrent sessions it has to sustain. The EOS fuse client and the CVMFS client will be automatically deployed on all the nodes labeled as "nodeApp=swan-users"; 474 | - The container responsible for spawning, managing, and proxying multiple Jupyter sessions ("jupyterhub") will be downloaded and executed on the node labeled with `nodeApp=swan`, requires access to the hostNetwork of the node, and the container path `/srv/jupyterhub/jupyterhub_data` must be stored on persistent media. 475 | 476 | Also, SWAN requires access to the Kubernetes cluster resources and the ability to list and start containers in the namespace where it is deployed. 477 | In order to achieve this, please review your cluster configuration and, if needed, configure the default service account for the namespace as an admin of the cluster. 478 | 479 | Example with namespace "boxed": 480 | ``` 481 | kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=boxed:default 482 | ``` 483 | 484 | 485 | #### Site-specific paramenters 486 | 487 | Few configuration parameters are site-specific and require modifications to the `SWAN.yaml` file. 488 | Consider changing, in the environment variable section: 489 | 490 | 1. For "swan", the envvar `HOSTNAME` must match the FQDN of the node where the "jupyterhub" container will execute. Please, adjust it accordingly to your DNS configuration. 491 | 492 | 493 | #### Service internals parameters 494 | 495 | It is possible to configure some of the service internals via environment variables in `SWAN.yaml`: 496 | 497 | 1. For "swan", the envvar `CONTAINER_IMAGE` can be used to specify the base image for single-user's sessions; 498 | 2. For "swan", the envvars `NODE_SELECTOR_KEY` and `NODE_SELECTOR_VALUE` must match "nodeApp" and "swan-users", respectively. In case the label identifying SWAN worker nodes is modified, please update these two envvars consistently. 499 | 3. For "swan", the envvar `HTTP_PORT` specifies the listening port for HTTP traffic. Same for `HTTPS_PORT` and HTTPS traffic. The default setting are ports 80 and 443, respectively. 500 | 501 | 502 | 503 | 504 | 505 | ----- 506 | 507 | ## The Network Perspective 508 | 509 | WIP 510 | 511 | 512 | ----- 513 | 514 | ## The Storage Perspective 515 | 516 | WIP 517 | 518 | 519 | ### How to Fail Over a Node with Persistent Storage Attached 520 | 521 | --------------------------------------------------------------------------------