From aed92bfd7dec739c0b22a749c189ef76143f99a9 Mon Sep 17 00:00:00 2001 From: altafan <18440657+altafan@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:14:43 +0100 Subject: [PATCH] Fix naming --- .goreleaser.yaml | 36 +++++----- Dockerfile | 14 ++-- Makefile | 6 +- api-spec/protobuf/arkd/v1/service.proto | 23 ------- api-spec/protobuf/buf.yaml | 2 +- .../protobuf/coordinator/v1/service.proto | 68 +++++++++++++++++++ cmd/{arkd => coordinatord}/main.go | 0 goreleaser.Dockerfile | 12 ++-- scripts/build | 2 +- 9 files changed, 104 insertions(+), 59 deletions(-) delete mode 100755 api-spec/protobuf/arkd/v1/service.proto create mode 100755 api-spec/protobuf/coordinator/v1/service.proto rename cmd/{arkd => coordinatord}/main.go (100%) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ab83b2a..c030126 100755 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,6 +1,6 @@ builds: - - id: "arkd" - main: ./cmd/arkd + - id: "coordinatord" + main: ./cmd/coordinatord ldflags: - -s -X 'main.version={{.Version}}' -X 'main.commit={{.Commit}}' -X 'main.date={{.Date}}' goos: @@ -9,7 +9,7 @@ builds: goarch: - amd64 - arm64 - binary: arkd + binary: coordinatord ## flag the semver v**.**.**-.* as pre-release on Github release: @@ -25,11 +25,11 @@ changelog: use: github-native archives: - - id: arkd + - id: coordinatord format: binary builds: - - arkd - name_template: "arkd-v{{ .Version }}-{{ .Os }}-{{ .Arch }}" + - coordinatord + name_template: "coordinatord-v{{ .Version }}-{{ .Os }}-{{ .Arch }}" dockers: ########################### @@ -38,12 +38,12 @@ dockers: #amd64 - image_templates: - - "ghcr.io/ark-network/arkd:{{ .Tag }}-amd64" + - "ghcr.io/ark-network/coordinatord:{{ .Tag }}-amd64" # push always either release or prerelease with a docker tag with the semver only skip_push: "false" use: buildx ids: - - arkd + - coordinatord dockerfile: goreleaser.Dockerfile # GOOS of the built binaries/packages that should be used. goos: linux @@ -54,19 +54,19 @@ dockers: - "--platform=linux/amd64" - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.title=arkd" + - "--label=org.opencontainers.image.title=coordinatord" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" - "--build-arg=VERSION={{.Version}}" - "--build-arg=COMMIT={{.Commit}}" - "--build-arg=DATE={{.Date}}" - image_templates: - - "ghcr.io/ark-network/arkd:{{ .Tag }}-arm64v8" + - "ghcr.io/ark-network/coordinatord:{{ .Tag }}-arm64v8" # push always either release or prerelease with a docker tag with the semver only skip_push: "false" use: buildx ids: - - arkd + - coordinatord dockerfile: goreleaser.Dockerfile # GOOS of the built binaries/packages that should be used. goos: linux @@ -77,7 +77,7 @@ dockers: - "--platform=linux/arm64/v8" - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" - - "--label=org.opencontainers.image.title=arkd" + - "--label=org.opencontainers.image.title=coordinatord" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" - "--build-arg=VERSION={{.Version}}" @@ -85,15 +85,15 @@ dockers: - "--build-arg=DATE={{.Date}}" docker_manifests: - - name_template: ghcr.io/ark-network/arkd:{{ .Tag }} + - name_template: ghcr.io/ark-network/coordinatord:{{ .Tag }} image_templates: - - ghcr.io/ark-network/arkd:{{ .Tag }}-amd64 - - ghcr.io/ark-network/arkd:{{ .Tag }}-arm64v8 + - ghcr.io/ark-network/coordinatord:{{ .Tag }}-amd64 + - ghcr.io/ark-network/coordinatord:{{ .Tag }}-arm64v8 skip_push: "false" - - name_template: ghcr.io/ark-network/arkd:latest + - name_template: ghcr.io/ark-network/coordinatord:latest image_templates: - - ghcr.io/ark-network/arkd:{{ .Tag }}-amd64 - - ghcr.io/ark-network/arkd:{{ .Tag }}-arm64v8 + - ghcr.io/ark-network/coordinatord:{{ .Tag }}-amd64 + - ghcr.io/ark-network/coordinatord:{{ .Tag }}-arm64v8 skip_push: auto \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 502875f..a44fedf 100755 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,9 @@ WORKDIR /app COPY . . -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${COMMIT}' -X 'main.Commit=${COMMIT}' -X 'main.Date=${COMMIT}'" -o bin/arkd cmd/arkd/main.go +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.Version=${COMMIT}' -X 'main.Commit=${COMMIT}' -X 'main.Date=${COMMIT}'" -o bin/coordinatord cmd/coordinatord/main.go -# Second image, running the arkd executable +# Second image, running the coordinatord executable FROM debian:buster-slim # $USER name, and data $DIR to be used in the 'final' image @@ -31,11 +31,11 @@ RUN adduser --disabled-password \ "$USER" USER $USER -# Prevents 'VOLUME $DIR/.arkd/' being created as owned by 'root' -RUN mkdir -p "$DIR/.arkd/" +# Prevents 'VOLUME $DIR/.coordinatord/' being created as owned by 'root' +RUN mkdir -p "$DIR/.coordinatord/" -# Expose volume containing all 'arkd' data -VOLUME $DIR/.arkd/ +# Expose volume containing all 'coordinatord' data +VOLUME $DIR/.coordinatord/ -ENTRYPOINT [ "arkd" ] +ENTRYPOINT [ "coordinatord" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 8cb3cae..83a42a4 100755 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ ## build: build for all platforms build: - @echo "Building arkd binary..." + @echo "Building coordinatord binary..." @bash ./scripts/build ## clean: cleans the binary @@ -32,8 +32,8 @@ lint: ## run: run in dev mode run: clean - @echo "Running arkd in dev mode..." - @go run ./cmd/arkd + @echo "Running coordinatord in dev mode..." + @go run ./cmd/coordinatord ## test: runs unit and component tests test: diff --git a/api-spec/protobuf/arkd/v1/service.proto b/api-spec/protobuf/arkd/v1/service.proto deleted file mode 100755 index 3900743..0000000 --- a/api-spec/protobuf/arkd/v1/service.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; - -package arkd.v1; - -import "google/api/annotations.proto"; - -// TODO: Edit this proto to something more meaningful for your application. -service Service { - rpc GetVersion(GetVersionRequest) returns (GetVersionResponse) { - option (google.api.http) = { - post: "/v1/hello" - body: "*" - }; - } -} - -message GetVersionRequest { - string name = 1; -} -message GetVersionResponse { - string message = 1; -} - \ No newline at end of file diff --git a/api-spec/protobuf/buf.yaml b/api-spec/protobuf/buf.yaml index 54dab72..5b887f1 100755 --- a/api-spec/protobuf/buf.yaml +++ b/api-spec/protobuf/buf.yaml @@ -1,5 +1,5 @@ version: v1 -name: buf.build/ark-network/ark +name: buf.build/ark-network/coordinator deps: - buf.build/googleapis/googleapis breaking: diff --git a/api-spec/protobuf/coordinator/v1/service.proto b/api-spec/protobuf/coordinator/v1/service.proto new file mode 100755 index 0000000..e919b8a --- /dev/null +++ b/api-spec/protobuf/coordinator/v1/service.proto @@ -0,0 +1,68 @@ +syntax = "proto3"; + +package coordinator.v1; + +import "google/api/annotations.proto"; + +service CoordinatorService { + rpc RegisterPayment(RegisterPaymentRequest) returns (RegisterPaymentResponse) { + option (google.api.http) = { + post: "/v1/payment/register" + body: "*" + }; + }; + rpc FinalizePayment(FinalizePaymentRequest) returns (FinalizePaymentResponse) { + option (google.api.http) = { + post: "/v1/payment/finalize" + body: "*" + }; + }; + rpc ListPoolTransactions(ListPoolTransactionsRequest) returns (ListPoolTransactionsResponse) { + option (google.api.http) = { + post: "/v1/pools" + body: "*" + }; + }; + rpc GetPoolTransaction(GetPoolTransactionRequest) returns (GetPoolTransactionResponse) { + option (google.api.http) = { + get: "/v1/pool/{txid}" + }; + }; +} + +message RegisterPaymentRequest { + repeated Input inputs = 1; + repeated Output outputs = 2; +} +message RegisterPaymentResponse { + string vtx = 1; +} + +message FinalizePaymentRequest { + string signed_vtx = 1; +} +message FinalizePaymentResponse {} + +message ListPoolTransactionsRequest { + int64 start = 1; + int64 end = 2; +} +message ListPoolTransactionsResponse { + repeated string txs = 1; +} + +message GetPoolTransactionRequest { + string txid = 1; +} +message GetPoolTransactionResponse { + string txhex = 1; +} + +message Input { + string txid = 1; + uint32 vout = 2; +} +message Output { + string pubkey = 1; + uint64 amount = 2; +} \ No newline at end of file diff --git a/cmd/arkd/main.go b/cmd/coordinatord/main.go similarity index 100% rename from cmd/arkd/main.go rename to cmd/coordinatord/main.go diff --git a/goreleaser.Dockerfile b/goreleaser.Dockerfile index 753614e..22737f9 100755 --- a/goreleaser.Dockerfile +++ b/goreleaser.Dockerfile @@ -9,7 +9,7 @@ COPY . . RUN set -ex \ && if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then export TARGETPLATFORM=amd64; fi \ && if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then export TARGETPLATFORM=arm64; fi \ - && mv "arkd-linux-$TARGETPLATFORM" /usr/local/bin/arkd + && mv "coordinatord-linux-$TARGETPLATFORM" /usr/local/bin/coordinatord # $USER name, and data $DIR to be used in the 'final' image @@ -25,11 +25,11 @@ RUN adduser --disabled-password \ "$USER" USER $USER -# Prevents 'VOLUME $DIR/.arkd/' being created as owned by 'root' -RUN mkdir -p "$DIR/.arkd/" +# Prevents 'VOLUME $DIR/.coordinatord/' being created as owned by 'root' +RUN mkdir -p "$DIR/.coordinatord/" -# Expose volume containing all arkd data -VOLUME $DIR/.arkd/ +# Expose volume containing all coordinatord data +VOLUME $DIR/.coordinatord/ -ENTRYPOINT [ "arkd" ] +ENTRYPOINT [ "coordinatord" ] \ No newline at end of file diff --git a/scripts/build b/scripts/build index c9b0b02..00d126a 100755 --- a/scripts/build +++ b/scripts/build @@ -13,6 +13,6 @@ ARCH=$(eval "go env GOARCH") pushd $PARENT_PATH mkdir -p build -GO111MODULE=on go build -ldflags="-s -w" -o build/arkd-$OS-$ARCH cmd/arkd/main.go +GO111MODULE=on go build -ldflags="-s -w" -o build/coordinatord-$OS-$ARCH cmd/coordinatord/main.go popd \ No newline at end of file