Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jenkins setup for Rails on EC2
Based on these:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu
http://www.intridea.com/blog/2013/5/21/howto-install-setup-jenkins-ci-for-rails-projects
Setup an EC2 instance with Ubuntu (14.04)
Open port 8080
Install Jenkins
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
http://<host>:8080 -> you should see Jenkns running.
Setup nginx on port 80
sudo aptitude -y install nginx
cd /etc/nginx/sites-available
sudo rm default ../sites-enabled/default
Copy & save into /etc/nginx/sites-available/jenkins:
# Configuration for nginx
upstream app_server {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
listen [::]:80 default ipv6only=on;
server_name ci.yourcompany.com;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
}
}
# End nginx configuration
sudo ln -s /etc/nginx/sites-available/jenkins /etc/nginx/sites-enabled/
sudo service nginx restart
Open port 80 in the security group and close 8080.
TODO: put basic auth instructions in here
Setup Ruby/Rails
sudo apt-get install build-essential git-core libxml2 libxslt-dev libxml2-dev
sudo apt-get install curl
# Add the "jenkins" user to the sudo group
usermod -a -G sudo jenkins
sudo su jenkins
sudo passwd jenkins -> set a password
sudo curl -L https://get.rvm.io | bash -s stable --ruby
sudo apt-get install libmysqlclient-dev ruby-dev
# For MySQL 5.5
sudo apt-get install mysql-client mysql-server ruby-mysql libmysqlclient-dev
# For MySQL 5.1
# Download the tarball and follow the instructions
# http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz
sudo groupadd mysql
sudo useradd -r -g mysql mysql
cd /usr/local
sudo tar zxvf /path/to/mysql-VERSION-OS.tar.gz
sudo ln -s full-path-to-mysql-VERSION-OS mysql
cd mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
sudo scripts/mysql_install_db --user=mysql
sudo chown -R root .
sudo chown -R mysql data
sudo cp support-files/my-medium.cnf /etc/my.cnf
sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server
# For Postgres
sudo aptitude install libpq-dev
sudo apt-get install postgresql
sudo apt-get install postgresql-client
# For MongoDB
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list
sudo apt-get update
sudo apt-get install mongodb-10gen
# Plugins
Github OAuth
Github
Brakeman
Rake
RVM
All Changes
Gravatar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.