03 注销实例

nacos 基于 2.2.4 版本

注销实例的 curl

1
2
3
4
5
curl --location --request DELETE 'http://localhost:8848/nacos/v2/ns/instance' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'serviceName=test' \
--data-urlencode 'ip=1.2.3.4' \
--data-urlencode 'port=80'

注销实例的主流程

源码位置: com.alibaba.nacos.naming.controllers.v2.InstanceControllerV2#deregister

02 注册实例

nacos 基于 2.2.4 版本

注册实例的 curl

1
2
3
4
5
curl --location 'http://localhost:8848/nacos/v2/ns/instance' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'serviceName=test' \
--data-urlencode 'ip=1.2.3.4' \
--data-urlencode 'port=80'

注册实例的主流程

源码位置: com.alibaba.nacos.naming.controllers.v2.InstanceControllerV2#register

Github 上使用 Goreleaser

1. goreleaser 的简单说明

1
2
3
4
5
6
7
8
9
# install goreleaser
brew install goreleaser

# init goreleaser, create .goreleaser.yml
goreleaser init

# available commands
goreleaser build --clean
goreleaser release --snapshot --clean

2. .goreleaser.yml 示例文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
  hooks:
    # You may remove this if you don't use go modules.
    - go mod tidy
    # you may remove this if you don't need go generate
#    - go generate ./...
builds:
  - id: http-tunnel-client
    binary: http-tunnel-client
    main: ./cmd/http-tunnel-client
    env:
      - CGO_ENABLED=0
    goos:
      - linux
      - windows
      - darwin
    goarch:
      - amd64
      - arm64
  - id: http-tunnel-server
    binary: http-tunnel-server
    main: ./cmd/http-tunnel-server
    env:
      - CGO_ENABLED=0
    goos:
      - linux
      - windows
      - darwin
    goarch:
      - amd64
      - arm64
archives:
  - format: tar.gz
    # this name template makes the OS and Arch compatible with the results of uname.
    name_template: >-
      {{ .ProjectName }}_
      {{- .Version }}_
      {{- title .Os }}_
      {{- .Arch }}
      {{- if .Arm }}v{{ .Arm }}{{ end }}
    # use zip for windows archives
    format_overrides:
      - goos: windows
        format: zip
checksum:
  name_template: 'checksums.txt'
snapshot:
  name_template: "{{ incpatch .Version }}-next"
changelog:
  sort: asc
  filters:
    exclude:
      - '^docs:'
      - '^test:'

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

3. github action 配置

文件路径:.github/workflows/goreleaser.yml