Skip to content

Commit

Permalink
Update build files
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Feb 23, 2021
1 parent 1211fb6 commit 17b79f6
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 563 deletions.
20 changes: 4 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TARGET ?= local

export DOCKER_BUILDKIT = 1

all: amazon centos7 centos8 ubuntu-xenial amazon2 ubuntu-bionic ubuntu-focal ubuntu-groovy
all: amazon amazon2 centos7 centos8 debian

.PHONY: test
test:
Expand Down Expand Up @@ -35,21 +35,9 @@ centos8: build
docker build -t centos8-builder --target ${TARGET} --build-arg CONTAINER_VERSION=centos:8 --build-arg OS_TYPE=rpm_based -f build/Dockerfile .
docker run --rm -v $(shell pwd)/build/package/rpm:/rpm -v $(shell pwd)/build_output:/build_output centos8-builder

ubuntu-xenial: build
docker build -t ubuntu-xenial-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:xenial --build-arg OS_TYPE=deb_based -f build/Dockerfile .
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-xenial-builder

ubuntu-bionic: build
docker build -t ubuntu-bionic-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:bionic --build-arg OS_TYPE=deb_based -f build/Dockerfile .
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-bionic-builder

ubuntu-focal: build
docker build -t ubuntu-focal-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:focal --build-arg OS_TYPE=deb_based -f build/Dockerfile .
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-focal-builder

ubuntu-groovy: build
docker build -t ubuntu-groovy-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:groovy --build-arg OS_TYPE=deb_based -f build/Dockerfile .
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-groovy-builder
debian: build
docker build -t debian-builder --target ${TARGET} --build-arg OS_TYPE=deb_based -f build/Dockerfile .
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output debian-builder

.PHONY: clean
clean:
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Below you will find documentation on how to use nginx-asg-sync.

We provide packages for the following operating systems:

* Ubuntu: 16.04 (Xenial), 18.04 (Bionic), 20.04 (Focal), 20.10 (Groovy)
* Ubuntu/Debian: 16.04 and later, Debian 9/10
* CentOS/RHEL: 7, 8
* Amazon Linux: 1, 2

