Skip to content

Commit

Permalink
fix: support headless mode --ci (#203)
Browse files Browse the repository at this point in the history
* fix: support headless mode --ci

* readme
  • Loading branch information
tiero authored Dec 29, 2024
1 parent 16cd19c commit dfce62b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ $ nigiri start --ark

Go to http://localhost:5000 for quickly inspect the Bitcoin blockchain.

Want more? Add Elements/Liquid or Lightning nodes:
Want more? Add Elements/Liquid, Lightning nodes, or Ark:
```bash
$ nigiri start --ark --liquid # Add Elements/Liquid sidechain
$ nigiri start --ark --ln # Add Lightning Network nodes
$ nigiri start --liquid --ln # Add both Liquid and Lightning
$ nigiri start --ark --liquid --ln # Add all features
```

**Note for users of macOS Monterey an onward**
Expand Down Expand Up @@ -218,13 +220,6 @@ $ nigiri arkd wallet create --password secret # Create a new wallet
$ nigiri arkd wallet unlock --password secret # Unlock the wallet
```

### Run in headless mode (without Esplora)
If you are looking to spin-up Nigiri in Travis or Github Action you can use the `--ci` flag.

```
$ nigiri start --ci [--liquid] [--ln]
```

### Update the docker images

```
Expand Down
28 changes: 24 additions & 4 deletions cmd/nigiri/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ import (
"github.com/vulpemventures/nigiri/internal/docker"
)

var ciFlag = cli.BoolFlag{
Name: "ci",
Usage: "runs in headless mode without esplora for continuous integration environments",
Value: false,
}

var start = cli.Command{
Name: "start",
Usage: "start nigiri",
Expand All @@ -22,6 +28,7 @@ var start = cli.Command{
&liquidFlag,
&lnFlag,
&arkFlag,
&ciFlag,
},
}

Expand All @@ -34,10 +41,22 @@ func startAction(ctx *cli.Context) error {
composePath := filepath.Join(datadir, config.DefaultCompose)

// Build the docker-compose command with appropriate services
services := []string{"bitcoin", "electrs", "chopsticks", "esplora"}

if ctx.Bool("liquid") {
services = append(services, "liquid", "electrs-liquid", "chopsticks-liquid", "esplora-liquid")
var services []string

if ctx.Bool("ci") {
// In CI mode, only run chopsticks and its dependencies
services = []string{"bitcoin", "electrs", "chopsticks"}

if ctx.Bool("liquid") {
services = append(services, "liquid", "electrs-liquid", "chopsticks-liquid")
}
} else {
// Not in CI mode, include all services including Esplora
services = []string{"bitcoin", "electrs", "chopsticks", "esplora"}

if ctx.Bool("liquid") {
services = append(services, "liquid", "electrs-liquid", "chopsticks-liquid", "esplora-liquid")
}
}

if ctx.Bool("ln") {
Expand All @@ -64,6 +83,7 @@ func startAction(ctx *cli.Context) error {
"liquid": strconv.FormatBool(ctx.Bool("liquid")),
"ln": strconv.FormatBool(ctx.Bool("ln")),
"ark": strconv.FormatBool(ctx.Bool("ark")),
"ci": strconv.FormatBool(ctx.Bool("ci")),
}); err != nil {
return fmt.Errorf("failed to update state: %w", err)
}
Expand Down

0 comments on commit dfce62b

Please sign in to comment.