Skip to content

Instantly share code, notes, and snippets.

@tmaybe
Last active August 29, 2015 14:14
Show Gist options
  • Save tmaybe/514af9c8dba311e83cbe to your computer and use it in GitHub Desktop.
Save tmaybe/514af9c8dba311e83cbe to your computer and use it in GitHub Desktop.

sudo apt-get install -y apache2

sudo a2enmod rewrite

sudo a2enmod headers

sudo apt-get install -y git

sudo apt-get install nodejs

sudo apt-get install mysql-server mysql-client

sudo apt-get install libmysqlclient-dev

sudo apt-get install sqlite3

sudo apt-get install libsqlite3-dev

sudo apt-get install libcurl4-openssl-dev

sudo apt-get install libssl-dev

sudo apt-get install apache2-threaded-dev

sudo apt-get install libapr1-dev

sudo apt-get install libaprutil1-dev

sudo apt-get install bundler

cd /var/www/

sudo git clone https://github.com/pemiluAPI/calon-api-endpoint.git

cd calon-api-endpoint/

bundle install

sudo gem install passenger

sudo dd if=/dev/zero of=/swap bs=1M count=1024

sudo mkswap /swap

sudo swapon /swap

sudo passenger-install-apache2-module

sudo cp config/database.yml.example config/database.yml

mysqladmin -u root variables | grep socket

copy the path to the .sock file into database.yml

sudo vi config/database.yml

bundle exec rake db:setup

sudo vi /etc/apache2/sites-available/000-default.conf

replace the contents with the following

LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-4.0.58/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
	PassengerRoot /var/lib/gems/1.9.1/gems/passenger-4.0.58
	PassengerDefaultRuby /usr/bin/ruby1.9.1
</IfModule>

<VirtualHost *:80>
	# !!! Be sure to point DocumentRoot to 'public'!
	DocumentRoot /var/www/calon-api-endpoint/public
	<Directory /var/www/calon-api-endpoint/public>
		# This relaxes Apache security settings.
		AllowOverride all
		# MultiViews must be turned off.
		Options -MultiViews
		# Uncomment this if you're on Apache >= 2.4:
		Require all granted
	</Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

sudo service apache2 restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment