Skip to content

Commit

Permalink
Merge pull request #452 from kit-data-manager/development
Browse files Browse the repository at this point in the history
Prepare next release
  • Loading branch information
VolkerHartmann committed Jan 13, 2024
2 parents 1e27f08 + ca54c87 commit f4d1eb2
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 104 deletions.
16 changes: 15 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
########################################
# Adopt authentication for RabbitMQ
########################################
RABBIT_MQ_USER=rabbituser
RABBIT_MQ_PASSWORD=rabbitpasswd

########################################
# Only edit the following lines if you
# want to update service versions.
########################################
METASTORE_VERSION=v1.4.1
FRONTEND_COLLECTION_VERSION=metastore-v1.0.0
INDEXING_SERVICE_VERSION=v1.0.1
ELASTICSEARCH_VERSION=8.11.1
########################################
# Don't edit following lines
########################################
PREFIX4DOCKER=ghcr.io/kit-data-manager
169 changes: 93 additions & 76 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,118 @@
# Create and publish a Docker image on github
name: Create and publish a Docker image

name: Docker

# Configures this workflow to run every time a change
# is pushed to the 'main' branch.
on:
push:
# Publish `master` as Docker `latest` image.
# Publish `main` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*
- '*-v*'

# Run tests for PRs on main branch only.
pull_request:
branches:
- main

# Defines two custom environment variables for the workflow.
# These are used for the Container registry domain, and a
# name for the Docker image that this workflow builds.
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: metastore2
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

# Two jobs for creating and pushing Docker image
# - build-and-push-image -> triggered by commits on main and tagging with semantic version (e.g.: v1.2.3)
# - build-and-push-image-of-branch -> triggered by tags matching '*-v*' (e.g.: Version_1-v1.2.3)
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
build-and-push-image:
runs-on: ubuntu-latest

if: ${{ contains(github.ref_name, '-') == failure() }}
# Sets the permissions granted to the `GITHUB_TOKEN`
# for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- uses: actions/checkout@v4

- name: Set up OpenJDK version ...
uses: actions/setup-java@v4
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container
# registry using the account and password that will publish the packages.
# Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
distribution: 'zulu'
java-version: 17
- name: Run tests
run: |
./gradlew jacocoTestReport
# docker build . --file Dockerfile
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test

registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
# to extract tags and labels that will be applied to the specified image.
# The `id` "meta" allows the output of this step to be referenced in a
# subsequent step. The `images` value provides the base name for the tags
# and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-and-push-image-of-branch:
runs-on: ubuntu-latest
if: github.event_name == 'push'

if: contains(github.ref_name, '-')
# Sets the permissions granted to the `GITHUB_TOKEN`
# for the actions in this job.
permissions:
contents: read
packages: write
#
steps:
- uses: actions/checkout@v4

- name: Build image
run: |
docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Push image
- name: Split first part
env:
TAG: ${{ github.ref_name }}
id: split
run: echo "branch=${TAG%-v*}" >> $GITHUB_OUTPUT
- name: Test variable
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v5
with:
# list of Docker images to use as base name for tags
images: |
kitdm/metastore2
# add git short SHA as Docker tag
tag-sha: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
echo ${{ steps.split.outputs.branch }}
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container
# registry using the account and password that will publish the packages.
# Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to Docker Hub
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
# to extract tags and labels that will be applied to the specified image.
# The `id` "meta" allows the output of this step to be referenced in a
# subsequent step. The `images` value provides the base name for the tags
# and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta-branch
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{steps.split.outputs.branch}}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.meta-branch.outputs.tags }}
labels: ${{ steps.meta-branch.outputs.labels }}

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

## [1.4.1] - 2024-01-13
### Added

### Changed
- Switch to GitHub Packages.
- Loge for SCC (Scientific Computing Centre)

### Libs
- Bump com.google.errorprone:error_prone_core from 2.24.0 to 2.24.1
- Bump com.google.errorprone:error_prone_core from 2.23.0 to 2.24.0
- Bump javersVersion from 7.3.6 to 7.3.7
- Bump org.asciidoctor.jvm.convert from 4.0.0 to 4.0.1
- Bump org.asciidoctor.jvm.convert from 3.3.2 to 4.0.0
- Bump org.owasp.dependencycheck from 9.0.7 to 9.0.8
- Bump org.springframework.boot from 3.2.0 to 3.2.1
- Bump org.springframework.cloud:spring-cloud-gateway-mvc from 4.1.0 to 4.1.1
- Bump org.springframework.data:spring-data-elasticsearch from 5.2.1 to 5.2.2

