Ruby on rails 如何在digital ocean上一键部署rails应用程序?
我已经用已经配置好的nginx和unicorn服务器在rubyonrails的数字海洋上创建了一个drop 如何将已创建的rails应用程序部署到该服务器 我应该使用capistrano进行部署吗?或者有其他的部署方式吗 我已经到过digital ocean guide进行部署,但对于像我这样的初学者来说,它非常混乱Ruby on rails 如何在digital ocean上一键部署rails应用程序?,ruby-on-rails,ruby,nginx,deployment,digital-ocean,Ruby On Rails,Ruby,Nginx,Deployment,Digital Ocean,我已经用已经配置好的nginx和unicorn服务器在rubyonrails的数字海洋上创建了一个drop 如何将已创建的rails应用程序部署到该服务器 我应该使用capistrano进行部署吗?或者有其他的部署方式吗 我已经到过digital ocean guide进行部署,但对于像我这样的初学者来说,它非常混乱 我创建了相同的液滴是的,您可以使用Capistrano进行部署,使用Capistrano是最佳做法,您可以参考 如果你面临任何问题,请告诉我 是的,您可以使用Capistrano
我创建了相同的液滴是的,您可以使用Capistrano进行部署,使用Capistrano是最佳做法,您可以参考
如果你面临任何问题,请告诉我 是的,您可以使用Capistrano进行部署,使用Capistrano是您可以参考的最佳实践 如果你面临任何问题,请告诉我 或者您也可以使用mina进行部署。这就像卡皮斯特拉诺,但它比卡皮斯特拉诺更容易,速度也快得多 看看:或者您也可以使用mina进行部署。这就像卡皮斯特拉诺,但它比卡皮斯特拉诺更容易,速度也快得多
请看:我将尝试一步一步地解释它。 使用Ubuntu 12或14。 你需要Nginx,RoR,Capistrano,git,乘客 0。将int记录到服务器
ssh root@server_ip
ssh -p XXXX deployer@XXX.XXX.XXX.XXX
rvmsudo passenger-install-nginx-module
你可以在这里找到ip
1。创建用户(如果需要)
2。将用户移动到sudo用户
visudo
deployer ALL=(ALL:ALL) ALL
3。为他安装bash
nano /etc/passwd
Change /bin/sh to /bin/bash
4。更改ssh端口以实现安全性
nano /etc/ssh/sshd_config
Change Port 22 on Port XXXX (where XXXX is any number)
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
gem 'net-ssh’, ‘2.7.0'
end
5。重新加载ssh
6。通过ssh与新用户一起输入
ssh root@server_ip
ssh -p XXXX deployer@XXX.XXX.XXX.XXX
rvmsudo passenger-install-nginx-module
7。必要时更新系统
adduser deployer
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl
sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap
8。安装rvm:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
9。安装ruby、postgres等…
rvm install [version of ruby similar to app]
sudo apt-get install postgresql
如果未创建群集,请手动执行此操作:
sudo pg_createcluster [postgresql_version] main --start
sudo apt-get install language-pack-en-base
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
创建postgres用户
sudo -u postgres psql
alter user postgres with password '[password]';
要退出psql,请按\q
10。安装gem乘客:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
11。使用乘客座椅安装nginx
ssh root@server_ip
ssh -p XXXX deployer@XXX.XXX.XXX.XXX
rvmsudo passenger-install-nginx-module
12。如果需要,设置交换
adduser deployer
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl
sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap
13。更改nginx的配置(服务器部分):
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
15。运行nginx:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
博雅!!检查你的浏览器强>
让我们转到我们的应用程序强>
1。用于depoly的gem“capistrano”
nano /etc/ssh/sshd_config
Change Port 22 on Port XXXX (where XXXX is any number)
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
gem 'net-ssh’, ‘2.7.0'
end
2。跑步:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
打开deploy.rb并设置:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
5。添加:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
6。cap部署:选中
7。cap部署:设置
set :bundle_cmd, "/home/deployer/.rvm/gems/ruby-2.0.0-p451@global/bin/bundle"
set :bundle_dir, "/home/deployer/.rvm/gems/ruby-2.0.0-p451"
set :rvm_type, :user
set :rvm_ruby_string, 'ruby-2.0.0-p451@global'
8。部署方法:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
9。在服务器上克隆ssh密钥并添加到repo
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
10。添加宝石“therubyracer”
11。帽子展开:冷
adduser deployer
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl
sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap
博雅!如果smth不清楚,我可以提问。我将尝试一步一步地解释它。 使用Ubuntu 12或14。 你需要Nginx,RoR,Capistrano,git,乘客 0。将int记录到服务器
ssh root@server_ip
ssh -p XXXX deployer@XXX.XXX.XXX.XXX
rvmsudo passenger-install-nginx-module
你可以在这里找到ip
1。创建用户(如果需要)
2。将用户移动到sudo用户
visudo
deployer ALL=(ALL:ALL) ALL
3。为他安装bash
nano /etc/passwd
Change /bin/sh to /bin/bash
4。更改ssh端口以实现安全性
nano /etc/ssh/sshd_config
Change Port 22 on Port XXXX (where XXXX is any number)
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
gem 'net-ssh’, ‘2.7.0'
end
5。重新加载ssh
6。通过ssh与新用户一起输入
ssh root@server_ip
ssh -p XXXX deployer@XXX.XXX.XXX.XXX
rvmsudo passenger-install-nginx-module
7。必要时更新系统
adduser deployer
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl
sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap
8。安装rvm:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
9。安装ruby、postgres等…
rvm install [version of ruby similar to app]
sudo apt-get install postgresql
如果未创建群集,请手动执行此操作:
sudo pg_createcluster [postgresql_version] main --start
sudo apt-get install language-pack-en-base
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
创建postgres用户
sudo -u postgres psql
alter user postgres with password '[password]';
要退出psql,请按\q
10。安装gem乘客:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
11。使用乘客座椅安装nginx
ssh root@server_ip
ssh -p XXXX deployer@XXX.XXX.XXX.XXX
rvmsudo passenger-install-nginx-module
12。如果需要,设置交换
adduser deployer
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl
sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap
13。更改nginx的配置(服务器部分):
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
15。运行nginx:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
博雅!!检查你的浏览器强>
让我们转到我们的应用程序强>
1。用于depoly的gem“capistrano”
nano /etc/ssh/sshd_config
Change Port 22 on Port XXXX (where XXXX is any number)
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
gem 'net-ssh’, ‘2.7.0'
end
2。跑步:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
打开deploy.rb并设置:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
5。添加:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
6。cap部署:选中
7。cap部署:设置
set :bundle_cmd, "/home/deployer/.rvm/gems/ruby-2.0.0-p451@global/bin/bundle"
set :bundle_dir, "/home/deployer/.rvm/gems/ruby-2.0.0-p451"
set :rvm_type, :user
set :rvm_ruby_string, 'ruby-2.0.0-p451@global'
8。部署方法:
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
gem install passenger
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
location ^~ /assets/
{ gzip_static on;
expires max;
add_header Cache-Control public;
}
}
git clone https://github.com/vkurennov/rails-nginx-passenger-ubuntu.git
sudo cp nginx/nginx.conf /etc/init.d/nginx.conf
sudo chmod +x /etc/init.d/nginx/conf
sudo /etc/init.d/nginx start
capify .
set :application, 'app_title'
set :repository, 'app_repo'
require 'bundler/capistrano'
require "rvm/capistrano"
load 'deploy/assets’
set :port, XXXX
set :use_sudo, false
set :rails_env, :production
set :branch, "master"
set :deploy_to, "/home/deployer/app_title"
set :user, 'deployer'
role :web, "XXX.XXX.XXX.XXX" # Your HTTP server, Apache/etc
role :app, "XXX.XXX.XXX.XXX" # This may be the same as your `Web` server
role :db, "XXX.XXX.XXX.XXX", :primary => true # This is where Rails migrations will run
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
9。在服务器上克隆ssh密钥并添加到repo
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
10。添加宝石“therubyracer”
11。帽子展开:冷
adduser deployer
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl
sudo dd if=/dev/zero of=/swap bs=1M count=1024
sudo mkswap /swap
sudo swapon /swap
博雅!如果smth不清楚,我会提出问题。我有这张图片,只想使用它。您能指导我吗?意味着您需要使用nginx和Unicorn配置应用程序?是的,我需要使用当前安装的nginx和Unicorn部署和配置我的应用程序。您可以参考,谢谢,但目前没有任何用处。你能解释一下吗?我有这个图像,只想用这个。您能指导我吗?意味着您需要使用nginx和Unicorn配置应用程序?是的,我需要使用当前安装的nginx和Unicorn部署和配置我的应用程序。您可以参考,谢谢,但目前没有任何用处。你能解释一下吗?我想部署我的应用程序并用当前安装的nginx和unicorn进行配置。我想部署我的应用程序并用当前安装的nginx和unicorn进行配置。我知道这个过程,并且已经成功地完成了我的一个项目。但目前我已经用自动安装的rails创建了droplet。我知道这个过程,并且成功地完成了我的一个项目。但目前我已经用自动安装的rails创建了droplet。一键式安装不使用Capistrano或Unicorn。这是一个非常基本的Rails安装,使用Webbrick作为服务器。如果你可以让你的应用程序在他们非常简单的配置中运行,这是一个很好的第一步,然后在你确认你的应用程序在Webbrick中启动后增加复杂性。一键安装不使用Capistrano,也不使用Unicorn。这是一个非常基本的Rails安装,使用Webbrick作为服务器。如果你能让你的应用程序在他们非常简单的配置中运行,这是一个很好的第一步,那么一旦你在Webbrick中确认你的应用程序启动,就会增加复杂性。