Created
January 28, 2017 07:26
-
-
Save dcalixto/1c90e196d64fd1aa28c4cbf02f0b3ff3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apt-get -y update | |
| apt-get -y install curl git-core python-software-properties | |
| # nginx | |
| add-apt-repository ppa:nginx/stable | |
| apt-get -y update | |
| apt-get -y install nginx | |
| service nginx start | |
| # PostgreSQL | |
| add-apt-repository ppa:pitti/postgresql | |
| apt-get -y update | |
| apt-get -y install postgresql libpq-dev | |
| sudo -u postgres psql | |
| # \password | |
| # create user blog with password 'secret'; | |
| # create database blog_production owner blog; | |
| # \q | |
| # Postfix | |
| apt-get -y install telnet postfix | |
| # Node.js | |
| add-apt-repository ppa:chris-lea/node.js | |
| apt-get -y update | |
| apt-get -y install nodejs | |
| # Add deployer user | |
| adduser deployer --ingroup admin | |
| su deployer | |
| cd | |
| # rbenv | |
| curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash | |
| vim ~/.bashrc # add rbenv to the top | |
| . ~/.bashrc | |
| rbenv bootstrap-ubuntu-10-04 | |
| rbenv install 1.9.3-p125 | |
| rbenv global 1.9.3-p125 | |
| gem install bundler --no-ri --no-rdoc | |
| rbenv rehash | |
| # get to know github.com | |
| ssh [email protected] | |
| # after deploy:cold | |
| sudo rm /etc/nginx/sites-enabled/default | |
| sudo service nginx restart | |
| sudo update-rc.d -f unicorn_blog defaults | |
| Local Setup | |
| terminal | |
| rails new blog -d postgresql | |
| rails g scaffold article name content:text | |
| # setup Git | |
| mate .gitignore | |
| cp config/database.yml config/database.example.yml | |
| git init | |
| git add . | |
| git commit -m "initial commit" | |
| git remote add origin [email protected]:ryanb/blog.git | |
| git push | |
| # add Capistrano, Unicorn, and nginx config | |
| bundle | |
| capify . | |
| chmod +x config/unicorn_init.sh | |
| git add . | |
| git commit -m "deployment configs" | |
| # ssh setup | |
| cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys' | |
| ssh-add # -K on Mac OS X | |
| # deployment | |
| cap deploy:setup | |
| # edit /home/deployer/apps/blog/shared/config/database.yml on server | |
| cap deploy:cold | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment