apiVersion: v1
kind: ReplicationController
metadata:
  name: zulip-1
  labels:
    version: 1.8.0-2
    app: zulip
spec:
  replicas: 1
  selector:
    version: 1.8.0-2
    app: zulip
  template:
    metadata:
      labels:
        version: 1.8.0-2
        app: zulip
    spec:
      containers:
      - name: redis
        image: quay.io/sameersbn/redis:latest
        resources:
          limits:
            cpu: 50m
        volumeMounts:
          - name: redis-persistent-storage
            mountPath: /var/lib/redis
      - name: memcached
        image: quay.io/sameersbn/memcached:latest
        resources:
          limits:
            cpu: 75m
            memory: 768Mi
      - name: rabbitmq
        image: rabbitmq:3.5.5
        resources:
          limits:
            cpu: 75m
            memory: 768Mi
        env:
        - name: RABBITMQ_DEFAULT_USER
          value: "zulip"
        - name: RABBITMQ_DEFAULT_PASS
          value: "zulip"
      - name: postgresql
        image: quay.io/galexrt/zulip-postgresql-tsearchextras:latest
        resources:
          limits:
            cpu: 80m
            memory: 768Mi
        env:
        - name: DB_NAME
          value: zulip
        - name: DB_USER
          value: zulip
        - name: DB_PASS
          value: zulip
        volumeMounts:
          - name: postgresql-persistent-storage
            mountPath: /var/lib/postgresql
      - name: zulip
        image: quay.io/galexrt/zulip:1.8.0-2
        resources:
          limits:
            cpu: 100m
            memory: 3584Mi
        env:
        # Please take a look at the environment variables in docker-compose.yml for all required env variables!
        - name: DB_HOST
          value: "database"
        - name: MEMCACHED_HOST
          value: "memcached"
        - name: REDIS_HOST
          value: "redis"
        - name: RABBITMQ_HOST
          value: "rabbitmq"
        - name: ZULIP_AUTH_BACKENDS
          value: "EmailAuthBackend"
        - name: SECRETS_email_password
          value: "123456789"
        - name: SETTING_EXTERNAL_HOST
          value: "localhost"
        - name: SETTING_ZULIP_ADMINISTRATOR
          value: "admin@example.com"
        - name: SETTING_ADMIN_DOMAIN
          value: "zerbytes.net"
        - name: SETTING_NOREPLY_EMAIL_ADDRESS
          value: "noreply@example.com"
        - name: SETTING_DEFAULT_FROM_EMAIL
          value: "Zulip <noreply@example.com>"
        - name: SETTING_EMAIL_HOST
          value: "smtp.example.com"
        - name: SETTING_EMAIL_HOST_USER
          value: "noreply@example.com"
        - name: ZULIP_USER_EMAIL
          value: "example@example.com"
        - name: ZULIP_USER_DOMAIN
          value: "example.com"
        - name: ZULIP_USER_PASS
          value: "123456789"
        - name: SECRETS_secret_key
          value: "REPLCAE_WITH_SECURE_SECRET_KEY"
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 443
          name: https
          protocol: TCP
        volumeMounts:
          - name: zulip-persistent-storage
            mountPath: /data
#        livenessProbe:
#          httpGet:
#            path: /login
#            port: 443
#            scheme: HTTP
#          initialDelaySeconds: 120
#          timeoutSeconds: 12
      volumes:
      - name: redis-persistent-storage
        hostPath:
          path: /opt/docker/zulip/redis
      - name: postgresql-persistent-storage
        hostPath:
          path: /opt/docker/zulip/postgresql
      - name: zulip-persistent-storage
        hostPath:
          path: /opt/docker/zulip/zulip
