Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Get your application on a server [only for 0.7.x versions]

Nick Janetakis edited this page Jul 30, 2014 · 1 revision

This guide is only applicable if you're using a version of orats that still contains ansible generation.

This guide will assume you're deploying to a virtual machine somewhere. Ansible does have plugins to support all of the major cloud providers and getting it to work with vagrant isn't too difficult but all of that is beyond the scope of this guide.

This guide assumes you have a single IP address capable of accepting an ssh connection and is running ubuntu 12.04 LTS server.

# 1. generate the necessary files
orats project /tmp/myapp --template auth -p yourpostgrespw
orats playbook /tmp/orats-playbook

# 2. push myapp to some git repository
# you need to do this on your own

# 3. configure /tmp/myapp/inventory/group_vars/all.yml
# change `ansible_ssh_user`     to whatever your initial user name is on the server
# change `rails_deploy_git_url` to point to some git repository that you pushed to

# 4. configure /tmp/myapp/inventory/hosts
# change the IP addresses to match your server's IP address

# 5. run the playbook
ansible-playbook /tmp/orats-playbook/site.yml -i /tmp/myapp/inventory -kK
# the -kK flags tell ansible to prompt you for the initial user's password and sudo
# password, you only need to supply -kK on the first run because at this stage ansible
# has not provisioned your server to accept ssh keys yet

# 6. view the site
# when everything is done...
# 
# visit http://the_ip_of_your_server
# login with:
#   username: admin@myapp.com
#   password: password

In the future if you want to push a new build of your app to your server you can run this command:

ansible-playbook /tmp/orats-playbook/site.yml -i /tmp/myapp/inventory --tags rails

The above command only runs the rails related tasks which handles deploying your app. Of course you will have to push a new version of your app to some remote git repo first. The above command is set to only make changes when the remote git repo changes.