Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

4x400: Early pass at a relay maintainer initcontainer #575

Merged
merged 41 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0ea3c0a
Early pass at a relay maintainer initcontainer
Shadowfiend Apr 10, 2020
5e85d0c
Add deployment of relay contract to migrations
Shadowfiend Apr 13, 2020
943f336
Flesh out relay maintainer initcontainer some more
Shadowfiend Apr 13, 2020
b15a22b
WIP relay-maintainer Deployment
Apr 13, 2020
f5536cd
Use env vars for ETH account material
Apr 15, 2020
ae311e6
Set Bitcoin host
Apr 15, 2020
ed17179
Merge branch 'master' into four-by-four-hundred
Apr 15, 2020
c2b4159
Build and publish InitContainer
Apr 15, 2020
e621410
Execute initcontainer jobs in keep-dev workflow for now
Apr 15, 2020
a5717bb
squash: comment filters for test deploy
Apr 15, 2020
7b54a54
Publish requires the build step to finish first
Apr 15, 2020
ac52304
Use existing dir path
Apr 16, 2020
fd4488d
Create image dir
Apr 16, 2020
f7d2da8
Deploy Summa relay to keep-dev
Apr 16, 2020
aa9d157
Update tbtc to get latest pre version
Apr 16, 2020
68c10b1
Use docker-node executor for relay maintainer
Shadowfiend Apr 17, 2020
a7924c7
Bump initcontainer to 0.14.0-pre release
Shadowfiend Apr 17, 2020
418c6e2
Bump relay initcontrainer to Node 13, use Alpine
Shadowfiend Apr 17, 2020
188eca3
Pull URL class out of Node url library
Shadowfiend Apr 17, 2020
02aa78f
Pull operator key and address to top level
Shadowfiend Apr 17, 2020
0b75d3d
Include network name + Bitcoin info from env
Shadowfiend Apr 17, 2020
dec7b72
Fix maintainer env template find/replace
Shadowfiend Apr 17, 2020
2b19680
WIP Don't do contract migration for testing build
Shadowfiend Apr 17, 2020
b4de285
Set SUMMA_RELAY_BCOIN_API_KEY with BITCOIN_API_KEY
Apr 17, 2020
ea8f738
Revert "Set SUMMA_RELAY_BCOIN_API_KEY with BITCOIN_API_KEY"
Apr 17, 2020
0b0d895
Fiddling with getting Bitcoin auth working
Apr 17, 2020
08d33df
Minimum viable Kube config for Bcoin
Apr 18, 2020
009f9a3
Set BITCOIN_API_KEY
Apr 19, 2020
a5a7777
Call it what it is
Apr 19, 2020
80f4aea
Update env vars
Apr 19, 2020
b7f91ac
Build/publish relay InitContainer in keep-test workflow
Apr 19, 2020
25d7034
Tag InitContainer image.
Apr 19, 2020
8856fac
fix: clear dirty lower-order bits in functionSignature
liamzebedee Apr 20, 2020
6391c6c
Rename createNewDepositFeeEstimate -> getNewDepositFeeEstimate
liamzebedee Apr 20, 2020
3d07ece
Remove unnecessary require assertions
liamzebedee Apr 20, 2020
db763e8
Ignore kube secrets dir
Apr 20, 2020
bc5e151
Include bcoin / relayer keep-test deploy
Apr 20, 2020
deaa64a
Fix serviceName for bcoin StatefulSets
Shadowfiend Apr 21, 2020
a5804d5
Merge pull request #586 from keep-network/rename-deposit-factory-getter
Shadowfiend Apr 21, 2020
0f585af
Merge pull request #585 from keep-network/a-bit-sale
Shadowfiend Apr 21, 2020
d10c78a
Merge branch 'master' into four-by-four-hundred
Shadowfiend Apr 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions infrastructure/kube/keep-dev/relay-maintainer-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put some space between a few values for readability while we work through this.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: relay-maintainer
namespace: default
labels:
keel.sh/policy: all
app: maintainer
type: relay
spec:
replicas: 1
selector:
matchLabels:
app: maintainer
type: relay
template:
metadata:
labels:
app: maintainer
type: relay
spec:

initContainers:
- name: initcontainer-provision-relay-maintainer
image: gcr.io/keep-dev-fe24/initcontainer-provision-relay-maintainer
imagePullPolicy: Always
env:

- name: ETH_RPC_URL
valueFrom:
configMapKeyRef:
name: eth-network-internal
key: rpc-url

- name: ETH_NETWORK_ID
valueFrom:
configMapKeyRef:
name: eth-network-internal
key: network-id

- name: ETH_NETWORK_NAME
value: internal

- name: RELAY_MAINTAINER_ETH_ACCOUNT_ADDRESS
valueFrom:
configMapKeyRef:
name: eth-account-info
key: account-0-address

- name: RELAY_MAINTAINER_ETH_ACCOUNT_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: eth-account-privatekeys
key: account-0

- name: CONTRACT_OWNER_ETH_ACCOUNT_ADDRESS
valueFrom:
configMapKeyRef:
name: eth-network-internal
key: contract-owner-eth-account-address

- name: CONTRACT_OWNER_ETH_ACCOUNT_PRIVATE_KEY
valueFrom:
secretKeyRef:
name: eth-network-internal
key: contract-owner-eth-account-private-key

- name: BITCOIN_HOST
value:

- name: BITCOIN_PORT
value:

- name: BITCOIN_API_KEY
value:

volumeMounts:
- name: relay-maintainer-env
mountPath: /mnt/relay-maintainer
command: ['node', '/tmp/provision-relay-maintainer.js']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile already sets an appropriate entry point, yah?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I go back and forth on this, it feels good to be explicit on the app config with what command is being run for a container, even if it's the default entry point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is probably true for external containers, since they can change out from under you, but for containers we control it feels like we're just doubling our workload whenever we need to change something… Either way, it's fine for this PR, especially if it's what we've been doing elsewhere.


containers:
- name: relay-maintainer
image: gcr.io/keep-dev-fe24/relay-maintainer
imagePullPolicy: Always
volumeMounts:
- name: relay-maintainer-env
mountPath: /mnt/relay-maintainer

volumes:
- name: relay-maintainer-env
persistentVolumeClaim:
claimName: relay-maintainer-env

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: relay-maintainer-env
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:11 AS runtime

WORKDIR /tmp

COPY ./package.json /tmp/package.json
COPY ./package-lock.json /tmp/package-lock.json

RUN npm ci

COPY ./env-template /tmp/env-template

COPY ./provision-relay-maintainer.js /tmp/provision-relay-maintainer.js

ENTRYPOINT ["node", "./provision-relay-maintainer.js"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# default: 127.0.0.1
SUMMA_RELAY_ETHER_HOST=127.0.0.1

# default: 8545
SUMMA_RELAY_ETHER_PORT=8545

# no default
# 32-byte hex-encoded privkey
SUMMA_RELAY_OPERATOR_KEY=

# default: ropsten
SUMMA_RELAY_ETH_NETWORK=ropsten

# default: inherited from ETH_NETWORK.
# to override, leave network blank
SUMMA_RELAY_ETH_CHAIN_ID=33

# default: 127.0.0.1
SUMMA_RELAY_BCOIN_HOST=127.0.0.1

# default: "" (empty string)
SUMMA_RELAY_BCOIN_API_KEY=""

# default: 8332
SUMMA_RELAY_BCOIN_PORT=8332

# no default
# infura project ID
SUMMA_RELAY_INFURA_KEY=""

# no default
# target relay smart contract address
SUMMA_RELAY_CONTRACT=0x...
Loading