Skip to content

Commit 14f9439

Browse files
lucacomepleshakov
andauthored
Update build files (#73)
* Update build files * Update README.md Co-authored-by: Michael Pleshakov <[email protected]> * Add licenses Co-authored-by: Michael Pleshakov <[email protected]>
1 parent 1211fb6 commit 14f9439

File tree

15 files changed

+5809
-1065
lines changed

15 files changed

+5809
-1065
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ jobs:
158158
image: centos8-builder:${{ github.sha }}
159159
run: /build.sh
160160
options: -v ${{ github.workspace }}/build/package/rpm:/rpm -v ${{ github.workspace }}/build_output:/build_output
161-
- name: Build Image Ubuntu Xenial
161+
- name: Build Image Debian
162162
uses: docker/build-push-action@v2
163163
with:
164164
file: build/Dockerfile
@@ -167,70 +167,12 @@ jobs:
167167
load: true
168168
cache-from: type=local,src=/tmp/.buildx-cache
169169
cache-to: type=local,dest=/tmp/.buildx-cache
170-
tags: ubuntu-xenial-builder:${{ github.sha }}
170+
tags: debian-builder:${{ github.sha }}
171171
build-args: |
172-
CONTAINER_VERSION=ubuntu:xenial
173172
OS_TYPE=deb_based
174-
- name: Run Ubuntu Xenial
173+
- name: Run Debian
175174
uses: addnab/docker-run-action@v2
176175
with:
177-
image: ubuntu-xenial-builder:${{ github.sha }}
178-
run: /build.sh
179-
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
180-
- name: Build Image Ubuntu Bionic
181-
uses: docker/build-push-action@v2
182-
with:
183-
file: build/Dockerfile
184-
context: '.'
185-
target: local
186-
load: true
187-
cache-from: type=local,src=/tmp/.buildx-cache
188-
cache-to: type=local,dest=/tmp/.buildx-cache
189-
tags: ubuntu-bionic-builder:${{ github.sha }}
190-
build-args: |
191-
CONTAINER_VERSION=ubuntu:bionic
192-
OS_TYPE=deb_based
193-
- name: Run Ubuntu Bionic
194-
uses: addnab/docker-run-action@v2
195-
with:
196-
image: ubuntu-bionic-builder:${{ github.sha }}
197-
run: /build.sh
198-
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
199-
- name: Build Image Ubuntu Focal
200-
uses: docker/build-push-action@v2
201-
with:
202-
file: build/Dockerfile
203-
context: '.'
204-
target: local
205-
load: true
206-
cache-from: type=local,src=/tmp/.buildx-cache
207-
cache-to: type=local,dest=/tmp/.buildx-cache
208-
tags: ubuntu-focal-builder:${{ github.sha }}
209-
build-args: |
210-
CONTAINER_VERSION=ubuntu:focal
211-
OS_TYPE=deb_based
212-
- name: Run Ubuntu Focal
213-
uses: addnab/docker-run-action@v2
214-
with:
215-
image: ubuntu-focal-builder:${{ github.sha }}
216-
run: /build.sh
217-
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output
218-
- name: Build Image Ubuntu Groovy
219-
uses: docker/build-push-action@v2
220-
with:
221-
file: build/Dockerfile
222-
context: '.'
223-
target: local
224-
load: true
225-
cache-from: type=local,src=/tmp/.buildx-cache
226-
cache-to: type=local,dest=/tmp/.buildx-cache
227-
tags: ubuntu-groovy-builder:${{ github.sha }}
228-
build-args: |
229-
CONTAINER_VERSION=ubuntu:groovy
230-
OS_TYPE=deb_based
231-
- name: Run Ubuntu Groovy
232-
uses: addnab/docker-run-action@v2
233-
with:
234-
image: ubuntu-groovy-builder:${{ github.sha }}
176+
image: debian-builder:${{ github.sha }}
235177
run: /build.sh
236178
options: -v ${{ github.workspace }}/build/package/debian:/debian -v ${{ github.workspace }}/build_output:/build_output

Makefile

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TARGET ?= local
44

55
export DOCKER_BUILDKIT = 1
66

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

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

38-
ubuntu-xenial: build
39-
docker build -t ubuntu-xenial-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:xenial --build-arg OS_TYPE=deb_based -f build/Dockerfile .
40-
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-xenial-builder
41-
42-
ubuntu-bionic: build
43-
docker build -t ubuntu-bionic-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:bionic --build-arg OS_TYPE=deb_based -f build/Dockerfile .
44-
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-bionic-builder
45-
46-
ubuntu-focal: build
47-
docker build -t ubuntu-focal-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:focal --build-arg OS_TYPE=deb_based -f build/Dockerfile .
48-
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-focal-builder
49-
50-
ubuntu-groovy: build
51-
docker build -t ubuntu-groovy-builder --target ${TARGET} --build-arg CONTAINER_VERSION=ubuntu:groovy --build-arg OS_TYPE=deb_based -f build/Dockerfile .
52-
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output ubuntu-groovy-builder
38+
debian: build
39+
docker build -t debian-builder --target ${TARGET} --build-arg OS_TYPE=deb_based -f build/Dockerfile .
40+
docker run --rm -v $(shell pwd)/build/package/debian:/debian -v $(shell pwd)/build_output:/build_output debian-builder
5341

5442
.PHONY: clean
5543
clean:

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Below you will find documentation on how to use nginx-asg-sync.
4343

4444
We provide packages for the following operating systems:
4545

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

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

6161
### NGINX Plus Configuration
6262

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

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

153-
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`
153+
For Ubuntu >= 16.04, Debian 9/10, CentOS7/RHEL7, CentOS8/RHEL8 and Amazon Linux 2, run: `$ sudo service nginx-asg-sync start|stop|restart`
154154

155155
## Troubleshooting
156156

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

177174
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:
178175

179-
`$ make ubuntu-focal TARGET=container`
176+
`$ make debian TARGET=container`
180177

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

build/Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
ARG CONTAINER_VERSION=ubuntu:groovy
1+
ARG CONTAINER_VERSION=amazonlinux:2
22
ARG OS_TYPE=deb_based
3-
ARG PACKAGE_VERSION=0.4-1
43

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

2019
#---------------------------------------------------------------------------------------------
2120

22-
FROM ${CONTAINER_VERSION} as deb_based
21+
FROM debian:buster as deb_based
2322

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

27-
ARG PACKAGE_VERSION
28-
ARG CONTAINER_VERSION
29-
ENV PACKAGE_VERSION=${PACKAGE_VERSION}
30-
ENV CONTAINER_VERSION=${CONTAINER_VERSION}
31-
3226
ENTRYPOINT ["/build.sh"]
3327

3428
#---------------------------------------------------------------------------------------------
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
#!/bin/bash
22

3-
package_name=nginx-asg-sync-${PACKAGE_VERSION}
4-
5-
export SYSTEMD='--with=systemd'
6-
export OS_VERSION=${CONTAINER_VERSION#*:}
7-
8-
mkdir -p ~/${package_name}/
9-
cp -r /debian ~/${package_name}/
10-
cd ~/${package_name}/
11-
sed -i "s/%%CODENAME%%/${OS_VERSION}/g" debian/changelog
12-
rm debian/nginx-asg-sync.upstart
3+
mkdir -p ~/nginx-asg-sync/
4+
cp -r /debian ~/nginx-asg-sync/
5+
cd ~/nginx-asg-sync/
136
dpkg-buildpackage -us -uc
147
cd ..
158
mv *.deb /build_output/

build/package/debian/changelog

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
nginx-asg-sync (0.4-1-%%CODENAME%%) unstable; urgency=low
1+
nginx-asg-sync (0.4-1) unstable; urgency=low
22

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

8-
nginx-asg-sync (0.3-1-%%CODENAME%%) unstable; urgency=low
8+
-- Raul Marrero <[email protected]> Fri, 22 Nov 2019 12:06:02 +0000
9+
10+
nginx-asg-sync (0.3-1) unstable; urgency=low
911

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

1315
-- Raul Marrero <[email protected]> Wed, 4 Sep 2019 14:06:00 +0000
1416

15-
nginx-asg-sync (0.2-1-%%CODENAME%%) unstable; urgency=low
17+
nginx-asg-sync (0.2-1) unstable; urgency=low
1618

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

2224
-- Peter Kelly <[email protected]> Fri, 27 Jul 2018 13:48:00 +0000
2325

24-
nginx-asg-sync (0.1-2-%%CODENAME%%) unstable; urgency=low
26+
nginx-asg-sync (0.1-2) unstable; urgency=low
2527

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

2931
-- Michael Pleshakov <[email protected]> Wed, 30 Aug 2017 21:03:28 +0000
3032

31-
nginx-asg-sync (0.1-1-%%CODENAME%%) unstable; urgency=low
33+
nginx-asg-sync (0.1-1) unstable; urgency=low
3234

3335
* 0.1-1
3436
* First release

build/package/debian/compat

Lines changed: 0 additions & 1 deletion
This file was deleted.

build/package/debian/control

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Source: nginx-asg-sync
2-
Section: misc
2+
Section: contrib
33
Priority: optional
44
Maintainer: Michael Pleshakov <[email protected]>
5-
Build-Depends: debhelper (>= 8.0.0)
6-
Standards-Version: 3.9.4
5+
Build-Depends: debhelper-compat (= 12)
6+
Standards-Version: 4.5.1
77
Homepage: https://github.com/nginxinc/nginx-asg-sync
88

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

0 commit comments

Comments
 (0)