×

Welcome to TagMyCode

Please login or create account to add a snippet.
2
0
 
3
Language: Text
Posted by: Davide
Added: May 25, 2012 6:49 AM
Modified: Jun 11, 2012 1:50 PM
Views: 87
https://github.com/davidebettio/rails3-on-ec2
  1. from https://github.com/davidebettio/rails3-on-ec2
  2.  
  3.  
  4. rails3-on-ec2
  5. =============
  6.  
  7. Instructions for create a ubuntu ec2 instance for rails
  8.  
  9. ami for Ubuntu LTS 12.04
  10. -------------
  11.     ami-e1e8d395
  12.  
  13. system update
  14. -------------
  15.     sudo apt-get update
  16.     sudo apt-get upgrade
  17.  
  18. configure timezone
  19. -------------
  20.     dpkg-reconfigure tzdata
  21.  
  22. rvm
  23. -------------
  24.     curl -L get.rvm.io | sudo bash -s stable
  25.     usermod -a -G rvm ubuntu
  26.     exit
  27.     rvm install 1.9.3
  28.     rvm use 1.9.3 --default
  29.     exit
  30.  
  31. rubygems/rails/passenger
  32. -------------
  33.     gem update --system
  34.     gem install rails
  35.     gem install passenger
  36.  
  37. nginx
  38. -------------
  39.     sudo apt-get install libcurl4-openssl-dev
  40.     rvmsudo passenger-install-nginx-module
  41.  
  42. nginx configuration
  43. -------------
  44.     /opt/nginx/conf/nginx.conf
  45.     server {
  46.         listen 80;
  47.         server_name www.yourhost.com;
  48.         root /somewhere/public;   # <--- be sure to point to 'public'!
  49.         passenger_enabled on;
  50.     }
  51.  
  52. guide to nginx
  53. -------------
  54.     located in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/doc/Users guide Nginx.html
  55.  
  56. nginx init script
  57. -------------
  58.     git clone https://github.com/hulihanapplications/nginx-init-debian.git
  59.     cd nginx-init-debian
  60.     sudo cp etc/init/nginx.conf /etc/init
  61.     sudo start nginx
  62.  
  63. mysql
  64. -------------
  65.     sudo apt-get install mysql-server libmysqlclient-dev
  66.  
  67. mysql configuration
  68. -------------
  69.     add to [client]
  70.         default-character-set=utf8
  71.  
  72.     add to [mysqld]
  73.         character-set-server=utf8
  74.         collation-server=utf8_general_ci
  75.         init-connect='SET NAMES utf8'
  76.    
  77.     to comment
  78.         bind-address           = 127.0.0.1
  79.  
  80. database and users
  81. -------------
  82.     mysql -u root -p
  83.     create database db1
  84.     CREATE USER 'user1'@'localhost' IDENTIFIED BY '123456';
  85.     GRANT ALL PRIVILEGES ON db1.* TO 'user1'@'localhost' WITH GRANT OPTION;
  86.  
  87. nodejs
  88. -------------
  89.     sudo apt-get install python-software-properties
  90.     sudo add-apt-repository ppa:chris-lea/node.js
  91.     sudo apt-get update
  92.     sudo apt-get install nodejs npm
  93.  
  94. Wordpress automatic update
  95. -------------
  96.     change php-fpm user in /etc/php/fpm/pool.d/www.conf
  97.         user = ubuntu
  98.         group = ubuntu
  99.  
  100. crontab for Rails tasks
  101. -------------
  102.     /bin/bash -l -c "cd /home/ubuntu/www/site1 && rake cron"
  103.