0
我需要将多个NodeJS应用程序部署到在Microsoft Azure上运行的Ubuntu 14.04.4虚拟机。
我正在使用shipit和shipit-deploy来执行此任务。在远程Azure虚拟机上将sudo部署为sudo
我shipitfile.js
到目前为止看起来如下:
module.exports = function (shipit) {
require('shipit-deploy')(shipit);
var stagingConfig = require('./config.staging').deploy;
var productionConfig = require('./config.prod').deploy;
shipit.initConfig({
default: {
workspace: '/tmp/my-api',
deployTo: '/var/www/my-api',
repositoryUrl: 'https://githubrepoaddresshere.git',
ignores: ['.git', 'node_modules', 'migrations', 'dumpDB', 'logs', 'bin'],
rsync: ['--del'],
keepReleases: 2,
key: '~/.ssh/id_rsa.pem',
shallowClone: true
},
staging: stagingConfig,
production: productionConfig
});
shipit.on('init', function() {
console.log('Starting deployment...');
});
shipit.on('deployed', function() {
// npm install etc etc
});
};
的stagingConfig
变量的物体保持环境的具体信息:
{
"branch": "develop",
"servers": "[email protected]"
}
当我运行shipit staging deploy
命令,我得到
'deploy:update' errored after 3.41 s
Error: Command failed: ssh -i ~/.ssh/id_rsa.pem "[email protected]" "mkdir -p /var/www/my-api/releases/20160429125114"
mkdir: cannot create directory ‘/var/www/my-api/releases’: Permission denied
我知道我可以:
1)尽量部署在/home/username
2)Use this workaround启动SSH会话为root
。
我还是要尝试第一个,并且不肯愿意使用第二个。
所以我的问题是:是否有一个干净,非hacky的解决方案,使shipit-deploy
前缀每个命令在部署期间运行sudo
?