diff --git a/.circleci/config.yml b/.circleci/config.yml index 8aed783d..cc9c6d69 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -100,8 +100,10 @@ jobs: command: | docker build -t build/cyberd . docker login -u $DOCKER_USER -p $DOCKER_PASS - docker tag build/cyberd cyberd/cyberd:$CIRCLE_TAG - docker push cyberd/cyberd:$CIRCLE_TAG + docker tag build/cyberd cyberd/cyberd:euler-$CIRCLE_TAG + docker push cyberd/cyberd:euler-$CIRCLE_TAG + docker tag build/cyberd cyberd/cyberd:euler-1 + docker push cyberd/cyberd:euler-1 release_cyberdcli_binaries: diff --git a/Dockerfile b/Dockerfile index baf81e03..23f79bd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -95,6 +95,6 @@ RUN chmod +x /entrypoint.sh # Start ############################################################################### -EXPOSE 26656 26657 26660 +EXPOSE 26656 26657 1317 ENTRYPOINT ["/entrypoint.sh"] CMD ["./start_script.sh"] diff --git a/cli/main.go b/cli/main.go index 31f40665..e73f130b 100644 --- a/cli/main.go +++ b/cli/main.go @@ -2,6 +2,7 @@ package main import ( "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/lcd" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" @@ -25,6 +26,12 @@ import ( "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/libs/cli" "os" + + auth "github.com/cosmos/cosmos-sdk/x/auth/client/rest" + bank "github.com/cosmos/cosmos-sdk/x/bank/client/rest" + gov "github.com/cosmos/cosmos-sdk/x/gov/client/rest" + slashing "github.com/cosmos/cosmos-sdk/x/slashing/client/rest" + staking "github.com/cosmos/cosmos-sdk/x/staking/client/rest" ) func main() { @@ -58,6 +65,8 @@ func main() { txCmd(cdc, mc), keys.Commands(), client.LineBreak, + lcd.ServeCommand(cdc, registerRoutes), + client.LineBreak, version.VersionCmd, client.NewCompletionCmd(cyberdcli, true), ) @@ -75,6 +84,16 @@ func main() { } } +func registerRoutes(rs *lcd.RestServer) { + rpc.RegisterRoutes(rs.CliCtx, rs.Mux) + tx.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc) + auth.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc, at.StoreKey) + bank.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc, rs.KeyBase) + staking.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc, rs.KeyBase) + slashing.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc, rs.KeyBase) + gov.RegisterRoutes(rs.CliCtx, rs.Mux, rs.Cdc) +} + func queryCmd(cdc *amino.Codec, mc []sdk.ModuleClients) *cobra.Command { queryCmd := &cobra.Command{ Use: "query", diff --git a/docs/run_validator.md b/docs/run_validator.md index e96d5c9f..0a2b4fac 100644 --- a/docs/run_validator.md +++ b/docs/run_validator.md @@ -64,7 +64,7 @@ mkdir /cyberd Run daemon with mounted volumes on created during previous step folder. ```bash docker run -d --name=cyberd --restart always --runtime=nvidia \ - -p 26656:26656 -p 26657:26657 -p 26660:26660 \ + -p 26656:26656 -p 26657:26657 -p 26660:26660 -p 1317:1317 \ -v /cyberd/daemon:/root/.cyberd \ -v /cyberd/cli:/root/.cyberdcli \ cyberd/cyberd: @@ -86,7 +86,7 @@ docker rm cyberd docker pull cyberd/cyberd: docker run -d --name=cyberd --restart always --runtime=nvidia \ - -p 26656:26656 -p 26657:26657 -p 26660:26660 \ + -p 26656:26656 -p 26657:26657 -p 26660:26660 -p 1317:1317 \ -v /cyberd/daemon:/root/.cyberd \ -v /cyberd/cli:/root/.cyberdcli \ cyberd/cyberd: diff --git a/go.mod b/go.mod index e7015dea..0c49bc1d 100644 --- a/go.mod +++ b/go.mod @@ -44,6 +44,7 @@ require ( github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e // indirect github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 // indirect + github.com/rakyll/statik v0.1.5 // indirect github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 // indirect github.com/rs/cors v1.6.0 // indirect github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 // indirect diff --git a/go.sum b/go.sum index 93dc8b5b..44ec9614 100644 --- a/go.sum +++ b/go.sum @@ -101,6 +101,7 @@ github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e h1:n/3MEhJQjQxrO github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273 h1:agujYaXJSxSo18YNX3jzl+4G6Bstwt+kqv47GS12uL0= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/rakyll/statik v0.1.5/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= diff --git a/start_script.sh b/start_script.sh index 0bfd49b7..344e30f8 100644 --- a/start_script.sh +++ b/start_script.sh @@ -7,5 +7,36 @@ else COMPUTE_GPU="${COMPUTE_RANK_ON_GPU}" fi -echo ${COMPUTE_GPU} -cyberd start --compute-rank-on-gpu=${COMPUTE_GPU} +# Start the first process +cyberd start --compute-rank-on-gpu=${COMPUTE_GPU} . & +status=$? +if [ $status -ne 0 ]; then + echo "Failed to start cyberd: $status" + exit $status +fi + +# Start the second process +cyberdcli rest-server --cors=* --trust-node --chain-id=euler-1 --laddr=tcp://0.0.0.0:1317 --indent --insecure . & +status=$? +if [ $status -ne 0 ]; then + echo "Failed to start cyberd light-client: $status" + exit $status +fi + +# Naive check runs checks once a minute to see if either of the processes exited. +# This illustrates part of the heavy lifting you need to do if you want to run +# more than one service in a container. The container exits with an error +# if it detects that either of the processes has exited. +# Otherwise it loops forever, waking up every 60 seconds +while sleep 60; do + ps aux |grep cyberd |grep -q -v grep + PROCESS_1_STATUS=$? + ps aux |grep cyberdcli |grep -q -v grep + PROCESS_2_STATUS=$? + # If the greps above find anything, they exit with 0 status + # If they are not both 0, then something is wrong + if [ $PROCESS_1_STATUS -ne 0 -o $PROCESS_2_STATUS -ne 0 ]; then + echo "One of the processes has already exited." + exit 1 + fi +done