Skip to content

Commit 8700a23

Browse files
Renamed demo and added unprivileged docker image support (#173)
* Renamed demo and added unprivileged docker image support * Renamed demo and added unprivileged docker image support
1 parent 5804237 commit 8700a23

File tree

12 files changed

+438
-342
lines changed

12 files changed

+438
-342
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ utilizing *fleet* and *etcd*.
1717

1818
* **mysql-galera-demo**: This demo uses NGINX Plus as a TCP load balancer for a MySQL Galera cluster consisting of two mysqld servers. It does round-robin load balancing between the 2 mysqld servers and also does active health checks using an xinetd script running on port 9200 inside each mysqld container.
1919

20-
* **nginx-agent-docker**: This demo helps building a docker image to deploy NGINX Plus and NGINX Agent for NGINX Management Suite, with optional support for NGINX App Protect WAF and NGINX Developer Portal for API Connectivity Manager
20+
* **nginx-docker-builder**: This demo helps building a docker image to deploy NGINX Plus (privileged and unprivileged), NGINX App Protect WAF and NGINX Agent for NGINX Instance Manager and NGINX One Console
2121

2222
* **nginx-hello**: NGINX running as webserver in a docker container that serves a simple page containing the container's hostname, IP address and port
2323

nginx-agent-docker/README.md

-109
This file was deleted.

nginx-agent-docker/container/start.sh

-82
This file was deleted.

nginx-agent-docker/manifests/1.nginx-with-agent.yaml

-95
This file was deleted.

nginx-agent-docker/scripts/nginxWithAgentStart.sh

-20
This file was deleted.

nginx-agent-docker/Dockerfile.oss renamed to nginx-docker-builder/Dockerfile.oss

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FROM nginx:stable-bullseye-perl
22

33
ARG NMS_URL
4+
ARG NGINX_AGENT=false
45

56
# Initial packages setup
67
RUN apt-get -y update \
@@ -15,10 +16,13 @@ RUN apt-get -y update \
1516
&& groupadd -g 1001 nginx-agent \
1617
&& usermod root -G nginx-agent \
1718
&& usermod nginx -G nginx-agent \
18-
# NGINX Instance Manager agent installation
19-
&& if [ `curl -o /dev/null -sk -w "%{http_code}\n" $NMS_URL/install/nginx-agent` = 200 ] ; then \
20-
bash -c 'export DATA_PLANE_KEY="placeholder" && curl -k $NMS_URL/install/nginx-agent | sh' && echo "NGINX Agent installed"; else \
21-
bash -c 'export DATA_PLANE_KEY="placeholder" && curl -k $NMS_URL/nginx-agent/install | sh || :' && echo "NGINX Agent installed"; fi
19+
# NGINX Agent
20+
&& if [ "$NGINX_AGENT" = "true" ] ; then \
21+
apt-get -y install curl gnupg2 ca-certificates lsb-release debian-archive-keyring \
22+
&& curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor > /usr/share/keyrings/nginx-archive-keyring.gpg \
23+
&& echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://packages.nginx.org/nginx-agent/debian/ `lsb_release -cs` agent" > /etc/apt/sources.list.d/nginx-agent.list \
24+
&& apt-get -y update \
25+
&& apt-get -y install nginx-agent; fi
2226

2327
# Startup script
2428
COPY ./container/start.sh /deployment/

nginx-agent-docker/Dockerfile.plus renamed to nginx-docker-builder/Dockerfile.plus

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM debian:bullseye-slim
22

3-
ARG NMS_URL
43
ARG NAP_WAF=false
4+
ARG NGINX_AGENT=false
55

66
# Initial packages setup
77
RUN apt-get -y update \
@@ -12,7 +12,7 @@ RUN apt-get -y update \
1212
&& wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq \
1313
&& chmod +x /usr/bin/yq
1414

15-
# Use certificate and key from kubernetes secret
15+
# Use certificate and key from secret
1616
RUN --mount=type=secret,id=nginx-crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
1717
--mount=type=secret,id=nginx-key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
1818
set -x \
@@ -32,14 +32,12 @@ RUN --mount=type=secret,id=nginx-crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644
3232
# Forward request logs to Docker log collector
3333
&& ln -sf /dev/stdout /var/log/nginx/access.log \
3434
&& ln -sf /dev/stderr /var/log/nginx/error.log \
35-
# User and group
36-
&& groupadd -g 1001 nginx-agent \
37-
&& usermod root -G nginx-agent \
38-
&& usermod nginx -G nginx-agent \
39-
# NGINX Instance Manager agent installation
40-
&& if [ `curl -o /dev/null -sk -w "%{http_code}\n" $NMS_URL/install/nginx-agent` = 200 ] ; then \
41-
bash -c 'export DATA_PLANE_KEY="placeholder" && curl -k $NMS_URL/install/nginx-agent | sh' && echo "NGINX Agent installed"; else \
42-
bash -c 'export DATA_PLANE_KEY="placeholder" && curl -k $NMS_URL/nginx-agent/install | sh || :' && echo "NGINX Agent installed"; fi
35+
# NGINX Agent
36+
&& if [ "$NGINX_AGENT" = "true" ] ; then \
37+
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor > /usr/share/keyrings/nginx-archive-keyring.gpg \
38+
&& echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://packages.nginx.org/nginx-agent/debian/ `lsb_release -cs` agent" > /etc/apt/sources.list.d/nginx-agent.list \
39+
&& apt-get -y update \
40+
&& apt-get -y install nginx-agent; fi
4341

4442
# Startup script
4543
COPY ./container/start.sh /deployment/

0 commit comments

Comments
 (0)