Forge服务器已链接到GitLab存储库。因此,每当我将新的提交推送到我的主分支时,Gitlab就会触发Forge的部署URL。
问题似乎是我的部署脚本执行时间太长,这导致Forge正在查杀脚本。我可以以某种方式避免杀死部署脚本吗?
我的部署脚本:
cd /home/forge/x.dk
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
npm install
npm install gulp
gulp --production
php artisan migrate --force
部署日志:
From gitlab.com:x/x
* branch master -> FETCH_HEAD
Already up-to-date.
Loading composer repositories with package information
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files
> php artisan clear-compiled
> php artisan optimize
Generating optimized class loader
Compiling common classes
gulp@3.9.0 node_modules/gulp
├── interpret@0.6.6
├── pretty-hrtime@1.0.1
├── deprecated@0.0.1
├── archy@1.0.0
├── tildify@1.1.2 (os-homedir@1.0.1)
├── minimist@1.2.0
├── v8flags@2.0.10 (user-home@1.1.1)
├── chalk@1.1.1 (escape-string-regexp@1.0.3, supports-color@2.0.0, ansi-styles@2.1.0, has-ansi@2.0.0, strip-ansi@3.0.0)
├── semver@4.3.6
├── orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5)
├── liftoff@2.2.0 (extend@2.0.1, rechoir@0.6.2, flagged-respawn@0.3.1, resolve@1.1.6, findup-sync@0.3.0)
├── vinyl-fs@0.3.14 (graceful-fs@3.0.8, strip-bom@1.0.0, vinyl@0.4.6, defaults@1.0.3, mkdirp@0.5.1, through2@0.6.5, glob-stream@3.1.18, glob-watcher@0.0.6)
└── gulp-util@3.0.6 (array-differ@1.0.0, array-uniq@1.0.2, beeper@1.1.0, lodash._reevaluate@3.0.0, lodash._reinterpolate@3.0.0, lodash._reescape@3.0.0, object-assign@3.0.0, replace-ext@0.0.1, vinyl@0.5.3, lodash.template@3.6.2, through2@2.0.0, multipipe@0.1.2, dateformat@1.0.11)
[17:43:36] Using gulpfile ~/x.dk/gulpfile.js
[17:43:36] Starting 'default'...
[17:43:36] Starting 'less'...
Fetching Less Source Files...
- resources/assets/less/style.less
Saving To...
- public/css/style.css
[17:43:37] Finished 'default' after 1.02 s
[17:43:41] gulp-notify: [Laravel Elixir] Less Compiled!
[17:43:41] gulp-notify: [Error in notifier] Error in plugin 'gulp-notify'
Message:
not found: notify-send
[17:43:41] Finished 'less' after 5.15 s
[17:43:41] Starting 'less'...
Fetching Less Source Files...
- resources/assets/less/admin-style.less
Saving To...
- public/css/admin-style.css
[17:43:45] gulp-notify: [Laravel Elixir] Less Compiled!
[17:43:45] gulp-notify: [Error in notifier] Error in plugin 'gulp-notify'
Message:
notify-send must be installed on the system.
[17:43:45] Finished 'less' after 4.18 s
[17:43:45] Starting 'scripts'...
Fetching Scripts Source Files...
- bower_components/jquery/dist/jquery.min.js
- bower_components/bootstrap/dist/js/bootstrap.min.js
Saving To...
- public/js/all.js
/home/forge/.forge/provision-1234567.sh: line 8: 21661 Killed gulp --production
答案 0 :(得分:0)
我会避免在部署脚本中执行此NPM:
npm install
npm install gulp
您可能需要的是通过SSH安装Gulp,然后让部署脚本在每次推送时运行gulp --production
。
要通过SSH访问您的服务器,请按照此Laracast:https://laracasts.com/series/server-management-with-forge/episodes/4。它解释了如何连接到数据库,但它基本相同。
当您拥有SSH访问权限时,请使用以下命令安装Gulp:
sudo apt-get update
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo npm install -g gulp
希望它有所帮助。