Installation

Komander is composed of a server, a frontend, a MongoDB database and a CLI (see this page for information on how to install it).

Environment variables

VariableDescription
KOMANDER_URLThe domain from which you will access your Komander instance, no trailing slash (ex: http://localhost:82).
KOMANDER_MONGODB_URISets the address of the MongoDB database, followed by the authentication database. Should be something like komander-mongo:27017/admin (don't include the protocol).
KOMANDER_MONGODB_USERSets the username used to connect to the database.
KOMANDER_MONGODB_PASSWORDSets the password used to connect to the database.
KOMANDER_DB_NAMESets the name of the database in MongoDB.
KOMANDER_GIT_PROVIDERShould be gtilab. Sets the type of provider. More will come soon.
KOMANDER_GIT_HOSTSets the address of the Git provider. Should be a fully formed url like https://gitlab.com.
KOMANDER_GIT_OAUTH_CLIENT_IDThe Application ID in your OAuth provider (see Requirements)
KOMANDER_GIT_OAUTH_CLIENT_SECRETThe Secret in your OAuth provider (see Requirements)
KOMANDER_JWT_SECRETA secret key to sign the JWT used to authenticate you with the Komander Server.

Tags

For a list of available image tags go to Docker Hub.

Docker

  1. (Optional) If you have Repository Templates, put them under ./repository_templates (or wherever you want, then replace ./repository_templates with your path in the commands and configuration files below).

  2. Create a .env file with the environment variable listed above

  3. Assuming you already have a MongoDB instance running, simply run:

    docker run --rm -d --name komander -p 81:80 -v ./projects:/komander_projects -v ./repository_templates:/komander_repository_templates/user --network komander --env-file .env komanderdx/komander:latest
    

    Or, using Docker Compose, create the following compose file:

    # komander-docker-compose.yml
    version: '3.5'
    
    services:
      komander:
        image: komanderdx/komander:latest
        container_name: komander
        restart: unless-stopped
        depends_on:
          - komander-mongo
        ports:
          - "81:80"
        volumes:
          - "./projects:/komander_projects"
          - "./repository_templates:/komander_repository_templates/user"
        env_file:
          - .env
        networks:
          - komander
            
      komander-mongo:
        image: mongo:latest
        container_name: komander-mongo
        restart: unless-stopped
        ports:
          - "27017:27017"
        volumes:
          - "./database:/data/db"
        environment:
          - MONGO_INITDB_ROOT_USERNAME=komander
          - "MONGO_INITDB_ROOT_PASSWORD=$KOMANDER_MONGODB_PASSWORD"
        networks:
          - komander
    
    networks:
      komander:
        name: komander
    

    Then run:

    docker compose -f komander-docker-compose.yml up -d
    

Kubernetes

Using Kubernetes, create the following resource file and modify it with your environment variables:

# komander-resources.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: komander
  name: komander
spec:
  replicas: 1
  selector:
    matchLabels:
      app: komander
  template:
    metadata:
      labels:
        app: komander
    spec:
      containers:
        - env:
            - name: KOMANDER_MONGODB_USER
              value: "komander"
            - name: KOMANDER_DB_NAME
              value: "komander"
            - name: KOMANDER_GIT_PROVIDER
              value: "gitlab"
            - name: KOMANDER_GIT_HOST
              value: ""
            - name: KOMANDER_GIT_OAUTH_CLIENT_ID
              value: ""
            - name: KOMANDER_URL
              value: "<komander_url>"
            - name: KOMANDER_MONGODB_URI
              value: "komander-mongo.komander.svc.cluster.local:27017/admin"
            - name: KOMANDER_MONGODB_PASSWORD
              valueFrom:
                secretKeyRef:
                    key: KOMANDER_MONGODB_PASSWORD
                    name: komander-secrets
            - name: KOMANDER_GIT_OAUTH_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                    key: KOMANDER_GIT_OAUTH_CLIENT_SECRET
                    name: komander-secrets
            - name: KOMANDER_JWT_SECRET
              valueFrom:
                secretKeyRef:
                    key: KOMANDER_JWT_SECRET
                    name: komander-secrets
          image: komanderdx/komander:latest
          imagePullPolicy: Always
          name: server
          ports:
            - containerPort: 80
              protocol: TCP
          volumeMounts:
            - mountPath: /komander_repository_templates/user
              name: data0
      volumes:
        - name: data0
          persistentVolumeClaim:
            claimName: komander
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  namespace: komander
  name: komander
spec:
  selector:
    app: komander
  ports:
    - port: 80
      protocol: TCP
      targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: komander
  name: komander-mongo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: komander-mongo
  template:
    metadata:
      labels:
        app: komander-mongo
    spec:
      containers:
        - env:
            - name: MONGO_INITDB_ROOT_USERNAME
              value: "komander"
            - name: MONGO_INITDB_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                    key: KOMANDER_MONGODB_PASSWORD
                    name: komander-secrets
          image: mongo:latest
          imagePullPolicy: Always
          name: mongo
          ports:
            - containerPort: 27017
              protocol: TCP
          volumeMounts:
            - mountPath: /data/db
              name: data0
      volumes:
        - name: data0
          persistentVolumeClaim:
            claimName: komander-mongo
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  namespace: komander
  name: komander-mongo
spec:
  selector:
    app: komander-mongo
  ports:
    - port: 27017
      protocol: TCP
      targetPort: 27017
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
  namespace: komander
  name: komander
spec:
  ingressClassName: nginx
  rules:
    - host: <komander_domain>
      http:
        paths:
          - backend:
              service:
                name: komander
                port:
                  number: 80
            path: /
            pathType: Prefix
  tls:
    - hosts:
        - <komander_domain>
      secretName: komander-tls
---
apiVersion: v1
kind: Secret
stringData:
  KOMANDER_MONGODB_PASSWORD: ""
  KOMANDER_GIT_OAUTH_CLIENT_SECRET: ""
  KOMANDER_JWT_SECRET: ""
metadata:
  namespace: komander
  name: komander-secrets
type: Opaque
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: komander
  name: komander-mongo
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: komander
  name: komander
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

Then run:

kubectl create namespace komander 
kubectl apply -n komander -f komander-resources.yaml

If you have Repository Templates, copy them to the pod using something like:

kubectl cp ./repository_templates komander-xxxxxxxxxx:/komander_repository_templates/user -n komander

Then restart the pod so that templates are loaded by the server.