All Projects → erikgall → envoyer-npm-deployment

erikgall / envoyer-npm-deployment

Licence: other
Compile assets that depend on node packages using Laravel Envoyer deployment hooks

Projects that are alternatives of or similar to envoyer-npm-deployment

Vinyl Ftp
Blazing fast vinyl adapter for FTP
Stars: ✭ 385 (+795.35%)
Mutual labels:  gulp, deployment
tiller-circleci-orb
Deploy Trellis, Bedrock and Sage(optional) via CircleCI
Stars: ✭ 13 (-69.77%)
Mutual labels:  deployment
corebot
A bot to trigger Rundeck and Jenkins jobs from Slack.
Stars: ✭ 69 (+60.47%)
Mutual labels:  deployment
ploi-deploy-action
Deploy your application to Ploi with Github actions
Stars: ✭ 25 (-41.86%)
Mutual labels:  deployment
streetsupport-web
Helping people facing homelessness across the UK to find services in their area, and connecting people who want to help to where it is needed most.
Stars: ✭ 21 (-51.16%)
Mutual labels:  gulp
sclblpy
Python package for Scailable uploads
Stars: ✭ 18 (-58.14%)
Mutual labels:  deployment
file-include-webpack-plugin
A webpack plugin to include files using @@ include syntax in html files, like gulp-file-include
Stars: ✭ 16 (-62.79%)
Mutual labels:  gulp
fly-helper
It's a Tool library, method collection
Stars: ✭ 21 (-51.16%)
Mutual labels:  gulp
feater
Tool for rapid deployment of selected features of your web application to isolated testing or demo environments.
Stars: ✭ 27 (-37.21%)
Mutual labels:  deployment
volkscv
A Python toolbox for computer vision research and project
Stars: ✭ 58 (+34.88%)
Mutual labels:  deployment
laravel-env-security
Securely manage Laravel .env files for different deployment environments
Stars: ✭ 67 (+55.81%)
Mutual labels:  deployment
django-boilerplate-3.6.1
Django served by Gunicorn running behind Nginx reverse proxy. Deploy to AWS Elastic Beanstalk with Fabric3!
Stars: ✭ 13 (-69.77%)
Mutual labels:  deployment
manage-demo
后台管理系统模版
Stars: ✭ 19 (-55.81%)
Mutual labels:  gulp
electron-angular-ngrx
An Angular (6x) Electron seed featuring @angular/cli, @ngrx/platform, and Typescript. Complete with HMR workflow
Stars: ✭ 39 (-9.3%)
Mutual labels:  gulp
pacco
A bundler for modular and extensible web projects.
Stars: ✭ 16 (-62.79%)
Mutual labels:  gulp
phoenix example
An example Phoenix app with one-click deployments to different cloud services.
Stars: ✭ 62 (+44.19%)
Mutual labels:  deployment
generator-veams
Scaffold modern frontend web apps or web pages with a static site generator (Assemble or Mangony), Grunt and/or Gulp, Sass and Bower. Use modern frameworks like Bourbon, Bootstrap or Foundation and structure your JavaScript with ES Harmony support.
Stars: ✭ 45 (+4.65%)
Mutual labels:  gulp
bibleapi-rest
Node.js based Bible API RESTful web service
Stars: ✭ 34 (-20.93%)
Mutual labels:  gulp
eadmin
eadmin - 极致用户体验与极简开发并存的开箱即用的后台UI框架
Stars: ✭ 258 (+500%)
Mutual labels:  gulp
craft-boilerplate
Starter project for Craft CMS & Tailwind CSS Sites
Stars: ✭ 18 (-58.14%)
Mutual labels:  laravel-mix

Asset Compilation w/ Laravel Envoyer

The Problem(s)

  1. Running gulp --production before deployment is tedious and often forgotten, especialy when you are running gulp watch and assets are being compiled after any change.
  2. Running npm install on a server during every deployment and compiling it after is slow.
  3. Compiling locally and committing your versioned assets doesn't allow you to make tiny commits unless you leave out the versioned file until you are done.
  4. Using Envoyer for zero-downtime deployments doesn't handle this for you.

The Solution

Using Envoyer's deployment hooks we can fix the problems so that our assets are compiled when the project is deployed. We can also eliminate how long it takes NPM to download all of the packages we need by storing them in a shared node_modules folder.

Below are the steps required to download your node dependencies and compile your assets during deployment.

Performance

After the deployment hook runs for the first time, the deployment time drastically decreases. This is because we need to download all the node packages during the first deployment and then from there we symlink the project's node_modules directory to the release's node_modules directory.

  1. Running NPM install and gulp on server w/out symlinks (see example below): 4 min
  2. Using .envoyer deployment hook (first deployment): 2 min
  3. Using .envoyer deployment hook (after first deployment): 55s

Example w/out symlinks

Using one deployment hook containing:

npm install
gulp --production

Usage

  1. Login to your envoyer.io account and go to your projects deployment screen.
  2. Click "Deployment Hooks" tab
  3. Click cog wheel icon/button on the "Activate New Release" hook
  4. In the "Before This Action" panel click add hook
  5. Add a hook name
  6. Add the user to run the hook as (default: forge)
  7. Copy and paste the .envoyer file into the editor*

The Psuedo-Code Steps

  1. Go to the release directory
  2. Copy the package.json file to the projects directory
  3. Go to the project directory
  4. Run npm install
  5. Run npm update
  6. Symlink the {{project}}/node_modules directory to the {{release}}/node_modules directory
  7. Go to the release directory
  8. Run gulp

My Hooks*

I broke down the steps into 5 different hooks so I could see how long certain steps were taking. The hooks names are listed below.

  1. Copy package.json
  2. Install node packages
  3. Update node packages
  4. Create node_modules symlink
  5. Compile assets
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].