【问题标题】:Laravel Forge kills the deploy scriptLaravel Forge 杀死部署脚本
【发布时间】:2016-01-09 02:26:28
【问题描述】:

Forge 服务器已链接到 GitLab 存储库。所以每次我将新提交推送到我的主分支时,Gitlab 都会触发 Forge 的 Deployment 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

【问题讨论】:

    标签: laravel gulp forge


    【解决方案1】:

    我会避免在部署脚本中做这些 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
    

    希望对你有帮助。

    【讨论】:

    • 很抱歉这么晚才回复您。随着您的改进,脚本仍然超时。不知道从这里做什么。
    • @MichaelSørensen 他希望您通过 SSH 安装一次,然后编辑您的 deply 脚本以简单地运行 gulp --production(而不是每次都安装 npm)
    猜你喜欢
    • 2019-10-05
    • 2016-04-29
    • 2015-12-01
    • 2016-01-24
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-30
    相关资源
    最近更新 更多