Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Update docker container ubuntu 16 -> 20 (#36)
Browse files Browse the repository at this point in the history
* use tessera (java) instead of constellation (haskell only on ubuntu 16) to generate tm keys.
* remove dependencies on npm and web3.
* remove package that are no longer needed in base image: golang, make, git, etc.
* use ethkey instead of geth for key gen.
* UTC key names -> acctkeyfile.json
  • Loading branch information
libby authored Jun 10, 2020
1 parent 28461f4 commit acdcadb
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 22 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 23 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:20.10

ARG COMMIT=""
ARG QUBES_VERSION=""
Expand All @@ -11,26 +11,34 @@ LABEL org.opencontainers.image.source="https://github.com/jpmorganchase/qubernet
LABEL org.opencontainers.image.title="qubernetes"
LABEL org.opencontainers.image.version=${QUBES_VERSION}

RUN apt-get update \
&& apt-get --no-install-recommends install -y apt-utils curl wget git tree ne software-properties-common apt-transport-https ca-certificates build-essential
RUN apt-get update

RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
RUN add-apt-repository ppa:longsleep/golang-backports
RUN add-apt-repository -y ppa:ethereum/ethereum
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -

# RUN apt-get update # done by node script above
RUN apt-get --no-install-recommends install -y nodejs ruby haskell-stack golang-go google-cloud-sdk kubectl ethereum libdb-dev libleveldb-dev libsodium-dev zlib1g-dev libtinfo-dev
# set tzdata non-interactive https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
# for now need musl-dev for geneating account key from the private key
RUN DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get install -y ruby-full golang-go git make musl-dev
RUN gem install colorize
RUN npm install web3
ENV PATH=/root/go/bin:$PATH

RUN go get github.com/getamis/istanbul-tools/cmd/istanbul
RUN cd /usr/bin && curl -L https://github.com/jpmorganchase/constellation/releases/download/v0.3.2/constellation-0.3.2-ubuntu1604.tar.xz | tar -xJ --strip=1
ENV PATH=/root/go/bin:$PATH

RUN go get github.com/getamis/istanbul-tools/cmd/istanbul && git clone https://github.com/ethereum/go-ethereum.git /root/go/src/github.com/ethereum/go-ethereum && \
cd /root/go/src/github.com/ethereum/go-ethereum && git checkout e9ba536d && make all && \
cp /root/go/src/github.com/ethereum/go-ethereum/build/bin/ethkey /root/go/bin/ && \
cp /root/go/src/github.com/ethereum/go-ethereum/build/bin/bootnode /root/go/bin/ && \
cp /root/go/bin/* /usr/local/bin && \
rm -r /root/go

RUN apt-get --no-install-recommends install -y default-jre wget
RUN echo 'alias tessera="java -jar /usr/bin/tessera-app-0.10.5-app.jar"' >> ~/.bashrc
ENV TESSERA_JAR=/usr/bin/tessera-app-0.10.5-app.jar

# echo | tessera keygen --keyout tm
RUN cd /usr/bin && wget https://oss.sonatype.org/service/local/repositories/releases/content/com/jpmorgan/quorum/tessera-app/0.10.5/tessera-app-0.10.5-app.jar
RUN apt-get remove -y git golang-go wget make

WORKDIR /qubernetes
COPY . .

# set commit SHA and QUBES_VERSION as ENV vars in last layer
ENV COMMIT_SHA=${COMMIT}
ENV QUBES_VERSION=${QUBES_VERSION}
ENV QUBES_VERSION=${QUBES_VERSION}
4 changes: 2 additions & 2 deletions templates/k8s/quorum-keystore.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ data:
# ethereum / geth account keys (keystore)
---
# kubectl create configmap game-config --from-file=configure-pod-container/dd1/key
# @Keystore_File=Dir[@Key_Dir_Base + "/" + @Node_Key_Dir + "/UTC*"][0]
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -86,8 +87,7 @@ metadata:
name: <%= @Node_UserIdent %>-account-key-config
data:
key: |-

<%- @Keystore_File=Dir[@Key_Dir_Base + "/" + @Node_Key_Dir + "/UTC*"][0] %>
<%- @Keystore_File=@Key_Dir_Base + "/" + @Node_Key_Dir + "/acctkeyfile.json" %>
<%- File.readlines("#{@Keystore_File}").each do |line| -%>
<%= line -%>
<% end -%>
Expand Down
11 changes: 8 additions & 3 deletions templates/quorum/gen-keys.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,26 @@ BASE_DIR=<%= @Key_Dir_Base %>
<%- else %>
BASE_DIR=$(pwd)/<%= @Key_Dir_Base %>
<%- end %>

TESSERA_KEY_GEN_CMD="java -jar ${TESSERA_JAR} keygen --keyout tm"
mkdir -p $BASE_DIR
IFS=', ' read -r -a array <<< "$NODE_DIRS"

for node_key_dir in "${array[@]}"; do
KEY_DIR=$BASE_DIR/$node_key_dir
echo "KEY DIR IS $KEY_DIR"
## If key dir exists, skip it.

if [ ! -d $KEY_DIR ]; then
pushd .
shopt -s expand_aliases
mkdir -p $KEY_DIR
cd $KEY_DIR
echo | constellation-node --generatekeys=tm
#echo | constellation-node --generatekeys=tm
#echo | tessera --keyout tm
echo | $TESSERA_KEY_GEN_CMD
touch password.txt
geth --keystore $KEY_DIR account new --password password.txt
#geth account new --keystore $KEY_DIR --password password.txt
ethkey generate $KEY_DIR/acctkeyfile.json --passwordfile password.txt
bootnode -genkey nodekey
bootnode -nodekeyhex $(cat nodekey) -writeaddress > enode
popd
Expand Down
5 changes: 4 additions & 1 deletion templates/quorum/genesis.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ end
#puts(@Key_Dir_Base + "/" + @Node_Key_Dir + "/nodekey")
File.open(@Key_Dir_Base + "/" + @Node_Key_Dir + "/nodekey", "r") do |f|
f.each_line do |nodekey|
nodeAcct=`node istanbul-helpers/privateKeyToAccount.js 0x#{nodekey}`
nodeAcct=`ethkey generate tmpkey.json --passwordfile #{@Key_Dir_Base}/#{@Node_Key_Dir}/password.txt --privatekey #{@Key_Dir_Base}/#{@Node_Key_Dir}/nodekey | sed 's/Address: //g' | sed 's/}//g'`
`rm tmpkey.json`

puts("node account for Istanbul is: " + nodeAcct)

nodeAcct=nodeAcct.strip
File.open(@IstanbulConfig, "a") do |f|
f.puts "\"" + nodeAcct + "\","
Expand Down
2 changes: 1 addition & 1 deletion testing/test-k8s-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ do

echo "NAMESPACE: $NAMESPACE"
echo "CUR_OUT_DIR: $CUR_OUT_DIR"

ls $CUR_OUT_DIR/
# Create namespace for this run
kubectl delete namespace $NAMESPACE
kubectl create namespace $NAMESPACE &&
Expand Down

0 comments on commit acdcadb

Please sign in to comment.