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.
Related
I have built a Release pipeline custom task extension and this has been successful, we are downloading a file from one location (Dev environment), then deploying it to the next (test environment) I am wanting to have the build task capture the file and store it in the Repo as part of the task.
I've researched through all the Microsoft documentation, samples etc, but i am unable to find anything, can anyone recommend some blogs/tutorials/examples that will allow me to do what i am after?
I also have a few other queries around custom build tasks and would love an end to end general tutorial, i have found disparate information on the Microsoft Docs but piecing it all together is an issue.
how can i upload to Repo as part of a custom release build task
There is no such out of box method to upload file to Repo as part of a custom release build task. Because it is not recommended to use a script/build task to upload files directly to the repository without any checks.
If you are interested, you can try to use following method to do this:
Steps:
Using task to download the file and you can copy them to your local repo directory. Then specify the Working Folder to the local repo directory in all Command Lines tasks.
Run the build agent with an account that can push commits to TFS/Azure Devops.
Details steps:
Run git add <filename> command:
Run git commit -m "Commit message".
Run git push origin master.
Note: Make sure you have install Git on your build agent machine.
Hope this helps.
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
I have this strange issue that my git push origin master and cap deploy it not updating to the latest code and images on production server. I still have old images that I updated localy a long time ago and changes still not reflected.
Is there a way to reset a remote git repo and upload a clean latest version of your local to it?
Or other ways to debug, git status shows no untracked files so I really don't get where it goes wrong.
check your .gitignore file, you could have a line there ignoring these files or entire folders.
check your deploy.rb and multistage deploy files in /deploy folder to make sure that you are using correct branch (master)
When you update an image, commit, push to remote and do cap production deploy:pending do you see your commit listed there as pending deployment?
This turned out to be an SSH timeout on cap deploy, wich I dident have noticed. Resulting in not all commits uploaded thus not seeing my latest commited changes.
Had to upgrade ssh timeout on server.
I pushed code to my server using capistrano (using git also).
I then made changes on my laptop, but haven't sinced published to the server.
I want to know which git version I pushed to the server so I can rollback to that version.
Is this possible?
I know I should have used tags but kinda late for that, hoping I can figure out the version I pushed to my server, so I can rollback to that version or at least diff from that version to the current built to see what has changed since then.
Capistrano should have put a REVISION file under #{your_app}/current on the server, with the deployed commit's SHA:
So something like:
git diff `ssh your_user#your_server "cat /path/to/your/app/current/REVISION" `
should get you the appropriate diff.
yes, you can check your reflog.
git reflog
But you should be tagging when you release.
Hope this helps
git fetch
git log origin/master -1
fetch synchronizes with your server and log origin/master shows the log of your server's git repo instead of your local repo. The -1 tells it to only show the last commit. This will show the commit hash and message of the last commit on your server's repo.
If your server is listed in your remotes as something other than origin or your server is using a branch other than master, you'll have to change that. But "origin" and "master" are the defaults and are standard convention if you haven't changed it.
<subjective>
Unless you're explicitly versioning your software (like when creating a gem, for example), it's not necessary to add a tag every time you deploy your app. This would quickly become unwieldy. With git, a commit hash can be used just like a tag if it's ever needed.</subjective>
I am new to the world of Git, GitHub and Heroku. So far, I am enjoying this paradigm but coming from a background with SVN, things seems a bit complicated to me in the world of Git. I am facing a problem for which I am looking for a solution.
Scenario:
1. I have setup a new private project on GitHub. I forked the private project and now I have the following structure in my branch:
/project
/apps
/my-apps
/my-app-1
....
/my-app-2
....
/your-apps
/your-app-1
....
/your-app-2
....
/plugins
....
I can commit the code in my Fork on GitHub from my machine in any of the folders I want. Later on, these would be pulled into the master repository by the admin of the project.
2. For every individual application in the apps folder, I have setup an app on Heroku which is a Git Repo in itself where I push my changes when I am done with the user stories from my local machine. In short, every app in the apps folder is a Rails App hosted on Heroku.
Problem:
What I want is that when I push my changes into Heroku, they can be committed into my project fork on GitHub as well, so, it also has the latest code all the time.
The issue I see is that the code on Heroku is a Git Repo while the folders which I have on GitHub are part of a Repo.
So far, what I have researched is that there is something known as Submodule in the Git World which can come to the rescue, however, I have not been able to find some newbie instructions.
Can someone in the community be kind enough to share thoughts and help me to identify the solution of this problem?
The idea behind submodules is that they're all separate git repositories that you can include into a master one and rather instead of including all the files it includes a link to that submodule instead.
How to use submodules
To use a submodule, first you must extract out the directory and create it as its own git repository by using git init. Then you can upload this separately to Github or [place of your choosing] and to use it as a submodule use the command: git submodule add [place/to/put/it] git://github.com/you/proj1.
Separation is best
I would think it better to leave these separated out as their own git repositories and push to heroku from each one. The reason? It's more likely (I feel) that you're going to be working on one at a time and doing a git commit and git push heroku master for that one only.
If you wished however to deploy all applications at the same time you could recurse down the directory tree using this Ruby script placed in the top-level directory:
Dir["**/*"].select { |dir| File.directory?(dir) }.each do |f|
Dir.chdir(dir) do
`git push origin master`
`git push heroku master`
end
end
Of course this would only work if you have staged all your changes. I can't think of a way to automate that as Ruby <= 1.9 doesn't have the module to read your thoughts.