我对shipit.js的部署如下所示
// shipitfile.js
module.exports = shipit => {
// Load shipit-deploy tasks
require('shipit-deploy')(shipit)
const backend_folder = 'backend';
shipit.initConfig({
default: {
deployTo: '/var/www/app/',
repositoryUrl: 'git@github.com:user/app.git',
},
staging: {
servers: 'deploy@ip.ip.ip.ip',
},
})
shipit.blTask('npm:install', async () => {
await shipit.remote(`cd ${shipit.releasePath}/${backend_folder}/ && npm install --production`)
})
shipit.blTask('server:start', async () => {
const be_command = 'NODE_ENV=production forever start build/server.js'
await shipit.remote(`cd ${shipit.config.deployTo}/current/`
+ `${backend_folder}/ && ${be_command}`)
})
shipit.blTask('server:restart', async () => {
const command = 'forever restartall'
await shipit.remote(`cd ${shipit.config.deployTo} && ${command}`)
})
shipit.on('updated', () => {
shipit.start('npm:install')
})
shipit.on('published', () => {
shipit.start('server:restart')
})
}
尝试从github克隆时,shipit失败,因为deploy
需要使用sudo创建文件夹。我该如何提供Shipit deploy
的密码,以便它可以sudo并创建文件夹?
谢谢。