Skip to content

Instantly share code, notes, and snippets.

@Ikera
Created May 25, 2016 10:59
Show Gist options
  • Save Ikera/2866c65da2962cae69e89fb984749bfa to your computer and use it in GitHub Desktop.
Save Ikera/2866c65da2962cae69e89fb984749bfa to your computer and use it in GitHub Desktop.

Set key

check keys in VM cd ~/.ssh/ then ls -la

key = yogain.pem(for_yoga_in) or yoga-api(for yoga_service_api) first copy to key to yoga.in or ayurveda.in folder

~/ayurveda.in$ cp ~/ayurvedain.pem . Put key in VM

vagrant@ayurvedain:~$ mv /vagrant/ayurvedain.pem ~/.ssh change permissions for ayurvedain.pem:

vagrant@ayurvedain:~$ chmod go-rwx ~/.ssh/ayurvedain.pem In VM do cd ~/.ssh/

Then do vim config

And write(for yogain) text bellow. See https://gist.github.com/jexchan/2351996 (Modify the ssh config)

Host yogain.yoga.buldozerteam.com HostName yogain.yoga.buldozerteam.com User yogain IdentityFile ~/.ssh/yogain.pem 7.b Until you run bundle exec cap production(or staging) deploy cannot ssh to ayurvedain@ayurvedain.yoga.buldozerteam.com

After that visit ssh ayurvedain@ayurvedain.yoga.buldozerteam.com and create application.yml in ...shared/config ayurvedain@stage1:$ cd projects/ayurvedain/staging/web/shared/config ayurvedain@stage1:$ cd projects/ayurvedain/staging/web/shared/config touch application.yml In rails project run rake secret for SECRET_KEY_BASE: rake secret open application.yml and add secret key for environment

projects/ayurvedain/staging/web/shared/config$ vim application.yml production:

SECRET_KEY_BASE: YOGA_IN_DATABASE_PASSWORD: staging:

SECRET_KEY_BASE: here put generated secret key YOGA_IN_DATABASE_PASSWORD: for staging run

vagrant@ayurvedain:/vagrant$ cap staging figaro:setup Cold deploy

cap production figaro:setup

go to server: ssh yoga-api@api.production.yoga.buldozerteam.com

nano /home/yoga-api/projects/yoga-api/production/web/shared/config/application.yml to set secret key: generated key by rake secret and password: take password for yoga-api from google document

before this we must do: cap deploy production => then we will get error after that we need to go to yoga-api@api:~/projects/yoga-api/production/web/releases/20151130154658$ RAILS_ENV=production bundle exec rake db:reset use latest migration when you are at releases folder use latest migration and then RAILS_ENV=production bundle exec rake db:reset after that you need to do RAILS_ENV=production bundle exec rake db:schema:load logout from server and do deploy again (cap deploy production)

RAILS_ENV=production bundle exec rake seed:default_sites

  1. Deploy a specific branch (name_of_branch)

BRANCH=name_of_branch cap staging deploy 2. Deploy master branch

cap staging deploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment