-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile-Raspberrypi64
268 lines (202 loc) · 9.06 KB
/
Dockerfile-Raspberrypi64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#
# Initial release
#
# The docker works on Raspberry pi running a 64bit OS (aarch64)
# it may work on other aarch64 hardware as well but has not been tested
#
FROM arm64v8/ubuntu:20.10
ENV debian stretch
LABEL maintainer="Denis Roio <[email protected]>" \
homepage="https://sawroom.dyne.org"
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
RUN apt-get update -y -q \
&& apt-get install -y -q --fix-missing \
apt-utils \
g++ \
pkg-config \
python3 \
python3-pip \
python3-stdeb \
python3-dev \
python3-protobuf \
python3-cbor \
python3-colorlog \
python3-toml \
python3-yaml \
python3-zmq \
python3-grpcio \
python3-grpc-tools \
supervisor \
daemontools \
net-tools \
zsh \
curl \
unzip \
wget \
git \
autoconf \
libtool \
autoconf \
libffi-dev \
&& apt-get clean
RUN pip3 install wheel
RUN curl https://sh.rustup.rs -sSf > /usr/bin/rustup-init \
&& chmod +x /usr/bin/rustup-init \
&& rustup-init -y
ENV PATH=$PATH:/project/sawtooth-core/bin:/protoc3/bin:/project/sawtooth-core/bin:/root/.cargo/bin \
CARGO_INCREMENTAL=0
RUN mkdir -p /etc/sawtooth/keys \
&& mkdir -p /var/lib/sawtooth \
&& mkdir -p /var/log/sawtooth
# udpating 11.02.21
# ENV PATH=$PATH:/project/sawtooth-core/bin
ENV PATH=$PATH:/project/sawtooth-core/bin \
DYNESDK=https://sdk.dyne.org:4443/job \
STEM_VERSION=1.6.0 \
STEM_GIT=https://git.torproject.org/stem.git \
PROTOBUF_VERSION=3.14.0 \
SAWTOOTH_SDK_VERSION=1.2.3 \
SAWTOOTH_CORE_VERSION=1.2.6 \
SAWTOOTH_PBFT_VERSION=1.0.3
WORKDIR /project
RUN cd /project && \
curl -OLsS https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-aarch_64.zip \
&& unzip protoc-$PROTOBUF_VERSION-linux-aarch_64.zip -d protoc3 \
&& cp -v protoc3/bin/protoc /usr/local/bin \
&& rm -rf protoc-$PROTOBUF_VERSION-linux-aarch_64.zip protoc3
# Sawtooth SDK
# RUN git clone https://github.com/hyperledger/sawtooth-sdk-python.git /project/sawtooth-sdk-python
RUN cd /project && \
wget https://github.com/hyperledger/sawtooth-sdk-python/archive/v$SAWTOOTH_SDK_VERSION.tar.gz \
&& tar xf v$SAWTOOTH_SDK_VERSION.tar.gz \
&& ln -s sawtooth-sdk-python-$SAWTOOTH_SDK_VERSION sawtooth-sdk-python \
&& /project/sawtooth-sdk-python/bin/protogen \
&& pip install gevent --pre \
&& pip install auto-py-to-exe \
&& pip3 install -e /project/sawtooth-sdk-python \
&& rm -rf v$SAWTOOTH_SDK_VERSION.tar.gz sawtooth-sdk-python-$SAWTOOTH_SDK_VERSION sawtooth-sdk-python
# Petition transaction processor
# using latest zenroom-tp-python on git
RUN cd /project && \
git clone https://github.com/dyne/petition-tp-python /project/petition-tp-python \
&& pip3 install -e /project/petition-tp-python/src
ENV PATH=$PATH:/project/petition-tp-python/bin
# install zenroom's cli binary and repo for tests
RUN cd /project && \
wget https://zenroom.org/builds/arm64/zenroom -O /usr/local/bin/zenroom && chmod +x /usr/local/bin/zenroom
# installed later: must not be installed when compiling the sdk
RUN apt-get install -y -q libssl-dev libzmq3-dev torsocks
# dep of sawtooth-core and transaction processor
RUN pip3 install sawtooth-signing
### OLD
## Sawtooth Validator
# RUN cd /project
# RUN wget https://github.com/hyperledger/sawtooth-core/archive/v1.2.5.tar.gz
# RUN tar xvf v1.2.5.tar.gz
# RUN mv /project/sawtooth-core-1.2.5 /project/sawtooth-core
# RUN /bin/sh -c 'cd /project/sawtooth-core'
# RUN pwd
# RUN /project/sawtooth-core/bin/protogen
# RUN cd /project/sawtooth-core/validator
### END OLD
## Sawtooth Validator
RUN cd /project && \
wget https://github.com/hyperledger/sawtooth-core/archive/v$SAWTOOTH_CORE_VERSION.tar.gz \
&& tar xvf v$SAWTOOTH_CORE_VERSION.tar.gz && ln -s sawtooth-core-$SAWTOOTH_CORE_VERSION sawtooth-core \
&& cd /project/sawtooth-core && ./bin/protogen \
&& cd /project/sawtooth-core/validator
### For some reason, in docker for raspi64, this like can't be broken with "\"
RUN sed -i -e 's/heartbeat_interval=10/heartbeat_interval=60/' -e 's/connection_timeout=60/connection_timeout=360/' /project/sawtooth-core/validator/sawtooth_validator/networking/interconnect.py
# build broken on raspi64: cargo build --color never --release
# This builds on raspi64:
RUN apt install -y cargo \
&& rustup update nightly \
&& rustup update stable
RUN ln -sf /usr/bin/python3 /usr/bin/python
RUN rustup run stable cargo build --manifest-path /project/sawtooth-core/validator/Cargo.toml --color never --release
# end of build on
# Install Sawtooth Validator (rust and python)
RUN cd /project/sawtooth-core && pip3 install -e validator \
&& cp validator/target/release/sawtooth-validator /usr/local/bin \
&& cp validator/target/release/libsawtooth_validator.so /usr/local/lib \
&& ldconfig
## Sawtooth admin cli: sawadm and sawset
# RUN cd /project/sawtooth-core && pip3 install -e validator
RUN cd /project/sawtooth-core && pip3 install -e cli
RUN cd /project/sawtooth-core && pip3 install -e rest_api
RUN cd /project/sawtooth-core/families/settings/sawtooth_settings && rustup run stable cargo build --color never --release \
&& cp -v ./target/release/settings-tp /usr/local/bin/settings-tp
RUN cd /project/sawtooth-core/families/block_info/sawtooth_block_info && rustup run stable cargo build --color never --release \
&& cp -v ./target/release/block-info-tp /usr/local/bin/block-info-tp
RUN cd /project/sawtooth-core/families/identity/sawtooth_identity && rustup run stable cargo build --color never --release \
&& cp -v ./target/release/identity-tp /usr/local/bin/identity-tp
# # temet nosce
# RUN apt-get install -y -q yarnpkg && yarnpkg add gatsby-cli npm
# RUN git clone https://github.com/DECODEproject/temet-nosce /project/temet-nosce \
# && cd /project/temet-nosce && yarnpkg
# # CMD yarn start
RUN cd /project && \
git clone https://github.com/hyperledger/sawtooth-devmode.git \
sawtooth-devmode && cd /project/sawtooth-devmode \
&& rustup run stable cargo build --color never --release
RUN cp /project/sawtooth-devmode/target/release/devmode-engine-rust /usr/local/bin
RUN cd /project && \
wget https://github.com/hyperledger/sawtooth-pbft/archive/v$SAWTOOTH_PBFT_VERSION.tar.gz \
&& tar xfz v$SAWTOOTH_PBFT_VERSION.tar.gz && ln -s sawtooth-pbft-$SAWTOOTH_PBFT_VERSION sawtooth-pbft \
&& ls -l \
&& cd /project/sawtooth-pbft \
&& cargo build --color never --release
RUN cp /project/sawtooth-pbft/target/release/pbft-engine /usr/local/bin
# Tor repository
ADD https://raw.githubusercontent.com/DECODEproject/decode-os/master/docker-sdk/tor.pub.asc tor.pub.asc
RUN apt-key add tor.pub.asc
RUN echo "deb https://deb.torproject.org/torproject.org $debian main" > /etc/apt/sources.list.d/tor.list
RUN apt-get install -y -q redis-server redis-tools tor nyx
RUN useradd -ms /bin/zsh sawroom
ENV TORDAM_GIT=github.com/dyne/tor-dam
# Download latest tor-dam binaries from files.dyne.org
RUN wget -q https://files.dyne.org/tor-dam/nightly/dam-client \
&& wget -q https://files.dyne.org/tor-dam/nightly/dam-dir \
&& mv dam-* /usr/local/bin && chmod a+x /usr/local/bin/dam-*
# Configure Tor Controlport auth
COPY src/torrc /etc/tor/torrc
RUN torpass=`echo "print(OCTET.random(16):url64())" | zenroom` \
&& git clone https://$TORDAM_GIT && cd tor-dam \
&& sed -i python/damhs.py -e "s/topkek/$torpass/" \
&& make install && make -C contrib install-init \
&& torpasshash=`HOME=/var/lib/tor setuidgid debian-tor tor --hash-password "$torpass"` \
&& sed -e 's/HashedControlPassword .*//' -i /etc/tor/torrc \
&& echo "HashedControlPassword $torpasshash" >> /etc/tor/torrc \
&& sed -e 's/Log notice .*/Log notice file \/var\/log\/tor\/tor.log/' -i /etc/tor/torrc
RUN chmod -R go-rwx /etc/tor && chown -R sawroom:sawroom /etc/tor \
&& rm -rf /var/lib/tor/data && mkdir -p /var/lib/tor/dam \
&& chown -R sawroom:sawroom /var/lib/tor \
&& chown -R sawroom:sawroom /etc/sawtooth \
&& chmod o-rwx /etc/sawtooth/keys
WORKDIR /project
# petition transaction middleware
RUN pip3 install 'fastapi[all]' && pip3 install hypercorn
# SAWROOM BUILD CONFIGURATION
ENV SAWROOM_TRACKERS https://sawroom.dyne.org/testnet.txt
# ENV SAWROOM_GENESIS https://sawroom.dyne.org/testnet-genesis.txt
ENV SAWROOM_NETWORK TOR
RUN echo $SAWROOM_TRACKERS > /etc/SAWROOM_TRACKERS
# RUN echo $SAWROOM_GENESIS > /etc/SAWROOM_GENESIS
RUN echo $SAWROOM_NETWORK > /etc/SAWROOM_NETWORK
COPY src/supervisord.conf /etc/supervisor/supervisord.conf
COPY src/sawroom-validator /usr/local/bin/sawroom-validator
COPY src/sawroom-start /usr/local/bin/sawroom-start
COPY src/sawroom-list /usr/local/bin/sawroom-list
COPY src/sawroom-address /usr/local/bin/sawroom-address
COPY src/sawroom-seeds /usr/local/bin/sawroom-seeds
COPY src/genesis-create /usr/local/bin/genesis-create
COPY src/genesis-import /usr/local/bin/genesis-import
COPY src/genesis-export /usr/local/bin/genesis-export
COPY src/keys-create /usr/local/bin/keys-create
COPY src/keys-export /usr/local/bin/keys-export
COPY src/dam-start /usr/local/bin/dam-start
# COPY src/update-tp /usr/local/bin/update-tp
RUN echo "127.0.0.1 validator" >> /etc/hosts \
&& echo "127.0.0.1 rest-api" >> /etc/hosts
RUN /etc/init.d/supervisor start