Skip to content

Commit

Permalink
Explorer now works in local mode
Browse files Browse the repository at this point in the history
  • Loading branch information
samalba committed Nov 4, 2018
1 parent c05e17c commit 5c6242a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
18 changes: 6 additions & 12 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"
"path"
"path/filepath"
"time"

"github.com/blocklayerhq/chainkit/pkg/ui"
"github.com/spf13/cobra"
Expand All @@ -31,17 +30,12 @@ func init() {
func startExplorer(ctx context.Context, name, rootDir string) {
cmd := []string{
"run", "--rm",
"-e", "NGINX_PORT=8080",
"--network", "container:" + name,
"samalba/cosmos-explorer-localhost" + ":latest",
"-p", "8080:8080",
"samalba/cosmos-explorer-localhost:latest",
}
if err := docker(ctx, rootDir, cmd...); err != nil {
ui.Fatal("Failed to start the Explorer: %v", err)
}
go func() {
// FIXME: wait for the container to be created
time.Sleep(3 * time.Second)
if err := docker(ctx, rootDir, cmd...); err != nil {
ui.Fatal("Failed to start the Explorer: %v", err)
}
}()
}

func start(name, rootDir string) {
Expand All @@ -62,7 +56,7 @@ func start(name, rootDir string) {
ui.Success("Application is live at: %s", ui.Emphasize("http://localhost:26657/"))
ui.Success("Cosmos Explorer is live at: %s", ui.Emphasize("http://localhost:8080/"))
defer cancel()
startExplorer(ctx, name, rootDir)
go startExplorer(ctx, name, rootDir)
if err := dockerRun(ctx, rootDir, name, "start"); err != nil {
ui.Fatal("Failed to start the application: %v", err)
}
Expand Down
1 change: 0 additions & 1 deletion cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func dockerRun(ctx context.Context, rootDir, name string, args ...string) error
"run", "--rm",
"-p", "26656:26656",
"-p", "26657:26657",
"-p", "8080:8080",
"-v", daemonDir + ":" + daemonDirContainer,
"-v", cliDir + ":" + cliDirContainer,
"--name", name,
Expand Down

0 comments on commit 5c6242a

Please sign in to comment.