Hosting JIRA on an Amazon EC2 instance is quite easy and can save you a lot of money. Compare $10 per month to a one-time payment of $10 for the self hosted solution. The setup per se is quite easy but by default JIRA doesn’t allow you to use port 80 as it’s default access port. In this tutorial we are going to look into how to still achieve this using iptables on a Linux system.
I recommend using Amazon RDS as the database for JIRA, to increase redundancy and data safety in general.
The first step is to set up an Amazon RDS database, afterwards you can go ahead fire up an EC2 instance and install JIRA. I used the recommended Amazon Linux Image for my installation.
After the machine is up and running you simply get the latest JIRA binary and execute it.
Get the download link of the latest version here: https://www.atlassian.com/software/jira/download
Afterwards use wget to download the file onto your EC2 instance:
Now all you have to do is make the file executable and then run it and follow the steps in the guided installation:
sudo chmod a+x atlassian-jira-software-7.1.7-jira-7.1.7-x64.bin
After you have finished the installation guide, you need to change the port mapping using iptables.
Set the iptables configuration using the following commands:
sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT sudo iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
Afterwards the iptables configuration needs to be stored to a local file, which late on is going to be used to load the configuration at boot of the host system.
Store the configuration under /etc/iptables.rules
sudo bash -c "iptables-save > /etc/iptables.rules"
In order to load this file after the system has been booted, edit /etc/rc.local and append the following command at the very end of it:
iptables-restore < /etc/iptables.rules
Save the file and reboot your system. Double check if everything is working properly, use sudo iptables -L to see if the custom rules have been loaded during the boot. The output should look similar to this:
Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere tcp dpt:webcache Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
Afterwards you can continue to use your JIRA by accessing the web interface through port 80.