Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guanyu/dockerfiles #110

Merged
merged 70 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from 67 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2b03b44
added docker config files
Apr 13, 2022
b211a37
Jinja template for docker-compose file
JBGYZ Apr 27, 2022
9df09c7
Merge branch 'main' into guanyu/dockerfiles
JBGYZ Apr 28, 2022
fba488a
Added setup files for 3 containers
JBGYZ Apr 29, 2022
5532264
Cleaned up
JBGYZ Apr 29, 2022
adb1182
Fixed typo in names
JBGYZ Apr 29, 2022
9d01e40
Fixed clean docker containers part bug
JBGYZ Apr 29, 2022
d34876e
added files for launching and setting up more than 3 nodes
JBGYZ Apr 29, 2022
074fd38
Fixed a bug
JBGYZ May 1, 2022
961ee99
Added logs of every node
JBGYZ May 1, 2022
f71a7e3
Exposed ports to localhost allowing testing on local machine
JBGYZ May 1, 2022
ee48898
Showed IP addr of nodes
JBGYZ May 3, 2022
fe88e58
Generated log files in log dir
JBGYZ May 4, 2022
92ac6f9
Set Log level
JBGYZ May 4, 2022
13c8d99
Merge branch 'main' into guanyu/dockerfiles
JBGYZ May 4, 2022
f2f23bd
Changed port number
JBGYZ May 4, 2022
7686e8c
added log dir
JBGYZ May 9, 2022
57b219a
Added an extra window for setup cmd
JBGYZ May 12, 2022
5bf3b4f
Added docker test part
JBGYZ May 12, 2022
43de033
Added node num as env var in scenario test
JBGYZ May 13, 2022
bf54291
added sleep
JBGYZ May 16, 2022
db2be9d
Added pooling check for DKG setup
JBGYZ May 16, 2022
ed3969a
added pooling for election status
JBGYZ May 16, 2022
51914f9
Should work
May 17, 2022
822ca3f
Merge branch 'guanyu/dockerfiles' of https://github.com/dedis/d-votin…
JBGYZ May 17, 2022
65c24f1
automatised tests in a sequential way
JBGYZ May 17, 2022
fccbc30
fixed autotest; commented attach tmux window
JBGYZ May 17, 2022
50b25df
fixed tmux window
JBGYZ May 18, 2022
ee2d4ce
Removed useless sleep
JBGYZ May 18, 2022
ce2c7ec
added autotest in readme
JBGYZ May 18, 2022
e8fa901
rewrite killnode func & cleanup
JBGYZ May 18, 2022
3e11334
Removed hardcoded setup files for 3 nodes
JBGYZ May 18, 2022
bf9b831
Merge branch 'main' into guanyu/dockerfiles
JBGYZ May 19, 2022
cf40f05
Renamed function to avoid conflicts
JBGYZ May 19, 2022
6fc6fde
Changed var name
JBGYZ May 19, 2022
b01b83a
Added comments on autotest.sh
JBGYZ May 19, 2022
10ee4b4
Merged local and docker setup
JBGYZ May 20, 2022
734ef28
Used new scripts
JBGYZ May 20, 2022
2523e64
Changed proxy port
JBGYZ May 20, 2022
b74d3b9
Updated for new scripts
JBGYZ May 20, 2022
0f5f154
Cleaned up
JBGYZ May 20, 2022
e9681e6
added count success test numbers
JBGYZ May 23, 2022
8b87f92
added logs for running in local machine
JBGYZ May 23, 2022
8863839
Added kill node to pass lint
JBGYZ May 24, 2022
9ee68c1
fixed integration tests
JBGYZ May 24, 2022
ed079b9
Ignored log files and tmp node data files
JBGYZ May 25, 2022
a8bd506
Set Watchtime as a function of node nb
JBGYZ May 25, 2022
be22d4e
Updated readme with helps
JBGYZ May 25, 2022
6dbcfc0
added help flag to scripts
JBGYZ May 25, 2022
9443cc4
Fixed flags
JBGYZ May 30, 2022
1418be3
added restart node func
JBGYZ May 30, 2022
5242b05
Removed useless packages
JBGYZ May 31, 2022
fa10293
Changed require.NoError
JBGYZ May 31, 2022
bcc5429
set DOCKER=false by default
JBGYZ May 31, 2022
003fc4b
Explained default value in help
JBGYZ May 31, 2022
173e64b
Remove only d-voting containers
JBGYZ May 31, 2022
d0337e8
Removed directly log
JBGYZ May 31, 2022
c9c4c43
Update integration/scenario_test.go
JBGYZ May 31, 2022
49b5826
Not use flags in default cases
JBGYZ May 31, 2022
2240d8f
Merge branch 'guanyu/dockerfiles' of https://github.com/dedis/d-votin…
JBGYZ May 31, 2022
0c9f51e
Removed useless eval cmd
JBGYZ May 31, 2022
11777e4
Handle ignored error
JBGYZ May 31, 2022
f87fe29
Trick to pass linting without commenting functions
JBGYZ May 31, 2022
2ac0f0f
Removed commented codes
JBGYZ May 31, 2022
64a79be
Removed seed and redundant wait
JBGYZ May 31, 2022
073aee6
Merge branch 'main' into guanyu/dockerfiles
JBGYZ May 31, 2022
ae116b9
Reset wait time of function of threshold
JBGYZ May 31, 2022
9e8c581
Removed useless mkdir
JBGYZ Jun 1, 2022
54b22fe
Added new env var KILLNODE to control kill and restart node
JBGYZ Jun 1, 2022
851bdef
Merge branch 'main' into guanyu/dockerfiles
nkcr Jun 7, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/go_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
./memcoin --config /tmp/node3 start --postinstall --promaddr :9102 --proxyaddr :9082 --proxykey adbacd10fdb9822c71025d6d00092b8a4abb5ebcb673d28d863f7c7c5adaddf3 --listen tcp://0.0.0.0:2003 --public //localhost:2003 &

