Skip to content

Commit

Permalink
world cardinal dev using redis from docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
zulkhair committed Jun 22, 2024
1 parent b0fefd8 commit ac31a92
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cmd/world/cardinal/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,8 @@ func startRedis(ctx context.Context) error {

// Start Redis container
group.Go(func() error {
//nolint:gosec // not applicable
cmd := exec.Command(
"docker", "run", "-d", "-p", fmt.Sprintf("%s:%s", RedisPort, RedisPort),
"--name", "cardinal-dev-redis", "redis",
"docker", "compose", "up", "-d", "redis",
)

// Retry starting Redis container until successful
Expand Down Expand Up @@ -273,10 +271,10 @@ func startRedis(ctx context.Context) error {
}

func stopRedis() error {
logger.Println("Stopping cardinal-dev-redis container")
if err := sh.Run("docker", "rm", "-f", "cardinal-dev-redis"); err != nil {
logger.Println("Stopping redis container")
if err := sh.Run("docker", "compose", "down"); err != nil {
logger.Println("Failed to delete Redis container automatically")
logger.Println("Please delete it manually with `docker rm -f cardinal-dev-redis`")
logger.Println("Please delete it manually with `docker compose down`")

Check warning on line 277 in cmd/world/cardinal/dev.go

View check run for this annotation

Codecov / codecov/patch

cmd/world/cardinal/dev.go#L277

Added line #L277 was not covered by tests
return err
}
return nil
Expand Down

0 comments on commit ac31a92

Please sign in to comment.