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

implement dev mode #8

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.env
.env
./listener/src/tmp/*
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
# validator-monitoring
# validator-monitoring

## Description

This repository contains the code for the validator monitoring system. The system is designed to listen signatures request from different networks validate them and store the results in a database.

## Running the system

**Requirements:**

- docker
- docker-compose

**Steps:**

1. Clone the repository
2. Run `docker-compose up` (production) or `docker compose -f docker-compose.dev.yml up` (development) in the root directory of the repository
3. Access database UI at `http://localhost:8081`.
25 changes: 25 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.9"

services:
listener:
extends:
file: docker-compose.yml
service: listener
build:
context: listener
dockerfile: Dockerfile.dev
volumes:
- ./listener/src:/app/src

mongo:
extends:
file: docker-compose.yml
service: mongo

ui:
extends:
file: docker-compose.yml
service: ui

volumes:
mongo-data:
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
listener:
build:
context: listener
dockerfile: Dockerfile
ports:
- "8080:8080"
environment:
Expand All @@ -30,6 +31,8 @@ services:
depends_on:
- mongo
container_name: ui
ports:
- "8081:8081" # required for mac os access UI

mongo:
build:
Expand Down
35 changes: 35 additions & 0 deletions listener/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Start from the latest golang base image
FROM golang:1.22.0-alpine3.19

# Set the Current Working Directory inside the container.
WORKDIR /app

# Install system dependencies required for Air and your application
RUN apk add --no-cache git

# Install Air
RUN go install github.com/cosmtrek/air@latest

# Copy the Air configuration file (if you have one) into the container.
# If you don't have a custom .air.toml, you can skip this step,
# and Air will use its default configuration.
# COPY .air.toml . (Uncomment if you have a custom Air config)

# Copy go module files.
COPY go.mod .
COPY go.sum .

# Download dependencies.
# Doing this before copying the entire source code
# utilizes Docker's cache to speed up builds.
RUN go mod download

# Expect source code to be mounted at this directory rather than copied
# This is the change for development mode.
VOLUME ["/app/src"]

# Set the Current Working Directory inside the container to the src directory.
WORKDIR /app/src

# Command to run the application using Air for live reloading.
CMD ["air"]
2 changes: 1 addition & 1 deletion listener/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func main() {

logger.Info("Starting listener")
// Load config
config, err := config.LoadConfig()
if err != nil {
Expand Down
Loading