Skip to content

Commit ed8a96f

Browse files
Ozaqtbkr
andcommitted
Add z3fdb-web service
Co-authored-by: Tobias Kremer <[email protected]>
1 parent b073f57 commit ed8a96f

File tree

26 files changed

+991
-3
lines changed

26 files changed

+991
-3
lines changed

.github/workflows/build-ubuntu-rolling-fdb-build-env.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ jobs:
4141
with:
4242
images: ${{ env.REGISTRY }}/${{ env.PROJECT_NAME }}/${{ env.IMAGE_NAME }}
4343
tags: |
44+
# SHA tag for all builds
4445
type=sha
45-
type=raw,value=latest,enable={{is_default_branch}}
46+
# latest tag only for semver releases
47+
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
48+
# latest-develop for develop branch
49+
type=raw,value=latest-develop,enable=${{ github.ref == 'refs/heads/develop' }}
50+
# latest-pr-<number> for pull requests
51+
type=raw,value=latest-pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }}
52+
# latest for workflow run from cron
53+
type=raw,value=latest,enable=${{ github.event_name == 'schedule' }}
4654
4755
- name: Set up Docker Buildx
4856
uses: docker/setup-buildx-action@v3
@@ -51,6 +59,8 @@ jobs:
5159
uses: docker/build-push-action@v5
5260
with:
5361
context: ./containerfiles/ubuntu_rolling_fdb_build_env
62+
build-contexts: |
63+
ubuntu:rolling=docker-image://eccr.ecmwf.int/docker-hub-proxy/library/ubuntu:rolling
5464
file: ./containerfiles/ubuntu_rolling_fdb_build_env/Dockerfile
5565
push: true
5666
tags: ${{ steps.meta.outputs.tags }}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Build Z3FDB Web Service Container
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- develop
8+
tags:
9+
- '[0-9]+.[0-9]+.[0-9]+'
10+
pull_request:
11+
12+
env:
13+
REGISTRY: eccr.ecmwf.int
14+
IMAGE_NAME: z3fdb-web-service
15+
PROJECT_NAME: kkratz
16+
17+
jobs:
18+
build-packages:
19+
name: Build Packages
20+
runs-on: [self-hosted, Linux, platform-builder-docker]
21+
container:
22+
image: eccr.ecmwf.int/ci-utils/ubuntu_rolling_fdb_build_env:latest
23+
credentials:
24+
username: ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }}
25+
password: ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }}
26+
steps:
27+
- name: Get ecbuild
28+
uses: actions/checkout@v5
29+
with:
30+
repository: ecmwf/ecbuild
31+
ref: develop
32+
path: ecbuild
33+
- name: Get cxx-dependencies
34+
uses: actions/checkout@v5
35+
with:
36+
repository: ecmwf/cxx-dependencies
37+
ref: master
38+
path: cxx-dependencies
39+
token: ${{ secrets.GH_REPO_READ_TOKEN }}
40+
submodules: recursive
41+
- name: Get eccodes
42+
uses: actions/checkout@v5
43+
with:
44+
repository: ecmwf/eccodes
45+
ref: develop
46+
path: eccodes
47+
- name: Get eckit
48+
uses: actions/checkout@v5
49+
with:
50+
repository: ecmwf/eckit
51+
ref: develop
52+
path: eckit
53+
- name: Get metkit
54+
uses: actions/checkout@v5
55+
with:
56+
repository: ecmwf/metkit
57+
ref: develop
58+
path: metkit
59+
- name: Get fdb5
60+
uses: actions/checkout@v5
61+
with:
62+
repository: ecmwf/fdb
63+
path: fdb
64+
- name: Compile, test and pack
65+
run: |
66+
./fdb/containerfiles/z3fdb_web_service/build_contents.sh
67+
rm -rf stage
68+
mkdir stage
69+
mv *.zst *.whl stage
70+
- name: Upload stage archive
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: stage
74+
path: stage/
75+
76+
77+
build-container:
78+
name: Build Image
79+
runs-on: [self-hosted, Linux, platform-builder-docker]
80+
needs: [build-packages]
81+
steps:
82+
- name: Get fdb5
83+
uses: actions/checkout@v5
84+
with:
85+
repository: ecmwf/fdb
86+
- name: Download stage archive
87+
uses: actions/download-artifact@v4
88+
with:
89+
name: stage
90+
path: stage/
91+
- name: Log in to ECCR
92+
uses: docker/login-action@v3
93+
with:
94+
registry: ${{ env.REGISTRY }}
95+
username: ${{ secrets.KKRATZ_ECCR_USER }}
96+
password: ${{ secrets.KKRATZ_ECCR_TOKEN }}
97+
- name: Extract metadata (tags, labels)
98+
id: meta
99+
uses: docker/metadata-action@v5
100+
with:
101+
images: ${{ env.REGISTRY }}/${{ env.PROJECT_NAME }}/${{ env.IMAGE_NAME }}
102+
tags: |
103+
# SHA tag for all builds
104+
type=sha
105+
# Semver tag: use git tag as-is (e.g., 1.2.3)
106+
type=semver,pattern={{version}}
107+
# latest tag only for semver releases
108+
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
109+
# latest-develop for develop branch
110+
type=raw,value=latest-develop,enable=${{ github.ref == 'refs/heads/develop' }}
111+
# latest-pr-<number> for pull requests
112+
type=raw,value=latest-pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }}
113+
# latest-manual for workflow_dispatch
114+
type=raw,value=latest-manual,enable=${{ github.event_name == 'workflow_dispatch' }}
115+
- name: Set up Docker Buildx
116+
uses: docker/setup-buildx-action@v3
117+
- name: Build and push Docker image
118+
uses: docker/build-push-action@v5
119+
with:
120+
context: ./stage
121+
file: ./containerfiles/z3fdb_web_service/Dockerfile
122+
push: true
123+
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/z3fdb.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ jobs:
7777
-GNinja \
7878
-DCMAKE_INSTALL_PREFIX=dependencies \
7979
-DCMAKE_PREFIX_PATH=dependencies \
80-
-DCMAKE_BUILD_TYPE=RelWithDebInfo
80+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
81+
-DENABLE_MARS2GRIB_PYTHON=OFF
8182
cmake --build metkit-build -j -t install
8283
- name: Archive with permissions preserved
8384
run: tar --zstd -cpf files.tar.zst dependencies/ ecbuild/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ compile_commands.json
1616
__pycache__/
1717

