我正在使用grunt-msdeploy将angularJs代码部署到服务器之一,这是工作得很好。我想将相同的代码部署到多个服务器。我如何实现它?请帮忙 !对于msdeploygrunt-msdeploy用于将AngularJS应用程序部署到多个服务器
Gruntfile.js代码:
var path = require('path');
//add the config file name
var configFile = path.resolve('./deployconfig.json');
var config = require(configFile);
msdeploy: {
push: {
options: {
verb: 'sync',
allowUntrusted: 'true',
source: {
'contentPath': path.resolve('./dist')
},
dest: {
contentPath: config.contentPath,
wmsvc: config.serverAddress,
userName: config.userName,
password: config.password
}
}
}
}
grunt.loadNpmTasks('grunt-msdeploy');
//add task for deployment - copying the dist from local server to remote server
grunt.registerTask('deploy', ['msdeploy:push']);
deployconfig.json:
{
"contentPath": "c:/inetpub/wwwroot/dist",
"serverAddress": "ec2-xx-xx-xx-x.ap-northeast-1.compute.amazonaws.com",
"userName": "xxxxxxxxx",
"password": "xxxxxxxxx"
}
我已经在JSON文件中的多台服务器的信息msdeploy使用多个DEST尝试过,但没没有工作。有没有办法做到这一点?
好的,谢谢!我如何为多个目的地注册任务,然后假设我有mydest1和mydest2? grunt.registerTask('deploy',['msdeploy:push:mydest1']); ? – Srini
@Srini,在编辑的答案中找到我的答案,我为你提供这些信息。 – Farside
谢谢!我尝试了上面提到的确切方式,但不接受任何除了dest以外的其他任何名称。当我提供multile dest的部署只到第一台服务器。 – Srini