-
Notifications
You must be signed in to change notification settings - Fork 186
Add Support for "Overwrite" instruction in appspec.yml "Files" section #14
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
Comments
Hi, |
I would also love this feature. |
Add one more name to the list. |
Of course we need this feature! Purge removes all files in the destination before performing copying the new files. Merge leaves the destination as-is, adds the files from source and will replace an files in the destination that also exist in the source. As for now I guess I need to stage my source files in a temp location and then run a script to achieve this. 🐼 😢 |
+1 for this feature as well. Side note: the Windows agent does NOT exhibit this behavior. I've been writing several appspecs for Windows services and I've never run into this. Only when we went to deploy to an Ubuntu server for the first time did we see this behavior. |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
So, I hope this helps other people find a solution. In my situation I work a lot with Magento so I deal with PHP, nginx. Composer is also tossed in the mix. I found a solution that works for me and for my case. If anyone has any comments or suggestions, please let me know. I wanted to be have the production directory synced with the repository that I was using so any file modifications would be reflected. Not just updates to files, but delete the files that are no longer required. I think this is what everyone really wants. The solution I found was to deploy the code into a temporary directory ( appspec.yaml version: 0.0
os: linux
files:
- source: ./
destination: /var/www/release/
permissions:
- object: /var/www/magento/
owner: www-data
group: www-data
hooks:
BeforeInstall:
- location: scripts/beforeInstall.bash
AfterInstall:
- location: scripts/afterInstall.bash scripts/beforeInstall.bash #!/usr/bin/env bash
# I want to make sure that the directory is clean and has nothing left over from
# previous deployments. The servers auto scale so the directory may or may not
# exist.
if [ -d /var/www/release ]; then
rm -rf /var/www/release
fi
mkdir -vp /var/www/release scripts/afterInstall.bash #!/usr/bin/env bash
# I have left a few things in here and will explain this further (see below)
rsync --delete-before --verbose --archive --exclude "htdocs/media/" --exclude ".*" --exclude "htdocs/var/" --exclude "htdocs/app/etc/local.xml" /var/www/release/ /var/www/magento/ > /var/log/deploy.log The There are also directories that are excluded from the rsync command. You do not need to sync cache directories and in my case the All of the output is put into a deployment log ( Some things I want to try when I make the time, is to rsync files directly from the code-deploy directory. For each deployment, AWS CodeDeploy puts the code into a specific directory which you can reach by some of the environment variables it sets. This should speed up the deploy a little since it isn't putting the files in two places. There are some things that have been left out of the scripts. Certain directories are You can read more about the various hooks and when they occur in the docs at http://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref.html and also see the environment variables that can be used within the scripts. |
+1 |
2 similar comments
+1 |
+1 |
@JoshuaEstes You beautiful SOB, this is exactly what I needed. |
+1 |
Thanks, glad I could help! |
+1 |
3 similar comments
+1 |
+1 |
+1 |
This is a good workaround. The issue I have is with Amazon and the fact that it's been over a year and yet this feature is still not implemented. |
+1. It's a must. |
+100 |
+1 |
any update on this feature? |
+1 |
Any update on this? |
@philstrong |
Is this really happening ?!!! |
if this is fixed, i would be very happy. :) +1 |
We’re going to investigate and report back
…On Wed, Mar 10, 2021 at 2:35 PM Eric Mckee ***@***.***> wrote:
if this is added, i would be very happy. :) +1
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUCBC55MKX2QDM4AABLQ3TC63XHANCNFSM4BIIWZCQ>
.
|
This will be coming soon in the next release of the agent. @chrisdibble did all of the work so he can explain the feature/fix a little better. |
Great news! Thanks so much for your attention to this. |
Not a huge change - we're just allowing the |
Thanks a lot for fixing it. You may not have noticed that, but this is exactly THE huge fix thousands of people have been waiting for. |
On what date its planned to release? |
Guys, this is it !
Hopefully soon ! I'll just put the |
Looking forward to this! |
Any updates regarding the overwrite feature? It takes time to delete everything and setup apps from scratch. The feature would be a great time saver. |
Releasing it now to first regions as 1.3.2
…On Fri, Apr 30, 2021 at 6:51 PM s-larbi ***@***.***> wrote:
Any updates regarding the overwrite feature? It takes time to delete
everything and setup apps from scratch. The feature would be a great time
saver.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAUCBBWIJSEC4VCYZXDPOTTLMX6FANCNFSM4BIIWZCQ>
.
|
I think there is already a feature files:
read this out https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-files.html |
I have tried this before and it didn't work: "The deployment failed because a specified file already exists at this location: /var/www/html/website-folder/sub-folder/file-name.php"... |
mate you should always read before write something: this bug exists because this feature, which it seems you haven't tried, does not work, in fact it's a bug...do you really think that an issue could remain open and debated for years, waiting for a doc page that we all haven't read? 😶 |
I hope this bug is fixed ASAP. It would be a great time saver. |
As Phil said, after the release cycle of 1.3.2 it will work. Phil's team was fast, but "ASAP" is a relative concept, have you read the date of issue? |
1.3.2 is out in some regions e.g. us-east-1 but rolling out to the rest. We will update GitHub once all commercial regions are released which will be Thurs or Friday (5/13 or 5/14). |
Jeff, Give this guy a cigar ! |
Issue is fixed in 1.3.2. Any and all feedback is welcome. |
Thank you, @philstrong, for getting this issue resolved. This will be a great little quality-of-life improvement for a lot of people. I'm grateful. 🙏🏻 |
hi @philstrong is if my previous appspec.yml was
and then i changed it to
i'd get that file already exist error, so if i add
will that solve the problem? |
@philstrong sorry for the multiple comments but im also facing this `version: 0.0
any idea where i got it wrong? that should have overwritten the previously existing files right? |
@andreprawira to address your first comment, no. With respect to your second comment, the service team will try to reproduce the problem. Can we have a little more information?
|
Feature Request:
Would like the ability to have an "overwrite" instruction in the appspec.yml "Files" section.
Use:
In my initial testing, I wanted to clobber all files in
/var/www/html
with new files. This resulted in a failure because the files already existed. Specifically, the following failure:2015-06-13 20:58:40 ERROR [codedeploy-agent(7589)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform: RuntimeError - File already exists at location /var/www/html/index.html - /opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:113:in
generate_normal_copy'`Desired Behavior:
I'd like to be able to create an appspec.yml file with the following section:
files:
- source: web
destination: /var/www/html/
overwrite: true
Notice I've added the "overwrite" instruction, which is currently not offered.
Current Workaround:
I've been working around by utilizing the hook section to do file copies. The hooks/shell script workaround is sufficient, rendering this a lower priority feature request.
The text was updated successfully, but these errors were encountered: