laundree/laundree

View on GitHub
kube/laundree.yml

Summary

Maintainability
Test Coverage
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  namespace: ${NAMESPACE}
  name: laundree
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: laundree
    spec:
      containers:
      - name: nginx
        image: nginx
        resources:
          requests:
            cpu: 0.02
        readinessProbe:
          httpGet:
            path: /en
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 5
        ports:
          - containerPort: 3000
        volumeMounts:
          - mountPath: /etc/nginx/
            name: nginx-config
            readOnly: true
      volumes:
      - name: nginx-config
        configMap:
          name: laundree
          items:
            - key: nginx.conf
              path: nginx.conf

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  namespace: ${NAMESPACE}
  name: web
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - name: web
        image: laundree/laundree:${TAG}
        readinessProbe:
          httpGet:
            path: /en
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 5
        command:
          - "bash"
          - "-c"
          - ". /home/laundree/.nvm/nvm.sh && npm run start:web"
        resources:
          requests:
            cpu: 0.01
        env:
          - name: 'REDIS_HOST'
            value: 'redis.default'
          - name: 'REDIS_PORT'
            value: '6379'
          - name: 'NODE_ENV'
            value: 'production'
          - name: 'HOST'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: host
          - name: 'SESSION_DOMAIN'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: host
          - name: FACEBOOK_APP_ID
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: facebookAppId
          - name: 'FACEBOOK_APP_SECRET'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: facebookAppSecret
          - name: 'FACEBOOK_CALLBACK_URL'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: facebookCallbackUrl
          - name: 'GOOGLE_TRACKING_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: googleTrackingId
          - name: 'GOOGLE_CALLBACK_URL'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: googleCallbackUrl
          - name: 'GOOGLE_CLIENT_API_KEY'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: googleClientApiKey
          - name: 'GOOGLE_CLIENT_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: googleClientId
          - name: 'GOOGLE_CLIENT_SECRET'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: googleClientSecret
          - name: 'GOOGLE_SERVER_API_KEY'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: googleServerApiKey
          - name: 'OPBEAT_APP_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: opbeatAppId
          - name: 'OPBEAT_ORGANIZATION_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: opbeatOrgId
          - name: 'OPBEAT_SECRET_TOKEN'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: opbeatSecretToken
          - name: 'SESSION_SECRET'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: sessionSecret
          - name: 'AUTH_SECRET'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: authSecret
          - name: 'API_BASE'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: apiBase
          - name: 'SOCKET_IO_BASE'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: socketIoBase

        ports:
          - containerPort: 3000
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  namespace: ${NAMESPACE}
  name: api
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: api
    spec:
      containers:
      - name: api
        image: laundree/laundree:${TAG}
        command:
          - "bash"
          - "-c"
          - ". /home/laundree/.nvm/nvm.sh && npm run start:api"
        readinessProbe:
          httpGet:
            path: /users
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 5
        resources:
          requests:
            cpu: 0.02
        env:
          - name: 'REDIS_HOST'
            value: 'redis.default'
          - name: 'REDIS_PORT'
            value: '6379'
          - name: 'NODE_ENV'
            value: 'production'
          - name: 'MONGO_URL'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: mongoUrl
          - name: 'HOST'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: host
          - name: 'GOOGLE_SERVER_API_KEY'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: googleServerApiKey
          - name: 'MAILGUN_API_KEY'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: mailgunApiKey
          - name: 'ONE_SIGNAL_APP_ID'
            value: '390e23c3-658b-46cd-83ee-2fdead3211af'
          - name: 'ONE_SIGNAL_REST_API_KEY'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: oneSignalRestApiKey
          - name: 'OPBEAT_APP_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: opbeatAppId
          - name: 'OPBEAT_ORGANIZATION_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: opbeatOrgId
          - name: 'OPBEAT_SECRET_TOKEN'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: opbeatSecretToken
          - name: 'AUTH_SECRET'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: authSecret
        ports:
          - containerPort: 3000
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  namespace: ${NAMESPACE}
  name: socket
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: socket
    spec:
      containers:
      # [START web]
      - name: socket
        command:
          - "bash"
          - "-c"
          - ". /home/laundree/.nvm/nvm.sh && npm run start:socket"
        image: laundree/laundree:${TAG}
        resources:
          requests:
            cpu: 0.02
        readinessProbe:
          httpGet:
            path: /
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 5
        env:
          - name: 'REDIS_HOST'
            value: 'redis.default'
          - name: 'REDIS_PORT'
            value: '6379'
          - name: 'NODE_ENV'
            value: 'production'
          - name: 'MONGO_URL'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: mongoUrl
          - name: 'OPBEAT_APP_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: opbeatAppId
          - name: 'OPBEAT_ORGANIZATION_ID'
            valueFrom:
              configMapKeyRef:
                name: laundree
                key: opbeatOrgId
          - name: 'OPBEAT_SECRET_TOKEN'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: opbeatSecretToken
          - name: 'AUTH_SECRET'
            valueFrom:
              secretKeyRef:
                name: laundree
                key: authSecret
        ports:
          - containerPort: 3000
---

apiVersion: v1
kind: Service
metadata:
  namespace: ${NAMESPACE}
  name: laundree
  labels:
    app: laundree
spec:
  type: NodePort
  ports:
  - port: 3000
    targetPort: 3000
    protocol: TCP
    name: http
  selector:
    app: laundree
---

apiVersion: v1
kind: Service
metadata:
  namespace: ${NAMESPACE}
  name: web
  labels:
    app: web
spec:
  type: NodePort
  ports:
  - port: 3000
    targetPort: 3000
    protocol: TCP
    name: http
  selector:
    app: web
---

apiVersion: v1
kind: Service
metadata:
  namespace: ${NAMESPACE}
  name: api
  labels:
    app: api
spec:
  type: NodePort
  ports:
  - port: 3000
    targetPort: 3000
    protocol: TCP
    name: http
  selector:
    app: api
---

apiVersion: v1
kind: Service
metadata:
  namespace: ${NAMESPACE}
  name: socket
  labels:
    app: socket
spec:
  type: NodePort
  sessionAffinity: ClientIP
  ports:
  - port: 3000
    targetPort: 3000
    protocol: TCP
    name: http
  selector:
    app: socket