How to Self-Hosted Sentry.io at AWS EC2

2021/5/13 min read
bookmark this
Responsive image

This blog shows how to self-hosted Sentry.io with AWS EC2.  

First, sentry.io provide the self-hosted solution and hosted the source code here . Base on the sentry self-host requirement, at this point you'll need to follow the below requirement. These requirements will probably change when a new version comes out, so just double-check the requirement before setup the instance. 

  • Docker 19.03.6+
  • Compose 1.28.0+
  • 4 CPU Cores
  • 8 GB RAM
  • 20 GB Free Disk Space

Setup EC2 Ubuntu

Launch AWS EC2 Instance

Choose Ubuntu Server 20.04, Free tier eligible

Choose t2.medium

The requirement is 4 CPU cores but looks like minimal is 2 CPUs is fine, so I choose t2.medium with CPU here.

Configure Instance Details

This blog is not for setup AWS VPC, Subnet, most of the settings here set as default is fine, as long as the VPC has public access then is fine. 

Add Storage

At storage, add Size as 25 GB. 

Configure Security Group

Here also, depending on how you want to host the sentry this could be different, but at least make sure ingress ports 80, 22 are open, so one is for access from the internet and another is for SSH into this instance. 

Finish create the Instance

After finish creating the EC2 instance for the ubuntu, then SSH into this instance. After SSH into the Linux instance, we'll perform the following task to install docker. 

Install Docker, Docker-Compose

Setup the repository

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

 Add Docker's official GPG Key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Install Docker Compose on Linux System

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Apply executable permissions to the binary

sudo chmod +x /usr/local/bin/docker-compose

Reboot the Ubuntu

Clone the sentry self-hosted repo

git clone https://github.com/getsentry/onpremise.git

Install the sentry and Create a new User

Here, the process will ask to create a new account, enter the email and password to create a new account, you'll use the email and password to log in later.

cd onpremise/
sudo ./install.sh

Run the docker-compose

Now, this docker-compose might take some time to finish everything, but once it finishes you should be able to access them by the browser IP address. 

That's it

If everything works, when you hit the browser IP you should see sentry.io and if you type the email address you entered earlier you should be able to log in. 

sudo docker-compose up -d

References

  • Install Docker Engine on Ubuntu
  • Install Docker Compose
  • Self-Hosted Sentry nightly