apiVersion: apps/v1
kind: Deployment
metadata:
  name: firefly-core
  namespace: firefly
spec:
  replicas: 1
  selector:
    matchLabels:
      app: firefly-core
  template:
    metadata:
      labels:
        app: firefly-core
    spec:
      containers:
      - name: firefly-core
        image: hyperledger/firefly:v1.2.0
        env:
        - name: FF_DATABASE_TYPE
          value: postgres
        - name: FF_DATABASE_URL
          valueFrom:
            configMapKeyRef:
              name: firefly-config
              key: database-url
        - name: FF_BLOCKCHAIN_TYPE
          value: ethereum
        - name: FF_BLOCKCHAIN_RPC
          value: http://besu-rpc-service.besu-network.svc.cluster.local:8545
        - name: FF_BLOCKCHAIN_WS
          value: ws://besu-rpc-service.besu-network.svc.cluster.local:8546
        - name: FF_CHAIN_ID
          value: "138"
        - name: FF_NODE_NAME
          value: firefly-node-1
        - name: FF_API_PUBLICURL
          value: http://firefly-api:5000
        - name: FF_LOGGING_LEVEL
          value: info
        ports:
        - containerPort: 5000
          name: api
        - containerPort: 5001
          name: metrics
        volumeMounts:
        - name: config
          mountPath: /etc/firefly
        resources:
          requests:
            cpu: "1"
            memory: "2Gi"
          limits:
            cpu: "2"
            memory: "4Gi"
        livenessProbe:
          httpGet:
            path: /api/v1/status
            port: 5000
          initialDelaySeconds: 60
          periodSeconds: 30
        readinessProbe:
          httpGet:
            path: /api/v1/status
            port: 5000
          initialDelaySeconds: 30
          periodSeconds: 10
      volumes:
      - name: config
        configMap:
          name: firefly-config
---
apiVersion: v1
kind: Service
metadata:
  name: firefly-api
  namespace: firefly
spec:
  selector:
    app: firefly-core
  ports:
  - port: 5000
    targetPort: 5000
    name: api
  - port: 5001
    targetPort: 5001
    name: metrics
  type: ClusterIP

