Skip to content

Commit fcf4e9b

Browse files
committed
default path, replace deprecated docker command
1 parent 47d002f commit fcf4e9b

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build:
55
.PHONY: build
66

77
build-docker:
8-
docker-compose build
8+
docker compose build
99
.PHONY: build-docker
1010

1111
clean:
@@ -21,8 +21,8 @@ test:
2121
.PHONY: test
2222

2323
integration:
24-
docker-compose down
25-
docker-compose up -d minio create-buckets
24+
docker compose down
25+
docker compose up -d minio create-buckets
2626
RUN_INTEGRATION_TESTS=true go test -v ./...
2727
.PHONY: integration
2828

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ To run the project locally, you should first copy `.env.template` to `.env` and
4646
to your beacon client and storage backend of choice. Then you can run the project with:
4747

4848
```sh
49-
docker-compose up
49+
docker compose up
5050
```
5151

5252
You can see a full list of configuration options by running:

archiver/flags/config.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package flags
22

33
import (
44
"fmt"
5-
"time"
65
"strings"
7-
6+
"time"
7+
88
common "github.com/base-org/blob-archiver/common/flags"
99
oplog "github.com/ethereum-optimism/optimism/op-service/log"
1010
opmetrics "github.com/ethereum-optimism/optimism/op-service/metrics"
@@ -48,7 +48,6 @@ func (c ArchiverConfig) Check() error {
4848

4949
func ReadConfig(cliCtx *cli.Context) ArchiverConfig {
5050
pollInterval, _ := time.ParseDuration(cliCtx.String(ArchiverPollIntervalFlag.Name))
51-
5251
return ArchiverConfig{
5352
LogConfig: oplog.ReadCLIConfig(cliCtx),
5453
MetricsConfig: opmetrics.ReadCLIConfig(cliCtx),

common/flags/flags.go

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func CLIFlags(envPrefix string) []cli.Flag {
8383
Usage: "The path to append to file",
8484
Hidden: true,
8585
EnvVars: opservice.PrefixEnvVar(envPrefix, "S3_PATH"),
86+
Value: "",
8687
},
8788
// File Data Store Flags
8889
&cli.StringFlag{

common/storage/s3.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"context"
77
"encoding/json"
88
"io"
9+
"path"
910

1011
"github.com/base-org/blob-archiver/common/flags"
1112
"github.com/ethereum/go-ethereum/common"
@@ -17,7 +18,7 @@ import (
1718
type S3Storage struct {
1819
s3 *minio.Client
1920
bucket string
20-
path string
21+
path string
2122
log log.Logger
2223
compress bool
2324
}
@@ -49,7 +50,7 @@ func NewS3Storage(cfg flags.S3Config, l log.Logger) (*S3Storage, error) {
4950
}
5051

5152
func (s *S3Storage) Exists(ctx context.Context, hash common.Hash) (bool, error) {
52-
_, err := s.s3.StatObject(ctx, s.bucket, s.path+hash.String(), minio.StatObjectOptions{})
53+
_, err := s.s3.StatObject(ctx, s.bucket, path.Join(s.path, hash.String()), minio.StatObjectOptions{})
5354
if err != nil {
5455
errResponse := minio.ToErrorResponse(err)
5556
if errResponse.Code == "NoSuchKey" {
@@ -63,7 +64,7 @@ func (s *S3Storage) Exists(ctx context.Context, hash common.Hash) (bool, error)
6364
}
6465

6566
func (s *S3Storage) Read(ctx context.Context, hash common.Hash) (BlobData, error) {
66-
res, err := s.s3.GetObject(ctx, s.bucket, s.path+hash.String(), minio.GetObjectOptions{})
67+
res, err := s.s3.GetObject(ctx, s.bucket, path.Join(s.path, hash.String()), minio.GetObjectOptions{})
6768
if err != nil {
6869
s.log.Info("unexpected error fetching blob", "hash", hash.String(), "err", err)
6970
return BlobData{}, ErrStorage
@@ -124,7 +125,7 @@ func (s *S3Storage) Write(ctx context.Context, data BlobData) error {
124125

125126
reader := bytes.NewReader(b)
126127

127-
_, err = s.s3.PutObject(ctx, s.bucket, s.path+data.Header.BeaconBlockHash.String(), reader, int64(len(b)), options)
128+
_, err = s.s3.PutObject(ctx, s.bucket, path.Join(s.path, data.Header.BeaconBlockHash.String()), reader, int64(len(b)), options)
128129

129130
if err != nil {
130131
s.log.Warn("error writing blob", "err", err)

common/storage/s3_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414

1515
// Prior to running these tests, a local Minio server must be running.
1616
// You can accomplish this with:
17-
// docker-compose down # shut down any running services
18-
// docker-compose up minio create-buckets # start the minio service
17+
// docker compose down # shut down any running services
18+
// docker compose up minio create-buckets # start the minio service
1919
func setupS3(t *testing.T) *S3Storage {
2020
if os.Getenv("RUN_INTEGRATION_TESTS") == "" {
2121
t.Skip("skipping integration tests: set RUN_INTEGRATION_TESTS environment variable")

0 commit comments

Comments
 (0)