DEV Community

Cover image for My Journey Deploying an API: From Novice to Docker Enthusiast
Anadu Godwin
Anadu Godwin

Posted on

My Journey Deploying an API: From Novice to Docker Enthusiast

Last Month (December 2024), I was tasked to deploy my organization's backend API—a task I had never attempted before. Armed with AWS server credentials and no prior experience, I relied on documentation and online resources to guide me through the setup. Testing the application locally went smoothly, but upon deployment, I hit a major snag: the GraphQL endpoint failed to respond, though the rest of the application was perfectly functional.

When I sought help, a senior engineer simply asked, “Did you deploy it using Docker?” That’s when it hit me: I had missed a critical step. Determined to fix my mistake, I cleaned up the server, removed all dependencies and tools installed initially, and started fresh. This time, I focused on learning Docker.

My deployment journey junior to pro

Initially, I struggled to understand the difference between Dockerfile and Docker Compose and when to use them, but with patience, I began to appreciate Docker’s power and versatility. Once I had the application dockerized and tested locally (breaking my local setup felt safer than risking the server 😅), I redeployed it to the AWS server using a rsync bash script I had written earlier. To my delight, the application ran seamlessly!

To ensure the application stayed running after I exited the server, I used PM2. Combining Docker and PM2 turned out to be a not-great approach, as I later learned. The final task was setting up the domain with Nginx—a challenge I embraced with a sense of nostalgia, having last used Nginx during my ALX-SE training (where we did hard things :)).

The deployment was a success, and my team was impressed. When they asked about my experience with these tools, I had simply said, “I will learn and integrate.” I delivered on that promise within a week. But just as I was celebrating, a new challenge emerged: securing the domain with SSL.

The battle with SSL certification

The Final Boss: SSL Configuration

This felt like the ultimate test. I discovered Certbot, an open-source tool for setting up Let's Encrypt certificates, and dived into its documentation. After configuring Certbot, the application crashed entirely. My first thought was to wait 24 hours for the DNS to propagate, but the next day, the domain was still unresponsive.
Debugging this issue without GUI tools was grueling. Docker logs were empty, PM2 refused to start, and error logs offered no clues. After extensive research, I stumbled upon a DigitalOcean guide that mentioned critical firewall commands to execute post-SSL setup:

sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'
Enter fullscreen mode Exit fullscreen mode

These simple commands resolved the issue. It was a hard-fought lesson, but the application was finally live and secured.

Lessons Learned

. Resources Are Limited: At advanced stages of software engineering, you rely more on your brain and experience as there gets to be little or no resources available.
. Tackle Big Challenges: By not shying away from these tasks, I gained valuable skills like Docker, PM2, rsync, debugging, networking, and more.
. Soft Skills Matter: Beyond technical prowess, resilience, problem-solving, and communication play a huge role in your growth.

Final Thoughts

This experience reminded me that “you don’t know how strong you are until being strong is your only choice”. To my fellow juniors: embrace challenges—they are opportunities to grow and surpass your past self.

Top comments (2)

Collapse
 
sidgoyal2014 profile image
Siddharth Goyal

This was almost my experience when I was tasked with changing the complete 30-year build process. At that time I understood that when you get into a niche, fewer to lesser useful resources are available.

Collapse
 
anadudev profile image
Anadu Godwin

Lol, then you realize using YouTube videos means you still have a lot to learn ;)