Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerize and add lots of scripts to make it easier to use.
- Loading branch information
1 parent
b333b84
commit 1fa429a
Showing
15 changed files
with
182 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
|
||
external/eosjs/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,9 @@ dist | |
*.log | ||
*.out | ||
keys.json | ||
|
||
*.crt | ||
*.key | ||
*.pem | ||
|
||
webauthn-nodeos-data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
FROM ubuntu:18.04 | ||
|
||
# Make sure the image is updated, install some prerequisites, | ||
# Download the latest version of Clang (official binary) for Ubuntu | ||
# Extract the archive and add Clang to the PATH | ||
RUN apt-get update && apt-get install -y \ | ||
xz-utils \ | ||
build-essential \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& curl -SL http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz \ | ||
| tar -xJC . && \ | ||
mv clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04 clang_8.0.0 | ||
|
||
RUN echo 'export PATH=/clang_8.0.0/bin:$PATH' >> ~/.bashrc | ||
RUN echo 'export LD_LIBRARY_PATH=/clang_8.0.0/lib:LD_LIBRARY_PATH' >> ~/.bashrc | ||
|
||
RUN apt-get update && apt-get install -y libudev-dev cmake \ | ||
git build-essential jq \ | ||
sudo autoconf libtool \ | ||
pkg-config libusb-1.0 wget | ||
|
||
RUN git clone https://github.com/EOSIO/eos.git /app/eos | ||
|
||
WORKDIR /app/eos | ||
|
||
RUN git checkout webauthn && git submodule update --init --recursive | ||
ENV PATH=/clang_8.0.0/bin:$PATH | ||
ENV LD_LIBRARY_PATH=/clang_8.0.0/lib:LD_LIBRARY_PATH | ||
RUN CC=clang CXX=clang++ ./scripts/eosio_build.sh -y | ||
|
||
WORKDIR /app | ||
|
||
RUN wget https://github.com/EOSIO/eosio.cdt/releases/download/v1.6.1/eosio.cdt_1.6.1-1_amd64.deb -O eosio.cdt.deb | ||
RUN apt-get install ./eosio.cdt.deb | ||
RUN git clone https://github.com/EOSIO/eosio.contracts.git /app/eosio.contracts | ||
|
||
WORKDIR /app/eosio.contracts | ||
|
||
RUN git checkout v1.7.0-rc1 | ||
RUN mkdir build && cd build && cmake .. && make contracts_project | ||
|
||
WORKDIR /app/eos | ||
|
||
RUN echo 'export PATH=/app/eos/build/bin:$PATH' >> ~/.bashrc | ||
ENV PATH=/app/eos/build/bin:$PATH | ||
|
||
COPY ./scripts /app/scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# Create wallet | ||
cleos wallet create --file /app/.wallet-password | ||
cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 | ||
|
||
# Enable webauthn feature of nodeos | ||
curl -X POST http://127.0.0.1:8888/v1/producer/schedule_protocol_feature_activations -d '{"protocol_features_to_activate": ["0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"]}' | jq | ||
|
||
# Create token account | ||
cleos create account eosio eosio.token EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV | ||
|
||
sleep 1s # Sleep because there seems to be a race condition of trying to deploy the contract too quickly | ||
|
||
# Deploy contracts | ||
cleos set contract eosio /app/eosio.contracts/build/contracts/eosio.bios -p eosio | ||
cleos set contract eosio.token /app/eosio.contracts/build/contracts/eosio.token -p eosio.token | ||
|
||
# Initialize accounts | ||
cleos push action eosio activate '["4fca8bd82bbd181e714e283f83e1b45d95ca5af40fb89ad3977b653c448f78c2"]' -p eosio | ||
cleos push action eosio.token create '["eosio","10000000.0000 SYS"]' -p eosio.token | ||
cleos push action eosio.token issue '["eosio","10000000.0000 SYS",""]' -p eosio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defaults | ||
timeout connect 10000ms | ||
timeout client 50000ms | ||
timeout server 50000ms | ||
|
||
frontend https-in | ||
bind *:7000 ssl crt ./localhostca.pem | ||
use_backend http_backend | ||
|
||
backend http_backend | ||
server server1 localhost:8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
pushd docker | ||
docker build . -t eosio/eos-webauthn:latest -f Dockerfile-eosio | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
./scripts/start.sh | ||
sleep 5s # Give nodeos time to startup | ||
docker exec -it webauthn-nodeos /app/scripts/chain-setup.sh | ||
./scripts/stop.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
docker stop webauthn-nodeos | ||
docker rm webauthn-nodeos | ||
|
||
rm -rf webauthn-nodeos-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# Setup JS App | ||
yarn | ||
rm -rf node_modules/eosjs | ||
( | ||
cd external/eosjs && yarn | ||
) | ||
yarn add file:external/eosjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
openssl req \ | ||
-x509 \ | ||
-nodes \ | ||
-new \ | ||
-newkey rsa:4096 \ | ||
-keyout localhostca.key \ | ||
-out localhostca.crt \ | ||
-sha256 \ | ||
-days 3650 \ | ||
-config <(cat <<EOF | ||
[ req ] | ||
prompt = no | ||
distinguished_name = subject | ||
x509_extensions = x509_ext | ||
[ subject ] | ||
commonName = localhost | ||
[ x509_ext ] | ||
subjectAltName = @alternate_names | ||
basicConstraints=CA:TRUE,pathlen:0 | ||
[ alternate_names ] | ||
DNS.1 = localhost | ||
EOF | ||
) | ||
|
||
cat localhostca.crt localhostca.key > localhostca.pem | ||
|
||
cp localhostca.pem docker/haproxy | ||
|
||
CLEAR="\033[0m" | ||
GREEN="\033[32m" | ||
YELLOW="\033[33m" | ||
echo -e "${GREEN}Certificate generated, remember to import into your browser!${CLEAR}" | ||
echo -e "${YELLOW}For security, it is recommended you remove this cert after testing is complete.${CLEAR}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
# Frontend setup | ||
./scripts/frontend-setup.sh | ||
|
||
# Create Local Cert | ||
./scripts/generate-cert.sh | ||
|
||
# Setup Chain | ||
./scripts/chain-setup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
docker run \ | ||
-d \ | ||
-p '8888:8888' \ | ||
--name 'webauthn-nodeos' \ | ||
-v "$(pwd)/webauthn-nodeos-data":/root/.local/share/eosio \ | ||
-it eosio/eos-webauthn:latest \ | ||
nodeos --data-dir /root/.local/share/eosio --plugin eosio::chain_api_plugin --plugin eosio::producer_api_plugin --http-validate-host 0 --access-control-allow-origin "*" --http-server-address=0.0.0.0:8888 -p eosio -e | ||
|
||
haproxy -f haproxy-webauthn.cfg &> haproxy.log & | ||
yarn server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
docker stop webauthn-nodeos | ||
docker rm webauthn-nodeos | ||
pgrep haproxy | xargs kill |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters