Skip to content

Commit

Permalink
feat: remove debug api (#4674)
Browse files Browse the repository at this point in the history
  • Loading branch information
acha-bill authored May 29, 2024
1 parent 97e7ee6 commit 79a7991
Show file tree
Hide file tree
Showing 49 changed files with 84 additions and 1,610 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
if: steps.checkdocs.outputs.build_docs == 'true'
uses: acud/openapi-dockerized@v1
with:
build-roots: 'openapi/Swarm.yaml openapi/SwarmDebug.yaml'
build-roots: 'openapi/Swarm.yaml'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DO_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DO_AWS_SECRET_ACCESS_KEY }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ jobs:
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Set the API and debug API versions
- name: Set the API version
run: |
echo "BEE_API_VERSION=$(grep '^ version:' openapi/Swarm.yaml | awk '{print $2}')" >> $GITHUB_ENV
echo "BEE_DEBUG_API_VERSION=$(grep '^ version:' openapi/SwarmDebug.yaml | awk '{print $2}')" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand All @@ -50,4 +49,3 @@ jobs:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
BEE_API_VERSION: ${{ env.BEE_API_VERSION }}
BEE_DEBUG_API_VERSION: ${{ env.BEE_DEBUG_API_VERSION }}
5 changes: 0 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ builds:
- -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }}
- -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }}
- -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }}
- -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }}
env:
- CGO_ENABLED=0
goos:
Expand All @@ -43,7 +42,6 @@ builds:
- -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }}
- -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }}
- -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }}
- -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }}
env:
- CGO_ENABLED=0
goos:
Expand All @@ -69,7 +67,6 @@ builds:
- -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }}
- -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }}
- -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }}
- -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }}
env:
- CGO_ENABLED=0
goos:
Expand All @@ -89,7 +86,6 @@ builds:
- -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }}
- -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }}
- -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }}
- -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }}
env:
- CGO_ENABLED=0
goos:
Expand All @@ -108,7 +104,6 @@ builds:
- -X github.com/ethersphere/bee/v2.commitHash={{ .ShortCommit }}
- -X github.com/ethersphere/bee/v2.commitTime={{ .CommitTimestamp }}
- -X github.com/ethersphere/bee/v2/pkg/api.Version={{ .Env.BEE_API_VERSION }}
- -X github.com/ethersphere/bee/v2/pkg/debugapi.Version={{ .Env.BEE_DEBUG_API_VERSION }}
env:
- CGO_ENABLED=0
goos:
Expand Down
4 changes: 2 additions & 2 deletions CODING.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ A value of `all` will enable the highest verbosity of V-level.

Examples:

`curl -XPUT http://localhost:1635/loggers/bm9kZS8q/none` - will disable all loggers; `bm9kZS8q` is base64 encoded `node/*` regular expression.
`curl -XPUT http://localhost:1633/loggers/bm9kZS8q/none` - will disable all loggers; `bm9kZS8q` is base64 encoded `node/*` regular expression.

`curl -XPUT http://localhost:1635/loggers/bm9kZS9hcGlbMV1bXT4-ODI0NjM0OTMzMjU2/error` - will set the verbosity of the logger with the subsystem `node/api[1][]>>824634933256` to `error`.
`curl -XPUT http://localhost:1633/loggers/bm9kZS9hcGlbMV1bXT4-ODI0NjM0OTMzMjU2/error` - will set the verbosity of the logger with the subsystem `node/api[1][]>>824634933256` to `error`.

## Commit Messages

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ These are work items that are good if you're contributing to the codebase for th

- Performance optimizations

The best way to propose any optimizations would be to provide the relevant data to describe the problem and then also the same data after the optimizations are done. Keep in mind, Bee nodes work in a distributed system, so changes that would seem good locally may not hold in some cases. The Bee client in debug mode can show you metrics as well as pprof information. This can be used to demonstrate the optimizations.
The best way to propose any optimizations would be to provide the relevant data to describe the problem and then also the same data after the optimizations are done. Keep in mind, Bee nodes work in a distributed system, so changes that would seem good locally may not hold in some cases. The Bee client can show you metrics as well as pprof information. This can be used to demonstrate the optimizations.

- Concurrency related optimizations

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN mkdir -p /home/bee/.bee && chown 999:999 /home/bee/.bee

COPY --from=build /src/dist/bee /usr/local/bin/bee

EXPOSE 1633 1634 1635
EXPOSE 1633 1634
USER bee
WORKDIR /home/bee
VOLUME /home/bee/.bee
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN addgroup --system bee --gid 998; \

COPY bee /bee

