From bd6199a7872ca05cb04cb01646bec1e84cfdcc23 Mon Sep 17 00:00:00 2001 From: altafan <18440657+altafan@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:43:51 +0100 Subject: [PATCH] Scaffolding --- .dockerignore | 7 ++ .github/workflows/ci.intergation.yaml | 19 ++++ .github/workflows/ci.unit.yaml | 32 ++++++ .github/workflows/release.yaml | 47 +++++++++ .gitignore | 21 ++++ .goreleaser.yaml | 99 +++++++++++++++++++ Dockerfile | 41 ++++++++ LICENSE | 22 +++++ Makefile | 58 +++++++++++ README.md | 1 + api-spec/protobuf/arkd/v1/service.proto | 23 +++++ api-spec/protobuf/buf.lock | 8 ++ api-spec/protobuf/buf.yaml | 12 +++ buf.gen.yaml | 20 ++++ buf.work.yaml | 4 + cmd/arkd/main.go | 40 ++++++++ go.mod | 7 ++ go.sum | 15 +++ goreleaser.Dockerfile | 35 +++++++ internal/config/.gitkeep | 0 internal/core/application/.gitkeep | 0 internal/core/domain/.gitkeep | 0 internal/core/ports/.gitkeep | 0 internal/infrastructure/.gitkeep | 0 internal/interface/grpc/handlers/.gitkeep | 0 internal/interface/grpc/interceptors/.gitkeep | 0 internal/interface/grpc/permissions/.gitkeep | 0 internal/interface/grpc/service.go | 22 +++++ internal/interface/service.go | 16 +++ internal/test/.gitkeep | 0 pkg/.gitkeep | 0 scripts/build | 18 ++++ 32 files changed, 567 insertions(+) create mode 100755 .dockerignore create mode 100755 .github/workflows/ci.intergation.yaml create mode 100755 .github/workflows/ci.unit.yaml create mode 100755 .github/workflows/release.yaml create mode 100755 .gitignore create mode 100755 .goreleaser.yaml create mode 100755 Dockerfile create mode 100755 LICENSE create mode 100755 Makefile create mode 100755 README.md create mode 100755 api-spec/protobuf/arkd/v1/service.proto create mode 100644 api-spec/protobuf/buf.lock create mode 100755 api-spec/protobuf/buf.yaml create mode 100755 buf.gen.yaml create mode 100755 buf.work.yaml create mode 100755 cmd/arkd/main.go create mode 100644 go.mod create mode 100644 go.sum create mode 100755 goreleaser.Dockerfile create mode 100755 internal/config/.gitkeep create mode 100755 internal/core/application/.gitkeep create mode 100755 internal/core/domain/.gitkeep create mode 100755 internal/core/ports/.gitkeep create mode 100755 internal/infrastructure/.gitkeep create mode 100755 internal/interface/grpc/handlers/.gitkeep create mode 100755 internal/interface/grpc/interceptors/.gitkeep create mode 100755 internal/interface/grpc/permissions/.gitkeep create mode 100755 internal/interface/grpc/service.go create mode 100755 internal/interface/service.go create mode 100755 internal/test/.gitkeep create mode 100755 pkg/.gitkeep create mode 100755 scripts/build diff --git a/.dockerignore b/.dockerignore new file mode 100755 index 0000000..50870ba --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +*.md +build +dist +.git +.github +Dockerfile + \ No newline at end of file diff --git a/.github/workflows/ci.intergation.yaml b/.github/workflows/ci.intergation.yaml new file mode 100755 index 0000000..f15d10d --- /dev/null +++ b/.github/workflows/ci.intergation.yaml @@ -0,0 +1,19 @@ +name: ci_integration + +on: + push: + branches: [master] + +jobs: + test: + name: integration tests + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: ">1.17.2" + - uses: actions/checkout@v3 + - run: go get -v -t -d ./... + - name: integration testing + run: make integrationtest + \ No newline at end of file diff --git a/.github/workflows/ci.unit.yaml b/.github/workflows/ci.unit.yaml new file mode 100755 index 0000000..f3786ac --- /dev/null +++ b/.github/workflows/ci.unit.yaml @@ -0,0 +1,32 @@ +name: ci_unit + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + test: + name: unit tests + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: ">1.17.2" + - uses: actions/checkout@v3 + - name: check linting + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 + - name: check code integrity + uses: securego/gosec@master + with: + args: '-severity high -quiet ./...' + - uses: bufbuild/buf-setup-action@v1.3.1 + - name: check proto linting + run: make proto-lint + - run: go get -v -t -d ./... + - name: unit testing + run: make test + \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100755 index 0000000..41b148d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,47 @@ +name: release + +on: + workflow_dispatch: + push: + tags: + - "*" + +jobs: + goreleaser: + runs-on: ubuntu-20.04 + env: + DOCKER_CLI_EXPERIMENTAL: "enabled" + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-go@v3 + with: + go-version: ">1.17.2" + - uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: release artifacts + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist --debug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + - uses: bufbuild/buf-setup-action@v1.3.1 + - name: release protos + uses: bufbuild/buf-push-action@v1 + with: + input: api-spec/protobuf + buf_token: ${{ secrets.BUF_TOKEN }} + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..43e4731 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with 'go test -c' +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +/build/ +/dist/ + +DS_Store +._.DS_Store +**/.DS_Store +**/._.DS_Store + \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100755 index 0000000..ab83b2a --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,99 @@ +builds: + - id: "arkd" + main: ./cmd/arkd + ldflags: + - -s -X 'main.version={{.Version}}' -X 'main.commit={{.Commit}}' -X 'main.date={{.Date}}' + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + binary: arkd + +## flag the semver v**.**.**-.* as pre-release on Github +release: + prerelease: auto + +checksum: + name_template: "checksums.txt" + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + use: github-native + +archives: + - id: arkd + format: binary + builds: + - arkd + name_template: "arkd-v{{ .Version }}-{{ .Os }}-{{ .Arch }}" + +dockers: + ########################### + # tag latest & prerelease # + ########################### + + #amd64 + - image_templates: + - "ghcr.io/ark-network/arkd:{{ .Tag }}-amd64" + # push always either release or prerelease with a docker tag with the semver only + skip_push: "false" + use: buildx + ids: + - arkd + dockerfile: goreleaser.Dockerfile + # GOOS of the built binaries/packages that should be used. + goos: linux + # GOARCH of the built binaries/packages that should be used. + goarch: amd64 + # Template of the docker build flags. + build_flag_templates: + - "--platform=linux/amd64" + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title=arkd" + - "--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" + # push always either release or prerelease with a docker tag with the semver only + skip_push: "false" + use: buildx + ids: + - arkd + dockerfile: goreleaser.Dockerfile + # GOOS of the built binaries/packages that should be used. + goos: linux + # GOARCH of the built binaries/packages that should be used. + goarch: arm64 + # Template of the docker build flags. + build_flag_templates: + - "--platform=linux/arm64/v8" + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.title=arkd" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + - "--build-arg=VERSION={{.Version}}" + - "--build-arg=COMMIT={{.Commit}}" + - "--build-arg=DATE={{.Date}}" + +docker_manifests: + - name_template: ghcr.io/ark-network/arkd:{{ .Tag }} + image_templates: + - ghcr.io/ark-network/arkd:{{ .Tag }}-amd64 + - ghcr.io/ark-network/arkd:{{ .Tag }}-arm64v8 + skip_push: "false" + + - name_template: ghcr.io/ark-network/arkd:latest + image_templates: + - ghcr.io/ark-network/arkd:{{ .Tag }}-amd64 + - ghcr.io/ark-network/arkd:{{ .Tag }}-arm64v8 + skip_push: auto + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..502875f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +# first image used to build the sources +FROM golang:1.21 AS builder + +ARG VERSION +ARG COMMIT +ARG DATE +ARG TARGETOS +ARG TARGETARCH + +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 + +# Second image, running the arkd executable +FROM debian:buster-slim + +# $USER name, and data $DIR to be used in the 'final' image +ARG USER=ark +ARG DIR=/home/ark + +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates + +COPY --from=builder /app/bin/* /usr/local/bin/ + +# NOTE: Default GID == UID == 1000 +RUN adduser --disabled-password \ + --home "$DIR/" \ + --gecos "" \ + "$USER" +USER $USER + +# Prevents 'VOLUME $DIR/.arkd/' being created as owned by 'root' +RUN mkdir -p "$DIR/.arkd/" + +# Expose volume containing all 'arkd' data +VOLUME $DIR/.arkd/ + +ENTRYPOINT [ "arkd" ] + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..3266959 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2023 ark-network + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..8cb3cae --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +.PHONY: build clean cov help intergrationtest lint run test vet proto proto-lint + +## build: build for all platforms +build: + @echo "Building arkd binary..." + @bash ./scripts/build + +## clean: cleans the binary +clean: + @echo "Cleaning..." + @go clean + +## cov: generates coverage report +cov: + @echo "Coverage..." + @go test -cover ./... + +## help: prints this help message +help: + @echo "Usage: \n" + @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' + +## intergrationtest: runs integration tests +integrationtest: + @echo "Running integration tests..." + @go test -v -count=1 -race ./... $(go list ./... | grep internal/test) + +## lint: lint codebase +lint: + @echo "Linting code..." + @golangci-lint run --fix + +## run: run in dev mode +run: clean + @echo "Running arkd in dev mode..." + @go run ./cmd/arkd + +## test: runs unit and component tests +test: + @echo "Running unit tests..." + @go test -v -count=1 -race ./... $(go list ./... | grep -v internal/test) + +## vet: code analysis +vet: + @echo "Running code analysis..." + @go vet ./... + + +## proto: compile proto stubs +proto: proto-lint + @echo "Compiling stubs..." + @buf generate + +## proto-lint: lint protos +proto-lint: + @echo "Linting protos..." + @buf lint + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100755 index 0000000..9e7d032 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# ark \ No newline at end of file diff --git a/api-spec/protobuf/arkd/v1/service.proto b/api-spec/protobuf/arkd/v1/service.proto new file mode 100755 index 0000000..3900743 --- /dev/null +++ b/api-spec/protobuf/arkd/v1/service.proto @@ -0,0 +1,23 @@ +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.lock b/api-spec/protobuf/buf.lock new file mode 100644 index 0000000..6c4355d --- /dev/null +++ b/api-spec/protobuf/buf.lock @@ -0,0 +1,8 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de diff --git a/api-spec/protobuf/buf.yaml b/api-spec/protobuf/buf.yaml new file mode 100755 index 0000000..54dab72 --- /dev/null +++ b/api-spec/protobuf/buf.yaml @@ -0,0 +1,12 @@ +version: v1 +name: buf.build/ark-network/ark +deps: + - buf.build/googleapis/googleapis +breaking: + use: + - FILE + ignore_unstable_packages: true +lint: + use: + - DEFAULT + \ No newline at end of file diff --git a/buf.gen.yaml b/buf.gen.yaml new file mode 100755 index 0000000..6efcb2d --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +1,20 @@ +version: v1 +managed: + enabled: true + go_package_prefix: + default: github.com/ark-network/ark/api-spec/protobuf/gen +plugins: + # Golang + - remote: buf.build/protocolbuffers/plugins/go + out: api-spec/protobuf/gen/go + opt: paths=source_relative + - remote: buf.build/grpc/plugins/go + out: api-spec/protobuf/gen/go + opt: paths=source_relative,require_unimplemented_servers=false + - remote: buf.build/grpc-ecosystem/plugins/grpc-gateway + out: api-spec/protobuf/gen + opt: paths=source_relative + #OpenApi + - remote: buf.build/grpc-ecosystem/plugins/openapiv2 + out: api-spec/openapi/swagger + \ No newline at end of file diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100755 index 0000000..20bc724 --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,4 @@ +version: v1 +directories: + - api-spec/protobuf + \ No newline at end of file diff --git a/cmd/arkd/main.go b/cmd/arkd/main.go new file mode 100755 index 0000000..904f120 --- /dev/null +++ b/cmd/arkd/main.go @@ -0,0 +1,40 @@ +package main + +import ( + "os" + "os/signal" + "syscall" + + log "github.com/sirupsen/logrus" + service_interface "github.com/ark-network/ark/internal/interface" +) + +//nolint:all +var ( + version = "dev" + commit = "none" + date = "unknown" +) + +// TODO: Edit this file to something more meaningful for your application. +func main() { + svc, err := service_interface.NewService() + if err != nil { + log.Fatal(err) + } + + log.RegisterExitHandler(svc.Stop) + + log.Info("starting service...") + if err := svc.Start(); err != nil { + log.Fatal(err) + } + + sigChan := make(chan os.Signal, 1) + signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT) + <-sigChan + + log.Info("shutting down service...") + log.Exit(0) +} + \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..c74c672 --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module github.com/ark-network/ark + +go 1.21.0 + +require github.com/sirupsen/logrus v1.9.3 + +require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..21f9bfb --- /dev/null +++ b/go.sum @@ -0,0 +1,15 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/goreleaser.Dockerfile b/goreleaser.Dockerfile new file mode 100755 index 0000000..753614e --- /dev/null +++ b/goreleaser.Dockerfile @@ -0,0 +1,35 @@ +FROM debian:buster-slim + +ARG TARGETPLATFORM + +WORKDIR /app + +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 + + +# $USER name, and data $DIR to be used in the 'final' image +ARG USER=ark +ARG DIR=/home/ark + +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates + +# NOTE: Default GID == UID == 1000 +RUN adduser --disabled-password \ + --home "$DIR/" \ + --gecos "" \ + "$USER" +USER $USER + +# Prevents 'VOLUME $DIR/.arkd/' being created as owned by 'root' +RUN mkdir -p "$DIR/.arkd/" + +# Expose volume containing all arkd data +VOLUME $DIR/.arkd/ + +ENTRYPOINT [ "arkd" ] + \ No newline at end of file diff --git a/internal/config/.gitkeep b/internal/config/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/core/application/.gitkeep b/internal/core/application/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/core/domain/.gitkeep b/internal/core/domain/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/core/ports/.gitkeep b/internal/core/ports/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/infrastructure/.gitkeep b/internal/infrastructure/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/interface/grpc/handlers/.gitkeep b/internal/interface/grpc/handlers/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/interface/grpc/interceptors/.gitkeep b/internal/interface/grpc/interceptors/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/interface/grpc/permissions/.gitkeep b/internal/interface/grpc/permissions/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/internal/interface/grpc/service.go b/internal/interface/grpc/service.go new file mode 100755 index 0000000..01c2293 --- /dev/null +++ b/internal/interface/grpc/service.go @@ -0,0 +1,22 @@ +package grpc_interface + +import ( + log "github.com/sirupsen/logrus" +) + +// TODO: Edit this file to something more meaningful for your application. +type service struct {} + +func NewService() (*service, error) { + return &service{}, nil +} + +func (s *service) Start() error { + log.Debug("service is listening") + return nil +} + +func (s *service) Stop() { + log.Debug("service stopped") +} + \ No newline at end of file diff --git a/internal/interface/service.go b/internal/interface/service.go new file mode 100755 index 0000000..b14123c --- /dev/null +++ b/internal/interface/service.go @@ -0,0 +1,16 @@ +package service_interface + +import ( + grpc_interface "github.com/ark-network/ark/internal/interface/grpc" +) + +// TODO: Edit this file to something more meaningful for your application. +type Service interface { + Start() error + Stop() +} + +func NewService() (Service, error) { + return grpc_interface.NewService() +} + \ No newline at end of file diff --git a/internal/test/.gitkeep b/internal/test/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/pkg/.gitkeep b/pkg/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/scripts/build b/scripts/build new file mode 100755 index 0000000..c9b0b02 --- /dev/null +++ b/scripts/build @@ -0,0 +1,18 @@ + +#!/bin/bash + +set -e + +PARENT_PATH=$(dirname $( + cd $(dirname $0) + pwd -P +)) + +OS=$(eval "go env GOOS") +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 +popd + \ No newline at end of file