Skip to content

Update package layout #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/build
/build_output
.DS_Store

65 changes: 65 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/aws/aws-sdk-go"
version = "1.14.29"

[[constraint]]
name = "gopkg.in/yaml.v2"
version = "2.2.1"

[prune]
go-tests = true
unused-packages = true
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GO_DOCKER_RUN = docker run --rm -v $(shell pwd)/cmd/sync:/go/src/github.com/nginxinc/nginx-asg-sync/cmd/sync -v $(shell pwd)/build:/build -w /go/src/github.com/nginxinc/nginx-asg-sync/cmd/sync
GO_DOCKER_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/nginx-asg-sync -v $(shell pwd)/build_output:/build_output -w /go/src/github.com/nginxinc/nginx-asg-sync/cmd/sync
GOLANG_CONTAINER = golang:1.10

all: amazon centos7 ubuntu-trusty ubuntu-xenial
Expand All @@ -7,25 +7,25 @@ test:
$(GO_DOCKER_RUN) $(GOLANG_CONTAINER) go test

compile: test
$(GO_DOCKER_RUN) $(GOLANG_CONTAINER) go build -o /build/nginx-asg-sync
$(GO_DOCKER_RUN) $(GOLANG_CONTAINER) go build -o /build_output/nginx-asg-sync

amazon: compile
make -C os-packages/builders/amazon/
docker run --rm -v $(shell pwd)/os-packages/rpm:/rpm -v $(shell pwd)/build:/build amazon-builder
make -C build/package/builders/amazon/
docker run --rm -v $(shell pwd)/build/package/rpm:/rpm -v $(shell pwd)/build_output:/build_output amazon-builder

centos7: compile
make -C os-packages/builders/centos7/
docker run --rm -v $(shell pwd)/os-packages/rpm:/rpm -v $(shell pwd)/build:/build centos7-builder
make -C build/package/builders/centos7/
docker run --rm -v $(shell pwd)/build/package/rpm:/rpm -v $(shell pwd)/build_output:/build_output centos7-builder

ubuntu-xenial: compile
make -C os-packages/builders/ubuntu-xenial/
docker run --rm -v $(shell pwd)/os-packages/debian:/debian -v $(shell pwd)/build:/build ubuntu-xenial-builder
make -C build/package/builders/ubuntu-xenial/
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-xenial-builder

ubuntu-trusty: compile
make -C os-packages/builders/ubuntu-trusty/
docker run --rm -v $(shell pwd)/os-packages/debian:/debian -v $(shell pwd)/build:/build ubuntu-trusty-builder
make -C build/package/builders/ubuntu-trusty/
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-trusty-builder

clean:
-rm -r build
-rm -r build_output

.PHONY: test
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/nginxinc/nginx-asg-sync)](https://goreportcard.com/report/github.com/nginxinc/nginx-asg-sync)

# NGINX Plus Integration with AWS Auto Scaling groups -- nginx-asg-sync

**nginx-asg-sync** allows [NGINX Plus](https://www.nginx.com/products/) to discover instances of [AWS Auto Scaling groups](http://docs.aws.amazon.com/autoscaling/latest/userguide/WhatIsAutoScaling.html). When the number of instances in an Auto Scaling group changes, nginx-asg-sync adds the new instances to the NGINX Plus configuration and removes the terminated ones.

## How It Works
nginx-asg-sync must be installed on the same EC2 instance with NGINX Plus. nginx-asg-sync constantly monitors backend Auto Scaling groups via the AWS Auto Scaling API.
nginx-asg-sync is an agent process that runs on the same EC2 instance as NGINX Plus. It polls for changes to the backend Auto Scaling groups via the AWS Auto Scaling API.
When it sees that a scaling event has happened, it adds or removes the corresponding backend instances from the NGINX Plus configuration via the NGINX Plus API.

**Note:** nginx-asg-sync does not scale Auto Scaling groups, it only gets the IP addresses of the instances of Auto Scaling groups.
Expand Down Expand Up @@ -114,7 +116,7 @@ server {

### nginx-asg-sync Configuration

nginx-asg-sync is configured in the file **aws.yaml** in the **/etc/nginx** folder. For our example, we define the following configuration:
nginx-asg-sync is configured in **/etc/nginx/aws.yaml**. For our example, we define the following configuration:

```yaml
region: us-west-2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM amazonlinux:latest
FROM amazonlinux:2018.03.0.20180424

RUN yum install -y rpmdevtools
ADD build.sh /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
mkdir -p ~/rpmbuild
cp -r rpm/* ~/rpmbuild/
rpmbuild -bb ~/rpmbuild/SPECS/nginx-asg-sync.spec
cp ~/rpmbuild/RPMS/x86_64/*.rpm /build
cp ~/rpmbuild/RPMS/x86_64/*.rpm /build_output
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
mkdir -p ~/rpmbuild
cp -r rpm/* ~/rpmbuild/
rpmbuild -bb ~/rpmbuild/SPECS/nginx-asg-sync.spec
cp ~/rpmbuild/RPMS/x86_64/*.rpm /build
cp ~/rpmbuild/RPMS/x86_64/*.rpm /build_output
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ sed -i 's/%%CODENAME%%/trusty/g' debian/changelog
rm debian/nginx-asg-sync.service
dpkg-buildpackage -us -uc
cd ..
mv *.deb /build/
mv *.deb /build_output/
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ sed -i 's/%%CODENAME%%/xenial/g' debian/changelog
rm debian/nginx-asg-sync.upstart
dpkg-buildpackage -us -uc
cd ..
mv *.deb /build/
mv *.deb /build_output/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion os-packages/debian/rules → build/package/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

override_dh_auto_install:
dh_auto_install
/usr/bin/install -m 755 /build/nginx-asg-sync debian/nginx-asg-sync/usr/sbin/
/usr/bin/install -m 755 /build_output/nginx-asg-sync debian/nginx-asg-sync/usr/sbin/
/usr/bin/install -m 644 debian/aws.yaml.example debian/nginx-asg-sync/etc/nginx/
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ with AWS Auto Scaling groups
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_sbindir}/

install -m 755 -p /build/nginx-asg-sync %{buildroot}%{_sbindir}/
install -m 755 -p /build_output/nginx-asg-sync %{buildroot}%{_sbindir}/

%if %{use_systemd}
mkdir -p %{buildroot}%{_unitdir}
Expand Down
161 changes: 0 additions & 161 deletions cmd/sync/Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions cmd/sync/Godeps/Readme

This file was deleted.

Loading