apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    description: Bitcoin Swisschain Private Network Explorer
  labels:
    app: bitcoin-private
    environment: Development
    tier: Service
  name: bitcoin-private
  namespace: sirius-explorers
spec:
  revisionHistoryLimit: 1
  minReadySeconds: 10
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  replicas: 1
  selector:
    matchLabels:
      app: bitcoin-private
  template:
    metadata:
      labels:
        app: bitcoin-private
      name: bitcoin-private
    spec:
      containers:
      - name: bitcoin-private
        image: oktapodia/btc-rpc-explorer
        imagePullPolicy: Always
        lifecycle:
          postStart:
            exec:
             command:
             - /bin/sh
             - -c 
             - "/bin/echo 'options single-request-reopen' >> /etc/resolv.conf"
        ports:
        - containerPort: 5000
        - containerPort: 5001
        readinessProbe:
          httpGet:
            path: /
            port: 3002
          initialDelaySeconds: 40
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /
            port: 3002
          initialDelaySeconds: 40
          periodSeconds: 20
        resources:
          requests:
            memory: 64Mi 
            cpu: 40m 
          limits:
            memory: 128Mi 
            cpu: 500m 
        env:
        - name: RPC_USER
          valueFrom:
            secretKeyRef:
              name: bitcoin-private
              key: BITCOIN_RPC_USER
        - name: RPC_PASSWORD
          valueFrom:
            secretKeyRef:
              name: bitcoin-private
              key: BITCOIN_RPC_PASS
        - name: RPC_HOST 
          value: "bitcoin-regtest.nodes.swisschain.io"
        - name: RPC_PORT
          value: "80"
