I’m taking over a project and am wanting to put a staging server in
place.
The thing holding me up is the Capistrano deploy scripts. I have
changed the ‘deploy.rb’ file to ‘deploy-production.rb’ and then added
a ‘deploy-stage.rb’ file.
Here is where I believe my problem is coming into play:
The current contents of my ‘Capfile’:
This was a shot in the dark (adding the last two lines). Am I
misunderstanding what that load line does? Here’s is why I’m
confused. After modifying the file as such, I then go to the command
line and attempt to run the stage script with ‘cap -f config/deploy-
stage.rb deploy’. I then receive a lovely message telling me that
“the task `deploy’ does not exist”. Whaaa? Well, we know it does, so
this must be caused by the Capfile no longer being included. I
thought I read in the documentation that if ‘-f’ is used even once, it
will negate the Capfile’s inclusion.
So I suppose I’m looking for some direction here. A seemingly ideal
solution would be to create a task such as ‘cap deploy:stage’ and ‘cap
deploy:production’ in order to deploy to stage. Is this a bad idea?
How would I go about doing this?
“the task `deploy’ does not exist”. Whaaa? Well, we know it does, so
this must be caused by the Capfile no longer being included. I
thought I read in the documentation that if ‘-f’ is used even once, it
will negate the Capfile’s inclusion.
So I suppose I’m looking for some direction here. A seemingly ideal
solution would be to create a task such as ‘cap deploy:stage’ and ‘cap
deploy:production’ in order to deploy to stage. Is this a bad idea?
How would I go about doing this?
My understanding is that calling:
RAILS_ENV=‘staging’ && cap deploy
should do it. Maintaining two versions of basically the same file goes
against the DRY principle.
“the task `deploy’ does not exist”. Whaaa? Well, we know it does, so
this must be caused by the Capfile no longer being included. I
thought I read in the documentation that if ‘-f’ is used even once, it
will negate the Capfile’s inclusion.
So I suppose I’m looking for some direction here. A seemingly ideal
solution would be to create a task such as ‘cap deploy:stage’ and ‘cap
deploy:production’ in order to deploy to stage. Is this a bad idea?
How would I go about doing this?
Thank you!!!
I did go in a different direction:
Top of my config/deploy.rb file try loads recipes from
config/deploy/*.rb, each of these “sub recipes” only created a task
for production and staging, that define db, app and web roles, also
rails_env
So I can do in the command line:
cap production deploy
cap staging deploy
etc.
Learned that trick from some EY recipes
Regards,
Luis L.
AREA 17
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams