Five-Minute Rails Application Deployment
Update Gems
Install the latest version of the railsmachine gem :
$ sudo gem install railsmachine
Install Phusion Passenger and Ruby Enterprise Edition
If you do not have Phusion Passenger and Ruby Enterprise Edition installed on your Rails Machine yet you can run this installer on your server.
$ wget http://assets.railsmachine.com/wiki/centos_passenger_install.sh
$ sh centos_passenger_install.sh
Setup Capistrano
Capify your application:
$ capify .
Configure Capistrano for Rails Machine
The following step customizes your
config/deploy.rb
with two bits of information you provide:--name
: a simple name for your application. no spaces, please.--domain
: the primary domain name for your application. please omit the ‘www’ – we automaticaly alias www.whateveryouprovide.com as needed.
$ railsmachine --apply-to . --name my-cool-app --domain my-cool-app.com
Please note that the domain name provided will need to be correctly pointed at your Rails Machine account. If you don’t have a DNS provider, we’ve been more than happy with DNS Made Easy .Update Database Config
Update your applications
config/database.yml
’s section with your desired MySQL datbase name, username, and password. The database and user will be created for you in a forthcoming step.Application Setup
Rails Machine defaults to using mongrel + mod_proxy_balancer to run your Rails Application. If you’d like to switch to Phusion Passenger , edit the line in your application’s
config/deploy.rb
that begins set :app_server
to reflect your choice. For example:
set :app_server, :passenger
Run the following Capistrano task to setup your MySQL databases and configure your application servers (mongrel/passenger):
$ cap servers:setup
Source Control
If you’re already using Source Control…
...edit the lines in your application’s
config/deploy.rb
that begin set :repository
and set :repository
. For example:
set :scm, :git
set :repository, "[email protected]:yourname/my-cool-app.git"
Important: Although your repository should be configured to ignore the contents of the db and log directories,
make sure the directories themselves are added. The easiest way to do this is to put an empty .gitignore
in the directories- add, commit, and push.
If you’re not yet using Source Control…
...you can easily setup a Git/Subversion repository on your Rails Machine. Subversion is the default, edit the line in your application’s config/deploy.rb
that begins set :scm
if you’d like to change it to git. For example:
set :scm, :git
Next, run the following task to import your application into a Git/SVN repository on your Rails Machine:
$ cap repos:setup
Initial Deploy
That’s it! You’re ready to use Capistrano to deploy your app for the first time:
$ cap deploy:cold
Once that’s done, open your application in a web browser and test it out!
To perform a subsequent deploy with Capistrano:
$ cap deploy
or, if you need to run migrations as well:
$ cap deploy:migrations
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
CentOS 7에서 OpenLDAP 서버 설치 및 구성LDAP(Lightweight Directory Access Protocol)는 ID와 개체를 쉽게 관리할 수 있는 디렉터리 서비스입니다. Windows 세계에서 서버는 일반적으로 Active Directory입니다...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.