DSpace directory structure
This is the directory structure
├── clarin-dspace-docker
│ └── commul-customization
└── kubernetes
├── helm
│ └── dspace
│ ├── charts
│ │ └── postgresql
│ │ └── templates
│ └── templates
└── yaml
-
/clarin-dspace-docker
- Docker files, copied from https://github.com/commul/clarin-dspace-docker @ 74d06d35 -
/kubernetes
- Kubernetes files -
/kubernetes/helm
- Chart Directory. Refer to https://github.com/kubernetes/helm/blob/master/docs/charts.md#the-chart-file-structure -
/kubernetes/yaml
- Useful for tests, but helm is a more flexible approach
Introduction
Prerequisites
- Kubernetes cluster
To interact with cluster
- Kubernetes credentials
- a working [kubectl] (https://kubernetes.io/docs/tasks/tools/install-kubectl/)
To interact with Helm server (tiller)
- Kubernetes credentials
- a working [kubectl] (https://kubernetes.io/docs/tasks/tools/install-kubectl/)
- a working [helm client] (https://docs.helm.sh/using_helm/#quickstart-guide)
How to use it
Workflow
First of all, check if a docker image already exists. If it exist, pull, otherwise, you need to build one. If necessary create a personal token and login into GitLab Registry.
docker login gitlab.scientificnet.org:4567
Use existing Docker image
docker image ls -a gitlab.scientificnet.org:4567/commul/dspace/*
docker pull gitlab.scientificnet.org:4567/commul/dspace/<my_image>:<my tag>
Build images
- build your docker image from
/clarin-dspace-docker
directory - push to
https://gitlab.scientificnet.org/commul/dspace/container_registry
docker build -t gitlab.scientificnet.org:4567/commul/dspace/<my_image>:<my tag> -f Dockerfile.XX .
docker push gitlab.scientificnet.org:4567/commul/dspace/<my_image>:<my tag>
Installation
Provide gitlab credentials
$ kubectl -n dspace-dev create -f gitlab-scientificnet-org-registry.yaml
$ kubectl -n dspace-dev create -f rbd-secret.yaml
PostgreSQL
To install PostgreSQL, we need some passwords, so we need Kubernetes secrets
$ kubectl -n dspace-dev create -f postgresql-secret.yaml
secret "dspace-postgresql" created
$ kubectl -n dspace-dev create -f dspace-secrets.yaml
secret "dspace-secrets" created
$ kubectl -n dspace-dev get secrets
NAME TYPE DATA AGE
ceph-rbd-secret kubernetes.io/rbd 1 14m
default-token-c1pd4 kubernetes.io/service-account-token 3 4d
dspace-postgresql Opaque 1 1h
dspace-secrets Opaque 1 1m
gitlab-scientificnet-org-registry kubernetes.io/dockerconfigjson 1 46m
Next, create a RBD Claim
$ kubectl -n dspace-dev create -f postgresql-pvc.yaml
persistentvolumeclaim "dspace-postgresql" created
$ kubectl -n dspace-dev get pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
dspace-postgresql Bound pvc-610c358d-a518-11e7-b21c-b60483de6a40 8Gi RWO auto 2s
Ok, now we are ready to deploy our PostgreSQL!
$ kubectl -n dspace-dev create -f postgresql.yaml
$ kubectl -n dspace-dev get po
NAME READY STATUS RESTARTS AGE
dspace-postgresql-1806947503-cj077 0/1 ContainerCreating 0 2s
$ kubectl -n dspace-dev get po
NAME READY STATUS RESTARTS AGE
dspace-postgresql-1806947503-qw8q4 0/1 Running 0 9s
$ kubectl -n dspace-dev get po
NAME READY STATUS RESTARTS AGE
dspace-postgresql-1806947503-qw8q4 1/1 Running 0 46s
when the container will be in running
$ kubectl -n dspace-dev exec -it dspace-postgresql-1806947503-qw8q4 bash
root@dspace-postgresql-1806947503-qw8q4:/#