hc to satellite rename (#282)

* hc to satellite rename

* rebase with master and fix spelling

* missed out rename

* rebase merge fix
This commit is contained in:
aligeti 2018-08-29 14:32:41 -04:00 committed by GitHub
parent 2bba44fa1c
commit 743ec65204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 65 deletions

View File

@ -84,9 +84,9 @@ test: lint
@echo done @echo done
build-binaries: build-binaries:
docker build -t hc . docker build -t satellite .
run-hc: run-satellite:
docker network create test-net docker network create test-net
docker run -d \ docker run -d \
@ -96,23 +96,23 @@ run-hc:
redis redis
docker run -d \ docker run -d \
--name=hc \ --name=satellite \
--network test-net \ --network test-net \
-p 127.0.0.1:8080:8080 \ -p 127.0.0.1:8080:8080 \
-e REDIS_ADDRESS=redis:6379 \ -e REDIS_ADDRESS=redis:6379 \
-e REDIS_PASSWORD="" \ -e REDIS_PASSWORD="" \
-e REDIS_DB=1 \ -e REDIS_DB=1 \
-e OVERLAY_PORT=7070 \ -e OVERLAY_PORT=7070 \
hc satellite
test-captplanet: test-captplanet:
@echo "Running ${@}" @echo "Running ${@}"
@./scripts/test-captplanet.sh @./scripts/test-captplanet.sh
clean-local: clean-local:
# cleanup heavy client # cleanup satellite
docker stop hc || true docker stop satellite || true
docker rm hc || true docker rm satellite || true
# cleanup redis # cleanup redis
docker stop redis || true docker stop redis || true
docker rm redis || true docker rm redis || true
@ -131,7 +131,7 @@ images: satellite-image storage-node-image uplink-image
.PHONY: satellite-image .PHONY: satellite-image
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 .PHONY: storage-node-image
storage-node-image: storage-node-image:
docker build --build-arg GO_VERSION=${GO_VERSION} -t storjlabs/storage-node:${TAG} -f cmd/storagenode/Dockerfile . docker build --build-arg GO_VERSION=${GO_VERSION} -t storjlabs/storage-node:${TAG} -f cmd/storagenode/Dockerfile .

View File

@ -24,8 +24,8 @@ const (
storagenodeCount = 50 storagenodeCount = 50
) )
// HeavyClient is for configuring client // Satellite is for configuring client
type HeavyClient struct { type Satellite struct {
Identity provider.IdentityConfig Identity provider.IdentityConfig
Kademlia kademlia.Config Kademlia kademlia.Config
PointerDB pointerdb.Config PointerDB pointerdb.Config
@ -51,7 +51,7 @@ var (
} }
runCfg struct { runCfg struct {
HeavyClient HeavyClient Satellite Satellite
StorageNodes [storagenodeCount]StorageNode StorageNodes [storagenodeCount]StorageNode
Uplink miniogw.Config Uplink miniogw.Config
} }
@ -76,13 +76,13 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
return err return err
} }
address := runCfg.StorageNodes[i].Identity.Address address := runCfg.StorageNodes[i].Identity.Address
if runCfg.HeavyClient.MockOverlay.Enabled && if runCfg.Satellite.MockOverlay.Enabled &&
runCfg.HeavyClient.MockOverlay.Host != "" { runCfg.Satellite.MockOverlay.Host != "" {
_, port, err := net.SplitHostPort(address) _, port, err := net.SplitHostPort(address)
if err != nil { if err != nil {
return err 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) storagenode := fmt.Sprintf("%s:%s", identity.ID.String(), address)
storagenodes = append(storagenodes, storagenode) storagenodes = append(storagenodes, storagenode)
@ -95,17 +95,17 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
}(i, storagenode) }(i, storagenode)
} }
// start heavy client // start satellite
go func() { go func() {
_, _ = fmt.Printf("starting heavy client on %s\n", _, _ = fmt.Printf("starting satellite on %s\n",
runCfg.HeavyClient.Identity.Address) runCfg.Satellite.Identity.Address)
var o provider.Responsibility = runCfg.HeavyClient.Overlay var o provider.Responsibility = runCfg.Satellite.Overlay
if runCfg.HeavyClient.MockOverlay.Enabled { if runCfg.Satellite.MockOverlay.Enabled {
o = overlay.MockConfig{Nodes: strings.Join(storagenodes, ",")} o = overlay.MockConfig{Nodes: strings.Join(storagenodes, ",")}
} }
errch <- runCfg.HeavyClient.Identity.Run(ctx, errch <- runCfg.Satellite.Identity.Run(ctx,
runCfg.HeavyClient.Kademlia, runCfg.Satellite.Kademlia,
runCfg.HeavyClient.PointerDB, runCfg.Satellite.PointerDB,
o) o)
}() }()

View File

