Skip to content

Commit

Permalink
Merge pull request #137 from CSCfi/CSCTTV-3855-indexer-rahti2-config
Browse files Browse the repository at this point in the history
CSCTTV-3855 indexer rahti2 config
  • Loading branch information
sarkikos authored May 17, 2024
2 parents 702dcc3 + a7b4f7f commit 2cce706
Show file tree
Hide file tree
Showing 10 changed files with 485 additions and 0 deletions.
29 changes: 29 additions & 0 deletions aspnetcore/openshift/indexer/rahti2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Builder
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /build

# Copy csproj and restore as distinct layers
COPY ["packages","./packages"]
COPY ["aspnetcore/nuget.config","./Indexer/nuget.config"]
COPY ["aspnetcore/src/Indexer/Indexer.csproj","./Indexer/Indexer.csproj"]
COPY ["aspnetcore/src/ElasticService/ElasticService.csproj","./ElasticService/ElasticService.csproj"]
COPY ["aspnetcore/src/DatabaseContext/DatabaseContext.csproj","./DatabaseContext/DatabaseContext.csproj"]
COPY ["aspnetcore/src/Repositories/Repositories.csproj","./Repositories/Repositories.csproj"]
COPY ["aspnetcore/src/Service.Models/Service.Models.csproj","./Service.Models/Service.Models.csproj"]
COPY ["aspnetcore/src/Logging/Logging.csproj","./Logging/Logging.csproj"]
RUN dotnet restore "Indexer/Indexer.csproj"

# Copy everything else and build
COPY ["aspnetcore/src/Indexer/","./Indexer"]
COPY ["aspnetcore/src/ElasticService/","./ElasticService"]
COPY ["aspnetcore/src/DatabaseContext/","./DatabaseContext"]
COPY ["aspnetcore/src/Repositories/","./Repositories"]
COPY ["aspnetcore/src/Service.Models/","./Service.Models"]
COPY ["aspnetcore/src/Logging/","./Logging"]
RUN dotnet publish "Indexer/Indexer.csproj" -c Release -o out

# Runtime image
FROM mcr.microsoft.com/dotnet/runtime:6.0
WORKDIR /app
COPY --from=build-env /build/out .
ENTRYPOINT ["dotnet", "CSC.PublicApi.Indexer.dll"]
52 changes: 52 additions & 0 deletions aspnetcore/openshift/indexer/rahti2/template-indexer-app-devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-indexer-devel
template: publicapi-indexer-devel
name: publicapi-indexer-devel
annotations:
description: "Public API indexer devel - Build and ImageStream"
iconClass: icon-dotnet
objects:

# ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: publicapi-indexer-devel
labels:
app: publicapi-indexer-devel
spec:
lookupPolicy:
local: true

# BuildConfig using Docker build strategy
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: publicapi-indexer-build-devel
labels:
app: publicapi-indexer-devel
spec:
source:
git:
uri: https://github.com/CSCfi/research-fi-publicapi.git
ref: devel
contextDir: .
strategy:
type: Docker
dockerStrategy:
dockerfilePath: aspnetcore/openshift/indexer/rahti2/Dockerfile
output:
to:
kind: ImageStreamTag
name: publicapi-indexer-devel:latest
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-indexer-production
template: publicapi-indexer-production
name: publicapi-indexer-production
annotations:
description: "Public API indexer production - Build and ImageStream"
iconClass: icon-dotnet
objects:

# ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: publicapi-indexer-production
labels:
app: publicapi-indexer-production
spec:
lookupPolicy:
local: true

# BuildConfig using Docker build strategy
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: publicapi-indexer-build-production
labels:
app: publicapi-indexer-production
spec:
source:
git:
uri: https://github.com/CSCfi/research-fi-publicapi.git
ref: main
contextDir: .
strategy:
type: Docker
dockerStrategy:
dockerfilePath: aspnetcore/openshift/indexer/rahti2/Dockerfile
output:
to:
kind: ImageStreamTag
name: publicapi-indexer-production:latest
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2
52 changes: 52 additions & 0 deletions aspnetcore/openshift/indexer/rahti2/template-indexer-app-qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-indexer-qa
template: publicapi-indexer-qa
name: publicapi-indexer-qa
annotations:
description: "Public API indexer QA - Build and ImageStream"
iconClass: icon-dotnet
objects:

