From 37db31bd85903686de57b23da747d779aa561985 Mon Sep 17 00:00:00 2001 From: Marcelo Salloum dos Santos Date: Wed, 10 Mar 2021 18:41:19 -0300 Subject: [PATCH] services/regulated-assets-approval-server-demo: remove "demo" suffix (#3462) ### What Remove "demo" suffix from `regulated-assets-approval-server-demo`. ### Why The "demo" suffix is not a common pattern for this kind of application and after using the service I realized it'd be better without it. --- Makefile | 4 +-- .../docker/Dockerfile | 14 --------- .../CHANGELOG.md | 0 .../Makefile | 4 +-- .../README.md | 30 ++++++++----------- .../cmd/serve.go | 4 +-- .../docker/Dockerfile | 14 +++++++++ .../main.go | 6 ++-- .../serve/handlers.go | 0 .../serve/middleware.go | 0 .../serve/serve.go | 4 +-- 11 files changed, 38 insertions(+), 42 deletions(-) delete mode 100644 services/regulated-assets-approval-server-demo/docker/Dockerfile rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/CHANGELOG.md (100%) rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/Makefile (67%) rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/README.md (59%) rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/cmd/serve.go (95%) create mode 100644 services/regulated-assets-approval-server/docker/Dockerfile rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/main.go (81%) rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/serve/handlers.go (100%) rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/serve/middleware.go (100%) rename services/{regulated-assets-approval-server-demo => regulated-assets-approval-server}/serve/serve.go (92%) diff --git a/Makefile b/Makefile index 9eb77e1bd7..df6045061e 100644 --- a/Makefile +++ b/Makefile @@ -17,5 +17,5 @@ webauth: recoverysigner: $(MAKE) -C exp/services/recoverysigner/ docker-build -regulated-assets-approval-server-demo: - $(MAKE) -C services/regulated-assets-approval-server-demo/ docker-build \ No newline at end of file +regulated-assets-approval-server: + $(MAKE) -C services/regulated-assets-approval-server/ docker-build \ No newline at end of file diff --git a/services/regulated-assets-approval-server-demo/docker/Dockerfile b/services/regulated-assets-approval-server-demo/docker/Dockerfile deleted file mode 100644 index 51bb7fdb83..0000000000 --- a/services/regulated-assets-approval-server-demo/docker/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM golang:1.16 as build - -ADD . /src/regulated-assets-approval-server-demo -WORKDIR /src/regulated-assets-approval-server-demo -RUN go build -o /bin/regulated-assets-approval-server-demo ./services/regulated-assets-approval-server-demo - - -FROM ubuntu:20.04 - -RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates -COPY --from=build /bin/regulated-assets-approval-server-demo /app/ -EXPOSE 8000 -ENTRYPOINT ["/app/regulated-assets-approval-server-demo"] -CMD ["serve"] diff --git a/services/regulated-assets-approval-server-demo/CHANGELOG.md b/services/regulated-assets-approval-server/CHANGELOG.md similarity index 100% rename from services/regulated-assets-approval-server-demo/CHANGELOG.md rename to services/regulated-assets-approval-server/CHANGELOG.md diff --git a/services/regulated-assets-approval-server-demo/Makefile b/services/regulated-assets-approval-server/Makefile similarity index 67% rename from services/regulated-assets-approval-server-demo/Makefile rename to services/regulated-assets-approval-server/Makefile index 7d35d7cb4b..cf7cdbbd8d 100644 --- a/services/regulated-assets-approval-server-demo/Makefile +++ b/services/regulated-assets-approval-server/Makefile @@ -2,14 +2,14 @@ SUDO := $(shell docker version >/dev/null 2>&1 || echo "sudo") # If TAG is not provided set default value -TAG ?= stellar/regulated-assets-approval-server-demo:$(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n)) +TAG ?= stellar/regulated-assets-approval-server:$(shell git rev-parse --short HEAD)$(and $(shell git status -s),-dirty-$(shell id -u -n)) # https://github.com/opencontainers/image-spec/blob/master/annotations.md BUILD_DATE := $(shell date --utc --rfc-3339=seconds) docker-build: cd ../../ && \ $(SUDO) docker build --pull --label org.opencontainers.image.created="$(BUILD_DATE)" \ - -f services/regulated-assets-approval-server-demo/docker/Dockerfile -t $(TAG) . + -f services/regulated-assets-approval-server/docker/Dockerfile -t $(TAG) . docker-push: cd ../../ && \ diff --git a/services/regulated-assets-approval-server-demo/README.md b/services/regulated-assets-approval-server/README.md similarity index 59% rename from services/regulated-assets-approval-server-demo/README.md rename to services/regulated-assets-approval-server/README.md index fbecca04ee..8422503fb6 100644 --- a/services/regulated-assets-approval-server-demo/README.md +++ b/services/regulated-assets-approval-server/README.md @@ -1,4 +1,4 @@ -# regulated-assets-approval-server-demo +# regulated-assets-approval-server ``` Varsion: v0.0.1 @@ -13,35 +13,32 @@ intended for **testing only**. It is being concieved to: 2. Serve as a demo server where wallets can test and validate their SEP-8 implementation. -Please be aware this is a demo and its code is not mean to be used in a -production application. - ## Usage -``` +```sh $ go install -$ regulated-assets-approval-server-demo --help -SEP-8 Approval Server Demo +$ regulated-assets-approval-server --help +SEP-8 Approval Server Usage: - regulated-assets-approval-server-demo [command] [flags] - regulated-assets-approval-server-demo [command] + regulated-assets-approval-server [command] [flags] + regulated-assets-approval-server [command] Available Commands: - serve Run the SEP-8 Approval Server Demo + serve Serve the SEP-8 Approval Server -Use "regulated-assets-approval-server-demo [command] --help" for more information about a command. +Use "regulated-assets-approval-server [command] --help" for more information about a command. ``` ## Usage: Serve -``` +```sh $ go install -$ regulated-assets-approval-server-demo serve --help -Run the SEP-8 Approval Server Demo +$ regulated-assets-approval-server serve --help +Serve the SEP-8 Approval Server Usage: - regulated-assets-approval-server-demo serve [flags] + regulated-assets-approval-server serve [flags] Flags: --horizon-url string Horizon URL used for looking up account details (HORIZON_URL) (default "https://horizon-testnet.stellar.org/") @@ -49,5 +46,4 @@ Flags: --port int Port to listen and serve on (PORT) (default 8000) ``` - -[SEP-8]: https://github.com/stellar/stellar-protocol/blob/7c795bb9abc606cd1e34764c4ba07900d58fe26e/ecosystem/sep-0008.md \ No newline at end of file +[SEP-8]: https://github.com/stellar/stellar-protocol/blob/7c795bb9abc606cd1e34764c4ba07900d58fe26e/ecosystem/sep-0008.md diff --git a/services/regulated-assets-approval-server-demo/cmd/serve.go b/services/regulated-assets-approval-server/cmd/serve.go similarity index 95% rename from services/regulated-assets-approval-server-demo/cmd/serve.go rename to services/regulated-assets-approval-server/cmd/serve.go index 3f879cb723..1b77388a25 100644 --- a/services/regulated-assets-approval-server-demo/cmd/serve.go +++ b/services/regulated-assets-approval-server/cmd/serve.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cobra" "github.com/stellar/go/clients/horizonclient" "github.com/stellar/go/network" - "github.com/stellar/go/services/regulated-assets-approval-server-demo/serve" + "github.com/stellar/go/services/regulated-assets-approval-server/serve" "github.com/stellar/go/support/config" ) @@ -42,7 +42,7 @@ func (c *ServeCommand) Command() *cobra.Command { } cmd := &cobra.Command{ Use: "serve", - Short: "Run the SEP-8 Approval Server Demo", + Short: "Serve the SEP-8 Approval Server", Run: func(_ *cobra.Command, _ []string) { configOpts.Require() configOpts.SetValues() diff --git a/services/regulated-assets-approval-server/docker/Dockerfile b/services/regulated-assets-approval-server/docker/Dockerfile new file mode 100644 index 0000000000..f9db869025 --- /dev/null +++ b/services/regulated-assets-approval-server/docker/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.16 as build + +ADD . /src/regulated-assets-approval-server +WORKDIR /src/regulated-assets-approval-server +RUN go build -o /bin/regulated-assets-approval-server ./services/regulated-assets-approval-server + + +FROM ubuntu:20.04 + +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates +COPY --from=build /bin/regulated-assets-approval-server /app/ +EXPOSE 8000 +ENTRYPOINT ["/app/regulated-assets-approval-server"] +CMD ["serve"] diff --git a/services/regulated-assets-approval-server-demo/main.go b/services/regulated-assets-approval-server/main.go similarity index 81% rename from services/regulated-assets-approval-server-demo/main.go rename to services/regulated-assets-approval-server/main.go index 3698313a5a..f641fdc6ee 100644 --- a/services/regulated-assets-approval-server-demo/main.go +++ b/services/regulated-assets-approval-server/main.go @@ -3,7 +3,7 @@ package main import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" - "github.com/stellar/go/services/regulated-assets-approval-server-demo/cmd" + "github.com/stellar/go/services/regulated-assets-approval-server/cmd" "github.com/stellar/go/support/log" ) @@ -12,8 +12,8 @@ func main() { log.DefaultLogger.Logger.Level = logrus.TraceLevel rootCmd := &cobra.Command{ - Use: "regulated-assets-approval-server-demo [command]", - Short: "SEP-8 Approval Server Demo", + Use: "regulated-assets-approval-server [command]", + Short: "SEP-8 Approval Server", Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, diff --git a/services/regulated-assets-approval-server-demo/serve/handlers.go b/services/regulated-assets-approval-server/serve/handlers.go similarity index 100% rename from services/regulated-assets-approval-server-demo/serve/handlers.go rename to services/regulated-assets-approval-server/serve/handlers.go diff --git a/services/regulated-assets-approval-server-demo/serve/middleware.go b/services/regulated-assets-approval-server/serve/middleware.go similarity index 100% rename from services/regulated-assets-approval-server-demo/serve/middleware.go rename to services/regulated-assets-approval-server/serve/middleware.go diff --git a/services/regulated-assets-approval-server-demo/serve/serve.go b/services/regulated-assets-approval-server/serve/serve.go similarity index 92% rename from services/regulated-assets-approval-server-demo/serve/serve.go rename to services/regulated-assets-approval-server/serve/serve.go index ae48553a30..f1006507de 100644 --- a/services/regulated-assets-approval-server-demo/serve/serve.go +++ b/services/regulated-assets-approval-server/serve/serve.go @@ -29,11 +29,11 @@ func Serve(opts Options) { WriteTimeout: time.Second * 35, IdleTimeout: time.Minute * 2, OnStarting: func() { - log.Info("Starting SEP-8 Approval Server Demo") + log.Info("Starting SEP-8 Approval Server") log.Infof("Listening on %s", listenAddr) }, OnStopping: func() { - log.Info("Stopping SEP-8 Approval Server Demo") + log.Info("Stopping SEP-8 Approval Server") }, } supporthttp.Run(serverConfig)