Skip to content

Commit

Permalink
Allow use of headless hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
angelini committed Dec 5, 2023
1 parent b4ded4d commit 531b08a
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 90 deletions.
34 changes: 17 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DB_PASS ?= password
DB_URI := postgres://$(DB_USER):$(DB_PASS)@$(DB_HOST):5432/dl

GRPC_PORT ?= 5051
GRPC_SERVER ?= localhost:$(GRPC_PORT)
GRPC_HOST ?= localhost

DEV_TOKEN_ADMIN ?= v2.public.eyJzdWIiOiJhZG1pbiIsImlhdCI6IjIwMjEtMTAtMTVUMTE6MjA6MDAuMDM0WiJ9WtEey8KfQQRy21xoHq1C5KQatEevk8RxS47k4bRfMwVCPHumZmVuk6ADcfDHTmSnMtEGfFXdxnYOhRP6Clb_Dw
DEV_TOKEN_PROJECT_1 ?= v2.public.eyJzdWIiOiIxIiwiaWF0IjoiMjAyMS0xMC0xNVQxMToyMDowMC4wMzVaIn2MQ14RfIGpoEycCuvRu9J3CZp6PppUXf5l5w8uKKydN3C31z6f6GgOEPNcnwODqBnX7Pjarpz4i2uzWEqLgQYD
Expand Down Expand Up @@ -109,7 +109,7 @@ endif
test-fuzz: export DL_TOKEN=$(DEV_TOKEN_ADMIN)
test-fuzz: export DL_SKIP_SSL_VERIFICATION=1
test-fuzz: reset-db
go run cmd/fuzz-test/main.go --server $(GRPC_SERVER) --iterations 1000 --projects 5
go run cmd/fuzz-test/main.go --host $(GRPC_HOST) --iterations 1000 --projects 5

reset-db: migrate
psql $(DB_URI) -c "truncate dl.objects; truncate dl.contents; truncate dl.projects; truncate dl.cache_versions;"
Expand All @@ -129,64 +129,64 @@ client-update: export DL_TOKEN=$(DEV_TOKEN_PROJECT_1)
client-update: export DL_SKIP_SSL_VERIFICATION=1
client-update:
development/scripts/simple_input.sh 1
go run cmd/client/main.go update --server $(GRPC_SERVER) --project 1 --dir input/simple
go run cmd/client/main.go update --host $(GRPC_HOST) --project 1 --dir input/simple
development/scripts/simple_input.sh 2
go run cmd/client/main.go update --server $(GRPC_SERVER) --project 1 --dir input/simple
go run cmd/client/main.go update --host $(GRPC_HOST) --project 1 --dir input/simple
development/scripts/simple_input.sh 3
go run cmd/client/main.go update --server $(GRPC_SERVER) --project 1 --dir input/simple
go run cmd/client/main.go update --host $(GRPC_HOST) --project 1 --dir input/simple

client-large-update: export DL_TOKEN=$(DEV_TOKEN_PROJECT_1)
client-large-update: export DL_SKIP_SSL_VERIFICATION=1
client-large-update:
development/scripts/complex_input.sh 1
go run cmd/client/main.go update --server $(GRPC_SERVER) --project 1 --dir input/complex
go run cmd/client/main.go update --host $(GRPC_HOST) --project 1 --dir input/complex
development/scripts/complex_input.sh 2
go run cmd/client/main.go update --server $(GRPC_SERVER) --project 1 --dir input/complex
go run cmd/client/main.go update --host $(GRPC_HOST) --project 1 --dir input/complex
development/scripts/complex_input.sh 3
go run cmd/client/main.go update --server $(GRPC_SERVER) --project 1 --dir input/complex
go run cmd/client/main.go update --host $(GRPC_HOST) --project 1 --dir input/complex

client-get: export DL_TOKEN=$(DEV_TOKEN_PROJECT_1)
client-get: export DL_SKIP_SSL_VERIFICATION=1
client-get:
ifndef to_version
go run cmd/client/main.go get --server $(GRPC_SERVER) --project 1 --prefix "$(prefix)"
go run cmd/client/main.go get --host $(GRPC_HOST) --project 1 --prefix "$(prefix)"
else
go run cmd/client/main.go get --server $(GRPC_SERVER) --project 1 --to $(to_version) --prefix "$(prefix)"
go run cmd/client/main.go get --host $(GRPC_HOST) --project 1 --to $(to_version) --prefix "$(prefix)"
endif

client-rebuild: export DL_TOKEN=$(DEV_TOKEN_ADMIN)
client-rebuild: export DL_SKIP_SSL_VERIFICATION=1
client-rebuild:
ifndef to_version
go run cmd/client/main.go rebuild --server $(GRPC_SERVER) --project 1 --prefix "$(prefix)" --dir $(dir)
go run cmd/client/main.go rebuild --host $(GRPC_HOST) --project 1 --prefix "$(prefix)" --dir $(dir)
else
go run cmd/client/main.go rebuild --server $(GRPC_SERVER) --project 1 --to $(to_version) --prefix "$(prefix)" --dir $(dir)
go run cmd/client/main.go rebuild --host $(GRPC_HOST) --project 1 --to $(to_version) --prefix "$(prefix)" --dir $(dir)
endif

