部署者 Vlad - 使用模式?
我开始使用 vlad 进行新部署,并且想知道设置它的最佳方法是什么,以便我可以对本地开发和远程生产服务器使用相同的任务?
我考虑过将所有内容定义为远程任务,然后使用设置域变量的 dev/prod 方法,然后我可以调用 rake dev/prod vlad:do_something ,但这感觉完全错误。
我的许多任务对于在本地服务器和生产服务器上运行非常有用,我希望通过为本地设置一个“任务”和为远程设置一个“remote_task”来避免重复。例如,
def do_something
run "echo something"
end
task :do_something_dev
do_something
end
remote_task do_something_prod
do_something
end
我是否遗漏了某些内容,或者这些确实是在本地和远程计算机上使用相同 rake 任务的唯一选择?
I'm starting to use vlad for new deployments and am wondering what's the best way to set it up so I can use the same tasks for my local development and remote production servers?
I thought about defining everything as remote tasks then having dev/prod methods which set the domain variable, then I can just call rake dev/prod vlad:do_something
, but this just feels totally wrong.
Many of my tasks are useful to run on my local server and on my production server and I want to avoid repeating myself by having one 'task' for local and one 'remote_task' for remote. e.g.
def do_something
run "echo something"
end
task :do_something_dev
do_something
end
remote_task do_something_prod
do_something
end
Am I missing something or are these really the only options for using the same rake tasks on both the local and remote machine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样:
这将为您提供:
rake vlad:development:do_something
rake vlad:test:do_something
rake vlad:product:do_something
只需一种方法,按照您的方式进行可能不会那么冗长。但只要你有 2 到 3 个方法,开销就可以忽略不计。
How about this:
This will give you:
rake vlad:development:do_something
rake vlad:test:do_something
rake vlad:production:do_something
With just one method it is probably less verbose to do it your way. But as soon as you have 2 or three methods, the overhead can be neglected.