Being new to Capistrano, I am looking for suggestions on a good capistrano deployment strategy for our needs.
We have a capistrano task to deploy the entire code base as a new release of the application. Works just fine, but in addition we need to be able to frequently (daily, 2-3 days) deploy a set of application files, followed by running a few system commands.
The only requirement is that the server not be restarted. Would we be best served by creating a new capistrano task that deploys the necessary files with the standard setup (current folder linked to the most recent release folder) and then using a symbolic link from within the application (deploy #1) to point to deploy #2's current?
Any suggestions/comments appreciated.
Another task is the way to go. If the application files are ruby files like models etc you need to restart to load them in otherwise you will get errors. What kind of files are you deploying.
Can l ask why you can't restart the server? also are you running passenger or ngix?
Why don't you restart your server manually through Shell. are you using mongrel ?
I could be wrong, but Eric might be referring to data files of some sort and not necessarily code. If this is the case, I'm right there with Michael. Go with a new Capistrano task. That would be the perfect solution in fact, since you can customize each action that is taken by the task.
Another thought about this sorta thing though. If you are indeed talking about periodically moving data into your application, I believe you'd be MUCH better suited with hosting a second application that can serve data through a secure API. That way, you could just have your production Rails app either use a cron job or user interaction to trigger the pulling of data up to your server instead of relying on a regular manual uploading.
Now, if you ARE talking about code, specifically code that would require a restart (such as a model), you definitely should be restarting the server anyway, and I'd say just stick with regular deployments.
Thanks for the replies. I'll try to address some of the questions.
The files to be deployed are classes (so code, not data). The code essentially follows the factory pattern, where abstract methods are overwritten. At this point, we are using self.instance_eval to pull in said methods and the classes are registered in a database during the Capistrano task. We considered using Rails' ability to dynamically load classes, but we warned of memory leak concerns and opted against that choice.
It's not that we can't restart the server at deployment, the concern is the frequency at which the server would be being brought down and the impact that might have on our ActiveResource setup (two Rails apps talking to and relying upon one another).