Self-hosting a Ticketing System on AWS

Esmeralda Lima
6 min readAug 28, 2023

--

How to deploy a ticketing system on AWS using Docker containers

Hello, how are you?

I am a big fan of the NetworkChuck channel. After watching one of his videos deploying a ticketing system on Linode, I got inspired to do that on AWS services.

Why AWS? Because I like the Amazon cloud and putting an extra challenge doing something different is cool.

The ticketing system I will deploy is an open-source tool called Peppermint. On the GitHub page, you can see useful information to assist you in deploying the system.

Let’s go!

Knowledge and tools required:

  • An AWS account and how to launch an EC2 instance.
  • Networking fundamentals and basic Docker knowledge.
  • PuTTY software (this one is not obligatory. If you download your key pair as .pem, you can use OpenSSH to access your instance).
  • Peppermint GitHub page.

1- Launching instance

After creating your account or logging into AWS, look for the EC2 instance dashboard. There, you can launch it.

Then, you have to give a name to your instance, choose the operating system, and create a key pair to securely connect to it.

I chose the Ubuntu Server and the instance type with the Free tier eligible.

Now it is time to create a key pair.

You can choose to download as .pem or .ppk. I will choose .ppk.

Also, you can choose whatever name you want. I decided to give my key pair the same name as my instance.

In the Network settings, don’t forget to allow HTTP traffic, so users can access it via a web browser.

In addition to that, click edit on the Network settings and add a security group role to allow traffic on port :5000. Later on, you will understand why we are doing it.

Next, hit launch instance and let the remaining configuration as default.

Instance successfully launched.

Come back to the instances dashboard. You will see your new instance running. Click on it to see more details.

When you click to see more details, you will find some useful information such as your public and private IP address as well as your private and public DNS.

To see the information on how to connect to your instance, click on the Connect option and you will see the SSH information.

2- Connecting to the instance with PuTTY

Open PuTTY. In Session, write the name of your user and Public DNS on the host name and make sure the port is 22. Besides that, give a name to this session and save it.

Remember that the logging information is found on the Connect to instance as we just saw above.

After that, go to SSH > Auth > Credentials and in the Private Key File for Authentication, search for the .ppk file you downloaded earlier when you created your key pair. Then, click Open.

Voila! You just connected to your instance.

3- Installing Docker

Before installing Docker, let’s start by updating our instance.

sudo apt update
sudo apt upgrade

You might be prompted to reboot your session after upgrading.

Now, let’s install Docker and Docker compose.

sudo apt install docker.io
sudo apt install docker-compose -y 

Or you can simply run both commands together:

sudo apt install docker.io docker-compose -y

4- Installing Peppermint

Now that we have our Docker container we can run our ticketing system.

Peppermint allows you to have a central location for customers' requests so you can have a complete picture of each customer. Just like Zendesk and any other system, you will need it in a Help Desk role.

On the GitHub page, you can find a script to use as a template to write your .yml file. You can tweak it to your needs.

Starting our configuration, create a peppermint directory (mkdir) and go inside it running cd command.

Now that you are inside the Peppermint directory, create a new file that will take the configuration to run the Help Desk system with Docker containers.

nano docker-compose.yml

Nano will be open and it is time for you to paste/write your configuration.

version: "3.8"

services:
postgres:
container_name: postgres
image: postgres:latest
restart: always
volumes:
- ./docker-data/db:/data/db
environment:
POSTGRES_USER: peppermint
POSTGRES_PASSWORD: 1234
POSTGRES_DB: peppermint

client:
container_name: peppermint
image: pepperlabs/peppermint:latest
ports:
- 5000:5000
restart: on-failure
depends_on:
- postgres
environment:
PORT: 5000
DB_USERNAME: peppermint
DB_PASSWORD: 1234
DB_HOST: 'postgres'
BASE_URL: "http://ec2-18-228-138-0.sa-east-1.compute.amazonaws.com:5000/"

This YAML is found on the GitHub page as mentioned. However, as we are running it on the AWS cloud, we need to make some adjustments to make it work out.

I will change the version to match a more recent YAML version and the BASE_URL I’ll put my Public IPv4 DNS from my instance. You can find this information in your instance summary. Moreover, notice that I added port :5000 to my URL. Do you remember we allowed inbound traffic on port :5000 earlier? That is why we did that before. So we can permit traffic in a specific port on this URL.

The next step is to build and run the Docker images and start the containers. To do it, we can run both commands in a single command with up.

sudo docker-compose up -d

To check all containers in the docker-compose file and to have more information about our ticketing system, run:

sudo docker-compose ps

Here we can see our app running on port :5000.

5- Logging into our Help Desk System

To log into Peppermint, you will need your Public IPv4 DNS. Once again, you can check it on your instance summary.

On your browser, add http// with the port number: <http://ec2-18-228-138-0.sa-east-1.compute.amazonaws.com:5000/>. This is my example.

There you go! You finally have your ticketing system available.

The default login credentials are:

admin@admin.com
1234

After logging in, you can change both. In fact, for security reasons, it is a MUST to change them.

This is your dashboard:

From here, you can explore all the features and have fun.

Thank you for reading!

--

--