- name: Run the setup
run: ./setupnNode.sh 3
run: ./setupnNode.sh -n 3 -d false


- name: Test integration & benchmark with coverage
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ web/app/node_modules
.idea

memcoin

*.log

nodedata/
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# syntax=docker/dockerfile:1

##
## Build
##
FROM golang:1.17.7-alpine AS build

ENV PATH="${GOPATH}/bin:${PATH}"
ENV LLVL=info

COPY . /d-voting
WORKDIR /d-voting/dela/cli/crypto
RUN go install

WORKDIR /d-voting/cli/memcoin/
RUN go install

EXPOSE 2001
WORKDIR /d-voting
# CMD memcoin --config /tmp/node1 start --port 2001





32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Then you should be able to run the setup script:
With this other script you can choose the number of nodes that you want to set up:

```sh
./setupnNode.sh 3
./setupnNode.sh -n 3
```

This script will setup the nodes and services. If you restart do not forget to
Expand All @@ -152,7 +152,7 @@ rm -rf /tmp/node{1,2,3}
## Automate the previous setup using `tmux`

If you have `tmux` installed, you can start a `tmux` session that will
execute the above setup by running in the project root `./runNode.sh 3`. This
execute the above setup by running in the project root `./runNode.sh -n 3`. This
command takes as argument the number of nodes.
Once the session is started, you can move around the panes with
`Ctrl+B` followed by arrow keys or by `N`. You can also have an overview of the windows
Expand All @@ -165,7 +165,7 @@ then delete the node data (i.e. the files `/tmp/node{1,2,3}`).

## Run the scenario test

If nodes are running and `setup.sh` or `setupnNode.sh 3` has been called, you can run a test
If nodes are running and `setup.sh` or `./setupnNode.sh -n 3` has been called, you can run a test
scenario:

```sh
Expand All @@ -185,6 +185,32 @@ Public key: `adbacd10fdb9822c71025d6d00092b8a4abb5ebcb673d28d863f7c7c5adaddf3`

Secret key: `28912721dfd507e198b31602fb67824856eb5a674c021d49fdccbe52f0234409`

## Run the scenario test with docker
Use the following commands to launch and set up nodes, and start the scenario test with user defined number of nodes.

First build the docker image `docker build -t node .`

Afterwards use the following commands, replace 4 by the desired nb of nodes :

```sh
./runNode.sh -n 4 -a true -d true
./setupnNode.sh -n 4 -d true

NNODES=4 go test -v -run ^TestScenario$ github.com/dedis/d-voting/integration -count=1
```

To end the session, run `./kill_test.sh`.

To launch multiple test and get statistics, run `./autotest.sh -n 10 -r 15`.

N.B. run following commands to get help
```sh
./runNode.sh -h
./setupnNode.sh -h
./autotest.sh -h
```


# Use the frontend

See README in `web/`.
Expand Down
64 changes: 64 additions & 0 deletions autotest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#! /bin/sh

# This script uses runNode.sh, setupnNode.sh, kill_test.sh to launch multiple
# times of scenario test with user defined number of nodes. The results of log are kept in directory named logkill$i


POSITIONAL_ARGS=()

while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
echo "This script uses runNode.sh, setupnNode.sh, kill_test.sh to launch multiple times of scenario test with user defined number of nodes. The results of log are kept in directory named logkill "
echo ""
echo "Options:"
echo "-h | --help program help (this file)"
echo "-n | --node number of d-voting nodes"
echo "-r | --run_time set how many times we want to run the test"
exit 0
;;
-n|--node)
N_NODE="$2"
shift # past argument
shift # past value
;;
-r|--run_time)
RUN_TIMES="$2"
shift # past argument
shift # past value
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done

set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters


vals=($(seq 1 1 $RUN_TIMES))
for i in "${vals[@]}"
do
echo "Test $i with $N_NODE nodes"
# Launch nodes
./runNode.sh -n $N_NODE -a false -d true
sleep 3
# Setup block chain
./setupnNode.sh -n $N_NODE -d true
sleep 3
# Start scenario test and keep logs
NNODES=$N_NODE go test -v -run ^TestScenario$ github.com/dedis/d-voting/integration -count=1 | tee ./log/log/gotest.log
sleep 3
# Stop the test
./kill_test.sh
# move log to a new directory named logkill
mv log/log log/logkill$i
mkdir -p log/log
done

echo "Test $RUN_TIMES times test and succeeded $(grep -c ok ./log*/gotest.log| awk 'BEGIN{FS=":"}{x+=$2}END{print x}') times"
Loading