Expand All @@ -56,7 +56,7 @@ Support for other operating systems can be added.
* For the latest source code from the master branch, build a software package by following [these instructions](#building-a-software-package).
2. Install the package:
* For Amazon Linux or CentOS/RHEL, run: `$ sudo rpm -i <package-name>.rpm`
* For Ubuntu, run: `$ sudo dpkg -i <package-name>.deb`
* For Ubuntu or Debian, run: `$ sudo dpkg -i <package-name>.deb`

### NGINX Plus Configuration

Expand Down Expand Up @@ -150,7 +150,7 @@ nginx-asg-sync runs as a system service and supports the start/stop/restart comm

For Amazon Linux 1, run: `$ sudo start|stop|restart nginx-asg-sync`

For Ubuntu 16.04, 18.04, 20.04, 20.10, CentOS7/RHEL7, CentOS8/RHEL8 and Amazon Linux 2, run: `$ sudo service nginx-asg-sync start|stop|restart`
For Ubuntu >= 16.04, Debian 9/10, CentOS7/RHEL7, CentOS8/RHEL8 and Amazon Linux 2, run: `$ sudo service nginx-asg-sync start|stop|restart`

## Troubleshooting

Expand All @@ -169,14 +169,11 @@ where `<os>` is the target OS. The following values are allowed:
* `amazon2` for Amazon Linux 2
* `centos7` for CentOS7/RHEL7
* `centos8` for CentOS8/RHEL8
* `ubuntu-xenial` for Ubuntu 16.04
* `ubuntu-bionic` for Ubuntu 18.04
* `ubuntu-focal` for Ubuntu 20.04
* `ubuntu-groovy` for Ubuntu 20.10
* `debian` for Ubuntu >= 16.04 and Debian 9/10

by default the nginx-asg-sync binary will be built locally, to build it inside a Docker container add the `TARGET` parameter to `make`, for example:

`$ make ubuntu-focal TARGET=container`
`$ make debian TARGET=container`

If you run make without any arguments, it will build software packages for all supported OSes.

Expand Down
12 changes: 3 additions & 9 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ARG CONTAINER_VERSION=ubuntu:groovy
ARG CONTAINER_VERSION=amazonlinux:2
ARG OS_TYPE=deb_based
ARG PACKAGE_VERSION=0.4-1

FROM golang:1.16-alpine AS builder
WORKDIR /go/src/github.com/nginxinc/nginx-asg-sync/cmd/sync
Expand All @@ -19,16 +18,11 @@ ENTRYPOINT ["/build.sh"]

#---------------------------------------------------------------------------------------------

FROM ${CONTAINER_VERSION} as deb_based
FROM debian:buster as deb_based

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install debhelper dh-systemd -y
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install build-essential debhelper-compat -y
ADD build/package/builders/deb_based/build.sh /

ARG PACKAGE_VERSION
ARG CONTAINER_VERSION
ENV PACKAGE_VERSION=${PACKAGE_VERSION}
ENV CONTAINER_VERSION=${CONTAINER_VERSION}

ENTRYPOINT ["/build.sh"]

#---------------------------------------------------------------------------------------------
Expand Down
13 changes: 3 additions & 10 deletions build/package/builders/deb_based/build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
#!/bin/bash

package_name=nginx-asg-sync-${PACKAGE_VERSION}

export SYSTEMD='--with=systemd'
export OS_VERSION=${CONTAINER_VERSION#*:}

mkdir -p ~/${package_name}/
cp -r /debian ~/${package_name}/
cd ~/${package_name}/
sed -i "s/%%CODENAME%%/${OS_VERSION}/g" debian/changelog
rm debian/nginx-asg-sync.upstart
mkdir -p ~/nginx-asg-sync/
cp -r /debian ~/nginx-asg-sync/
cd ~/nginx-asg-sync/
dpkg-buildpackage -us -uc
cd ..
mv *.deb /build_output/
12 changes: 7 additions & 5 deletions build/package/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
nginx-asg-sync (0.4-1-%%CODENAME%%) unstable; urgency=low
nginx-asg-sync (0.4-1) unstable; urgency=low

* 0.4-1
* Add support to set upstream server parameters (max_conns, max_fails, fail_timeout and slow_start)
* Add support to use wildcards in AWS autoscaling groups
* Allow to use the same AWS region as the instance where the nginx-asg-sync is running

nginx-asg-sync (0.3-1-%%CODENAME%%) unstable; urgency=low
-- Raul Marrero <raul.marrero@nginx.com> Fri, 22 Nov 2019 12:06:02 +0000

nginx-asg-sync (0.3-1) unstable; urgency=low

* 0.3-1
* Add support for Azure Virtual Machine Scale Sets

-- Raul Marrero <raul.marrero@nginx.com> Wed, 4 Sep 2019 14:06:00 +0000

nginx-asg-sync (0.2-1-%%CODENAME%%) unstable; urgency=low
nginx-asg-sync (0.2-1) unstable; urgency=low

* 0.2-1
* Add supporting guides for contributing and changelog
Expand All @@ -21,14 +23,14 @@ nginx-asg-sync (0.2-1-%%CODENAME%%) unstable; urgency=low

-- Peter Kelly <peter.kelly@nginx.com> Fri, 27 Jul 2018 13:48:00 +0000

nginx-asg-sync (0.1-2-%%CODENAME%%) unstable; urgency=low
nginx-asg-sync (0.1-2) unstable; urgency=low

* 0.1-2
* Make sure nginx-asg-sync works with NGINX Plus R13

-- Michael Pleshakov <michael@nginx.com> Wed, 30 Aug 2017 21:03:28 +0000

nginx-asg-sync (0.1-1-%%CODENAME%%) unstable; urgency=low
nginx-asg-sync (0.1-1) unstable; urgency=low

* 0.1-1
* First release
Expand Down
1 change: 0 additions & 1 deletion build/package/debian/compat

This file was deleted.

8 changes: 4 additions & 4 deletions build/package/debian/control
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Source: nginx-asg-sync
Section: misc
Section: contrib
Priority: optional
Maintainer: Michael Pleshakov <michael@nginx.com>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.4
Build-Depends: debhelper-compat (= 12)
Standards-Version: 4.5.1
Homepage: https://github.com/nginxinc/nginx-asg-sync

Package: nginx-asg-sync
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Pre-Depends: nginx-plus
Description: NGINX Plus Integration with Cloud Autoscaling
This package contains software that integrates NGINX Plus
with AWS Auto Scaling groups and Azure Virtual Machine Scale Sets
Loading

0 comments on commit 17b79f6

Please sign in to comment.