Capifony/capistrano hook after symlink switch into new revision - deployment

I need to call cli task on my server after capifony switch application onto new revision by symlink.
Its because of clean APC after succesfull deploy.
I know i can call anything before that symlink switch via after "deploy:finalize_update" do (i have many tasks there), but this i cannot find.

ok, i found it.
Its:
after "deploy" do
...your code...
end

Related

Custom Action not being fired

Recently, I was assigned the task to create a deployment package for an application which btw, I'm totally new at. So far, so good.. Now there is a requirement to extract files from a zip file which will be bundled with the setup file. So, I had to write custom actions in the 'Commit' section of the Installer class. I added the Installer class in a new project of type 'Class Library' under the same solution. I wrote the code after 'base.Commit(savedState)'.
I tried showing MessageBox at the event entry point, used Debugger.Launch(), Debugger.Break() but somehow, no matter what I do, it seems that the custom action is not willing to be hit at all and the application just installs itself. I searched a lot of sites and blogs but no help so far.
I've assigned my installer class (SampleApp.exe, in my case) to all the Custom Action's modes (Install, Commit, Rollback and Uninstall) in the Deployment project. Any help.
P.S. I'm using a Visual Studio 2010 setup project.
Thanks, in advance!
You should probably be trying a class library Dll, not an executable (which is typically for something like a service).
You don't need it all the nodes if all you're doing is calling at Commit. And why Commit? Install is just the same in most cases.
If you're not seeing a MessageBox then probably your CA isn't being called, and that may because it's not a class library. Note that your CA is not running in the interactive user context - it's being called from an msiexec process running with the system account, so you must be very explicit about (say) the path to the zip file, and any user profile folders will probably fail because the system account doesn't really have them.
What files are these and where are they going on disk? If they are user profile files you can install the zip files to a per machine location and then have the application itself unzip the files to the desired location on first launch. Unzipping from within your setup is not good practice - it is error prone and bad design.
Using the application allows proper exception handling and interactivity (the user can be informed if something goes wrong). Set some registry flags in HKCU when you have completed the unzipping so it doesn't happen more than once, and perform the unzip once per user.

Capistrano -- the task `staging:symlink' does not exist

I'm attempting to deploy to a server via Capistrano and I keep getting the error the task `staging:symlink' does not exist.
I've run cap:deploy setup and cap deploy successfully getting the releases and shared directories created but the above error always shows at the end and I think it's stopping my code from getting moved to the root of the directory where it belongs.
I'm new at using Capistrano and I've Googled the issue but I cannot find anything that helps. I can include my code and everything I just don't know what to show to help... let me know!
Thanks for any help you can provide!
The built-in symlink task for capistrano 2.x is cap deploy:symlink.
staging:symlink is not a valid task, unless you've defined it yourself. If you're not defining this, you are accidentally calling it somewhere in your config files (deploy.rb or one of your staging config files, if you're using multistage).
Additionally, deploy:symlink should be called automatically as part of the deploy task. You don't need to call it manually.

How do I run build Release from the command line in Eclipse / Flash Builder

Is there a way to run a Export Release build from the command line in Flash Builder (Eclipse)?
More Context
Flash Builder has debug, run and build release commands or configurations (not sure what they're called). I want to put Flash Builder on the server and invoke the build release configuration from the command line.
You don't need Flash Builder on the server. You can do it with the Flex SDK, Java and Apache ANT installed on the server. If it is a Windows server you can set it up to run like this:
Create an ANT script to update from the repository, then build the Flash app.
Create a .bat file to run the ANT build (literally just a text file 'build.bat' in the folder with the build.xml that just says 'ant' in it).
Set up a scheduled task to run the build.bat at whatever interval you desire, or, if you have SVN on the same server you can set up a post commit hook to run that scheduled task so when a person commits to the repo, the build script will run and the new version can be viewed on the dev server.
I have an ANT script that also will email all devs if the build fails to let everyone know who broke the build, so they can take care of it. If you message me back I would be happy to post a zip for you with my ANT script files you can use an example.
EDIT: I've posted the files to GitHub in case anyone else needs them. https://github.com/royaldigit/ant-flash-build

rails show the current version of my code on the page

On my website, in the footer, i want to clearly show which version of the code is live.
I am using git as version control. It would be great to get some visual feedback to know which version is actually live.
I want to show some readable number, like a gem version number. I could create a VERSION file, which i manage and increase every time it is needed.
I am curious if there are any existing solutions already out there? It would be preferable if it could e.g. use tag information from git.
I found a gem that actually does exactly what i need: version.
It allows to manage the version dead-easy, with the needed rake-tasks without the coupling to jeweler, and also allows to tag github in the process.
When developing a gem, i keep using jeweler, but for my rails-projects this is just what i need.
For more info see the gem's documentation.
Jeweler has some rake tasks that handle versioning pretty well for you. I have only used it for gems, but you can probably drop in a VERSION file and use the same rake tasks in a rails app. I have actually been thinking about doing the same thing for my app.. I will update this answer with more details if I get to it soon. For my gems I added a few new rake tasks that combine some of the jeweler tasks. Every time I have a new version I run one of the tasks and it increments the version (major,minor or patch), pushes my code to github and tags it all in one operation:
namespace :version do
desc "create a new version, create tag and push to github"
task :github_and_tag do
Rake::Task['github:release'].invoke
Rake::Task['git:release'].invoke
end
desc "bump patch push to github"
task :patch_release do
Rake::Task['version:bump:patch'].invoke
Rake::Task['version:github_and_tag'].invoke
end
desc "bump minor push to github"
task :minor_release do
Rake::Task['version:bump:minor'].invoke
Rake::Task['version:github_and_tag'].invoke
end
desc "bump major push to github"
task :major_release do
Rake::Task['version:bump:major'].invoke
Rake::Task['version:github_and_tag'].invoke
end
end
get jeweler if you dont have it and create a fake gem, put it on github and play around with the tasks until you get a feel for them. I took me a few tries (and peeks at the source) to fully understand what it was doing.
If you run these tasks every time you have a new version, your VERSION file will be in sync with your github project. If it was me, I would just read in the version number from the file and use something like settingslogic to set up a constant.. or you can set it up in an initializer. That way, you know that every time you restart your app, it will read the correct version

Using Capistrano to deploy (a non-Rails site) via FTP?

How would I go about this?
I have a mostly static site, which is being hosted on a cheap web-host, which only allows FTP access to the hosting. The site is tracked in git. I am using OS X.
I would like to upload a new version of the site by simply doing cap deploy
We use capistrano to deploy our site which is written in PHP.
From memory (I'm not at work right now) we overload deploy and used rsync to sync over sftp. Something like this:
desc "Sync"
namespace :deploy do
desc "Sync remote by default"
task :default do
remote.default
end
namespace :remote do
desc "Sync to remote server"
task :default do
`rsync -avz "/path/to/webapp" "#{remote_host}:#{remote_root}/path/to/webapp"`
end
end
end
I'm sure you could replace rsync with whatever an ftp program and it should work fine.
I've not tried it with capistrano, but in my own shell scripts, I've always used weex
(http://weex.sourceforge.net/)
to deploy sites over FTP. Imagine you could hack it up with capistrano too.
It keeps a local cache of the state of the FTP server so that it can only upload changed files. This is good, massively speeds things up ... but (obviously?), it'll go wrong if your code/other stuff gets changed via some other means. So it can be made not to do this if need be.