Skip to content

Commit

Permalink
Merge pull request #14 from CirclesUBI/feature/support-nethermind-plugin
Browse files Browse the repository at this point in the history
Add dockerfile for the export util
  • Loading branch information
jaensen authored May 18, 2024
2 parents c147029 + 208689b commit 3023315
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
1 change: 1 addition & 0 deletions CirclesLand.Pathfinder.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Other", "Other", "{E58EABF4
.env = .env
sequence.puml = sequence.puml
sequence.png = sequence.png
ExportUtil.Dockerfile = ExportUtil.Dockerfile
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CirclesUBI.PathfinderUpdater.IndexerWebsocket", "CirclesUBI.PathfinderUpdater.IndexerWebsocket\CirclesUBI.PathfinderUpdater.IndexerWebsocket.csproj", "{92CEC307-4134-4027-B988-55BCEF8693B9}"
Expand Down
16 changes: 16 additions & 0 deletions ExportUtil.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS publish
ENV DOTNET_EnableDiagnostics=0
WORKDIR /app
COPY . .
RUN cd CirclesUBI.PathfinderUpdater.Updater && dotnet restore "CirclesUBI.PathfinderUpdater.Updater.csproj"
RUN cd CirclesUBI.PathfinderUpdater.Updater && dotnet build "CirclesUBI.PathfinderUpdater.Updater.csproj" -c Release -o /app/build
RUN cd CirclesUBI.PathfinderUpdater.Updater && dotnet publish "CirclesUBI.PathfinderUpdater.Updater.csproj" -c Release -o /app/publish

FROM mcr.microsoft.com/dotnet/runtime:8.0
LABEL org.opencontainers.image.source=https://github.com/circlesland/pathfinder2-updater
ENV DOTNET_EnableDiagnostics=0

WORKDIR /app
COPY --from=publish /app/publish .
RUN chmod +x ./CirclesUBI.PathfinderUpdater.ExportUtil
ENTRYPOINT ["./CirclesUBI.PathfinderUpdater.ExportUtil"]
32 changes: 22 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ locations._

### Start the environment

On first start, it pulls the pathfinder2 image and builds the pathfinder2-updater image.
On first start, it pulls the pathfinder2 image and builds the pathfinder2-updater image from source.

```shell
docker-compose up
Expand All @@ -66,16 +66,28 @@ Alternatively, you can use the updater as a command line utility.
This allows you to dump the index db data to a file and load it into the pathfinder2 instance manually.

```shell
CirclesUBI.PathfinderUpdater.ExportUtil.exe \
"/home/user/pathfinder-db.bin" \
"Server=localhost;Port=5432;Database=postgres;User Id=postgres;Password=postgres;" \
"v2"
# Build the image
docker build -f ExportUtil.Dockerfile -t pathfinder2-export-util:latest .

# ########################################### #
# Define your out path and connection string #
# ########################################### #
OUTPUT_DIR="/home/user"
OUTPUT_FILENAME="pathfinder-db.bin"
INDEXER_DB_CONNECTION_STRING="Server=localhost;Port=5432;Database=postgres;User Id=postgres;Password=postgres;"
CIRCLES_VERSION="v2"

# Run the ExportUtil to dump the index db data to a file
docker run --rm \
-v ${OUTPUT_DIR}:/output \
--network host \
pathfinder2-export-util:latest \
"/output/${OUTPUT_FILENAME}" \
"${INDEXER_DB_CONNECTION_STRING}" \
"${CIRCLES_VERSION}"
```

The first argument is the output path for the binary dump file, the second argument is the connection string to the
index db and the third argument is the Circles version.

You can then use the resulting file to initialize a pathfinder2 instance:
You can then use the resulting file (at "${OUTPUT_DIR}/${OUTPUT_FILENAME}") to initialize a pathfinder2 instance:

```shell
curl -X POST \
Expand All @@ -87,7 +99,7 @@ curl -X POST \
"file": "/home/user/pathfinder-db.bin"
}
}' \
"http://<ip>:<port>"
"http://localhost:8080"
```

## File format
Expand Down

0 comments on commit 3023315

Please sign in to comment.