{"id":231661,"date":"2014-07-30T18:11:03","date_gmt":"2014-07-30T14:11:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=231661"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=231661","title":{"rendered":"<span class=\"post_title\">\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Ruby on Rails \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u043d\u0443\u043b\u044f \u043d\u0430 Ubuntu 14.04<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441 \u043d\u0443\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f Rails. \u0427\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u043e\u0442 \u044d\u0442\u043e\u0439 <a href=\"https:\/\/gorails.com\/deploy\/ubuntu\/14.04\">\u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043d\u043e \u044f \u0443\u0431\u0440\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u0435\u043c\u0430 \u00abCapistrano\u00bb, \u0442.\u043a. \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f git clone, \u0430 \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u0435\u043d Capistrano, \u0442\u043e\u043c\u0443 \u0438 \u044d\u0442\u043e\u0442 \u043c\u0430\u043d\u0443\u0430\u043b \u043d\u0435 \u043d\u0443\u0436\u0435\u043d. \u0422\u0430\u043a \u0436\u0435 \u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0434 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043f\u0430\u0440\u0443 \u043f\u0443\u043d\u043a\u0442\u043e\u0432, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>Ubuntu 14.04<\/li>\n<li>nginx + passenger<\/li>\n<li>rvm<\/li>\n<li>Ruby 2.1.2<\/li>\n<li>PostgreSQL<\/li>\n<li>git<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c SSH-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. <\/p>\n<h4>\u0428\u0430\u0433 0. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. <\/h4>\n<p>  \u041b\u043e\u0433\u0438\u043d\u0438\u043c\u0441\u044f \u043a \u043d\u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439 \u043b\u044e\u0431\u0438\u043c\u044b\u0439 SSH-\u043a\u043b\u0438\u0435\u043d\u0442. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e root-\u0430\u043a\u043a\u0430\u0443\u043d\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u0434 \u043d\u0438\u043c. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f deploy:  <\/p>\n<pre><code class=\"bash\">sudo adduser deploy sudo adduser deploy sudo su deploy <\/code><\/pre>\n<h5>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u044e\u0447\u0438 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443.<\/h5>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u0448\u0430\u0433 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d, \u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e, \u043d\u043e \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e. \u0411\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0430 ssh-copy-id. \u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 (\u043d\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435!) \u0432\u0432\u043e\u0434\u0438\u043c:  <\/p>\n<pre><code class=\"bash\">ssh-copy-id deploy@IPADDRESS <\/code><\/pre>\n<h4>\u0428\u0430\u0433 1. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435.<\/h4>\n<p>  <\/p>\n<h5>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Ruby<\/h5>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo apt-get update sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties <\/code><\/pre>\n<h5>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c rvm<\/h5>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev curl -L https:\/\/get.rvm.io | bash -s stable source ~\/.rvm\/scripts\/rvm echo &quot;source ~\/.rvm\/scripts\/rvm&quot; &gt;&gt; ~\/.bashrc rvm install 2.1.2 rvm use 2.1.2 --default ruby -v <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f rubygems \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"bash\">echo &quot;gem: --no-ri --no-rdoc&quot; &gt; ~\/.gemrc <\/code><\/pre>\n<h5>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c nginx<\/h5>\n<p>  <\/p>\n<pre><code class=\"bash\"># Install Phusion's PGP key to verify packages gpg --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7 gpg --armor --export 561F9B9CAC40B2F7 | sudo apt-key add -  # Add HTTPS support to APT sudo apt-get install apt-transport-https  # Add the passenger repository sudo sh -c &quot;echo 'deb https:\/\/oss-binaries.phusionpassenger.com\/apt\/passenger trusty main' &gt;&gt; \/etc\/apt\/sources.list.d\/passenger.list&quot; sudo chown root: \/etc\/apt\/sources.list.d\/passenger.list sudo chmod 600 \/etc\/apt\/sources.list.d\/passenger.list sudo apt-get update  # Install nginx and passenger sudo apt-get install nginx-full passenger <\/code><\/pre>\n<p>  \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0447\u0442\u043e ip \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0434\u0430\u0435\u0442 nginx welcome page.  <\/p>\n<pre><code class=\"bash\">sudo service nginx start <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u0444\u0430\u0439\u043b nginx. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 nano, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u0435\u0441\u0442\u044c \u0432 Ubuntu. \u0412\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:  <\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/nginx\/nginx.conf <\/code><\/pre>\n<p>  \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:  <\/p>\n<pre><code class=\"bash\">passenger_root \/usr\/lib\/ruby\/vendor_ruby\/phusion_passenger\/locations.ini; passenger_ruby \/usr\/bin\/ruby; <\/code><\/pre>\n<p>  \u0410\u0434\u0440\u0435\u0441 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f deploy \u043d\u0430 \u0441\u0432\u043e\u0435\u0433\u043e:  <\/p>\n<pre><code class=\"bash\">\/home\/deploy\/.rvm\/wrappers\/ruby-2.1.2\/ruby <\/code><\/pre>\n<h5>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c PostgreSQL<\/h5>\n<p>  <\/p>\n<pre><code class=\"bash\">sudo apt-get install postgresql postgresql-contrib libpq-dev <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u0442.\u043d. \u0440\u043e\u043b\u044c) \u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0434. \u041b\u043e\u0433\u0438\u043d \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0431\u0434 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f app_name:<\/p>\n<pre><code class=\"bash\">sudo -u postgres createuser --superuser app_name  sudo -u postgres psql <\/code><\/pre>\n<p>  \u0417\u0430\u0434\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044c:  <\/p>\n<pre><code class=\"bash\">\\password app_name <\/code><\/pre>\n<p>  \u0416\u043c\u0435\u043c Ctrl+d \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"bash\">sudo -u postgres createdb app_name <\/code><\/pre>\n<h4>\u0428\u0430\u0433 2. \u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440<\/h4>\n<p>  \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f git. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u044e\u0437\u0435\u0440\u0430:  <\/p>\n<pre><code class=\"bash\">cd \/home\/deploy <\/code><\/pre>\n<p>  \u0418\u0434\u0435\u043c \u043d\u0430 bitbucket.org \u0438\u043b\u0438 github.com, \u0432 \u043e\u0431\u0449\u0435\u043c, \u0442\u0443\u0434\u0430, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0432\u0430\u0448 \u043a\u043e\u0434 \u0438 \u0438\u0449\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0438 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"bash\">git clone https:\/\/deploy@bitbucket.org\/deploy\/app_name.git <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0430\u043f\u043a\u0430 \u0441 \u0432\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c app_name.<\/p>\n<h4>\u0428\u0430\u0433 3. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430 \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 nginx. \u0422\u0443\u0442 \u0443\u0436\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440, \u0447\u0435\u043c nano. \u042f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f vim (\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e, \u043a\u0430\u043a \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 sudo apt-get install vim). \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b:  <\/p>\n<pre><code class=\"bash\">sudo vim \/etc\/nginx\/sites-enabled\/default <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u0412\u043c\u0435\u0441\u0442\u043e \u0438\u043c\u0435\u043d\u0438 \u0434\u043e\u043c\u0435\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u043f\u0438\u0441\u0430\u0442\u044c ip-\u0430\u0434\u0440\u0435\u0441, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0433\u043e \u0435\u0449\u0435 \u043d\u0435\u0442. \u0422\u0430\u043a \u0436\u0435 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f deploy \u043d\u0430 \u0441\u0432\u043e\u0435\u0433\u043e:  <\/p>\n<pre><code class=\"bash\">server {         listen 80 default_server;         listen [::]:80 default_server ipv6only=on;          server_name mydomain.com;         passenger_enabled on;         rails_env    production;         root         \/home\/deploy\/myapp\/public;          # redirect server error pages to the static page \/50x.html         error_page   500 502 503 504  \/50x.html;         location = \/50x.html {             root   html;         } } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 vim \u043d\u0430\u0436\u043c\u0435\u043c Ctrl+c, \u0438 \u043d\u0430\u0436\u043c\u0435\u043c \u0431\u0443\u043a\u0432\u0443 V. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0432\u044b\u0448\u0435. \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a: Ctrl+c, \u043f\u043e\u0442\u043e\u043c :wq<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0432\u0430\u0448 config\/database.yml \u0444\u0430\u0439\u043b, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c:  <\/p>\n<pre><code class=\"ruby\">production:   adapter: postgresql   encoding: unicode   database: app_name   pool: 5   username: app_name   password: db-pass-word <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433 PostgreSQL:  <\/p>\n<pre><code class=\"bash\">sudo nano \/etc\/postgresql\/9.3\/main\/pg_hba.conf <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u00abpeer\u00bb \u043d\u0430 \u00abmd5\u00bb:  <\/p>\n<pre><code class=\"bash\">local   all             postgres                                peer <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0449\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c JS Runtime, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b nodejs:  <\/p>\n<pre><code class=\"bash\">sudo apt-get install nodejs <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u0431\u0434 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e assets:  <\/p>\n<pre><code class=\"bash\">rake db:migrate RAILS_ENV=production rake assets:precompile RAILS_ENV=production <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c nginx \u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:  <\/p>\n<pre><code class=\"bash\">sudo service nginx restart <\/code><\/pre>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/231661\/\"> http:\/\/habrahabr.ru\/post\/231661\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441 \u043d\u0443\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f Rails. \u0427\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u043e\u0442 \u044d\u0442\u043e\u0439 <a href=\"https:\/\/gorails.com\/deploy\/ubuntu\/14.04\">\u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043d\u043e \u044f \u0443\u0431\u0440\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u0435\u043c\u0430 \u00abCapistrano\u00bb, \u0442.\u043a. \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f git clone, \u0430 \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u0435\u043d Capistrano, \u0442\u043e\u043c\u0443 \u0438 \u044d\u0442\u043e\u0442 \u043c\u0430\u043d\u0443\u0430\u043b \u043d\u0435 \u043d\u0443\u0436\u0435\u043d. \u0422\u0430\u043a \u0436\u0435 \u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0434 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043f\u0430\u0440\u0443 \u043f\u0443\u043d\u043a\u0442\u043e\u0432, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>Ubuntu 14.04<\/li>\n<li>nginx + passenger<\/li>\n<li>rvm<\/li>\n<li>Ruby 2.1.2<\/li>\n<li>PostgreSQL<\/li>\n<li>git<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-231661","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/231661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=231661"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/231661\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=231661"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=231661"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=231661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}