-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Add rsync strategy for final deployment #106
Conversation
file: state=directory path={{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }} | ||
|
||
- name: ANSISTRANO | Sync release to new current path | ||
command: rsync -a --copy-links --delete-after "{{ ansistrano_release_path.stdout }}/" "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you had a look at trying to achieve this using the synchronize module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
Thanks for this contribution! Looks great apart from the synchronize module detail I mentioned We will need to update the docs as well but generally speaking 👍 |
@@ -11,6 +11,9 @@ ansistrano_version_dir: "releases" | |||
# Softlink name for the current release | |||
ansistrano_current_dir: "current" | |||
|
|||
# Current directorty deployment strategy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TYPO here, "directorty"
I was looking at some docs, assuming your symlink problem is happening with PHP, have you checked if doing and after-symlink step running
would do the trick? |
You can't clear the realpath-cache and opcode from cli, you have to clear it inside apache (mod_php) or fpm. But as long as requests are running the opcode cache is filled with old code so you have to stop/restart the webserver/fpm. The only solution for symlink deployments is using nginx with This is also an issue for other languages |
Yeah, an option which I have done in the past is to do a curl to an internal url to achieve the same thing as this php -r command is doing in either Apache or Nginx. Nasty stuff indeed! Thanks for the quick updates, it does not break anything so I am ok with it. @carlosbuenosvinos @theUniC ? |
I think it makes sense. Give me this afternoon to take a look closer. |
We've tried a workaround with 10 serial curl requests with opcode-clear.php but it doesn't help. On busy sites the opcode cache is still buggy and many users are getting HTTP 500. |
Yeah, ideally you need to take the box of the Load Balancer, wait for the running requests to stop, deploy code, clear caches and add them again to the Load Balancer once everything is fine. Surely easier said than done in many environments :( |
@carlosbuenosvinos |
With Ansible 1.9 is not working. Please check the log: 2016-04-03 12:39 GMT+02:00 Markus Blaschke [email protected]:
Carlos Buenosvinos Zamora url: http://carlosbuenosvinos.com |
I think if you rebase master back it and change the regexp as I did in shared-symlink.yml it should work |
Fixed |
@@ -105,6 +105,7 @@ Role Variables | |||
ansistrano_deploy_to: "/var/www/my-app" # Base path to deploy to. | |||
ansistrano_version_dir: "releases" # Releases folder name | |||
ansistrano_current_dir: "current" # Softlink name. You should rarely changed it. | |||
ansistrano_current_via: "symlink" # Deployment strategy who code should be deployed to current path. Options are symlink or rsync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should say something as "Deployment strategy about how code should be deployed to current path.
I would include some information into de readme. But I'm ok. |
Add possibility to sync (via rsync) files to current-directorty instead of symlink because of opcode-caching issues which are not always solvable (eg. shared hosting or customer hosted servers).
It's not an atomic deployment but better than dealing with symlink issues for such environments.
Still using releases/... will provide a possibility to run migrations before deploying the code to current directory so it's still better than just running rsync to web directory.
Default is still symlink but it can be changed with
ansistrano_current_via="rsync"
.