diff --git a/Makefile b/Makefile index e148eba..cd89597 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ test_fmt: test_lint: @echo Checking linting of files @{ \ - go get -u golang.org/x/lint/golint; \ + go install golang.org/x/lint/golint; \ el=$(EXCLUDE_LINT); \ lintfiles=$$( golint ./... | egrep -v "$$el" ); \ if [ -n "$$lintfiles" ]; then \ diff --git a/README.md b/README.md index 2cf6435..7c337b6 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,6 @@ MedCo documentation is centralized on the following website: [MedCo Unlynx](https://medco.epfl.ch/documentation/developer/components/medco-unlynx.html). -## Version - -We have a development and a stable version. The `master`-branch in `github.com/lca1/medco-unlynx` is the development version that works but can have incompatible changes. - -Use one of the latest tags `v0.1.1d` that are stable and have no incompatible changes. - -**Very Important!!** - -Due to the current changes being made to [onet](https://github.com/dedis/onet) and [kyber](https://github.com/dedis/kyber) (release of v3) you must revert back to previous commits for these two libraries if you want medco-unlynx to work. This will change in the near future. - -```bash -cd $GOPATH/src/dedis/onet/ -git checkout 5796104343ef247e2eed58e573f68c566db2136f - -cd $GOPATH/src/dedis/kyber/ -git checkout f55fec5463cda138dfc7ff15e4091d12c4ddcbfe -``` - ## License *medco-unlynx* is licensed under a End User Software License Agreement ('EULA') for non-commercial use. If you need more information, please contact us. diff --git a/deployment/Dockerfile b/deployment/Dockerfile index 6ec5aec..36d8471 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -1,21 +1,22 @@ -FROM medco/unlynx:v1.2b-alpha as build +FROM golang:1.11 as build -# build time environment variables -ENV MEDCO_UNLYNX_REPO="github.com/lca1/medco-unlynx" +COPY ./ /src +WORKDIR /src -ENV GO111MODULE=on +# get dependencies +RUN go get -v -d ./... -# adjust timeout values -RUN sed -i 's/conn.SetReadDeadline(time.Now().Add(5 \* time.Minute))/conn.SetReadDeadline(time.Now().Add(5 \* time.Hour))/' /go/src/github.com/dedis/onet/websocket.go && \ - sed -i 's/const expirationTime = 1 \* time.Minute/const expirationTime = 1 \* time.Hour/' /go/src/github.com/dedis/onet/overlay.go +# hack to adjust timeout values in onet +RUN cd /go/pkg/mod/go.dedis.ch/onet && \ + chmod u+w -R . && \ + find . -maxdepth 2 -name overlay.go | xargs sed -i \ + 's/const expirationTime = 1 \* time.Minute/const expirationTime = 1 \* time.Hour/' && \ + find . -maxdepth 2 -name websocket.go | xargs sed -i \ + 's/conn.SetReadDeadline(time.Now().Add(5 \* time.Minute))/conn.SetReadDeadline(time.Now().Add(5 \* time.Hour))/' -COPY ./ /go/src/$MEDCO_UNLYNX_REPO - -# get remaining dependencies, compile and install medco-unlynx binary +# compile and install medco-unlynx binary # CGO_ENABLED=0 in order to be able to run from alpine -WORKDIR /go/src/$MEDCO_UNLYNX_REPO -RUN go get -v -d ./... && \ - CGO_ENABLED=0 go build -v ./... && \ +RUN CGO_ENABLED=0 go build -v ./... && \ CGO_ENABLED=0 go install -v ./... && \ mv /go/bin/app /go/bin/medco-unlynx @@ -26,12 +27,11 @@ FROM golang:1.11-alpine as release ENV NODE_IDX="0" \ UNLYNX_DEBUG_LEVEL="1" \ MEDCO_CONF_DIR="/medco-configuration" -ENV UNLYNX_BIN_EXPORT_PATH="$MEDCO_CONF_DIR/medco-unlynx" COPY --from=build /go/bin/medco-unlynx /go/bin/ COPY deployment/docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \ - apk add --no-cache bash outils-md5 + apk add --no-cache bash VOLUME "$MEDCO_CONF_DIR" ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/deployment/docker-entrypoint.sh b/deployment/docker-entrypoint.sh index f01d928..59cc62d 100644 --- a/deployment/docker-entrypoint.sh +++ b/deployment/docker-entrypoint.sh @@ -5,16 +5,6 @@ set -Eeuo pipefail export UNLYNX_KEY_FILE_PATH="$MEDCO_CONF_DIR/srv$NODE_IDX-private.toml" \ UNLYNX_DDT_SECRETS_FILE_PATH="$MEDCO_CONF_DIR/srv$NODE_IDX-ddtsecrets.toml" -# copy unlynx binary in the configuration folder -if [[ (-f "$UNLYNX_BIN_EXPORT_PATH" && $(md5 /go/bin/medco-unlynx) != $(md5 $UNLYNX_BIN_EXPORT_PATH) ) ]]; then - rm -f $UNLYNX_BIN_EXPORT_PATH -fi - -if [[ ! -f "$UNLYNX_BIN_EXPORT_PATH" ]]; then - cp /go/bin/medco-unlynx $UNLYNX_BIN_EXPORT_PATH - chmod 777 $UNLYNX_BIN_EXPORT_PATH -fi - # run unlynx if [[ $# -eq 0 ]]; then ARGS="-d $UNLYNX_DEBUG_LEVEL server -c $UNLYNX_KEY_FILE_PATH" diff --git a/go.mod b/go.mod index 63e82a3..c9ff2fb 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/lca1/unlynx v0.0.0-20190312131415-2e3533f65afe github.com/lib/pq v1.0.0 github.com/satori/go.uuid v1.2.0 + github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect github.com/stretchr/testify v1.3.0 go.dedis.ch/kyber/v3 v3.0.0 go.dedis.ch/onet/v3 v3.0.0 diff --git a/go.sum b/go.sum index 281853b..fbe5173 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,7 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/btcsuite/goleveldb v1.0.0 h1:Tvd0BfvqX9o823q1j2UZ/epQo09eJh6dTcRp79ilIN4= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= @@ -11,16 +12,23 @@ github.com/daviddengcn/go-colortext v0.0.0-20180409174941-186a3d44e920 h1:d/cVoZ github.com/daviddengcn/go-colortext v0.0.0-20180409174941-186a3d44e920/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE= github.com/fanliao/go-concurrentMap v0.0.0-20141114143905-7d2d7a5ea67b h1:aHrWACMJZJ160Pl0qlH6s0/+5Kb1KYG/kEUTaZCW7QY= github.com/fanliao/go-concurrentMap v0.0.0-20141114143905-7d2d7a5ea67b/go.mod h1:DRc7ieGsJItxOsZ2lnqemj92zsSsBjBepuritZaumSE= +github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450 h1:7xqw01UYS+KCI25bMrPxwNYkSns2Db1ziQPpVq99FpE= github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho= +github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995 h1:f5gsjBiF9tRRVomCvrkGMMWI8W1f2OBFar2c5oakAP0= github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8= +github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e h1:KhcknUwkWHKZPbFy2P7jH5LKJ3La+0ZeknkkmrSgqb0= github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lca1/unlynx v0.0.0-20190213120802-5cef42d6b22c h1:PnK0cljJWiYFEg8Hb241BKo4f9gCO44BIAi+Kb2vEAk= -github.com/lca1/unlynx v0.0.0-20190213120802-5cef42d6b22c/go.mod h1:QlvYsckeeV0ZKVx0Ryh2wI2VyXMlKvn4uq5rX4Op2U0= github.com/lca1/unlynx v0.0.0-20190312131415-2e3533f65afe h1:WHc+KZi5aiGJJyNcADipOkaB+d1TWE7nVEwzDzFfi8A= github.com/lca1/unlynx v0.0.0-20190312131415-2e3533f65afe/go.mod h1:iVlai2WR/UbMOeozxL2uOuLK2AQ+pcEl0Hkepk1ub3g= github.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A= @@ -34,6 +42,10 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/r0fls/gostats v0.0.0-20180711082619-e793b1fda35c/go.mod h1:2mJY7Hx2k1GaMAmiAoyy090oY3RTSk3kkaaTieLq7wc= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -57,15 +69,20 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f h1:hX65Cu3JDlGH3uEdK7I99Ii+ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e h1:3GIlrlVLfkoipSReOMNAgApI0ajnalyLa/EZHHca/XI= golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5 h1:ZcPpqKMdoZeNQ/4GHlyY4COf8n8SmpPv6mcqF1+VPSM= golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/satori/go.uuid.v1 v1.2.0 h1:AH9uksa7bGe9rluapecRKBCpZvxaBEyu0RepitcD0Hw= gopkg.in/satori/go.uuid.v1 v1.2.0/go.mod h1:kjjdhYBBaa5W5DYP+OcVG3fRM6VWu14hqDYST4Zvw+E=