-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from migalabs/feat/dockerize
Feat/dockerize
- Loading branch information
Showing
10 changed files
with
270 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
app-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
LOG_LEVEL="info" # debug, info, warn, error | ||
DB_URL="postgres://user:password@localhost:5432/dbName" # URL to connect to the postgres database | ||
WORKER_NUM=15 # Number of workers to run concurrent alchemy/EL node requests | ||
ALCHEMY_URL="https://eth-mainnet.g.alchemy.com/v2/KEY" # Alchemy API URL | ||
EL_ENDPOINT="http://localhost:8545" # Ethereum Layer 1 endpoint, can also be alchemy or infura | ||
|
||
DATABASE_NAME=name # Your database name | ||
DATABASE_USERNAME=user # Your database username | ||
DATABASE_PASSWORD=pass # Your database password | ||
LOCAL_PORT=5439 # Port where you connect to the database container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ | |
|
||
.env | ||
.vscode | ||
|
||
app-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM golang:1.21-alpine as builder | ||
RUN mkdir /app | ||
WORKDIR /app | ||
ADD . . | ||
|
||
RUN go get | ||
RUN go build -o ./build/eth_pokhar | ||
|
||
|
||
FROM alpine:latest | ||
WORKDIR / | ||
COPY --from=builder /app/build/eth_pokhar ./ | ||
COPY --from=builder /app/db/migrations ./db/migrations | ||
|
||
ENTRYPOINT ["sh", "-c"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
version: "3.7" | ||
|
||
services: | ||
eth-pokhar: | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile | ||
init: true | ||
command: >- | ||
"./eth_pokhar beacon_depositors_transactions | ||
--log-level=${LOG_LEVEL} | ||
--el-endpoint=${EL_ENDPOINT} | ||
--db-url=${DB_URL} | ||
--workers-num=${WORKER_NUM} | ||
--alchemy-url=${ALCHEMY_URL} | ||
&& | ||
./eth_pokhar identify | ||
--log-level=${LOG_LEVEL} | ||
--el-endpoint=${EL_ENDPOINT} | ||
--db-url=${DB_URL} | ||
--workers-num=${WORKER_NUM} | ||
--alchemy-url=${ALCHEMY_URL} | ||
--recreate-table" | ||
network_mode: "host" | ||
depends_on: | ||
- db | ||
deploy: | ||
restart_policy: | ||
condition: on-failure | ||
max_attempts: 5 | ||
|
||
db: | ||
image: postgres | ||
restart: always | ||
environment: | ||
POSTGRES_USER: ${DATABASE_USERNAME} | ||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD} | ||
POSTGRES_DB: ${DATABASE_NAME} | ||
volumes: | ||
- ./app-data/:/var/lib/postgresql/data/ | ||
ports: | ||
- "127.0.0.1:${LOCAL_PORT}:5432" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.