|
| 1 | +--- |
| 2 | +title: "Lab 5: Upgrade NGINX Plus to the latest version" |
| 3 | +weight: 500 |
| 4 | +toc: true |
| 5 | +nd-content-type: tutorial |
| 6 | +nd-product: |
| 7 | +- nginx-one |
| 8 | +- nginx-plus |
| 9 | +--- |
| 10 | + |
| 11 | +## Overview |
| 12 | + |
| 13 | +In this lab, you upgrade NGINX Plus from R32 (or earlier) to the latest version in two ways: |
| 14 | + |
| 15 | +- **Docker**: Deploy a new container running the latest NGINX Plus image, add it to your Config Sync Group, then shift traffic and retire older containers. |
| 16 | +- **VM**: Push your JWT license to an existing VM instance, install the new NGINX Plus package, and restart the service. |
| 17 | + |
| 18 | +Pick the scenario that matches your setup. |
| 19 | + |
| 20 | +## What you’ll learn |
| 21 | + |
| 22 | +By the end of this lab, you’ll know how to: |
| 23 | + |
| 24 | +- Deploy a Docker container running the latest NGINX Plus with NGINX Agent installed |
| 25 | +- Add a VM to a Config Sync Group and push your JWT license |
| 26 | +- Install or upgrade to the latest NGINX Plus on a VM |
| 27 | +- Check version and sync status in the NGINX One Console |
| 28 | +- Clean up unavailable instances in the NGINX One Console |
| 29 | + |
| 30 | +## Before you begin |
| 31 | + |
| 32 | +Make sure you have: |
| 33 | + |
| 34 | +- Completed [Lab 4: Config Sync Groups]({{< ref "nginx-one/workshops/lab4/config-sync-groups.md" >}}) |
| 35 | +- Docker and Docker Compose installed and running (for Docker scenario) |
| 36 | +- A VM with NGINX Plus R32 (or earlier), SSH access, and the NGINX Agent installed (for VM scenario) |
| 37 | +- {{< include "workshops/nginx-one-env-variables.md" >}} |
| 38 | +- Basic familiarity with Linux command line and NGINX concepts |
| 39 | + |
| 40 | +## Scenario A: Upgrade NGINX Plus in Docker |
| 41 | + |
| 42 | +### Exercise A1: Pull and run the latest NGINX Plus image |
| 43 | + |
| 44 | +1. In your shell, log in to the private registry: |
| 45 | + |
| 46 | + ```shell |
| 47 | + echo "$JWT" | docker login private-registry.nginx.com \ |
| 48 | + --username "$JWT" --password-stdin |
| 49 | + ``` |
| 50 | + |
| 51 | +2. Open `docker-compose.yaml` in a text editor and uncomment the **plus4** service block (lines 74–95). This block pulls the latest Debian NGINX Plus image with the latest NGINX Agent installed, and sets your data plane key, JWT, and config sync group. |
| 52 | + |
| 53 | + ```yaml |
| 54 | + plus4: # Debian latest NGINX Plus Web / Load Balancer |
| 55 | + environment: |
| 56 | + NGINX_AGENT_SERVER_HOST: 'agent.connect.nginx.com' |
| 57 | + NGINX_AGENT_SERVER_GRPCPORT: '443' |
| 58 | + NGINX_AGENT_TLS_ENABLE: 'true' |
| 59 | + NGINX_AGENT_SERVER_TOKEN: $TOKEN # Data plane key from NGINX One Console |
| 60 | + NGINX_LICENSE_JWT: $JWT |
| 61 | + NGINX_AGENT_INSTANCE_GROUP: $NAME-sync-group |
| 62 | + hostname: $NAME-plus4 |
| 63 | + container_name: $NAME-plus4 |
| 64 | + image: private-registry.nginx.com/nginx-plus/agent:debian # From NGINX Private Registry |
| 65 | + volumes: # Sync these folders to container |
| 66 | + - ./nginx-plus/etc/nginx/nginx.conf:/etc/nginx/nginx.conf |
| 67 | + - ./nginx-plus/etc/nginx/conf.d:/etc/nginx/conf.d |
| 68 | + - ./nginx-plus/etc/nginx/includes:/etc/nginx/includes |
| 69 | + - ./nginx-plus/usr/share/nginx/html:/usr/share/nginx/html |
| 70 | + ports: |
| 71 | + - '80' # Open for HTTP |
| 72 | + - '443' # Open for HTTPS |
| 73 | + - '9000' # Open for API / Dashboard page |
| 74 | + - '9113' # Open for Prometheus Scraper page |
| 75 | + restart: always |
| 76 | + ``` |
| 77 | +
|
| 78 | + {{< call-out "note" "Tip" "" >}} If you use VS Code, highlight lines 74–95 and press `Ctrl` + `/` to uncomment them. {{< /call-out >}} |
| 79 | + |
| 80 | +3. Restart your containers: |
| 81 | + |
| 82 | + ```shell |
| 83 | + docker compose down && docker compose up --force-recreate -d |
| 84 | + ``` |
| 85 | + |
| 86 | +4. In the NGINX One Console, go to **Instances**. |
| 87 | +5. You should see your new instance (`$NAME-plus4`) in the list (for example, `s.jobs-plus4`). |
| 88 | +6. Select that instance and verify it runs the latest versions of NGINX Plus and NGINX Agent. |
| 89 | +7. The `$NAME-plus4` container was added to the `$NAME-sync-group` config sync group and inherited the shared config. |
| 90 | + |
| 91 | + {{< call-out "note" "Tip" "" >}} Because new containers in a sync group automatically pick up the shared config, you get a consistent, tested setup across versions. You can shift traffic to the new container one at a time for a safer, zero-downtime upgrade, and avoid any manual copy-and-paste steps. {{< /call-out >}} |
| 92 | + |
| 93 | +### Exercise A2: Delete unavailable containers |
| 94 | + |
| 95 | +When you recreate containers, they re-register in the NGINX One Console. Use the filter to clean up old entries: |
| 96 | + |
| 97 | +1. In the NGINX One Console, go **Instances**. |
| 98 | +2. Select **Add filter > Availability > Unavailable**. |
| 99 | +3. Check the boxes next to the unavailable hosts. |
| 100 | +4. Select **Delete selected**, then confirm. |
| 101 | +5. Remove the filter: Hover over the **Availability is Unavailable** filter tag, then select **X** to clear it and show all instances again. |
| 102 | + |
| 103 | +<span style="display: inline-block;"> |
| 104 | +{{< img src="nginx-one/images/unavailable-instances.png" |
| 105 | + alt="Table of three NGINX One Console instances filtered to ‘Availability = Unavailable.’ Shows hostnames (s.jobs-plus1, s.jobs-plus2, s.jobs-plus3), NGINX versions, grey ‘Unavailable’ circles, CVE and recommendation indicators, certificate status, operating system, and last reported times. The ‘Delete selected’ button appears at top right." >}} |
| 106 | +</span> |
0 commit comments