# ImageStream
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: publicapi-indexer-qa
labels:
app: publicapi-indexer-qa
spec:
lookupPolicy:
local: true

# BuildConfig using Docker build strategy
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: publicapi-indexer-build-qa
labels:
app: publicapi-indexer-qa
spec:
source:
git:
uri: https://github.com/CSCfi/research-fi-publicapi.git
ref: qa
contextDir: .
strategy:
type: Docker
dockerStrategy:
dockerfilePath: aspnetcore/openshift/indexer/rahti2/Dockerfile
output:
to:
kind: ImageStreamTag
name: publicapi-indexer-qa:latest
successfulBuildsHistoryLimit: 2
failedBuildsHistoryLimit: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-indexer-devel
template: publicapi-indexer-cronjob-devel
name: publicapi-indexer-cronjob-devel
annotations:
description: "Public API indexer devel - CronJob"
iconClass: icon-dotnet
objects:
# Recurring CronJob (devel)
# Indexes db entities to ElasticSearch.
- apiVersion: batch/v1
kind: CronJob
metadata:
name: publicapi-indexer-cronjob-devel
spec:
schedule: "0 1 * * *" # every day at 01:00 UTC
concurrencyPolicy: "Forbid"
startingDeadlineSeconds: 300 # Can start 5 minutes after the schedule
suspend: false
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 2
jobTemplate:
spec:
activeDeadlineSeconds: 2400 # Can run for 40 minutes
template:
spec:
restartPolicy: Never
containers:
- name: publicapi-indexer-container-devel
image: publicapi-indexer-devel
imagePullPolicy: Always
envFrom:
- secretRef:
name: publicapi-api-secret-devel
- configMapRef:
name: publicapi-api-config-devel
resources:
limits:
cpu: 500m
memory: 2Gi
requests:
cpu: 100m
memory: 512Mi

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-indexer-production
template: publicapi-indexer-cronjob-production
name: publicapi-indexer-cronjob-production
annotations:
description: "Public API indexer production - CronJob"
iconClass: icon-dotnet
objects:
# Recurring CronJob (production)
# Indexes db entities to ElasticSearch.
- apiVersion: batch/v1
kind: CronJob
metadata:
name: publicapi-indexer-cronjob-production
spec:
schedule: "40 19 * * *" # every day at 19:40 UTC
concurrencyPolicy: "Forbid"
startingDeadlineSeconds: 300 # Can start 5 minutes after the schedule
suspend: false
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 2
jobTemplate:
spec:
activeDeadlineSeconds: 2400 # Can run for 40 minutes
template:
spec:
restartPolicy: Never
containers:
- name: publicapi-indexer-container-production
image: publicapi-indexer-production
imagePullPolicy: Always
envFrom:
- secretRef:
name: publicapi-api-secret-production
- configMapRef:
name: publicapi-api-config-production
resources:
limits:
cpu: 500m
memory: 3Gi
requests:
cpu: 100m
memory: 1Gi

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file is part of the research.fi api
#
# Copyright 2024 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland [email protected]
# :license: MIT
apiVersion: template.openshift.io/v1
kind: Template
metadata:
labels:
app: publicapi-indexer-qa
template: publicapi-indexer-cronjob-qa
name: publicapi-indexer-cronjob-qa
annotations:
description: "Public API indexer QA - CronJob"
iconClass: icon-dotnet
objects:
# Recurring CronJob (qa)
# Indexes db entities to ElasticSearch.
- apiVersion: batch/v1
kind: CronJob
metadata:
name: publicapi-indexer-cronjob-qa
spec:
schedule: "0 2 * * *" # every day at 02:00 UTC
concurrencyPolicy: "Forbid"
startingDeadlineSeconds: 300 # Can start 5 minutes after the schedule
suspend: false
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 2
jobTemplate:
spec:
activeDeadlineSeconds: 2400 # Can run for 40 minutes
template:
spec:
restartPolicy: Never
containers:
- name: publicapi-indexer-container-qa
image: publicapi-indexer-qa
imagePullPolicy: Always
envFrom:
- secretRef:
name: publicapi-api-secret-qa
- configMapRef:
name: publicapi-api-config-qa
resources:
limits:
cpu: 500m
memory: 3Gi
requests:
cpu: 100m
memory: 1Gi

Loading

0 comments on commit 2cce706

Please sign in to comment.