All Projects → nickfan → Envoy Deployscript

nickfan / Envoy Deployscript

Licence: mit
Laravel Envoy Deployment Script

Projects that are alternatives of or similar to Envoy Deployscript

Deployer
Deployer is a free and open source deployment tool.
Stars: ✭ 854 (+433.75%)
Mutual labels:  laravel, deployment
Webloyer
Webloyer is a web UI for managing Deployer deployments
Stars: ✭ 199 (+24.38%)
Mutual labels:  laravel, deployment
Larapush
artisan push - Deploy your codebase into your web server with one Laravel artisan command and no SSH needed!
Stars: ✭ 150 (-6.25%)
Mutual labels:  laravel, deployment
Cipi
An Open Source Control Panel for your Cloud! Deploy and manage LEMP apps in one click!
Stars: ✭ 376 (+135%)
Mutual labels:  laravel, deployment
Laravel Caprover Template
Template to deploy a Laravel app in docker for CapRover
Stars: ✭ 56 (-65%)
Mutual labels:  laravel, deployment
Laravel Deployer
🚀 Zero-downtime deployment out-of-the-box
Stars: ✭ 1,536 (+860%)
Mutual labels:  laravel, deployment
Deeployer
Deploy your Laravel applications via Github or Bitbucket Hooks
Stars: ✭ 151 (-5.62%)
Mutual labels:  laravel, deployment
Cartoonify
Deploy and scale serverless machine learning app - in 4 steps.
Stars: ✭ 157 (-1.87%)
Mutual labels:  deployment
Region
laravel 省市区联动数据生成
Stars: ✭ 159 (-0.62%)
Mutual labels:  laravel
Capistrano
Remote multi-server automation tool
Stars: ✭ 12,035 (+7421.88%)
Mutual labels:  deployment
Tastyigniter
🔥 Powerful, yet easy to use, open-source online ordering, table reservation and management system for restaurants
Stars: ✭ 2,137 (+1235.63%)
Mutual labels:  laravel
Dsshop
vue2.0+Laravel7商城电商平台,完全前后端分离,免费开源可商用,H5商城电商平台,微信小程序商城电商平台;支持H5、微信小程序,支付宝小程序、百度小程序、字节跳动小程序、安卓、IOS等等
Stars: ✭ 156 (-2.5%)
Mutual labels:  laravel
Laravel Scout Tntsearch
包含中文分词的 Laravel Scout TNTSearch 驱动,支持 scws, phpanalysis 和 jieba 分词。
Stars: ✭ 158 (-1.25%)
Mutual labels:  laravel
Cachet
📛 An open source status page system for everyone.
Stars: ✭ 12,478 (+7698.75%)
Mutual labels:  laravel
Laravel Early Access
This package makes it easy to add early access mode to your existing application.
Stars: ✭ 160 (+0%)
Mutual labels:  laravel
Image
PHP Image Manipulation
Stars: ✭ 12,298 (+7586.25%)
Mutual labels:  laravel
Android Rocket Launcher
🚀 Launch android modules from the terminal
Stars: ✭ 161 (+0.63%)
Mutual labels:  deployment
Dashboard.spatie.be
The source code of dashboard.spatie.be
Stars: ✭ 1,916 (+1097.5%)
Mutual labels:  laravel
Pingcrm React
⚛️ Ping CRM React - A demo app to illustrate how Inertia.js works with Laravel and React (hosted on a heroku free dyno).
Stars: ✭ 158 (-1.25%)
Mutual labels:  laravel
Installomator
Installation script to deploy standard software on Macs
Stars: ✭ 159 (-0.62%)
Mutual labels:  deployment

envoy-deployscript

Laravel Envoy Deployment Script

Base on papertank/envoy-deploy

Inspired by

This repository includes an Envoy.blade.php script that is designed to provide a very basic "zero-downtime" deployment option using the open-source Laravel Envoy tool.

Requirements

This Envoy script is designed to be used with Laravel 5 projects,however you could modify for other type of projects.

Notice that your local server/machine should configured to use SSH Key-Based Authentication.

Installation

Your must have Envoy installed using the Composer global command:

composer global require "laravel/envoy=~1.0"

Usage

