apiVersion: apps/v1
kind: Deployment
metadata:
  name: board-app-deployment
spec:
  selector:
    matchLabels:
      app: board
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: board
    spec:
      containers:
      - name: board
        # change the app image here
        image: dannyh79/phx-board-app:0.1.0
        ports:
        - containerPort: 4000
        env:
        - name: PHX_HOST
          value: "k8s-challenge.chenghsuan.me"
        - name: PORT
          value: "4000"
        - name: DATABASE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: app-postgres-secret
              key: password
        - name: DATABASE_URL
          value: "postgres://app:$(DATABASE_PASSWORD)@postgres/app_prod"
        - name: SECRET_KEY_BASE
          valueFrom:
            secretKeyRef:
              name: app-secret-key-base
              key: password