client-rebuild-with-cache: export DL_TOKEN=$(DEV_TOKEN_ADMIN)
client-rebuild-with-cache: export DL_SKIP_SSL_VERIFICATION=1
client-rebuild-with-cache:
go run cmd/client/main.go rebuild --server $(GRPC_SERVER) --project 1 --prefix "$(prefix)" --dir $(dir) --cachedir input/cache
go run cmd/client/main.go rebuild --host $(GRPC_HOST) --project 1 --prefix "$(prefix)" --dir $(dir) --cachedir input/cache

client-getcache: export DL_TOKEN=$(DEV_TOKEN_ADMIN)
client-getcache: export DL_SKIP_SSL_VERIFICATION=1
client-getcache:
go run cmd/client/main.go getcache --server $(GRPC_SERVER) --path input/cache
go run cmd/client/main.go getcache --host $(GRPC_HOST) --path input/cache

client-gc-contents: export DL_TOKEN=$(DEV_TOKEN_ADMIN)
client-gc-contents: export DL_SKIP_SSL_VERIFICATION=1
client-gc-contents:
go run cmd/client/main.go gc --server $(GRPC_SERVER) --mode contents --sample 25
go run cmd/client/main.go gc --host $(GRPC_HOST) --mode contents --sample 25

client-gc-project: export DL_TOKEN=$(DEV_TOKEN_ADMIN)
client-gc-project: export DL_SKIP_SSL_VERIFICATION=1
client-gc-project:
go run cmd/client/main.go gc --server $(GRPC_SERVER) --mode project --project 1 --keep 1
go run cmd/client/main.go gc --host $(GRPC_HOST) --mode project --project 1 --keep 1

client-gc-random-projects: export DL_TOKEN=$(DEV_TOKEN_ADMIN)
client-gc-random-projects: export DL_SKIP_SSL_VERIFICATION=1
client-gc-random-projects:
go run cmd/client/main.go gc --server $(GRPC_SERVER) --mode random-projects --sample 25 --keep 1
go run cmd/client/main.go gc --host $(GRPC_HOST) --mode random-projects --sample 25 --keep 1

health:
grpc-health-probe -addr $(GRPC_SERVER)
Expand Down
8 changes: 5 additions & 3 deletions cmd/fuzz-test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ func newCommand() *cobra.Command {
var (
projects int
iterations int
server string
host string
port uint16
)

cmd := &cobra.Command{
Expand All @@ -634,7 +635,7 @@ func newCommand() *cobra.Command {

ctx := cmd.Context()

client, err := dlc.NewClient(ctx, server)
client, err := dlc.NewClient(ctx, host, port)
if err != nil {
return err
}
Expand All @@ -646,7 +647,8 @@ func newCommand() *cobra.Command {
flags := cmd.PersistentFlags()
flags.IntVar(&projects, "projects", 5, "How many projects to create")
flags.IntVar(&iterations, "iterations", 1000, "How many FS operations to apply")
flags.StringVar(&server, "server", "", "Server GRPC address")
flags.StringVar(&host, "host", "", "GRPC server hostname")
flags.Uint16Var(&port, "port", 5051, "GRPC server port")

return cmd
}
Expand Down
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildGoModule rec {
version = "0.6.1";
src = ./.;
proxyVendor = true; # Fixes: cannot query module due to -mod=vendor running make install
vendorSha256 = "sha256-IDr0jYOFskBPC6b7QUgZygBdDMZvm4pZePK1/2GGbY0=";
vendorSha256 = "sha256-v0orVKF/ili8RSGPxOYpvpa+vUmBJ3/fGS8mzcsbwc8=";

outputs = [ "out" "client" "server" "migrations" ];

Expand Down
28 changes: 15 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/gadget-inc/fsdiff v0.4.4
github.com/gobwas/glob v0.2.3
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/jackc/pgx/v5 v5.3.1
github.com/jackc/puddle/v2 v2.2.0
github.com/jackc/pgx/v5 v5.5.0
github.com/jackc/puddle/v2 v2.2.1
github.com/klauspost/compress v1.16.5
github.com/minio/sha256-simd v1.0.0
github.com/o1egl/paseto v1.0.0
Expand All @@ -21,15 +21,15 @@ require (
go.opentelemetry.io/otel/sdk v1.16.0
go.opentelemetry.io/otel/trace v1.16.0
go.uber.org/zap v1.23.0
golang.org/x/oauth2 v0.6.0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.8.0
google.golang.org/grpc v1.55.0
google.golang.org/protobuf v1.30.0
golang.org/x/oauth2 v0.15.0
golang.org/x/sync v0.5.0
golang.org/x/sys v0.15.0
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
)

require (
cloud.google.com/go/compute v1.18.0 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
github.com/aead/chacha20poly1305 v0.0.0-20201124145622-1a5aba2a8b29 // indirect
Expand All @@ -42,7 +42,7 @@ require (
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
Expand All @@ -60,10 +60,12 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 531b08a

Please sign in to comment.