Setup

  1. Download or clone this repository

  2. then copy envoy.config.example.php and Envoy.blade.php to your laravel project root directory.(e.g ~/code/mysite)

  3. then rename(or symbolic link) envoy.config.example.php to envoy.config.php and edit the envoy.config.php file with the ssh login info, Git repository, server path for your app. The $deploy_basepath (server base path) should already be created in your server with right permissions(e.g owner:www-data,read/write). You should set your website root directory (in vhost / server config) to $deploy_basepath/$appname/current/public (e.g /var/www/mysite/current/public)

  4. add .envoydeploy/ directory to your .gitignore file in your laravel project root if you use git as your source control software.

  5. you should create a .env.production file (dot env settings file ) in your laravel project root directory that will deploy to remote server otherwise if you specify the Laravel environment (e.g development/testing) create or symbolic the corresponding env file (e.g .env.development/.env.testing) and you could add the dot env settings file to your .gitignore file.

  6. you could create an directory extra/custom/ in your laravel project root, the deploy script will copy every directories and files in it to overwrite the files in target server.

for example:

your created file:

extra/custom/node_modules/laravel-elixir/Config.js

after deploy it will copy and overwrite to

($deployed_project_root)/node_modules/laravel-elixir/Config.js

it's usually we use this for custom laravel-elixir config setting and other staff.

Configuration

You could tweak your envoy.config.php for your application situation.

$pack_mode

local : checkout code and prepare the app code package locally,then pack and rsync/scp packed files to remote and extract on remote (good for small vps but scp cost bandwidth)

remote : checkout code and prepare the app code package on remote server (fast for your server have good network connection)

$deploy_mode

incr : sync new code to current running path (if you have lot of code and resource files in your project ,you may choose this mode)

link : link new release path to current running path (if you want light and quick code deployment, you may choose this mode)

Deploy-Init

When you're ready with the config, run the init task on your local machine by running the following in the repository directory

envoy run deploy_init

You can specify the Laravel environment (for artisan:migrate command) and git branch as options

envoy run deploy_init --branch=develop --env=development

You only need to run the init task once.

The init task creates a .env file in your app root path (e.g /var/www/mysite/.env )- make sure and update the environment variables appropriately.

Deploy

Each time you want to deploy simply run the deploy task on your local machine in the repository direcory

envoy run deploy

You can specify the Laravel environment (for artisan:migrate command) and git branch as options

envoy run deploy --branch=develop --env=development

Rollback

If you found your last deployment likely have some errors,you could simply run the rollback task on your local machine in the repository direcory

envoy run rollback

notice that will only relink your current release to previous release, it will NOT do the database migrate rollback.

if you wanna rollback database migration you could run BEFORE you run rollback task:

envoy run dbrollback --branch=master --env=production

if you run rollback task twice ,you will got current release still symbolic link to last release.

How it Works

Your $deploy_basepath directory will look something like this.

	mysite/
	mysite2/
	mysite3/

Your $deploy_basepath/$app_name directory will look something like this after you init and then deploy.

	releases/release_20150717032737/
	releases/release_20150717034646/
	current -> ./releases/release_20150717034646
	shared/storage/
	tmp/
	.env

As you can see, the current directory is symlinked to the latest deployment folder

Inside one of your deployment folders looks like the following (excluded some laravel folders for space)

	app/
	artisan
	boostrap/
	public/index.php
	composer.json
	.env -> ../../.env
	storage -> ../../shared/storage
	vendor/

The deployment folder .env file and storage directory are symlinked to the parent folders in the main (parent) path.

Feature

  • You could deploy multi projects with different $app_name and config settings on same target server.

  • To explore more feature by RTFC, and custom task as you wish in your project.

Notice

  • http/https protocol might be ask for password for your private repos and that will break the git clone progress, use git protocol and setup a deploy key on your server and SCM service instead (e.g github repo ->settings->Deploy keys and set $source_repo = '[email protected]:user/mysite.git' in your envoy.config.php)

  • the Task cleanupoldreleases_on_remote sometime may couldn't clean up all old release since your project contains too many files. and you could tweak keeps releases by change the config settings var $release_keep_count.

Example Usage

you could Deploy your app to DigitialOcean from Codeship using Envoy with this Envoy.blade.php and envoy.config.php script :

~/.composer/vendor/bin/envoy run deploy

if your laravel project runs on a small RAM (e.g 512MB) droplet.

you could change config settings $pack_mode = 'local';.

Todo

  • Make backup faster.

Contributing

Please submit improvements and fixes :)

Author

Nick Fan

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay

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].