Skip to content

DevOps: Upgrading Nginx Version on the Server

Emmanuel Nwakire edited this page Nov 14, 2024 · 4 revisions

Once Notification for upgrade has been received

  • Access the VA Technical Reference Model List here, confirm what version of Nginx has been approved.
  • Access VAEC AWS Console, beginning with Dev, then Staging, and finally Production servers, respectively. SSH into them using EC2 Instance Connect.
  • follow the steps below to ensure you upgrade the servers' Nginx version.
  • cd diffusion-marketplace directory and delete the Dockerfile used in building the application
  • mv Dockerfile inside the proxy directory to diffusion-marketplace directory
  • on your browser open the Nginx/centosrepository to be sure that the version you are upgrading to is available
  • Change Nginx version from 1.27.1 to new version of Nginx
  • Update necessary dependencies on the Dockerfile for example pcre2, gettext e.t.c
  • Build the proxy image with this command docker build -t proxy:latest .
  • check your docker images,you should see the newly built image Proxy image.
  • Stop then Remove your existing proxy container docker stop container id docker rm container id
  • Start the proxy container and also add the container to the diffusion marketplace network using this command docker run -d --name diffusion-marketplace_proxy_1 --network diffusion-marketplace_default -p 80:8080 proxy
  • mv back Dockerfile used in building the proxy image into the proxy directory
  • Inside the diffusion-marketplace directory vi into a new Dockerfile and paste content to build the app.
  • Then build the application from scratch using sudo docker-compose build app
  • Finally start the containers using ./scripts/start_appcontainer.sh

Troubleshooting Deployment errors from Upgrading Nginx

  • ERROR: for diffusion-marketplace_proxy_1 Cannot start service proxy: driver failed programming external connectivity on endpoint diffusion-marketplace_proxy_1 (fa3631fff5b91b70082e73b5b65922c99d2afb3d1da2ebf30d565ab9ab348c69): Bind for 0.0.0.0:80 failed: port is already allocated

  • Implement these steps below if the above error comes up while building the application

  • docker ps check docker container

  • docker stop <container id>, stop the proxy container

  • sudo lsof -i :80, Check the PID using TCP 80

  • sudo kil <pid>

  • ./scripts/start_appcontainer.sh finally start the container.

  • ERROR: for diffusion-marketplace_proxy_1 Cannot create container for service proxy: Conflict. The container name "/diffusion-marketplace_proxy_1" is already in use by container "5d03ab4534c0471434fed679d4bb6a9021928f7d7f6d6b41fbe727d58fc6668c". You have to remove (or rename) that container to be able to reuse that name. ERROR: for proxy Cannot create container for service proxy: Conflict. The container name "/diffusion-marketplace_proxy_1" is already in use bycontainer "5d03ab4534c0471434fed679d4bb6a9021928f7d7f6d6b41fbe727d58fc6668c". You have to remove (or rename) that container to be able to reuse that name. ERROR: Encountered errors while bringing up the project.

  • Implement these steps below if the above error comes up while building the application

  • Solution (just rename the container)

  • docker rename diffusion-marketplace_proxy_1 old_diffusion-marketplace_proxy_1

  • ./scripts/start_appcontainer.sh

Upgrading NGINX Centos image

  • Currently EOL Centos 9 is 5/31/2027.
  • Access AWS VAEC Dashboard, SSH into DEV server and Switch user to Ec2-user.
  • Gain access to Docker to enable the Dev server to push and pull images from AWS ECR, pass the command sudo docker login -u *** -p $(sudo /usr/local/bin/aws ecr get-login-password --region us-gov-west-1) ******.dkr.ecr.us-go [v-west-1.amazonaws.com](http://v-west-1.amazonaws.com/)
  • Ask the DevOps team for the content of the Dockerfile to build the centos image, make necessary dependency changes and base image change
  • vi Dockerfile paste content, build and tag the centos image, in this case, centos9. Use this Command to build the image sudo docker build -t ****.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:centos-9 .
  • Push the image to ECR
  • Cd into diffusion-marketplace directory
  • Create a backup of the Dockerfile used in building the ruby 3.2.3 application then remove the Dockerfile.
  • cd into the proxy directory in the diffusion-marketplace directory and move the Dockerfile into the diffusion-marketplace directory.
  • make necessary changes if need be to the content and build the proxy image.
  • Follow steps above to continue the Centos image upgrade.
Clone this wiki locally