DEV Community

Olaleye Obidiya
Olaleye Obidiya

Posted on

Deploying NGINX on Google Cloud: A Journey Through the First DevOps Track Task at HNG 12

Introduction

Embarking on the DevOps Stage 0 task of setting up and configuring an NGINX web server on a fresh Ubuntu instance was an enlightening experience. This task allowed me to gain hands-on experience with web server deployment, cloud infrastructure, and troubleshooting various challenges along the way. This blog post documents my approach, the obstacles I encountered, and how this task contributes to my professional growth as an aspiring DevOps Engineer.

My Approach to the Task

To successfully complete this task, I followed a structured approach:

Setting Up a Virtual Machine on Google Cloud:

  • I created a new Compute Engine instance with Ubuntu 22.04 LTS.
  • I configured firewall rules to allow HTTP traffic.

Installing NGINX:

  • I updated system packages and installed NGINX using sudo apt install nginx -y.
  • I enabled and started the NGINX service.

Configuring a Custom HTML Page:

  • I replaced the default index.html with a custom message: "Welcome to DevOps Stage 0 - Olaleye Obidiya/Onyx_Oceanview".
  • I ensured proper file permissions for NGINX to serve the page.

Testing the Deployment:

  • I verified the setup by accessing the external IP of the VM via a browser and using curl http://localhost on the terminal.

Enhancing Security and Performance:

  • I configured firewall rules to allow only necessary traffic.
  • I ensured NGINX auto-starts on boot.

Challenges and How I Overcame Them

Firewall Configuration Issues

Initially, my NGINX setup was not accessible from the internet. After troubleshooting, I realized that Google Cloud’s default firewall rules block incoming HTTP traffic. To resolve this:

  • I created a new firewall rule allowing traffic on port 80.
  • I used sudo ufw allow 'Nginx Full' to enable local firewall rules.

Permission Errors on HTML File

NGINX was unable to read the updated index.html. I fixed this by adjusting file permissions:

sudo chmod 644 /var/www/html/index.html
Enter fullscreen mode Exit fullscreen mode

Ensuring Persistent Server Availability

To prevent downtime, I enabled NGINX to start on boot:

sudo systemctl enable nginx
Enter fullscreen mode Exit fullscreen mode

How This Task Contributes to My Learning and Career Goals

Completing this task has been a valuable step in my journey towards becoming a proficient DevOps Engineer. It reinforced my understanding of cloud-based infrastructure, NGINX configuration, and troubleshooting real-world deployment issues. Moreover, it aligns with my goal of mastering site reliability and automation by exposing me to key DevOps practices.

For those looking to hire skilled professionals in DevOps and cloud engineering, I highly recommend checking out these resources:

DevOps Engineers
Cloud Engineers
Site Reliability Engineers
Platform Engineers
Infrastructure Engineers
Kubernetes Specialists
AWS Solutions Architects
Azure DevOps Engineers
Google Cloud Engineers
CI/CD Pipeline Engineers
Monitoring/Observability Engineers
Automation Engineers
Docker Specialists
Linux Developers
PostgreSQL Developers

Final Thoughts

This experience has strengthened my ability to deploy web applications on cloud infrastructure and troubleshoot network-related issues. It has also given me a greater appreciation for the role of cloud engineers, site reliability engineers, and DevOps professionals in maintaining high-availability systems.

As I continue my journey in cloud and DevOps engineering, I am excited to take on more complex challenges and deepen my expertise in automation, containerization, and cloud-native technologies.

Stay tuned for more insights into my DevOps learning journey
! 🚀

Top comments (0)