Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Install deprec
- sudo gem install deprec
- # Create user on slicehost account (run on server)
- adduser --ingroup users yourusername
- # Add new user to '/etc/sudoers' file (on server)
- # Remove obsolete projects from '/etc/apache2/sites-available' and
- # '/etc/apache2/site-enabled' (on server)
- ## If using github
- # Add ssh key to github
- cd .ssh
- ssh-keygen
- ssh-add id_rsa
- cat id_rsa.pub | pbcopy
- paste into github form
- # Create ~/.ssh/config file
- Host github.com
- User git
- Port 22
- Hostname github.com
- IdentityFile ~/.ssh/id_rsa
- TCPKeepAlive yes
- IdentitiesOnly yes
- # Config git
- git config --global user.name "Your Name"
- git config --global user.email your.email@gmail.com
- # Add project to github
- cd yourappname
- git init
- touch README
- git add README
- git commit -m 'first commit'
- git remote add origin git@github.com:yourusername/yourappname.git
- git push origin master
- ## If not using github
- # Add project to git
- cd yourappname
- git init
- mate .gitignore
- .DS_Store
- db/*.sqlite3
- log/*.log
- tmp/**/*
- touch log/.gitignore
- touch tmp/.gitignore
- git add .
- git commit -m 'first commit'
- ## [shell]
- # Create deprec configuration files
- cd yourappname
- depify .
- # Modify file 'config/deploy.rb':
- set :repository, "." # if not using github
- set :application, "yourappname"
- set :domain, "yourdomainname"
- set :user, "yourusername"
- set :password, "yourpassword" # if not using github
- set :deploy_via, :copy # if not using github
- # Install shared rails stack to slicehost using deprec
- cap deprec:rails:install_stack
- # Install shared database on slicehost.
- # WARNING! Don't run the following command if you
- # are using a shared database server that has already
- # been installed.
- cap deprec:db:install
- # Modify file 'config/database.yml'
- production:
- adapter: mysql
- database: yourappname_production
- username: root
- password:
- host: localhost
- # Publish changes to git
- git add .
- git commit -m "Updated configuration"
- # Create mysql production database:
- mysqladmin -u root create yourappname_production # run on slicehost server
- # Install project to slicehost using capistrano
- cap deploy:setup # once to initialize project
- cap deploy
- # Install gem dependencies (requires custom Capistrano task)
- cap deploy:gems
- # Run migrations
- cap deploy:migrate
- ## Routine
- # Commit changes to git
- git add .
- git commit -m "Updated configuration"
- # Deploy changes to server
- cap deploy
- # Deploy new migrations to server
- cap deploy:migrate
- # Deploy new gem dependencies to server (requires custom Capistrano task)
- cap deploy:gems
- # Run this on server to rollback schema
- rake RAILS_ENV=production db:rollback
- ## Switch domain name
- vi 'config/deploy.rb'
- set :domain, "yourdomain.com"
- cap deploy:setup # When prompted, overwrite apache_vhost
- ## Troubleshooting
- # Run gems on server
- ssh username@domainname
- sudo gem update
- # Run script/console on server
- ssh username@domainname
- cd /opt/apps/yourappname/current
- script/console production
- u = User.find_by_login('admin')
- u.is_admin = true
- u.save
- # View Rails production log
- tail -f /opt/apps/yourappname/current/log/production.log
- # View Apache log files
- tail -f /var/log/apache2/error.log
Add Comment
Please, Sign In to add comment