Passenger: https://www.phusionpassenger.com/library/deploy/apache/automating_app_updates/ruby/
DigitalOcean/Apache: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04
digitalocean.com: create Droplet (ubuntu 14.04.5 x32)
local: ssh [email protected]
https://gist.github.com/Netznarkose/098295c54b8b8bf402564fc7491e3eab
<script src="https://gist.github.com/Netznarkose/098295c54b8b8bf402564fc7491e3eab.js"></script>deploy@ubuntu: mkdir .ssh
deploy@ubuntu: chmod 700 .ssh
deploy@ubuntu: vi .ssh/authorized_keys
local: pbcopy < ~/.ssh/id_rsa.pub
deploy@ubuntu: sudo chmod 600 .ssh/authorized_keys
deploy@ubuntu: ssh -T [email protected]
deploy@ubuntu: ssh-keygen -t rsa
deploy@ubuntu: cat .ssh/id_rsa.pub
github: add ssh-key
deploy@ubuntu: sudo apt-get install git
deploy@ubuntu: git clone test_repository_to_check_connection
deploy@ubuntu: exit
local: ssh [email protected]
root@ubuntu: vi /etc/ssh/sshd_config
change PermitRootLogin yes => no
root@ubuntu: service ssh restart
local: ssh [email protected]
deploy@ubuntu: sudo apt-get update
deploy@ubuntu: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
deploy@ubuntu: curl -sSL https://get.rvm.io | bash -s stable
deploy@ubuntu: source ~/.rvm/scripts/rvm
deploy@ubuntu: rvm install 2.2.6
deploy@ubuntu: rvm use 2.2.6 --default
deploy@ubuntu: rvm gemset create my_app
deploy@ubuntu: rvm 2.2.6@my_app do gem install bundler
deploy@ubuntu: sudo apt-get update
deploy@ubuntu: sudo apt-get install apache2
deploy@ubuntu: sudo apt-get install -y dirmngr gnupg
deploy@ubuntu: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
deploy@ubuntu: sudo apt-get install -y apt-transport-https ca-certificates
deploy@ubuntu: sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
deploy@ubuntu: sudo apt-get update
deploy@ubuntu: sudo apt-get install -y libapache2-mod-passenger
deploy@ubuntu: sudo a2enmod passenger
deploy@ubuntu: sudo apache2ctl restart
deploy@ubuntu: sudo /usr/bin/passenger-config validate-install
deploy@ubuntu: sudo /usr/sbin/passenger-memory-stats
check for Apache-Processes
deploy@ubuntu: sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/my_app.conf
deploy@ubuntu: sudo vi /etc/apache2/sites-available/my_app.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/my_app/current/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/my_app/current/public">
RailsEnv production
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
deploy@ubuntu: sudo mkdir -p /var/www/my_app/shared
deploy@ubuntu: sudo chown deploy: /var/www/my_app /var/www/my_app/shared
deploy@ubuntu: sudo mkdir -p /var/www/my_app/shared/config
deploy@ubuntu: sudo touch /var/www/my_app/shared/config/database.yml
deploy@ubuntu: sudo touch /var/www/my_app/shared/config/secrets.yml
deploy@ubuntu: sudo chown -R deploy: /var/www/my_app/shared/config
deploy@ubuntu: chmod 600 /var/www/my_app/shared/config/database.yml
deploy@ubuntu: chmod 600 /var/www/my_app/shared/config/secrets.yml
local: gem list | grep rails
local: gem install rails -v 4.2.10
local: rails _4.2.10_ new my_app -T
Github: create repository my_app
local/my_app: git remote add origin [email protected]:Netznarkose/my_app.git
local/my_app: vi Gemfile
group :development do
gem 'capistrano'
gem 'capistrano-passenger', '>= 0.1.1'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano-rvm'
end
local/my_app: bundle install
local/my_app: cap install
local/my_app: vi Capfile
require 'capistrano/bundler'
require 'capistrano/passenger'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/rvm'
local/my_app: vi config/deploy.rb
set :application, "my_app"
set :repo_url, "[email protected]:Netznarkose/my_app.git"
set :deploy_to, "/var/www/my_app"
local/my_app: vi config/deploy/production.rb
server "139.59.185.172", user: "deploy", roles: %w{app db web}
set :rails_env, 'production'
set :rvm_ruby_version, 'ruby-2.2.6@my_app'
set :branch, 'master'
local/my_app: cap production deploy