Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible: production/staging deployment and upgrade playbooks #30

Open
2 tasks
holandes22 opened this issue Jan 26, 2015 · 8 comments
Open
2 tasks

Ansible: production/staging deployment and upgrade playbooks #30

holandes22 opened this issue Jan 26, 2015 · 8 comments

Comments

@holandes22
Copy link
Owner

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

  • Create a role that pulls code from git
  • Get sensitive data from user. Passwords for db, admin, secret_key, etc
@tzurE
Copy link

tzurE commented Jun 2, 2015

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
Copy link
Owner Author

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

@tzurE
Copy link

tzurE commented Jun 4, 2015

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
Copy link
Owner Author

Currently (in dev) is mounted at /vagrant

For production, is usually best practice to place it under
/var/www/<app_name> 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
#30 (comment).

@tzurE
Copy link

tzurE commented Jun 5, 2015

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
Copy link
Owner Author

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
#30 (comment).

@tzurE
Copy link

tzurE commented Jun 5, 2015

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

@tzurE
Copy link

tzurE commented Jun 11, 2015

ok, so -
according to this - hashicorp/vagrant#2924 (comment)
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 -ansible/ansible#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.

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

No branches or pull requests

2 participants