@ -60,7 +60,7 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
return nil return nil
} }
hcPath := filepath.Join(setupCfg.BasePath, "hc") hcPath := filepath.Join(setupCfg.BasePath, "satellite")
err = os.MkdirAll(hcPath, 0700) err = os.MkdirAll(hcPath, 0700)
if err != nil { if err != nil {
return err return err
@ -117,18 +117,18 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
} }
overrides := map[string]interface{}{ overrides := map[string]interface{}{
"heavy-client.identity.cert-path": setupCfg.HCIdentity.CertPath, "satellite.identity.cert-path": setupCfg.HCIdentity.CertPath,
"heavy-client.identity.key-path": setupCfg.HCIdentity.KeyPath, "satellite.identity.key-path": setupCfg.HCIdentity.KeyPath,
"heavy-client.identity.address": joinHostPort( "satellite.identity.address": joinHostPort(
setupCfg.ListenHost, startingPort+1), setupCfg.ListenHost, startingPort+1),
"heavy-client.kademlia.todo-listen-addr": joinHostPort( "satellite.kademlia.todo-listen-addr": joinHostPort(
setupCfg.ListenHost, startingPort+2), setupCfg.ListenHost, startingPort+2),
"heavy-client.kademlia.bootstrap-addr": joinHostPort( "satellite.kademlia.bootstrap-addr": joinHostPort(
setupCfg.ListenHost, startingPort+4), setupCfg.ListenHost, startingPort+4),
"heavy-client.pointer-db.database-url": "bolt://" + filepath.Join( "satellite.pointer-db.database-url": "bolt://" + filepath.Join(
setupCfg.BasePath, "hc", "pointerdb.db"), setupCfg.BasePath, "satellite", "pointerdb.db"),
"heavy-client.overlay.database-url": "bolt://" + filepath.Join( "satellite.overlay.database-url": "bolt://" + filepath.Join(
setupCfg.BasePath, "hc", "overlay.db"), setupCfg.BasePath, "satellite", "overlay.db"),
"uplink.cert-path": setupCfg.ULIdentity.CertPath, "uplink.cert-path": setupCfg.ULIdentity.CertPath,
"uplink.key-path": setupCfg.ULIdentity.KeyPath, "uplink.key-path": setupCfg.ULIdentity.KeyPath,
"uplink.address": joinHostPort( "uplink.address": joinHostPort(

View File

@ -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
```

View File

@ -7,7 +7,7 @@ RUN apk update && \
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
COPY . /go/src/storj.io/storj COPY . /go/src/storj.io/storj
RUN cd /go/src/storj.io/storj && dep ensure -vendor-only 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 # final stage
@ -19,8 +19,8 @@ ENV REDIS_ADDR=redis:6379 \
HTTP_PORT=:8080 \ HTTP_PORT=:8080 \
BOOTSTRAP_ADDR=bootstrap.storj.io:8080 BOOTSTRAP_ADDR=bootstrap.storj.io:8080
WORKDIR /app WORKDIR /app
COPY --from=build-env /go/src/storj.io/storj/cmd/hc/satellite /app/ COPY --from=build-env /go/src/storj.io/storj/cmd/satellite/satellite /app/
COPY cmd/hc/entrypoint /entrypoint COPY cmd/satellite/entrypoint /entrypoint
EXPOSE 8081/udp \ EXPOSE 8081/udp \
8080 \ 8080 \
7070 7070

17
cmd/satellite/README.md Normal file
View File

@ -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
```

View File

@ -19,12 +19,12 @@ import (
var ( var (
rootCmd = &cobra.Command{ rootCmd = &cobra.Command{
Use: "hc", Use: "satellite",
Short: "Heavy client", Short: "Satellite",
} }
runCmd = &cobra.Command{ runCmd = &cobra.Command{
Use: "run", Use: "run",
Short: "Run the heavy client", Short: "Run the satellite",
RunE: cmdRun, RunE: cmdRun,
} }
setupCmd = &cobra.Command{ setupCmd = &cobra.Command{
@ -47,7 +47,7 @@ var (
Overwrite bool `default:"false" help:"whether to overwrite pre-existing configuration files"` Overwrite bool `default:"false" help:"whether to overwrite pre-existing configuration files"`
} }
defaultConfDir = "$HOME/.storj/hc" defaultConfDir = "$HOME/.storj/satellite"
) )
func init() { func init() {
@ -74,7 +74,7 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
_, err = os.Stat(setupCfg.BasePath) _, err = os.Stat(setupCfg.BasePath)
if !setupCfg.Overwrite && err == nil { 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 return nil
} }

View File

@ -1,9 +1,9 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: hc name: satellite
labels: labels:
app: hc app: satellite
spec: spec:
ports: ports:
- name: grpc - name: grpc
@ -17,14 +17,14 @@ spec:
port: 8080 port: 8080
target: 8080 target: 8080
selector: selector:
app: hc app: satellite
--- ---
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: hc name: satellite
labels: labels:
app: hc app: satellite
spec: spec:
minReadySeconds: 10 minReadySeconds: 10
revisionHistoryLimit: 3 revisionHistoryLimit: 3
@ -35,13 +35,13 @@ spec:
template: template:
metadata: metadata:
labels: labels:
app: hc app: satellite
spec: spec:
terminationGracePeriodSeconds: 60 terminationGracePeriodSeconds: 60
containers: containers:
- image: "docker.io/storjlabs/hc" - image: "docker.io/storjlabs/satellite"
imagePullPolicy: Always imagePullPolicy: Always
name: hc name: satellite
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /health path: /health