Skip to content

bcanvural/brxm-cockroachdb

Repository files navigation

Run brXM on CockroachDB

Start minikube with some additional resources

minikube --memory 8192 --cpus 2 start

Start helm (install helm if missing https://helm.sh/)

helm init

Setup tiller for helm

kubernetes/tiller_setup.sh

Start cockroachdb cluster

kubernetes/install_cockroach.sh

Start a client pod to create a db named repositoryds (only once)

    kubectl run -it --rm cockroach-client \
        --image=cockroachdb/cockroach \
        --restart=Never \
        --command -- ./cockroach sql --insecure --host mycockroach-cockroachdb-public.default

create the db:

create database repositoryds;

Deployment/Working options

See "Local dev" OR "Local cluster" below.

Local dev

Port-forward from localhost to cockroachdb service within cluster:

kubectl port-forward svc/mycockroach-cockroachdb-public 26257:26257

This will only connect to a single node! If that node goes down, CMS goes down.

Change the conf/context.xml connection string to localhost one:

<!--snip-->
...
url="jdbc:postgresql://localhost:26257/repositoryds">
<!--snip-->

Run

mvn clean verify && mvn -Pcargo.run

Local cluster (better for HA)

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)

Build hippo project, and build docker image

./build.sh

Change the conf/context.xml connection string :

<!--snip-->
url="jdbc:postgresql://mycockroach-cockroachdb-public.default.svc.cluster.local:26257/repositoryds"/>
<!--snip-->

Deploy:

kubectl apply -f kubernetes/hippo-deployment.yaml

Add an entry in your /etc/hosts file. Replace <minikube_ip> with the output of the command:

minikube ip

Add the following line in your /etc/hosts file:

<minikube_ip> hippo.site hippo.cms

Enable ingress addon in minikube

minikube addons enable ingress

Apply ingress rules to access the cluster

kubectl apply -f kubernetes/ingress.yaml

Then visit http://hippo.cms/cms