apiVersion: apps/v1
kind: Deployment
metadata:
  name: myproject
  labels:
    app: myproject
spec:
  replicas: 1
  selector:
    matchLabels:
      app: myproject
  template:
    metadata:
      labels:
        app: myproject
    spec:
      # The sqlite3 database is shared through this volume
      # It's not a good approach for production use since it is deleted when the pod goes down
      volumes:
      - name: tmp-database
        emptyDir: {}
      containers:
      - name: myproject
        image: myproject:1
        imagePullPolicy: Never
        volumeMounts:
        - mountPath: /data
          name: tmp-database
        env:
        - name: DATABASE_DIR
          value: /data
        - name: CELERY_BROKER_URL
          value: "amqp://guest:guest@rabbitmq-service:5672"
        - name: CELERY_RESULT_BACKEND
          value: "rpc://"
#         env:
#         - name: CELERY_BROKER_URL
#           value: 'redis://redis-service:6379/0'
#         - name: CELERY_RESULT_BACKEND
#           value: 'redis://redis-service:6379/1'
      - name: consumer-small
        image: consumer-small:1
        imagePullPolicy: Never
        volumeMounts:
        - mountPath: /data
          name: tmp-database
        env:
        - name: DATABASE_DIR
          value: /data
        - name: CELERY_BROKER_URL
          value: "amqp://guest:guest@rabbitmq-service:5672"
        - name: CELERY_RESULT_BACKEND
          value: "rpc://"
#         env:
#         - name: CELERY_BROKER_URL
#           value: 'redis://redis-service:6379/0'
#         - name: CELERY_RESULT_BACKEND
#           value: 'redis://redis-service:6379/1'
