We are doing a rolling deploy.
Here is our task:
desc "Does a rolling deploy to the application instances. NOTE: Do
not use this task if there are database migrations."
task :rolling do
memoized_role_host_snapshot = role_host_snapshot
first_half_of_instances, second_half_of_instances =
split_all_instances_into_two_halves
deploy_to_instances(first_half_of_instances, memoized_role_host_snapshot)
deploy_to_instances(second_half_of_instances, memoized_role_host_snapshot)
restrict_roles_to_use_specified_instances(first_half_of_instances
+ second_half_of_instances, memoized_role_host_snapshot)
git_repo.update_environment_tag
end
On Fri, Jan 30, 2009 at 10:14 AM, Jamis Buck <[email protected]> wrote:
>
> 1. Define your roles in each stage file. E.g.
>
> # config/deploy/staging.rb
> role :app, "stage-app-01", "stage-app-02"
>
> # config/deploy/production.rb
> role :app, "prod-app-01", "prod-app-02"
>
> 2. Put the snippet in a task.
>
> task :foo do
> find_servers(:roles => :app).each do |server|
> # ...
> end
> end
>
> 3. There is no step three!
>
> - Jamis
>
> On 1/30/09 7:51 AM, Gerhardus Geldenhuis wrote:
>> True,
>> But I do need multistage to deploy to different stages eg production,
>> test, demo, load-test etc.
>>
>> I have also defined stages for different application stacks in
>> production for example. eg prod-app1, prod-app2
>>
>> We need to deploy our tomcat application to one server at a time in
>> production to prevent any outages. We handle about 350 web
>> transactions a second on a busy day in one of our environments which
>> makes it critical that deployment is one at a time. I have been trying
>> to modify this line to be a task
>> find_servers(:roles => :foo).each do |server|
>> but no success so far. It is probably due to my lack of ruby language
>> knowledge.
>>
>> In the example given a specific role is given, however all my tasks
>> defined in my cap file have no specific role attached and will thus
>> execute for all servers defined in the config file of the stage.
>>
>> Regards
>>
>> On Jan 30, 2:23 pm, Lee Hambley <[email protected]> wrote:
>>> Ger,
>>>
>>> You don't need multistage to deploy to an array of servers?
>>>
>>> - Lee
>>>
>>> 2009/1/30 Gerhardus Geldenhuis <[email protected]>:
>>>
>>>
>>>
>>>> Hi
>>>> I have finally found time to start implementing this but am a bit
>>>> stuck atm. I am not sure how to convert this code snippet into a
>>>> working task. I also need to adapt my task to work in a multistage
>>>> environment where I set my role definition in each stage's config
>>>> file.
>>>> Regards
>>>> On Jan 28, 3:31 pm, Jamis Buck <[email protected]> wrote:
>>>>> find_servers(:roles => :foo).each do |server|
>>>>> run "disable server on load balancer", :host => server
>>>>> run "install new software", :host => server
>>>>> run "test server", :host => server
>>>>> # etc.
>>>>> end
>>>>> - Jamis
>>>>> On 1/28/09 8:16 AM, Gerhardus Geldenhuis wrote:
>>>>>> Hi
>>>>>> I need to do something like the following:
>>>>>> for server in role do
>>>>>> Disable server on load balancer
>>>>>> Install new software
>>>>>> Test Server
>>>>>> Enable server in load balancer
>>>>>> If successful then deploy next server else fail/rollback.
>>>>>> done
>>>>>> The individual steps is not a problem but I am unsure how to approach
>>>>>> the sequential install in a capistrano way.
>>>>>> I could not find anything on the wiki or list archives.
>>>>>> Regards
>> >
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---