Moqui in Kubernetes

I’ve been looking into how to run Moqui in Kubernetes and I’m wondering if anyone is running Moqui in Kubernetes.

If anyone is, what are some recommendations that you suggest for running it?

Do you use an ingress controller? If so which one?

How do you handle having multiple instances of Moqui? Do you have elastic search setup to act as a cluster? Do you have one database or do you use a multi tenant model?

How do you leverage hazelcast’s session sharing?

Thanks for any comments. It’d help me a great deal

2 Likes

You can build Moqui Docker Images, and push the image to an docker Registry.
create Yaml like this:

---
apiVersion: v1
kind: Deployment
metadata:
  name: moqui
  namespace: your_namespace
  labels:
    version: v1
    app:moqui
  annotations:
    servicemesh.kubesphere.io/enabled: 'true'
spec:
  replicas: 1
  template:
    labels:
      version: v1
    annotations:
      sidecar.istio.io/inject: 'true'
    selector:
      matchLabels:
        version: v1
    spec:
      containers:
        - name: moqui
          image:  your_moqui_image
          ports:
            - containerPort: 8080
              protocol: TCP
            - containerPort: 8443
              protocol: TCP
            - containerPort: 5701
              protocol: TCP
           - containerPort: 9200
              protocol: TCP
          env:
            - name: instance_purpose
              value: "production"
            - name: entity_ds_db_conf
              value: "postgres"
            - name: entity_ds_host
              value: "your_database_url/your_database_svc_cluster_name"
            - name: entity_ds_port
              value: "5432"
            - name: entity_ds_database
              value: "your_database"
            - name: entity_ds_schema
              value: "public"
            - name: entity_ds_user
              value: "username"
            - name: entity_ds_password
              value: "password"
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
1 Like

Thank you that’s super helpful!

Hi Michael, we use Kubernetes for moqui, and gitlabs CI/CD to generate the container images and serve them to the cluster.
For review and testing environments we create 4 deployments for each moqui environment: moqui, elasticsearch, postgres and kibana. This way, when we terminate those deployments, we do not need to do any additional clean-up.
For production environments we have been using the same approach as it worked well, but are considering to switch to using shared clusters for at least postgres (same server but different databases, so no multi-tenant) and elasticsearch.

For ingress controller, we use ingress-nginx-controller, and hazelcast works well in our case with the AwsDiscoveryStrategy.

1 Like

And about the database, we are looking into setting up Cloud Native PostgreSQL (https://cloudnative-pg.io/) as it is fully open sourced as of May 2022.

1 Like

Hi Michael,

Kindly share the documents how you set up the moqui through docker and kubernetes.
Thanks for the post.

@girindrag is working with me to help setup infrastructure for Xolve Group. Any details anyone can share generally on the topic of docker and kubernetes will be helpful. We are curating detailed documentation as we go and will share publicly when it is ready.
@girindrag please post any specific questions that you have.

1 Like

Hi

I am getting jetty error in web browser.


Checkout the docs on Moqui Documentation

you are just typing localhost:80 ,i think you publish jwilder/nginx port 0n 80 thats why ,but by default in mapping(etc/nginx/conf.d/default.conf) of nginx it will return 503 ,
so there is nothing wrong.
for acessign instance you have to register logical-host to localhost in etc/hosts then you can
but still the instance named with moqui.local can give problem because
In the case logical host moqui.local instance secure https way is checked like certificate and all so it will also give 503
You can try with diffrent logical host it will work surely like http://moqui.test:80

We need an official Helm chart.

1 Like

Agreed. I’d be happy to look over one, or at some point make one.

1 Like