1818
*.swp
19+
**/*.egg-info/

charts/z3fdb-web/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/z3fdb-web/Chart.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v2
2+
name: z3fdb-web
3+
description: Remote access to a z3fdb store.
4+
type: application
5+
6+
# This is the chart version. This version number should be incremented each time you make changes
7+
# to the chart and its templates, including the app version.
8+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
9+
version: 0.1.0
10+
11+
# This is the version number of the application being deployed. This version number should be
12+
# incremented each time you make changes to the application. Versions are not expected to
13+
# follow Semantic Versioning. They should reflect the version the application is using.
14+
# It is recommended to use it with quotes.
15+
appVersion: "0.1.0"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "z3fdb-web.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "z3fdb-web.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "z3fdb-web.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "z3fdb-web.labels" -}}
37+
helm.sh/chart: {{ include "z3fdb-web.chart" . }}
38+
{{ include "z3fdb-web.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "z3fdb-web.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "z3fdb-web.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "z3fdb-web.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "z3fdb-web.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: caddy-config
5+
data:
6+
Caddyfile: |
7+
:80 {
8+
log {
9+
level DEBUG
10+
output stdout
11+
format console
12+
}
13+
encode {
14+
match {
15+
header Content-Type application/octet-stream
16+
}
17+
zstd best
18+
}
19+
reverse_proxy localhost:5000
20+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: fdb-config
5+
data:
6+
fdb-config: |
7+
{{- required ".Values.config.fdb_config is required " .Values.config.fdb_config | toYaml | nindent 4 }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: z3fdb-deployment
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: z3fdb
10+
template:
11+
metadata:
12+
labels:
13+
app: z3fdb
14+
spec:
15+
containers:
16+
- name: {{ .Values.image.z3fdb.name }}
17+
image: {{ .Values.image.z3fdb.repository }}:{{ .Values.image.z3fdb.tag }}
18+
args: ["--fdb-config=/etc/fdb/fdb.config"]
19+
ports:
20+
- containerPort: 5000
21+
volumeMounts:
22+
- name: z3fdb-web-volume
23+
mountPath: /etc/fdb/fdb.config
24+
subPath: fdb-config # Mounts the ConfigMap data as a single file
25+
- name: {{ .Values.image.caddy.name }}
26+
image: {{ .Values.image.caddy.repository }}:{{ .Values.image.caddy.tag }}
27+
ports:
28+
- containerPort: 80
29+
volumeMounts:
30+
- name: caddyfile
31+
mountPath: /etc/caddy/Caddyfile
32+
subPath: Caddyfile # Mounts the ConfigMap data as a single file
33+
volumes:
34+
- name: z3fdb-web-volume
35+
configMap:
36+
name: fdb-config
37+
- name: caddyfile
38+
configMap:
39+
name: caddy-config

0 commit comments

Comments
 (0)