Skip to content
New issue

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

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

Already on GitHub? # to your account

Add instructions to build docker image locally #262

Merged
merged 2 commits into from
Jul 2, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BUILD_DATE := $(shell date -u +%FT%TZ)
ETLHASH=stellar/stellar-etl:$(shell git rev-parse --short HEAD)

docker-build:
$(SUDO) docker build --pull --no-cache --label org.opencontainers.image.created="$(BUILD_DATE)" \
$(SUDO) docker build --platform linux/amd64 --pull --no-cache --label org.opencontainers.image.created="$(BUILD_DATE)" \
Copy link
Contributor

@chowbao chowbao Jul 1, 2024

Choose a reason for hiding this comment

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

I recommend not adding --platform to the Makefile as it is used in our https://github.com/stellar/pipelines/blob/master/stellar-etl/Jenkinsfile#L44-L45

Edit: NVM it should be fine to add as it'd be a noop. For more context: we all have macbooks with m* chips so we need to force the x86 (e.g. linux/amd64) build

-t $(ETLHASH) -t stellar/stellar-etl:latest -f ./docker/Dockerfile .

docker-push:
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,19 @@ If branch is already made, just rename it _before passing the pull request_.

1. Clone this repo `git clone https://github.com/stellar/stellar-etl`
2. Build stellar-etl with `go build`
3. Run export commands to export information about the legder
3. Build the docker image locally with `make docker-build`
4. Run the docker container in interactive mode to run export commands.

```sh
$ docker run --platform linux/amd64 -it stellar/stellar-etl:latest /bin/bash
```

5. Run export commands to export information about the legder
Example command to export ledger data

```sh
root@71890b878fca:/etl/data# stellar-etl export_ledgers --start-ledger 1000 --end-ledger 500000 --output exported_ledgers.txt
```

> _*Note:*_ If using the GCS datastore, you can run the following to set GCP credentials to use in your shell

Expand All @@ -65,6 +77,12 @@ gcloud config set project dev-hubble
gcloud auth application-default login
```

Add following to docker run command to pass gcloud credentials to docker container

```
-e GOOGLE_APPLICATION_CREDENTIALS=/.config/gcp/credentials.json -v "$HOME/.config/gcloud/application_default_credentials.json":/.config/gcp/credentials.json:ro
```

> _*Note:*_ Instructions for installing gcloud can be found [here](https://cloud.google.com/sdk/docs/install-sdk)

<br>
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func AddCommonFlags(flags *pflag.FlagSet) {
flags.Bool("futurenet", false, "If set, will connect to Futurenet instead of Mainnet.")
flags.StringToStringP("extra-fields", "u", map[string]string{}, "Additional fields to append to output jsons. Used for appending metadata")
flags.Bool("captive-core", false, "If set, run captive core to retrieve data. Otherwise use TxMeta file datastore.")
flags.String("datastore-path", "sdf-ledger-close-metas/ledgers", "Datastore bucket path to read txmeta files from.")
Copy link
Contributor

Choose a reason for hiding this comment

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

🙌

flags.String("datastore-path", "sdf-ledger-close-meta/ledgers", "Datastore bucket path to read txmeta files from.")
flags.Uint32("buffer-size", 200, "Buffer size sets the max limit for the number of txmeta files that can be held in memory.")
flags.Uint32("num-workers", 10, "Number of workers to spawn that read txmeta files from the datastore.")
flags.Uint32("retry-limit", 3, "Datastore GetLedger retry limit.")
Expand Down
Loading