Life

Exploring Microsoft Azure Portal: Setting Up GitLab Runner and Poste.io Mail Server with Amazon SES for SMTP

By CYLim

September 17, 2024

Introduction

In today’s cloud-driven world, managing infrastructure with services like Microsoft Azure and AWS has become a vital part of software development and deployment. In this post, I’ll walk you through my recent experience exploring Microsoft Azure, where I set up a Virtual Machine (VM) to host GitLab Runner for continuous integration and Poste.io as a mail server. However, I encountered a common issue — outbound port 25 was blocked, which is essential for sending email via SMTP. To overcome this, I integrated Amazon Simple Email Service (SES) to handle outbound mail.

This blog post details how I set up these services and how Amazon SES solved the port 25 block issue on cloud infrastructure, providing a seamless email-sending solution.

Step 1: Exploring Microsoft Azure and Creating a Virtual Machine

The first step in the process was to create a Virtual Machine (VM) on Microsoft Azure, which would serve as the host for both GitLab Runner and the Poste.io mail server.

Why Azure? Azure’s cloud platform offers powerful resources, scalability, and a wide range of services. Its Virtual Machines are versatile and support various operating systems, making it perfect for my needs.

Here’s a quick rundown of how I created the VM:

  1. Access the Azure Portal:
  2. Configuring the VM:
  3. Networking:
  4. Access the VM via SSH:

Step 2: Setting Up GitLab Runner on Azure VM

With the VM ready, I proceeded to set up GitLab Runner — a key component for running CI/CD pipelines on GitLab.

  1. Install GitLab Runner: SSH into your VM and run the following commands to install GitLab Runner:

Step 3: Setting Up Poste.io as a Mail Server

Next, I turned my attention to setting up the mail server. For this task, I chose Poste.io, a fully-featured mail server that’s easy to install and configure.

  1. Installing Docker: Poste.io runs within a Docker container, so the first step is to install Docker on your VM:
  2. Setting Up Poste.io: With Docker installed, you can now set up the Poste.io mail server. Simply run the following command to pull the Poste.io Docker image and start the container:
  3. Initial Configuration: Upon visiting your server’s IP in a browser, you’ll be prompted to configure the domain, admin account, and other initial settings. Once set up, you can start managing email accounts, domains, and mail queues directly through the Poste.io dashboard.

Step 4: Overcoming the Port 25 Block with Amazon SES for Outbound Mail

At this point, I ran into a common issue: Azure (and most cloud providers) block outbound traffic on port 25, the default port used for sending SMTP email. This meant my Poste.io server could not send outgoing mail.

The solution? Amazon Simple Email Service (SES) — a reliable, scalable service that bypasses port 25 restrictions and allows your server to send outbound emails.

Setting Up Amazon SES

  1. Log into the AWS Console: Head to the Amazon SES Console and create an SES account if you don’t have one already.
  2. Verify Your Domain:
  3. Create SMTP Credentials:

Configuring Poste.io to Use Amazon SES

Now, you need to configure Poste.io to use Amazon SES as the SMTP route for outbound emails.

  1. Modify Default SMTP Route (used by Poste.io): Change target SMTP server hostname Amazon SES SMTP hostname together with the SMTP username and password,

At this point, your Poste.io mail server is configured to send emails through Amazon SES, circumventing the port 25 block.

Step 5: Conclusion

Setting up a Virtual Machine on Microsoft Azure to run GitLab Runner and Poste.io for mail services is a powerful combination for managing your CI/CD workflows and email communication. However, the outbound port 25 block on most cloud providers can be a major hurdle for email delivery.

By integrating Amazon SES with Poste.io, I was able to successfully configure SMTP services, ensuring reliable outbound mail delivery. This solution not only bypasses cloud provider restrictions but also offers a scalable and cost-effective way to manage email sending.

If you’re facing similar challenges in your own cloud-based mail server setups, I highly recommend looking into Amazon SES for your email-sending needs. It’s a robust and dependable solution to keep your communication flowing smoothly!

Have you set up similar cloud-based systems or dealt with SMTP restrictions? Share your experiences in the comments below!