Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/gardenv1 #6

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (m *Merry) Start() error {
}
composePath := filepath.Join(home, ".merry", "docker-compose.yml")

bashCmd := runDockerCompose(composePath, "up", "-d", "cobi", "esplora", "ethereum-explorer", "arbitrum-explorer", "nginx")
bashCmd := runDockerCompose(composePath, "up", "-d", "cobi", "esplora", "ethereum-explorer", "arbitrum-explorer", "nginx", "garden-evm-watcher", "garden-db", "matcher", "bit-ponder", "cobiv2")
if m.IsHeadless && m.IsBare {
bashCmd = runDockerCompose(composePath, "up", "-d", "chopsticks", "ethereum", "arbitrum")
} else if m.IsHeadless {
Expand All @@ -39,7 +39,7 @@ func (m *Merry) Start() error {
fmt.Println("ENDPOINTS")
for name, endpoint := range m.Services {
if m.IsBare {
if name == "cobi" || name == "redis" || name == "orderbook" || name == "postgres" {
if name == "cobi" || name == "redis" || name == "orderbook" || name == "postgres" || name == "garden-evm-watcher" || name == "garden-db" || name == "matcher" || name == "bit-ponder" {
continue
}
Comment on lines +43 to 45
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Refactor service exclusion logic for maintainability

The condition to exclude services is becoming lengthy and harder to maintain:

if name == "cobi" || name == "redis" || name == "orderbook" || name == "postgres" || name == "garden-evm-watcher" || name == "garden-db" || name == "matcher" || name == "bit-ponder" {
	continue
}

Consider refactoring this by using a slice or map to store the service names and check for inclusion. This approach enhances readability and makes it easier to manage the list of services.

Example using a slice:

excludedServices := []string{"cobi", "redis", "orderbook", "postgres", "garden-evm-watcher", "garden-db", "matcher", "bit-ponder"}

if contains(excludedServices, name) {
	continue
}

func contains(slice []string, item string) bool {
	for _, s := range slice {
		if s == item {
			return true
		}
	}
	return false
}

}
Expand Down
62 changes: 57 additions & 5 deletions resources/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ services:
arbitrum:
image: ghcr.io/catalogfi/garden_sol:latest
container_name: arbitrum
environment:
environment:
CHAIN_ID: 31338
LIGHT: "false"
ports:
- 8546:8545

arbitrum-explorer:
image: otterscan/otterscan:latest
container_name: arbitrum-explorer
Expand All @@ -38,7 +38,7 @@ services:
ethereum:
image: ghcr.io/catalogfi/garden_sol:latest
container_name: ethereum
environment:
environment:
CHAIN_ID: 31337
LIGHT: "true"
ports:
Comment on lines +61 to 64
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Clarification Needed on LIGHT Settings

I've noticed that the LIGHT environment variable is set to "true" for the ethereum service and "false" for another service. Could you please explain the reasoning behind these differing settings? This discrepancy might influence the behavior and performance of the respective services.

🔗 Analysis chain

LGTM! Please clarify the difference in LIGHT settings.

The addition of environment variables for the ethereum service is good. The CHAIN_ID 31337 is appropriate for a local Hardhat network.

Could you please clarify why the LIGHT setting is "true" for ethereum but "false" for arbitrum? This difference might impact performance or functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of LIGHT environment variable
rg --type yaml 'LIGHT:' resources/docker-compose.yml

Length of output: 93

Expand Down Expand Up @@ -116,7 +116,7 @@ services:
ports:
- 3000:3000
restart: unless-stopped

postgres:
image: postgres:alpine
container_name: postgres
Expand All @@ -129,6 +129,18 @@ services:
volumes:
- ./volumes/orderbook_data:/var/lib/postgresql/data

garden-db:
image: postgres:alpine
container_name: garden-db
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: garden
ports:
- 5433:5432
volumes:
- ./volumes/ponder_data:/var/lib/postgresql/data

redis:
image: redis:alpine
container_name: redis
Expand Down Expand Up @@ -161,6 +173,47 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"

# following services will be part of gardenv2 stack
garden-evm-watcher:
image: ghcr.io/catalogfi/garden-evm-watcher:latest
container_name: garden-evm-watcher
depends_on:
- ethereum
- arbitrum
- chopsticks
- garden-db
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"

matcher:
image: ghcr.io/catalogfi/matcher:latest
container_name: matcher
depends_on:
- garden-evm-watcher
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"

bit-ponder:
image: ghcr.io/catalogfi/bit-ponder:latest
container_name: bit-ponder
depends_on:
- garden-evm-watcher
- matcher
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"

cobiv2:
image: ghcr.io/catalogfi/cobiv2:latest
container_name: cobiv2
depends_on:
- garden-evm-watcher
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"

nginx:
image: nginx:latest
container_name: nginx
Expand All @@ -182,7 +235,6 @@ services:
- orderbook
- cobi


networks:
default:
name: merry