apiVersion: v1 kind: Service metadata: annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true' name: blockfreight labels: app: blockfreight spec: type: LoadBalancer ports: - port: 8888 targetPort: 8888 name: p2p - port: 24365 targetPort: 46657 name: rpc - port: 80 name: http selector: app: bftx --- apiVersion: v1 kind: Service metadata: annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true' name: blockfreight-api labels: app: blockfreight-api spec: type: LoadBalancer sessionAffinity: ClientIP ports: - port: 8080 targetPort: 8080 selector: app: bftx --- apiVersion: v1 kind: ConfigMap metadata: name: bftx-config data: seeds: 'bftx0,bftx1,bftx2,bftx3' validators: 'bftx0,bftx1,bftx2,bftx3' validator.power: '10' genesis.json: |- { "genesis_time": "2016-04-26T22:00:00Z", "chain_id": "chain-IdealX", "validators": [], "app_hash": "" } pub_key_nginx.conf: |- server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; } --- apiVersion: apps/v1beta2 kind: StatefulSet metadata: name: bftx spec: selector: matchLabels: app: bftx serviceName: blockfreight replicas: 2 template: metadata: labels: app: bftx spec: containers: - name: app imagePullPolicy: Always image: 'blockfreight/go-bftx:rc1' ports: - containerPort: 8080 - containerPort: 46658 - containerPort: 46656 name: p2p - containerPort: 46657 name: rpc env: - name: BFTXHOME value: /go/src/github.com/blockfreight/go-bftx - name: LOCAL_RPC_CLIENT_ADDRESS value: 'tcp://localhost:46657' - name: HOME value: ~ - name: VALIDATOR_NAME valueFrom: secretKeyRef: name: node.private.keys key: validatorName - name: PRIVATE_KEY valueFrom: secretKeyRef: name: node.private.keys key: privateKey - name: PRIVATE_NODE_KEY valueFrom: secretKeyRef: name: node.private.keys key: privateNodeKey command: - bash - '-c' - | mkdir $HOME/.blockfreight mkdir $HOME/.blockfreight/config # Creating genesis.json curl -L https://raw.githubusercontent.com/blockfreight/tools/master/blockfreightnet-kubernetes/examples/blockfreight/genesis.json > $HOME/.blockfreight/config/genesis.json # Creating node_key.json curl -L https://raw.githubusercontent.com/blockfreight/tools/master/blockfreightnet-kubernetes/examples/blockfreight/validators/$VALIDATOR_NAME/node_key.json > $HOME/.blockfreight/config/pre_node_key.json cat $HOME/.blockfreight/config/pre_node_key.json | jq --arg PRIVATE_NODE_KEY "$PRIVATE_NODE_KEY" '.priv_key["value"]=$PRIVATE_NODE_KEY' > $HOME/.blockfreight/config/node_key.json # Creating priv_validator.json curl -L https://raw.githubusercontent.com/blockfreight/tools/master/blockfreightnet-kubernetes/examples/blockfreight/validators/$VALIDATOR_NAME/priv_validator.json > $HOME/.blockfreight/config/pre_priv_validator.json cat $HOME/.blockfreight/config/pre_priv_validator.json | jq --arg PRIVATE_KEY "$PRIVATE_KEY" '.priv_key["value"]=$PRIVATE_KEY' > $HOME/.blockfreight/config/priv_validator.json # Creating config.toml curl -L https://raw.githubusercontent.com/blockfreight/tools/master/config.toml > $HOME/.blockfreight/config.toml cp $HOME/.blockfreight/config.toml $HOME/.blockfreight/config/config.toml rm $HOME/.blockfreight/config/pre_node_key.json rm $HOME/.blockfreight/config/pre_priv_validator.json rm -f /socks/app.sock # remove old socket bftx node start -v - name: pub-key imagePullPolicy: IfNotPresent image: nginx ports: - containerPort: 80 name: http - containerPort: 8080 command: - bash - '-c' - > set -ex # fixes 403 Permission Denied (open() "/tendermint/pub_key.json" failed (13: Permission denied)) # => we cannot serve from /tendermint, so we copy the file mkdir -p /usr/share/nginx mkdir -p /etc/nginx/html cd /etc/nginx/html touch index.html cat > index.html << EOL

Blockfreight. EOL nginx -g "daemon off;" volumeMounts: - name: tmdir mountPath: /tendermint - name: appdir mountPath: /app - mountPath: /etc/nginx/conf.d/pub_key.conf name: tmconfigdir subPath: pub_key_nginx.conf volumes: - name: tmconfigdir configMap: name: bftx-config - name: appconfigdir configMap: name: bftx-config - name: socksdir emptyDir: {} volumeClaimTemplates: - metadata: name: tmdir annotations: volume.alpha.kubernetes.io/storage-class: anything spec: accessModes: - ReadWriteOnce resources: requests: storage: 2Gi - metadata: name: appdir annotations: volume.alpha.kubernetes.io/storage-class: anything spec: accessModes: - ReadWriteOnce resources: requests: storage: 12Mi updateStrategy: type: RollingUpdate ...