From 743ec652047fac10360f5b0572a974f502ed9991 Mon Sep 17 00:00:00 2001 From: aligeti <34487396+aligeti@users.noreply.github.com> Date: Wed, 29 Aug 2018 14:32:41 -0400 Subject: [PATCH] hc to satellite rename (#282) * hc to satellite rename * rebase with master and fix spelling * missed out rename * rebase merge fix --- Makefile | 16 +++++------ cmd/captplanet/run.go | 28 ++++++++++---------- cmd/captplanet/setup.go | 20 +++++++------- cmd/hc/README.md | 17 ------------ cmd/{hc => satellite}/Dockerfile | 6 ++--- cmd/satellite/README.md | 17 ++++++++++++ cmd/{hc => satellite}/entrypoint | 0 cmd/{hc => satellite}/main.go | 10 +++---- cmd/{hc/hc.yaml => satellite/satellite.yaml} | 16 +++++------ 9 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 cmd/hc/README.md rename cmd/{hc => satellite}/Dockerfile (75%) create mode 100644 cmd/satellite/README.md rename cmd/{hc => satellite}/entrypoint (100%) rename cmd/{hc => satellite}/main.go (93%) rename cmd/{hc/hc.yaml => satellite/satellite.yaml} (88%) diff --git a/Makefile b/Makefile index da048e897..452eebf78 100644 --- a/Makefile +++ b/Makefile @@ -84,9 +84,9 @@ test: lint @echo done build-binaries: - docker build -t hc . + docker build -t satellite . -run-hc: +run-satellite: docker network create test-net docker run -d \ @@ -96,23 +96,23 @@ run-hc: redis docker run -d \ - --name=hc \ + --name=satellite \ --network test-net \ -p 127.0.0.1:8080:8080 \ -e REDIS_ADDRESS=redis:6379 \ -e REDIS_PASSWORD="" \ -e REDIS_DB=1 \ -e OVERLAY_PORT=7070 \ - hc + satellite test-captplanet: @echo "Running ${@}" @./scripts/test-captplanet.sh clean-local: - # cleanup heavy client - docker stop hc || true - docker rm hc || true + # cleanup satellite + docker stop satellite || true + docker rm satellite || true # cleanup redis docker stop redis || true docker rm redis || true @@ -131,7 +131,7 @@ images: satellite-image storage-node-image uplink-image .PHONY: satellite-image satellite-image: - docker build --build-arg GO_VERSION=${GO_VERSION} -t storjlabs/satellite:${TAG} -f cmd/hc/Dockerfile . + docker build --build-arg GO_VERSION=${GO_VERSION} -t storjlabs/satellite:${TAG} -f cmd/satellite/Dockerfile . .PHONY: storage-node-image storage-node-image: docker build --build-arg GO_VERSION=${GO_VERSION} -t storjlabs/storage-node:${TAG} -f cmd/storagenode/Dockerfile . diff --git a/cmd/captplanet/run.go b/cmd/captplanet/run.go index c83988ff0..5c9f8107e 100644 --- a/cmd/captplanet/run.go +++ b/cmd/captplanet/run.go @@ -24,8 +24,8 @@ const ( storagenodeCount = 50 ) -// HeavyClient is for configuring client -type HeavyClient struct { +// Satellite is for configuring client +type Satellite struct { Identity provider.IdentityConfig Kademlia kademlia.Config PointerDB pointerdb.Config @@ -51,7 +51,7 @@ var ( } runCfg struct { - HeavyClient HeavyClient + Satellite Satellite StorageNodes [storagenodeCount]StorageNode Uplink miniogw.Config } @@ -76,13 +76,13 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) { return err } address := runCfg.StorageNodes[i].Identity.Address - if runCfg.HeavyClient.MockOverlay.Enabled && - runCfg.HeavyClient.MockOverlay.Host != "" { + if runCfg.Satellite.MockOverlay.Enabled && + runCfg.Satellite.MockOverlay.Host != "" { _, port, err := net.SplitHostPort(address) if err != nil { return err } - address = net.JoinHostPort(runCfg.HeavyClient.MockOverlay.Host, port) + address = net.JoinHostPort(runCfg.Satellite.MockOverlay.Host, port) } storagenode := fmt.Sprintf("%s:%s", identity.ID.String(), address) storagenodes = append(storagenodes, storagenode) @@ -95,17 +95,17 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) { }(i, storagenode) } - // start heavy client + // start satellite go func() { - _, _ = fmt.Printf("starting heavy client on %s\n", - runCfg.HeavyClient.Identity.Address) - var o provider.Responsibility = runCfg.HeavyClient.Overlay - if runCfg.HeavyClient.MockOverlay.Enabled { + _, _ = fmt.Printf("starting satellite on %s\n", + runCfg.Satellite.Identity.Address) + var o provider.Responsibility = runCfg.Satellite.Overlay + if runCfg.Satellite.MockOverlay.Enabled { o = overlay.MockConfig{Nodes: strings.Join(storagenodes, ",")} } - errch <- runCfg.HeavyClient.Identity.Run(ctx, - runCfg.HeavyClient.Kademlia, - runCfg.HeavyClient.PointerDB, + errch <- runCfg.Satellite.Identity.Run(ctx, + runCfg.Satellite.Kademlia, + runCfg.Satellite.PointerDB, o) }() diff --git a/cmd/captplanet/setup.go b/cmd/captplanet/setup.go index 2595055d7..a5c422381 100644 --- a/cmd/captplanet/setup.go +++ b/cmd/captplanet/setup.go @@ -60,7 +60,7 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) { return nil } - hcPath := filepath.Join(setupCfg.BasePath, "hc") + hcPath := filepath.Join(setupCfg.BasePath, "satellite") err = os.MkdirAll(hcPath, 0700) if err != nil { return err @@ -117,18 +117,18 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) { } overrides := map[string]interface{}{ - "heavy-client.identity.cert-path": setupCfg.HCIdentity.CertPath, - "heavy-client.identity.key-path": setupCfg.HCIdentity.KeyPath, - "heavy-client.identity.address": joinHostPort( + "satellite.identity.cert-path": setupCfg.HCIdentity.CertPath, + "satellite.identity.key-path": setupCfg.HCIdentity.KeyPath, + "satellite.identity.address": joinHostPort( setupCfg.ListenHost, startingPort+1), - "heavy-client.kademlia.todo-listen-addr": joinHostPort( + "satellite.kademlia.todo-listen-addr": joinHostPort( setupCfg.ListenHost, startingPort+2), - "heavy-client.kademlia.bootstrap-addr": joinHostPort( + "satellite.kademlia.bootstrap-addr": joinHostPort( setupCfg.ListenHost, startingPort+4), - "heavy-client.pointer-db.database-url": "bolt://" + filepath.Join( - setupCfg.BasePath, "hc", "pointerdb.db"), - "heavy-client.overlay.database-url": "bolt://" + filepath.Join( - setupCfg.BasePath, "hc", "overlay.db"), + "satellite.pointer-db.database-url": "bolt://" + filepath.Join( + setupCfg.BasePath, "satellite", "pointerdb.db"), + "satellite.overlay.database-url": "bolt://" + filepath.Join( + setupCfg.BasePath, "satellite", "overlay.db"), "uplink.cert-path": setupCfg.ULIdentity.CertPath, "uplink.key-path": setupCfg.ULIdentity.KeyPath, "uplink.address": joinHostPort( diff --git a/cmd/hc/README.md b/cmd/hc/README.md deleted file mode 100644 index 3f5b68495..000000000 --- a/cmd/hc/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Heavy client - -Documentation for developing and building the heavy client service - -Usage: - -First make an identity: -``` -go install storj.io/storj/cmd/hc -hc setup -``` - -You can edit `~/.storj/hc/config.yaml` to your liking. Then run it! - -``` -hc run -``` diff --git a/cmd/hc/Dockerfile b/cmd/satellite/Dockerfile similarity index 75% rename from cmd/hc/Dockerfile rename to cmd/satellite/Dockerfile index 78d4bb027..48b26de40 100644 --- a/cmd/hc/Dockerfile +++ b/cmd/satellite/Dockerfile @@ -7,7 +7,7 @@ RUN apk update && \ RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh COPY . /go/src/storj.io/storj RUN cd /go/src/storj.io/storj && dep ensure -vendor-only -RUN cd /go/src/storj.io/storj/cmd/hc && go build -o satellite +RUN cd /go/src/storj.io/storj/cmd/satellite && go build -o satellite # final stage @@ -19,8 +19,8 @@ ENV REDIS_ADDR=redis:6379 \ HTTP_PORT=:8080 \ BOOTSTRAP_ADDR=bootstrap.storj.io:8080 WORKDIR /app -COPY --from=build-env /go/src/storj.io/storj/cmd/hc/satellite /app/ -COPY cmd/hc/entrypoint /entrypoint +COPY --from=build-env /go/src/storj.io/storj/cmd/satellite/satellite /app/ +COPY cmd/satellite/entrypoint /entrypoint EXPOSE 8081/udp \ 8080 \ 7070 diff --git a/cmd/satellite/README.md b/cmd/satellite/README.md new file mode 100644 index 000000000..94718d2d5 --- /dev/null +++ b/cmd/satellite/README.md @@ -0,0 +1,17 @@ +# Satellite + +Documentation for developing and building the satellite service + +Usage: + +First make an identity: +``` +go install storj.io/storj/cmd/satellite +satellite setup +``` + +You can edit `~/.storj/satellite/config.yaml` to your liking. Then run it! + +``` +satellite run +``` diff --git a/cmd/hc/entrypoint b/cmd/satellite/entrypoint similarity index 100% rename from cmd/hc/entrypoint rename to cmd/satellite/entrypoint diff --git a/cmd/hc/main.go b/cmd/satellite/main.go similarity index 93% rename from cmd/hc/main.go rename to cmd/satellite/main.go index dcb2ebae2..80b78925a 100644 --- a/cmd/hc/main.go +++ b/cmd/satellite/main.go @@ -19,12 +19,12 @@ import ( var ( rootCmd = &cobra.Command{ - Use: "hc", - Short: "Heavy client", + Use: "satellite", + Short: "Satellite", } runCmd = &cobra.Command{ Use: "run", - Short: "Run the heavy client", + Short: "Run the satellite", RunE: cmdRun, } setupCmd = &cobra.Command{ @@ -47,7 +47,7 @@ var ( Overwrite bool `default:"false" help:"whether to overwrite pre-existing configuration files"` } - defaultConfDir = "$HOME/.storj/hc" + defaultConfDir = "$HOME/.storj/satellite" ) func init() { @@ -74,7 +74,7 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) { _, err = os.Stat(setupCfg.BasePath) if !setupCfg.Overwrite && err == nil { - fmt.Println("An hc configuration already exists. Rerun with --overwrite") + fmt.Println("An satellite configuration already exists. Rerun with --overwrite") return nil } diff --git a/cmd/hc/hc.yaml b/cmd/satellite/satellite.yaml similarity index 88% rename from cmd/hc/hc.yaml rename to cmd/satellite/satellite.yaml index de48760d5..840e9d904 100644 --- a/cmd/hc/hc.yaml +++ b/cmd/satellite/satellite.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: hc + name: satellite labels: - app: hc + app: satellite spec: ports: - name: grpc @@ -17,14 +17,14 @@ spec: port: 8080 target: 8080 selector: - app: hc + app: satellite --- apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: hc + name: satellite labels: - app: hc + app: satellite spec: minReadySeconds: 10 revisionHistoryLimit: 3 @@ -35,13 +35,13 @@ spec: template: metadata: labels: - app: hc + app: satellite spec: terminationGracePeriodSeconds: 60 containers: - - image: "docker.io/storjlabs/hc" + - image: "docker.io/storjlabs/satellite" imagePullPolicy: Always - name: hc + name: satellite livenessProbe: httpGet: path: /health