-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from IQSS/64-use-develop-branch
64 - Run branches in K8s deployment
- Loading branch information
Showing
20 changed files
with
260 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "dataverse"] | ||
path = dataverse | ||
url = https://github.com/IQSS/dataverse | ||
branch = develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2019 Forschungszentrum Jülich GmbH | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
############# BUILD DATAVERSE ############# | ||
|
||
FROM maven:3.5-jdk-8 as builder | ||
# copy the project files | ||
COPY dataverse/local_lib ./local_lib | ||
COPY dataverse/pom.xml ./pom.xml | ||
# build all dependencies for offline use | ||
RUN mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies | ||
# copy your other files | ||
COPY dataverse/src ./src | ||
# build for release (in offline mode) | ||
RUN mvn -o package -DskipTests | ||
|
||
############# BUILD IMAGE ############# | ||
FROM iqss/dataverse-k8s | ||
LABEL maintainer="FDM FZJ <forschungsdaten@fz-juelich.de>" | ||
|
||
# Copy files for the application | ||
COPY --chown=glassfish:glassfish --from=builder /target/dataverse-*.war ${HOME_DIR}/dvinstall/dataverse.war | ||
COPY --chown=glassfish:glassfish dataverse/scripts/api/data ${HOME_DIR}/dvinstall/data | ||
COPY --chown=glassfish:glassfish dataverse/scripts/api/*.sh ${HOME_DIR}/dvinstall/ | ||
COPY --chown=glassfish:glassfish dataverse/scripts/database/reference_data.sql ${HOME_DIR}/dvinstall/ | ||
COPY --chown=glassfish:glassfish dataverse/conf/jhove/* ${HOME_DIR}/dvinstall/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Support for running any branch in K8s | ||
|
||
This release adds support for running any branch in Kubernetes by using | ||
local Kind clusters and Skaffold for building images. | ||
|
||
For more information, see [the docs](docs/rundev.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Running Dataverse development snapshots | ||
|
||
Images on Docker Hub are meant for production usage or quick demos. | ||
When developing Dataverse, testing a new feature not yet shipped in a release or | ||
running integration tests you have a need to deploy all moving parts into | ||
a (more or less) ephemeral environment. | ||
|
||
**Be warned:** deployment times of Dataverse are a nightmare as of writing (Sept. 2019). | ||
For any change to the codebase, you most likely will have to wait about five | ||
to ten minutes to redeploy from compilation to reload of webpage. | ||
|
||
This is due to a really big WAR file (which needs to be loaded into the cluster) | ||
and being stuck on old technology in combination with a tremendous monolith. | ||
|
||
**YOU HAVE BEEN WARNED.** | ||
|
||
## Prepare toolchain | ||
For efficient workflows, tools make life easier. Please install: | ||
|
||
1. [skaffold](https://skaffold.dev/docs/getting-started/#installing-skaffold) | ||
2. [kustomize](https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md) | ||
* necessary as long as GoogleContainerTools/skaffold#1781 isn't resolved | ||
|
||
When you opt for using a local cluster, add: | ||
|
||
1. [Docker](https://docs.docker.com/install/) | ||
2. [kind](https://kind.sigs.k8s.io/docs/user/quick-start/) | ||
<small>(be nice to yourself, download a release, don't compile from source)</small> | ||
|
||
*Note: you do have `kubectl` already installed, don't you?* | ||
|
||
## Workflow | ||
While you can build and deploy everything manually, it will be easier to | ||
let Skaffold take care of everything. | ||
|
||
Running `skaffold run` or `skaffold dev` will build, tag and deploy for you. | ||
For a deeper insight, read docs at https://skaffold.dev/docs. | ||
|
||
As you will need to access services, be sure to add `--port-forward`. | ||
See also [port forward docs](https://skaffold.dev/docs/how-tos/portforward). | ||
|
||
**Before running Skaffold for the first time** be sure to have a cluster at hands. | ||
You can check via `kubectl`. Currently only using a local cluster with `kind` is | ||
supported by this project, see next section. PRs welcome. | ||
|
||
### A word on waiting | ||
Be aware that initial builds and deployments take lots of time due to cold caches. | ||
Recurring builds and deployments will be much faster, although you will still | ||
suffer from Glassfish WAR deployment times. | ||
|
||
Typically, when there is no change to `pom.xml` and caches are warmed up, | ||
* building will take ~1 minute, | ||
* loading images into cluster ~45 secs, | ||
* deploying to K8s ~30 secs | ||
* and Glassfish startup + WAR deployment ~3 minutes. | ||
|
||
<small>*How about some coffee?*</small> | ||
|
||
### Local cluster | ||
The easiest way to work with a local cluster is using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/), which is an abbrev for "Kubernetes IN Docker". | ||
|
||
Skaffold supports this out of the box now. Using `kind`, your context will be set | ||
to sth. like "@kind", which triggers loading images into a local `kind` cluster | ||
instead of pushing to remote registry. | ||
|
||
After installing Docker and `kind`, you simply need to run: | ||
``` | ||
kind create cluster | ||
``` | ||
or - if your prefer a specific K8s version, e.g. `1.14.6`: | ||
``` | ||
kind create cluster --image kindest/node:v1.14.6 | ||
``` | ||
|
||
<small><i> | ||
Please note that `kind` might have some troubles with changing networks and | ||
switching to a new DNS resolver. You might need to rebuild the cluster, which is | ||
no big deal. | ||
</i></small> | ||
|
||
If you want to use `k3s`, `minikube`, `microk8s` or similar, please consult the | ||
Skaffold docs, search via Google, etc. | ||
|
||
### Remote cluster | ||
Currently only using a [local cluster](#local-cluster) with `kind` is supported by this project. | ||
PRs welcome. Hint: we'll need [Kaniko](https://github.com/GoogleContainerTools/kaniko) | ||
for that, as Docker Hub must not be cluttered. | ||
|
||
## Future ideas | ||
- Test using [telepresence](https://www.telepresence.io/) - it might lower dev cycle time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- deployment.yaml | ||
- pvc.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- deployment.yaml | ||
- pvc.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
bases: | ||
- k8s/utils/postgresql | ||
- k8s/solr | ||
- k8s/dataverse | ||
|
||
resources: | ||
- k8s/utils/demo-secrets.yaml | ||
|
||
images: | ||
- name: iqss/dataverse-k8s | ||
newTag: 4.15.1 | ||
- name: iqss/solr-k8s | ||
newTag: 4.15.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: skaffold/v1beta14 | ||
kind: Config | ||
build: | ||
artifacts: | ||
- image: iqss/dataverse-k8s | ||
context: . | ||
docker: | ||
dockerfile: docker/dataverse-k8s/glassfish-dev/Dockerfile | ||
- image: iqss/solr-k8s | ||
context: docker/solr-k8s | ||
local: {} | ||
deploy: | ||
kustomize: {} |