diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d09f0a81..a26ca86b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,10 +109,10 @@ jobs: mkdir -p $HOME/.cache/snapcraft/stage-packages if: github.ref_type == 'tag' - - name: Build binaries + - name: Run GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 with: - version: latest + version: v2.2.0 # renovate: datasource=github-tags depName=goreleaser/goreleaser args: ${{ github.ref_type == 'tag' && 'release' || 'build --snapshot' }} --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 07914acf..673cc979 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +Starting with version 1.0.0 an automatically generated list of changes can be found on the [GitHub Releases page](https://github.com/nginxinc/nginx-asg-sync/releases). + ## 0.5.0 (February 24, 2021) IMPROVEMENTS: @@ -56,8 +58,8 @@ recommended steps to follow: status API. 3. Reload NGINX Plus to apply the updated configuration 4. Modify the /etc/nginx/aws.yaml file: - - Remove the `upstream_conf_endpoint` and `status_endpoint` fields. - - Add the `api_endpoint` field. See an example in the configuration section of the README.md + - Remove the `upstream_conf_endpoint` and `status_endpoint` fields. + - Add the `api_endpoint` field. See an example in the configuration section of the README.md 5. Download the Release 0.2 nginx-asg-sync package for your OS and upgrade the package using the OS tools (dpkg or rpm). 6. Check the logs of nginx-asg-sync to make sure that it is working properly after the upgrade. 7. Finally remove the upstream_conf and the status API from NGINX Plus configuration. diff --git a/Makefile b/Makefile index 5e386cec..ea22c451 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ lint: nginx-asg-sync: @go version || (code=$$?; printf "\033[0;31mError\033[0m: unable to build locally, try using the parameter TARGET=container or TARGET=download\n"; exit $$code) - CGO_ENABLED=0 GOFLAGS="-gcflags=-trimpath=$(shell go env GOPATH) -asmflags=-trimpath=$(shell go env GOPATH)" GOOS=linux go build -trimpath -ldflags "-s -w" -o nginx-asg-sync github.com/nginxinc/nginx-asg-sync/cmd/sync + CGO_ENABLED=0 GOFLAGS="-gcflags=-trimpath=$(shell go env GOPATH) -asmflags=-trimpath=$(shell go env GOPATH)" GOOS=linux go build -trimpath -ldflags "-s -w -X main.version=devel" -o nginx-asg-sync github.com/nginxinc/nginx-asg-sync/cmd/sync .PHONY: build-goreleaser build-goreleaser: diff --git a/README.md b/README.md index 972a85a0..679d7613 100644 --- a/README.md +++ b/README.md @@ -77,12 +77,12 @@ Support for other operating systems or architectures can be added. ### Manual Installation 1. Get a software package for your OS: - - For a stable release, download a package from the [releases page](https://github.com/nginxinc/nginx-asg-sync/releases). - - For the latest source code from the main branch, build a software package by following [these - instructions](#building-a-software-package). + - For a stable release, download a package from the [releases page](https://github.com/nginxinc/nginx-asg-sync/releases). + - For the latest source code from the main branch, build a software package by following [these + instructions](#building-a-software-package). 2. Install the package: - - For CentOS/RHEL based OSs, run: `sudo rpm -i .rpm` - - For Debian based OSs, run: `sudo dpkg -i .deb` + - For CentOS/RHEL based OSs, run: `sudo rpm -i .rpm` + - For Debian based OSs, run: `sudo dpkg -i .deb` ### Snap Installation @@ -198,12 +198,12 @@ parameter ensures NGINX Plus won't consider a newly added instance healthy until When using AWS it's possible to filter out the instances that are not in a `InService` state of the [Lifecycle](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html) with the parameter `in_service` set to `true`. This will ensure that the IP won't be added until the instance is ready to accept requests. -This also works when an instance is being terminated: the asg-sync will remove the IP of an instance that went from the +This also works when an instance is being terminated: the asg-sync will remove the IP of an instance that went from the `InService` state to one of the terminating states. > **Note** > -> Because the asg-sync works on a polling-based model, there will be a delay between the instance going to a +> Because the asg-sync works on a polling-based model, there will be a delay between the instance going to a > terminating state and the asg-sync removing its IP from NGINX Plus. To guarantee that NGINX Plus doesn't send any > requests to a terminated instance, make sure the instance goes to the `Terminating:Wait` state for a period greater > than the interval `sync_interval`. diff --git a/build/config.yaml.example b/build/config.yaml.example index 77adfd6b..37e870ad 100644 --- a/build/config.yaml.example +++ b/build/config.yaml.example @@ -5,16 +5,16 @@ # api_endpoint: http://127.0.0.1:8080/api # sync_interval: 5s # upstreams: -# - name: backend1 -# autoscaling_group: backend-group-1 +# - name: backend-one +# autoscaling_group: backend-one-group # port: 80 # kind: http -# - name: backend2 -# autoscaling_group: backend-group-2 +# - name: backend-two +# autoscaling_group: backend-two-group # port: 80 # kind: http # - name: tcp-backend -# autoscaling_group: backend-group-3 +# autoscaling_group: backend-three-group # port: 80 # kind: stream @@ -26,15 +26,15 @@ # api_endpoint: http://127.0.0.1:8080/api # sync_interval: 5s # upstreams: -# - name: backend1 -# virtual_machine_scale_set: backend-group-1 +# - name: backend-one +# virtual_machine_scale_set: backend-one-group # port: 80 # kind: http -# - name: backend2 -# virtual_machine_scale_set: backend-group-2 +# - name: backend-two +# virtual_machine_scale_set: backend-two-group # port: 80 # kind: http # - name: tcp-backend -# virtual_machine_scale_set: backend-group-3 +# virtual_machine_scale_set: backend-three-group # port: 80 # kind: stream diff --git a/cmd/sync/main.go b/cmd/sync/main.go index abf2a2f5..c58db265 100644 --- a/cmd/sync/main.go +++ b/cmd/sync/main.go @@ -17,7 +17,7 @@ import ( var ( configFile = flag.String("config_path", "/etc/nginx/config.yaml", "Path to the config file") logFile = flag.String("log_path", "", "Path to the log file. If the file doesn't exist, it will be created") - version = "0.5.0" + version string ) const connTimeoutInSecs = 10 diff --git a/examples/aws.md b/examples/aws.md index 607ff1da..bd6c8210 100644 --- a/examples/aws.md +++ b/examples/aws.md @@ -29,23 +29,23 @@ sync_interval: 5s cloud_provider: AWS profile: default upstreams: - - name: backend-one - autoscaling_group: backend-one-group - port: 80 - kind: http - max_conns: 0 - max_fails: 1 - fail_timeout: 10s - slow_start: 0s - - name: backend-two - autoscaling_group: backend-two-group - port: 80 - kind: http - max_conns: 0 - max_fails: 1 - fail_timeout: 10s - slow_start: 0s - in_service: true + - name: backend-one + autoscaling_group: backend-one-group + port: 80 + kind: http + max_conns: 0 + max_fails: 1 + fail_timeout: 10s + slow_start: 0s + - name: backend-two + autoscaling_group: backend-two-group + port: 80 + kind: http + max_conns: 0 + max_fails: 1 + fail_timeout: 10s + slow_start: 0s + in_service: true ``` - The `api_endpoint` key defines the NGINX Plus API endpoint. diff --git a/examples/azure.md b/examples/azure.md index 8b083316..229dd5b0 100644 --- a/examples/azure.md +++ b/examples/azure.md @@ -31,22 +31,22 @@ cloud_provider: Azure subscription_id: my_subscription_id resource_group_name: my_resource_group upstreams: - - name: backend-one - virtual_machine_scale_set: backend-one-group - port: 80 - kind: http - max_conns: 0 - max_fails: 1 - fail_timeout: 10s - slow_start: 0s - - name: backend-two - virtual_machine_scale_set: backend-two-group - port: 80 - kind: http - max_conns: 0 - max_fails: 1 - fail_timeout: 10s - slow_start: 0s + - name: backend-one + virtual_machine_scale_set: backend-one-group + port: 80 + kind: http + max_conns: 0 + max_fails: 1 + fail_timeout: 10s + slow_start: 0s + - name: backend-two + virtual_machine_scale_set: backend-two-group + port: 80 + kind: http + max_conns: 0 + max_fails: 1 + fail_timeout: 10s + slow_start: 0s ``` - The `api_endpoint` key defines the NGINX Plus API endpoint.