EXPOSE 1633 1634 1635
EXPOSE 1633 1634
USER bee
WORKDIR /home/bee

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.goreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN mkdir -p /home/bee/.bee && chown 999:999 /home/bee/.bee

COPY bee /usr/local/bin/bee

EXPOSE 1633 1634 1635
EXPOSE 1633 1634
USER bee
WORKDIR /home/bee
VOLUME /home/bee/.bee
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.scratch
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs
COPY --from=0 /etc/passwd /etc/passwd
COPY --from=0 /home /home

EXPOSE 1633 1634 1635
EXPOSE 1633 1634
USER bee
WORKDIR /home/bee
VOLUME /home/bee/.bee
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ REACHABILITY_OVERRIDE_PUBLIC ?= false
BATCHFACTOR_OVERRIDE_PUBLIC ?= 5

BEE_API_VERSION ?= "$(shell grep '^ version:' openapi/Swarm.yaml | awk '{print $$2}')"
BEE_DEBUG_API_VERSION ?= "$(shell grep '^ version:' openapi/SwarmDebug.yaml | awk '{print $$2}')"

VERSION ?= "$(shell git describe --tags --abbrev=0 | cut -c2-)"
COMMIT_HASH ?= "$(shell git describe --long --dirty --always --match "" || true)"
Expand All @@ -24,7 +23,6 @@ LDFLAGS ?= -s -w \
-X github.com/ethersphere/bee/v2.commitHash="$(COMMIT_HASH)" \
-X github.com/ethersphere/bee/v2.commitTime="$(COMMIT_TIME)" \
-X github.com/ethersphere/bee/v2/pkg/api.Version="$(BEE_API_VERSION)" \
-X github.com/ethersphere/bee/v2/pkg/api.DebugVersion="$(BEE_DEBUG_API_VERSION)" \
-X github.com/ethersphere/bee/v2/pkg/p2p/libp2p.reachabilityOverridePublic="$(REACHABILITY_OVERRIDE_PUBLIC)" \
-X github.com/ethersphere/bee/v2/pkg/postage/listener.batchFactorOverridePublic="$(BATCHFACTOR_OVERRIDE_PUBLIC)"

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[![codecov](https://codecov.io/gh/ethersphere/bee/branch/master/graph/badge.svg?token=63RNRLO3RU)](https://codecov.io/gh/ethersphere/bee)
[![Go Report Card](https://goreportcard.com/badge/github.com/ethersphere/bee)](https://goreportcard.com/report/github.com/ethersphere/bee)
[![API OpenAPI Specs](https://img.shields.io/badge/openapi-api-blue)](https://docs.ethswarm.org/api/)
[![Debug API OpenAPI Specs](https://img.shields.io/badge/openapi-debugapi-lightblue)](https://docs.ethswarm.org/debug-api/)
![Docker Pulls](https://img.shields.io/docker/pulls/ethersphere/bee)
![GitHub all releases](https://img.shields.io/github/downloads/ethersphere/bee/total)
![GitHub](https://img.shields.io/github/license/ethersphere/bee)
Expand All @@ -27,7 +26,7 @@ There are two versioning schemes used in Bee that you should be aware of. The ma
strict Semantic Versioning. Bee hosts different peer-to-peer wire protocol implementations and individual protocol breaking changes would necessitate a bump in the major part of the version. Breaking changes are expected with bumps of the minor version component. New (backward-compatible) features and bug fixes are expected with a bump of the patch component. Major version bumps are reserved for significant changes in Swarm's incentive structure.


The second set of versions that are important are the Bee's API versions (denoted in our [Bee](https://github.com/ethersphere/bee/blob/master/openapi/Swarm.yaml) and [Bee Debug](https://github.com/ethersphere/bee/blob/master/openapi/SwarmDebug.yaml) OpenAPI specifications). These versions **do follow**
The second is the Bee's API version (denoted in our [Bee](https://github.com/ethersphere/bee/blob/master/openapi/Swarm.yaml) OpenAPI specifications). This version **follows**
Semantic Versioning and hence you should follow these for breaking changes.

## Contributing
Expand Down
4 changes: 0 additions & 4 deletions cmd/bee/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ const (
optionNameP2PAddr = "p2p-addr"
optionNameNATAddr = "nat-addr"
optionNameP2PWSEnable = "p2p-ws-enable"
optionNameDebugAPIEnable = "debug-api-enable"
optionNameDebugAPIAddr = "debug-api-addr"
optionNameBootnodes = "bootnode"
optionNameNetworkID = "network-id"
optionWelcomeMessage = "welcome-message"
Expand Down Expand Up @@ -256,8 +254,6 @@ func (c *command) setAllFlags(cmd *cobra.Command) {
cmd.Flags().String(optionNameNATAddr, "", "NAT exposed address")
cmd.Flags().Bool(optionNameP2PWSEnable, false, "enable P2P WebSocket transport")
cmd.Flags().StringSlice(optionNameBootnodes, []string{""}, "initial nodes to connect to")
cmd.Flags().Bool(optionNameDebugAPIEnable, false, "enable debug HTTP API")
cmd.Flags().String(optionNameDebugAPIAddr, ":1635", "debug HTTP API listen address")
cmd.Flags().Uint64(optionNameNetworkID, chaincfg.Mainnet.NetworkID, "ID of the Swarm network")
cmd.Flags().StringSlice(optionCORSAllowedOrigins, []string{}, "origins with CORS headers enabled")
cmd.Flags().Bool(optionNameTracingEnabled, false, "enable tracing")
Expand Down
7 changes: 0 additions & 7 deletions cmd/bee/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (c *command) initStartCmd() (err error) {

fmt.Print(beeWelcomeMessage)
fmt.Printf("\n\nversion: %v - planned to be supported until %v, please follow https://ethswarm.org/\n\n", bee.Version, endSupportDate())
fmt.Printf("DEPRECATION NOTICE:\nThe Debug API is deprecated and will be removed in the next release, version [2.2.0].\nPlease update your integrations to use the main Bee API to avoid service disruptions.\n\n")
logger.Info("bee version", "version", bee.Version)

go startTimeBomb(logger)
Expand Down Expand Up @@ -214,11 +213,6 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
}
}

debugAPIAddr := c.config.GetString(optionNameDebugAPIAddr)
if !c.config.GetBool(optionNameDebugAPIEnable) {
debugAPIAddr = ""
}

signerConfig, err := c.configureSigner(cmd, logger)
if err != nil {
return nil, err
Expand Down Expand Up @@ -301,7 +295,6 @@ func buildBeeNode(ctx context.Context, c *command, cmd *cobra.Command, logger lo
DBWriteBufferSize: c.config.GetUint64(optionNameDBWriteBufferSize),
DBDisableSeeksCompaction: c.config.GetBool(optionNameDBDisableSeeksCompaction),
APIAddr: c.config.GetString(optionNameAPIAddr),
DebugAPIAddr: debugAPIAddr,
Addr: c.config.GetString(optionNameP2PAddr),
NATAddr: c.config.GetString(optionNameNATAddr),
EnableWS: c.config.GetBool(optionNameP2PWSEnable),
Expand Down
8 changes: 0 additions & 8 deletions cmd/bee/cmd/start_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,9 @@ func (c *command) initStartDevCmd() (err error) {
fmt.Println("Starting in development mode")
fmt.Println()

debugAPIAddr := c.config.GetString(optionNameDebugAPIAddr)
if !c.config.GetBool(optionNameDebugAPIEnable) {
debugAPIAddr = ""
}

// generate signer in here
b, err := node.NewDevBee(logger, &node.DevOptions{
APIAddr: c.config.GetString(optionNameAPIAddr),
DebugAPIAddr: debugAPIAddr,
Logger: logger,
DBOpenFilesLimit: c.config.GetUint64(optionNameDBOpenFilesLimit),
DBBlockCacheCapacity: c.config.GetUint64(optionNameDBBlockCacheCapacity),
Expand Down Expand Up @@ -140,9 +134,7 @@ func (c *command) initStartDevCmd() (err error) {
},
}

cmd.Flags().Bool(optionNameDebugAPIEnable, true, "enable debug HTTP API")
cmd.Flags().String(optionNameAPIAddr, ":1633", "HTTP API listen address")
cmd.Flags().String(optionNameDebugAPIAddr, ":1635", "debug HTTP API listen address")
cmd.Flags().String(optionNameVerbosity, "info", "log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace")
cmd.Flags().Uint64(optionNameDevReserveCapacity, 4194304, "cache reserve capacity")
cmd.Flags().StringSlice(optionCORSAllowedOrigins, []string{}, "origins with CORS headers enabled")
Expand Down
4 changes: 0 additions & 4 deletions openapi/SwarmCommon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,6 @@ components:
type: string
default: "0.0.0"
description: The default value is set in case the bee binary was not build correctly.
debugApiVersion:
type: string
default: "0.0.0"
description: The default value is set in case the bee binary was not build correctly.

PostageBatch:
type: object
Expand Down
Loading

0 comments on commit 79a7991

Please sign in to comment.