Skip to content

A spring boot app which takes care of cleaning up repository journal tables in kubernetes environments

Notifications You must be signed in to change notification settings

bcanvural/brxm-repo-maintainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brXM Repo Maintainer Application

A standalone application that takes care of running repository maintenance queries in a kubernetes cluster

Run it locally in minikube:

(Tested minikube version: v1.5.2)

Install virtualbox https://www.virtualbox.org/wiki/Downloads

Install minikube https://github.com/kubernetes/minikube

brew cask install minikube

Start minikube with some additional resources

minikube --memory 8192 --cpus 2 start

Setup helm (tested with v3.0.0) (kubernetes package manager) https://github.com/helm/helm

brew install kubernetes-helm

Switch to kubernetes folder

cd kubernetes

Setup a postgresql db for brxm

./setup_db.sh

After db is up, create a brxm deployment (from kubernetes directory)

./deploy-brxm.sh

Create serviceaccount for brxm-repo-maintainer application so that it can read pod names from kube-apiserver

./setup-serviceaccount.sh

To be able to work with the docker daemon on your mac/linux host use the docker-env command in your shell

eval $(minikube docker-env)

Now that you have run the eval command above, build the brxm-repo-maintainer image: (you have to keep using the same shell!)

cd .. # switch to pom.xml directory
mvn clean compile jib:dockerBuild

Create either a cronjob (brxm-repo-maintainer-cronjob.yaml), job (brxm-repo-maintainer-job.yaml), or a regular deployment (brxm-repo-maintainer.yaml)

kubectl create -f kubernetes/brxm-repo-maintainer-job.yaml

Caveats:

  • This application is built for postgresql. For other relational dbs the jdbc connection and the actual queries run should be tweaked.
  • The k8s manifest files (deployment/job/cronjob) rely on a serviceaccount named "brxm-repo-maintainer". You may or may not have the rights to create such a k8s object in your own organization.
  • Ideally you want to run brxm-repo-maintainer as a cronjob and once a day. (Right after a daily db backup is done for example)
  • BRXM_SELECTOR envrionment variable is used to select the brxm pods. This value should match the labels on brxm pod manfiest. (See "app: brxm" in kubernetes/brxm.yaml)
  • If you are running brXM as stateful sets, you also have to change how journal_id's are constructed. Then, they have the form: pod_name.service_name.namespace_name.svc.cluster.local

About

A spring boot app which takes care of cleaning up repository journal tables in kubernetes environments

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published