---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-deployment
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: server
  template:
    metadata:
      labels:
        app: server
    spec:
      restartPolicy: Always
      containers:
      - name: server
        image: oscarsotosanchez/server:v1.0
        command: ["bash"]
        args:
        - "-c"
        - "./wait-for-it.sh mysql-service:3306 -t 500 -- ./wait-for-it.sh rabbitmq-service:5672 -t 500 -- node src/server.js"
        ports:
        - containerPort: 3000
        env:
        - name: MYSQL_HOST
          value: mysql-service
        - name: MYSQL_DB
          value: eoloplantsDB
        - name: MYSQL_USER
          value: root
        - name: MYSQL_PASS
          value: password
        - name: RABBITMQ_URL
          value: amqp://root:password@rabbitmq-service
  replicas: 1