## [1.4.0] - 2023-12-19
### Security

Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
[![Codecov](https://codecov.io/gh/kit-data-manager/metastore2/graph/badge.svg)](https://codecov.io/gh/kit-data-manager/metastore2)
[![CodeQL](https://github.com/kit-data-manager/metastore2/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/kit-data-manager/metastore2/actions/workflows/codeql-analysis.yml)
![License](https://img.shields.io/github/license/kit-data-manager/metastore2.svg)
[![Docker Build Status](https://img.shields.io/docker/automated/kitdm/metastore2)](https://hub.docker.com/r/kitdm/metastore2/tags)
[![Docker Image Version](https://img.shields.io/docker/v/kitdm/metastore2/latest)](https://hub.docker.com/r/kitdm/metastore2/tags)
[![Docker Pulls](https://img.shields.io/docker/pulls/kitdm/metastore2)](https://hub.docker.com/r/kitdm/metastore2/tags)
[![docker]](https://github.com/kit-data-manager/metastore2/pkgs/container/metastore2)
[![currentVersion]](https://github.com/kit-data-manager/metastore2/pkgs/container/metastore2)
[![size]](https://github.com/kit-data-manager/metastore2/pkgs/container/metastore2)


[docker]: <https://ghcr-badge.egpl.dev/kit-data-manager/metastore2/tags?trim=major&color=steelblue&ignore=main,latest&label=docker versions>
[currentVersion]: <https://ghcr-badge.egpl.dev/kit-data-manager/metastore2/latest_tag?trim=major&color=steelblue&label=current version>
[size]: <https://ghcr-badge.egpl.dev/kit-data-manager/metastore2/size?color=steelblue&label=size>

MetaStore is a research data repository software for storing metadata documents and schemas.
Quality and consistency are ensured by associating and validating each document against a schema.
Expand All @@ -22,19 +27,19 @@ It allows you to

## Installation
There are three ways to install metaStore2 as a microservice:
- [Using](#Installation-via-DockerHub) the image available via [DockerHub](https://hub.docker.com/r/kitdm/) (***recommended***)
- [Using](#Installation-via-GitHub-Packages) the image available via [GitHub Packages](https://github.com/orgs/kit-data-manager/packages?repo_name=metastore2) (***recommended***)
- [Building](#Build-docker-container-locally) docker image locally
- [Building](#Build-and-run-locally) and running locally

## Installation via DockerHub
## Installation via GitHub Packages
### Prerequisites
In order to run this microservice via docker you'll need:

* [Docker](https://www.docker.com/)

### Installation
Typically, there is no need for locally building images as all version are accessible via DockerHub.
Have a look of available images and their tags [here](https://hub.docker.com/r/kitdm/metastore2)
Typically, there is no need for locally building images as all version are accessible via GitHub Packages.
Have a look of available images and their tags [here](https://github.com/orgs/kit-data-manager/packages?repo_name=metastore2)
Just follow instructions [below](#Build-docker-container).

## Build docker container locally
Expand Down Expand Up @@ -64,7 +69,7 @@ On default the created images will be tagged as follows:
```
user@localhost:/home/user/metastore2$ bash docker/buildDocker.sh
---------------------------------------------------------------------------
Build docker container kitdm/metastore2:1.2.0-2023-06-27
Build docker container ghcr.io/kit-data-manager/metastore2:1.2.0-2023-06-27
---------------------------------------------------------------------------
[...]
---------------------------------------------------------------------------
Expand All @@ -77,9 +82,9 @@ user@localhost:/home/user/metastore2$
After building image you have to create (and start) a container for executing microservice:
```
# If you want to use a specific image you may list all possible tags first.
user@localhost:/home/user/metastore2$ docker images kitdm/metastore2 --format {{.Tag}}
user@localhost:/home/user/metastore2$ docker images ghcr.io/kit-data-manager/metastore2 --format {{.Tag}}
1.2.0-2023-06-27
user@localhost:/home/user/metastore2$ docker run -d -p8040:8040 --name metastore4docker kitdm/metastore2:1.2.0-2023-06-27
user@localhost:/home/user/metastore2$ docker run -d -p8040:8040 --name metastore4docker ghcr.io/kit-data-manager/metastore2:1.2.0-2023-06-27
57c973e7092bfc3778569f90632d60775dfecd12352f13a4fd2fdf4270865286
user@localhost:/home/user/metastore2$
```
Expand All @@ -94,7 +99,7 @@ Therefor you have to provide an additional flag to the command mentioned before:
user@localhost:/home/user/metastore2$ mkdir config
# Place your own 'application.properties' inside the config directory
# Create/run container
user@localhost:/home/user/metastore2$ docker run -d -p8040:8040 -v `pwd`/config:/spring/metastore2/config --name metastore4docker kitdm/metastore2:1.2.0-2023-06-27
user@localhost:/home/user/metastore2$ docker run -d -p8040:8040 -v `pwd`/config:/spring/metastore2/config --name metastore4docker ghcr.io/kit-data-manager/metastore2:1.2.0-2023-06-27
57c973e7092bfc3778569f90632d60775dfecd12352f13a4fd2fdf4270865286
user@localhost:/home/user/metastore2$
```
Expand Down
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'org.springframework.boot' version '3.2.0'
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
id 'io.freefair.lombok' version '8.4'
id 'io.freefair.maven-publish-java' version '8.4'
id 'org.owasp.dependencycheck' version '9.0.7'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.owasp.dependencycheck' version '9.0.8'
id 'org.asciidoctor.jvm.convert' version '4.0.1'
id 'net.ltgt.errorprone' version '3.1.0'
id 'net.researchgate.release' version '3.0.2'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
Expand All @@ -18,9 +18,9 @@ group = 'edu.kit.datamanager'
ext {
// versions of dependencies
springDocVersion = '2.3.0'
javersVersion = '7.3.6'
javersVersion = '7.3.7'
keycloakVersion = '19.0.0'
errorproneVersion = '2.23.0'
errorproneVersion = '2.24.1'
// directory for generated code snippets during tests
snippetsDir = file("build/generated-snippets")
}
Expand Down Expand Up @@ -50,7 +50,7 @@ if (System.getProperty('profile') == 'minimal') {
dependencies {
// Spring
implementation 'org.springframework:spring-messaging:6.1.1'
implementation 'org.springframework.cloud:spring-cloud-gateway-mvc:4.1.0'
implementation 'org.springframework.cloud:spring-cloud-gateway-mvc:4.1.1'

// Spring Boot
implementation "org.springframework.boot:spring-boot-starter-data-rest"
Expand Down Expand Up @@ -113,7 +113,7 @@ dependencies {
implementation "edu.kit.datamanager:service-base:1.2.0"

// elasticsearch (since service-base 1.1.0)
implementation "org.springframework.data:spring-data-elasticsearch:5.2.1"
implementation "org.springframework.data:spring-data-elasticsearch:5.2.2"

// DOIP SDK
implementation "net.dona.doip:doip-sdk:2.2.0"
Expand Down Expand Up @@ -190,7 +190,7 @@ asciidoctor {
dependsOn test
sourceDir "docs/"
outputDir "build/docs/html5"
inProcess = JAVA_EXEC
executionMode = JAVA_EXEC
forkOptions {
jvmArgs "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED"
}
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ services:
dps:
ipv4_address: 172.0.0.10
my-apache:
build: https://github.com/kit-data-manager/frontend-collection.git#docker-metastore
image: my-apache
image: ${PREFIX4DOCKER}/frontend-collection-metastore:${FRONTEND_COLLECTION_VERSION}
container_name: my_apache
ports:
- "80:80"
networks:
- dps
elasticsearch:
image: elasticsearch:8.11.1
image: elasticsearch:${ELASTICSEARCH_VERSION}
container_name: elastic4indexing
environment:
- discovery.type=single-node
Expand Down Expand Up @@ -52,7 +52,7 @@ services:
networks:
- dps
indexing-service:
image: kitdm/indexing-service:v1.0.0
image: ${PREFIX4DOCKER}/indexing-service:${INDEXING_SERVICE_VERSION}
container_name: indexing4metastore
environment:
- REPO_MESSAGING_USERNAME=${RABBIT_MQ_USER}
Expand All @@ -69,7 +69,7 @@ services:
networks:
- dps
metastore:
image: kitdm/metastore2:v1.4.0
image: ${PREFIX4DOCKER}/metastore2:${METASTORE_VERSION}
container_name: metastore.docker
environment:
- HOSTNAMES=metastore.docker
Expand Down
Loading

0 comments on commit f4d1eb2

Please sign in to comment.