forked from iotaledger/hornet
-
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.
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
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 @@ | ||
latest-export.gz.bin |
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,37 @@ | ||
# Quickstart | ||
|
||
## Clone | ||
To quickly build, first clone the repository | ||
|
||
```sh | ||
git clone https://github.com/gohornet/hornet && cd hornet | ||
``` | ||
|
||
## Run build | ||
```sh | ||
docker build -t hornet:latest . | ||
``` | ||
|
||
## Prepare | ||
|
||
i. Download the DB file | ||
```sh | ||
curl -LO https://dbfiles.iota.org/mainnet/hornet/latest-export.gz.bin | ||
``` | ||
|
||
ii. Create a directory for the database. You can choose any path (perferably on a partition with enough disk space): | ||
```sh | ||
mkdir /tmp/db | ||
``` | ||
(Note: In the example above we're using /tmp that will get wiped after a reboot) | ||
|
||
iii. Edit the `config.json` for neighbors and alternative ports if needed. | ||
|
||
|
||
## Run | ||
|
||
Best run on host network for better performance (otherwise you are going to have to publish ports, that is done via iptables NAT and is slower) | ||
```sh | ||
docker run --rm -v $(pwd)/config.json:/app/config.json:ro -v $(pwd)/latest-export.gz.bin:/app/latest-export.gz.bin:ro -v /tmp/db:/app/mainnetdb --name hornet --net=host hornet:latest | ||
``` | ||
Use CTRL-c to gracefully end the process. |
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,34 @@ | ||
# ---[ build image ]--- | ||
FROM golang:1.13 as builder | ||
|
||
WORKDIR /go/src/github.com/gohornet/hornet | ||
ADD . . | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./hornet main.go | ||
|
||
# ---[ runtime image ]--- | ||
FROM alpine:latest | ||
WORKDIR /app | ||
ENV TINI_VERSION v0.18.0 | ||
|
||
# Tini is excellent: https://github.com/krallin/tini#why-tini | ||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini | ||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static.asc /tini.asc | ||
|
||
COPY --from=builder ["/go/src/github.com/gohornet/hornet/hornet", "/go/src/github.com/gohornet/hornet/config.json", "/app/"] | ||
RUN apk --no-cache add ca-certificates gnupg\ | ||
&& addgroup --gid 39999 hornet\ | ||
&& adduser -h /app -s /bin/sh -G hornet -u 39999 -D hornet\ | ||
&& chmod +x /tini /app/hornet\ | ||
&& chown hornet:hornet -R /app\ | ||
&& gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7\ | ||
&& gpg --batch --verify /tini.asc /tini | ||
|
||
# Not exposing ports, as it might be more efficient to run this on host network because of performance gain. | ||
# | Host mode networking can be useful to optimize performance, and in situations where a container needs | ||
# | to handle a large range of ports, as it does not require network address translation (NAT), and no | ||
# | “userland-proxy” is created for each port. | ||
# Source: https://docs.docker.com/network/host/ | ||
|
||
USER hornet | ||
ENTRYPOINT ["/tini", "--"] | ||
CMD ["/app/hornet"] |
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