Skip to content

Commit 3de485f

Browse files
committed
Created lab4 based on original work from Basics Workshop - lab 7. This is for Config Sync Groups and has all the boilerplate lab stuff included
1 parent 22d2a71 commit 3de485f

16 files changed

+271
-0
lines changed

labs/lab4/media/lab3_csg.png

338 KB
Loading

labs/lab4/media/lab3_csg_add.png

167 KB
Loading
313 KB
Loading
456 KB
Loading
380 KB
Loading
Loading
422 KB
Loading
479 KB
Loading

labs/lab4/media/lab3_csg_in_sync.png

462 KB
Loading

labs/lab4/media/lab3_csg_name.png

11.1 KB
Loading
Loading
50.4 KB
Loading
330 KB
Loading
Loading
87.4 KB
Loading

labs/lab4/readme.md

+271
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
# Nginx One Config Sync Groups
2+
3+
## Introduction
4+
5+
In this lab, we will show how to create and manage `Config Sync Groups` in the NGINX One Console. Config sync groups synchronize NGINX configurations across multiple NGINX instances, ensuring consistency and ease of management. If you’ve used instance groups in NGINX Instance Manager, you’ll find config sync groups in NGINX One similar. Let's go ahead and create one then add some instances to it.
6+
7+
<br/>
8+
9+
## Learning Objectives
10+
11+
By the end of the lab you will be able to:
12+
13+
- Create a Config Sync Group
14+
- Add instances to the group (OSS + NGinx Plus)
15+
- Make changes and apply a default config
16+
- Troubleshoot CSG issues
17+
18+
## Prerequisites
19+
20+
- You must have an F5 Distributed Cloud(XC) Account
21+
- You must have enabled NGINX One service on F5 Distributed Cloud(XC)
22+
- See `Lab0` for instructions on setting up your system for this Workshop
23+
- Familiarity with basic Linux concepts and commands
24+
- Familiarity with basic Nginx concepts and commands
25+
26+
### Create a Config Sync Group
27+
28+
- Under the `Manage` heading in the left hand column, click on `Config Sync Groups`.<br/>
29+
![Config Sync Groups](media/lab3_csg.png)<br/><br/>
30+
31+
- In the resulting panel at the top, click on the `Add Config Sync Group` button.<br/>
32+
![Add Config Sync Group](media/lab3_csg_add.png)<br/><br/>
33+
34+
- A modal window will pop up and ask you to give a name for the Config Sync Group. Here we will use the name:
35+
`basics-workshop-plus`<br/>
36+
![Config Sync Group Name](media/lab3_csg_name.png)<br/><br/>
37+
38+
### Create and add an instance to the group
39+
40+
On this page is a button that says `Add Instance to Config Sync Group`
41+
42+
<br/>
43+
44+
![Add Instance](media/lab3_csg_add_instance.png)
45+
46+
<br/>
47+
48+
This will pop up another modal window on the right. We will choose the second option that says: `Register a new instance with NGINX One and then add it to the config sync group`. Then proceed to click on the `Next` button.
49+
50+
<br/>
51+
52+
![Register New](media/lab3_csg_register_new.png)
53+
54+
<br/>
55+
56+
The next option is to generate a dataplane key or use an existing one. We will choose `Use existing Key` and enter `$TOKEN` so that we can use the variable that we created earlier (you can also paste the value of the key itself should you choose).
57+
58+
<br/>
59+
60+
![Use Existing Key](media/lab3_csg_use_existing_key.png)
61+
62+
<br/>
63+
64+
If you are testing on bare metal, there is a curl command listed to register things. We are going to choose the `Docker Container` option which will list the steps we need to perform. There are three of them as shown in the image below. We are going to modify them a bit (you may need sudo in your environment):
65+
66+
<br/>
67+
68+
![Docker instructions](media/lab3_csg_docker_instructions.png)
69+
70+
<br/>
71+
72+
Now that we saw the process as outlined in the NGINX One console, let's go over this again and run the provided commands in the terminal (with some modifications):
73+
74+
### Step 1
75+
76+
Confirm you are still logged in to the NGINX Private Registry. Replace `YOUR_JWT_HERE` with the content of the JSON Web Token (JWT) from MyF5 or you can use the environment variable you previously set: `$JWT`.
77+
78+
```bash
79+
docker login private-registry.nginx.com --username=$JWT --password=none
80+
```
81+
82+
### Step 2
83+
84+
Pull a docker image. Subject to availability, you can replace the agent with the specific NGINX Plus version, OS type and OS version you need. For example, r33-ubi-9. Here we are going to pull the r31 version of NGINX+ on alpine to demonstrate that.
85+
86+
```bash
87+
docker pull private-registry.nginx.com/nginx-plus/agent:nginx-plus-r31-alpine-3.19-20240522
88+
```
89+
90+
### Step 3
91+
92+
Start the container. We are going to modify the command shown in the console to use our environment variables. We are also going to add a `hostname` for the container as well as a `name` for it (to make it easier to work with).
93+
94+
```bash
95+
docker run \
96+
--hostname=basics-manual \
97+
--name=basics-manual \
98+
--env=NGINX_LICENSE_JWT="$JWT" \
99+
--env=NGINX_AGENT_SERVER_GRPCPORT=443 \
100+
--env=NGINX_AGENT_SERVER_HOST=agent.connect.nginx.com \
101+
--env=NGINX_AGENT_SERVER_TOKEN="$TOKEN" \
102+
--env=NGINX_AGENT_INSTANCE_GROUP=basics-workshop-plus \
103+
--env=NGINX_AGENT_TLS_ENABLE=true \
104+
--restart=always \
105+
--runtime=runc \
106+
-d private-registry.nginx.com/nginx-plus/agent:nginx-plus-r31-alpine-3.19-20240522
107+
```
108+
109+
You can see that the container starts up. With a refresh on the Config Sync Groups page, you will see that the basics-workshop-plus Config Sync Group now has 1 instance in it.
110+
111+
<br/>
112+
113+
![1 Manual Instance](media/lab3_csg_one_manual_instance.png)
114+
115+
<br/>
116+
117+
Hey, didn't we use docker compose to start our containers before? We can add instances to this `Config Sync Group` even easier than what we did above - automatically!
118+
119+
Let's stop our running containers by running:
120+
121+
```bash
122+
docker compose down
123+
```
124+
125+
Now open up the docker-compose.yml. You can uncomment the lines numbered 14, 36, & 58. This NGINX variable is all you need to add these to the instance group:
126+
127+
```bash
128+
NGINX_AGENT_INSTANCE_GROUP: basics-workshop-plus
129+
```
130+
131+
Let's launch the containers again and then watch the Nginx One console to see the instances added to the Config Sync Group.
132+
133+
```bash
134+
docker compose up
135+
```
136+
137+
Use the refresh button and you should see the three original instances added to our config group. These will only be the Plus instances as they were the instances to which we added the variable line.
138+
139+
<br/>
140+
141+
![3 Auto Instances](media/lab3_csg_three_auto_instances.png)
142+
143+
<br/>
144+
145+
Upon being added to the Config Instance group, NGINX One will attempt to apply the configuration of the group to the instances in it. Here we can see the config was immediately applied to **basics-plus-2**:
146+
147+
<br/>
148+
149+
![In Sync](media/lab3_csg_basics-plus-2.png)
150+
151+
<br/>
152+
153+
Before this finishes, let's show we can push a change to the whole group! Click on the `Configuration` button next to the `Details`. Then click the `Edit Config` button:
154+
<br/>
155+
156+
![Edit Config](media/lab3_csg_edit_config.png)
157+
158+
<br/>
159+
160+
On line 76, Let's simply add a comment, a trivial change. Then click the `Next` button.
161+
162+
<br/>
163+
164+
![Config Change](media/lab3_csg_config_change.png)
165+
166+
<br/>
167+
168+
The next screen allows you to see a diff between the two configs. After reviewing you can click `Save and Publish`.
169+
170+
<br>
171+
172+
![Save and Publish](media/lab3_csg_save_publish.png)
173+
174+
<br>
175+
176+
NGINX One will indicate the change was a success and push it to all of our instances. Click on the `Details` button of the group to see the status of the instances.
177+
178+
<br>
179+
180+
![Edit Success](media/lab3_csg_edit_success.png)
181+
182+
<br>
183+
184+
We can now see all the instances are in sync!
185+
186+
<br>
187+
188+
![In Sync](media/lab3_csg_in_sync.png)
189+
190+
<br>
191+
192+
---
193+
194+
**NOTE**
195+
196+
A final note... you can `mix OSS and Plus instances` in the same group! The important caveat is that the config features must be available to all instances. If you are going to be working with NGINX Plus specific configurations, you are better off putting those into their own Config Sync Group.
197+
198+
---
199+
200+
## Wrap UP
201+
202+
> If you are finished with this lab, you can use Docker Compose to shut down your test environment. Make sure you are in the `lab7` folder:
203+
204+
```bash
205+
docker compose down
206+
207+
```
208+
209+
```bash
210+
##Sample output##
211+
[+] Running 10/10
212+
✔ Container basics-oss3 Removed 6.4s
213+
✔ Container basics-plus2 Removed 10.7s
214+
✔ Container web1 Removed 0.5s
215+
✔ Container basics-oss1 Removed 5.5s
216+
✔ Container web2 Removed 0.4s
217+
✔ Container basics-plus1 Removed 10.7s
218+
✔ Container web3 Removed 0.5s
219+
✔ Container basics-oss2 Removed 6.2s
220+
✔ Container basics-plus3 Removed 10.6s
221+
✔ Network lab7_default Removed 0.1s
222+
223+
```
224+
225+
To clean up the manual container we added:
226+
227+
```bash
228+
docker ps | grep manual
229+
f8a5fb797615 private-registry.nginx.com/nginx-plus/agent:nginx-plus-r31-alpine-3.19-20240522 "/usr/bin/supervisor…" About an hour ago Up About an hour 80/tcp basics-manual
230+
```
231+
232+
Your container id will be different. You can stop it by using `docker stop <container id>`. Another tip, if you only have a few containers, docker will identify the container id with the first few characters (assuming they are unique). Here we use the first 3 characters and that's enough for docker to know which container we are talking about:
233+
234+
```bash
235+
docker stop f8a
236+
f8a
237+
```
238+
239+
As we are finished with this exercise we can fully remove the container image as well:
240+
241+
```bash
242+
docker rm f8a
243+
f8a
244+
```
245+
246+
Don't forget to stop all of the Nginx containers if you are finished with them, and Delete them from the Nginx One Instance inventory.
247+
248+
<br/>
249+
250+
<br/>
251+
252+
This ends lab4.
253+
254+
<br/>
255+
256+
## References
257+
258+
- [Nginx One Console](https://docs.nginx.com/nginx-one/)
259+
260+
<br/>
261+
262+
### Authors
263+
264+
- Chris Akker - Solutions Architect - Community and Alliances @ F5, Inc.
265+
- Shouvik Dutta - Solutions Architect - Community and Alliances @ F5, Inc.
266+
- Adam Currier - Solutions Architect - Community and Alliances @ F5, Inc.
267+
268+
---
269+
270+
Navigate to ([Lab5](../lab5/readme.md) | [LabGuide](../readme.md))
271+

0 commit comments

Comments
 (0)