I have a Rails application which I deployed to a remote server with git and Capistrano 3. It works fine.
Sometimes after I change some files (in app/views, for example), I want to upload those changes to the current release without running the full cycle of deploy process.
I need one command to upload changed files (files in the last commit in git) to the current release directory on the remote server.
What is the best way to do it?
Improve Performance with Remote Cache
The way Capistrano works, it will create a new clone/export of your repository on every deploy. That can be slow, so there’s an option to add some extra commands to our deploy.rb recipe to speed things up. Add the following to the section of your deploy.rb where you describe your scm settings: set :deploy_via, :remote_cache
This command makes Capistrano do a single clone/checkout of your repository on your server the first time, then do an svn up or git pull on every deploy instead of doing an entire clone/export. If you deploy often, you’ll notice that this speeds up your deployments significantly.
Hope this help you what you are looking for!!!
For more detail check out this link. deploy-with-capistrano
Related
Am looking for Capistrano Geek to reduce the Deployment time & process.
everyone knows how the capistrano is working, its always Clone code to the target server and keep the code as release directory & create a symblink to current directory.
Here am looking for Git pull request, in ROR if I made any changes like Changing the Caption, updating text means I dont want to deploy the whole application again.
I simply need to update the code which has minimum changes
For that I have to use Git pull to update the changes & Git pull is not working in the Capistrano
I directly ran git pull in the release path I got error only.
Could anyone has solution for this pls post & my sample code is show below.
desc "Update the deployed code."
task :update_code
execute "/usr/bin/git pull origin #{fetch(:release_path)}")
end
end
Capistrano uses git archive to create the release copy of the repo. This does not include the .git/ directory, so further git commands will not work.
I'm trying to test some changes out on production without having to commit and push the changes because I only want to commit what actually works. The project I'm working on was created with Rails (3.0.2), and deploys with Capistrano (3.1). I've tried making changes in the root folder of my app and redeploying, and the changes are not reflected on the website. I've tried making changes in the root/current directory and redeploying and that didn't work.
Is there any way I can redeploy changes to the server without having to push it to Github first?
Is there any way I can redeploy changes to the server without having
to push it to Github first?
No this isn't possible since one of the first things that Capistrano will do is git clone the latest from whatever branch you've specified in your deploy config.
I'm not sure what your familiarity with Rails is but the proper way to do this would be to create a new staging environment and deploy to that. The staging environment would have similar settings to your production environment with a separate database so that you don't affect production data.
Capistrano 3 supports this flow out of the box so that once you've set everything up you can simply call
cap staging deploy
to deploy to the staging environment, and
cap production deploy
to deploy to the production environment.
I'm trying to deploy my MVC4 app to ELB. The project has several post-build steps which pull together dependencies. The AWS SDK publish wizard then does not do the trick - it builds a Web Deploy package behind the scenes, which does not action those post-build steps or preserve the resulting directory structure.
So, I downloaded the command-line EB tools, got a git repository working, but can't work out the next step: what do I push to the server with git aws.push: because if it's just the resulting files then I can't specify the "Enable 32-bit applications" flag (required), etc. Do I then push a web deploy package from my repository?
I presume so, but if so, how do I include the files copied into the output folder during "normal" builds by my post-build steps?
Here we go. This seems to be in conflict with what Jim Flanagan was saying - below it's a zip file, but Jim says it's the contents of it.
#Jim Flanagan - perhaps you could comment if you have some time. Thanks.
Hi thanks for contacting AWS Premium Support
Communication from the Elastic Beanstalk Engineering Team.
When you aws.push an ASP.NET/MVC app you do not push the web deploy archive, rather you push the artifacts as you want them deployed on the machine. From the customers stack overflow question it seems they have already found the local git repo that the VS deployment wizard created and looking their should give them a good indication of what is needed in the git repository.
There isn't a nice way through the aws.push to specify what the "Enable 32-bit Application" app pool setting should be (or any other configuration setting). If you need a specific configuration setting set I would suggest creating the environment (via the console or using the eb command line tool) which allow you to specify the configuration. And then use git aws.push to deploy to that environment, git aws.push will just use the configuration that is already present on the environment.
The last question about still being incremental is not really valid since you are not pushing just one big zip file. But if you were, it could still be incremental depending on what changed in the zip file, it might just send a diff between the two versions of the zip file. As the question implies though that use case is not really what incremental deployments were designed to help with.
Is it possible to get Capistrano to update a currently deployed app with a migration (that's all that has been committed as a change since last deployment), update the deployed app with just this code (without running a new full deployment) and just run the migration?
A deployment is what it is, a deployment.
You are asking to deploy without deploying (!?)
IMHO, your issue is more related to SCM (svn, git, etc...) than to capistrano.
You probably want to deploy part of your code (one migration) but not everything that is committed to trunk/master. What you have to do is to branch/tag for deployment, and deploy from that branch/tag.
For example, if I'm using svn I always add these lines to my deploy.rb:
set(:tag) { Capistrano::CLI.ui.ask("Tag to deploy: ") }
set(:repository) { "#{repository_root}/tags/#{tag}" }
this way I can deploy a particular tag and my SVN has clearly defined my production code.
In your case, the procedure would be:
branch your last production revision
apply any changes to this branch (your desired migration)
tag it (for example, prod-with_my_desired_migration)
deploy that tag including cap deploy:migrate
Every tool has its purpose and we have to leverage the power of each of them.
We use git (github) and capistrano (like 99% of the Rails shops out there) to deploy our app to production.
What I'd like to do is, after every cap * deploy generate a text file containing all the git commit comments since the last deploy. I can then take that list of commit comments, clean it up, and put it somewhere for consumption.
"git log" http://book.git-scm.com/3_reviewing_history_-_git_log.html has plenty of options for fetching log messages, but I don't see an easy way in capistrano to return the current and previous commits, or even the last date/time a deployment occurred, so I can pass that to git log
Thoughts? I can't be the first one doing this... Thanks!
If capistrano doesn't do this, you can wrap it in another script/tool, say, release.
When you launch release, it records the commit, compares it with the previously recorded commit, calls a release notes generator script/tool, and then calls capistrano.