holandes22 / rafee

1 stars 1 forks source link

Ansible: production/staging deployment and upgrade playbooks #30

Open holandes22 opened 9 years ago

holandes22 commented 9 years ago

The fronted files should be committed prior to deploy, so maybe create a script that automates the whole process. Basically use the same playbook as for dev, but pulls code from git and asks passwords and other inputs from user

tzurE commented 9 years ago

I'll create a role that pulls everything from git(ill test it on my git fork of the project) should I just bring a prompt or something during the deploy that asks all the data? Or maybe the user should just supply a variables file, and we can just pass it to the j2 template file that has all the {{db_pass}} and {{user}}, etc...

holandes22 commented 9 years ago

Sounds Good. Sensitive data, such as passwords, should be prompted

tzurE commented 9 years ago

where exactly is all the django back-end source code? on the VM. I found the static files in /var/www with the path in ansible vars and I went through all the provisioning files...

Maybe this is something basic, but shouldn't the whole rafee folder live in the VM in a mounted folder? I mean,through a link or something. I've searched for it but I can't seem to find it so when I checkout/clone the code from github using ansible, I'm not sure what to change in the paths because I'm not sure where everything is supposed to be eventually

holandes22 commented 9 years ago

Currently (in dev) is mounted at /vagrant

For production, is usually best practice to place it under /var/www/ inheriting it's permissions and ownership. The provision script will be in charge of placing the code there (see Ansible's copy command)

On Thu, Jun 4, 2015 at 6:44 PM, tzurE notifications@github.com wrote:

where exactly is all the django back-end source code? I found the static files in /var/www with the path in ansible vars and I went through all the provisioning files...

Maybe this is something basic, but shouldn't the whole rafee folder live in the VM in a mounted folder? I mean,through a link or something. I've searched for it but I can't seem to find it so when I checkout/clone the code from github using ansible, I'm not sure what to change in the paths because I'm not sure where everything is supposed to be eventually

— Reply to this email directly or view it on GitHub https://github.com/holandes22/rafee/issues/30#issuecomment-108940965.

tzurE commented 9 years ago

Is the code hierarchy and structure supposed to be similar to the one in dev?

I mean, in /vagrant there is the "virtualenv" folder, and in it a local folder, bin, lib, etc... again, a basic question - shouldn't the code "live" the same way it's living on my local-folder, with all the rafee folder contents there? I mean, python is not a compiled language, so the code must be there as is, but I can't find it.

another thing - why should I use copy? I've used the ansible's git module to pull the code I need. isn't that enough? but again, not sure how is it supposed to be in prod.

holandes22 commented 9 years ago

About how the folder looks in production, is more up to you (for example, we don't really need to put all the tests folders), but no harm in copying it verbatim

You have different options, but why would you pull the repo once more? You already have the code at the machine you are deploying from, so just copy it to the host. Plus with copy you can control exactly what gets pushed to the host (same example as before, you might want to avoid putting test code in production)

On Fri, Jun 5, 2015 at 11:34 AM, tzurE notifications@github.com wrote:

Is the code hierarchy and structure supposed to be similar to the one in dev?

I mean, in /vagrant there is the "virtualenv" folder, and in it a local folder, bin, lib, etc... again, a basic question - shouldn't the code "live" the same way it's living on my local-folder, with all the rafee folder contents there? I mean, python is not a compiled language, so the code must be there as is, but I can't find it.

another thing - why should I use copy? I've used the ansible's git module to pull the code I need. isn't that enough? but again, not sure how is it supposed to be in prod.

— Reply to this email directly or view it on GitHub https://github.com/holandes22/rafee/issues/30#issuecomment-109203541.

tzurE commented 9 years ago

so what needs to be copied? all the templates\slidehows\users etc.. folders in rafee? the frontend needs to be copied differently?

tzurE commented 9 years ago

ok, so - according to this - https://github.com/mitchellh/vagrant/issues/2924#issuecomment-40004241 using vagrant makes it impossible running vars_prompt. it's just the way that vagrant runs ansible-playbook. (happens when you try to add vars_prompt to the site.yml file)

another idea was to create a role for that. But, accorind to this -https://github.com/ansible/ansible/issues/7221 you can't prompt for vars during a play. so using a role for that is currently impossible.

I found 2 solutions.

  1. pause the play and pass the vars. but that doesn't always work - again because of how vagrant runs ansible-playbook (it intercepts the stream of tokens and deprives it of ansible)

2.the user will pass a file that acts as an extra var file, containing the data we need, using the -e tag.

please let me know what do you prefer and I'll do it. I think number 2 is the best option we got.