Giter Site home page Giter Site logo

laravel-deploy-helper's Introduction

Laravel Deploy Helper

Dependency Status StyleCI Packagist Packagist license Made by DALTCORE FOSSA Status

Compatible with Laravel 5.1, 5.4 and higher.

For Laravel 5.1 use branch 5.1 and tag v0.5.x

LDH is a Laravel package that helps with deploying your website without the usage of FTP.
The LDH packages uses SSH to build a deployment environment on the server for zero-downtime deployments
and rollback functionality.

Everyone is allowed to help getting this package bigger and better! ;-)

Install

Via Composer

$ composer require daltcore/laravel-deploy-helper

In your config/app.php

DALTCORE\LaravelDeployHelper\LdhServiceProvider::class,

Publish configuration

$ php artisan vendor:publish --tag=ldh-config

Usage

Deploy to server
Deploy full instance to the remote server

php artisan ldh:deploy --stage=production --branch=develop

Patch to server
Push a simple patch to the remote server (minor changes only)

php artisan ldh:patch --stage=production --branch=patch

Rollback one instance
Something went horrably wrong, go back in history

php artisan ldh:rollback --stage=production

Configuration

stages
In the stages section you have to define your stages information.

git
You can use git's http url with basic auth. Example: https://username:[email protected]/repo/name.git .
You can use git's ssh. Example: [email protected]:repo/name.git

connection
In the connection section you can add your ssh details for deploying

remote.root
Here you can put the root directory where LDH can set up it's directory structure

commands
This is a array with commands that needs to be executed from the /current directory

shared.directories
This is te section with directories that needs to be copied from the previous deploy to the next one

shared.files
The same as with the directories, but then with files.

config.dependencies
Here you can optionally put some dependencies (applications) that you want to use for deploy.
You can use this for checking if everything on the server is setup correctly with the versions.
You may want use 'true' for no version checking, but instead just checking if the application exists.

config.keep
How many 'shadow' copies of the old deploys needs to exist. These come in handy for the rollback feature.

Config example:

<?php

return [
    'default' => [
        'stage' => 'production',
    ],

    'stages' => [
        'production' => [
            'git' => '',

            'branch' => '',

            'connection' => [
                'host'     => '',
                'username' => '',
                'password' => '',
                // 'key'       => '',
                // 'keytext'   => '',
                // 'keyphrase' => '',
                // 'agent'     => '',
                'timeout'  => 10,
            ],

            'remote' => [
                'root' => '/var/www',
            ],

            'commands' => [
                'composer install',
            ],

            'shared' => [
                'directories' => [
                    'public',
                    'storage',
                ],
                'files'       => [
                    '.env',
                ],
            ],

            'config' => [
                'dependencies' => [
                    'php' => '>=5.6',
                    'git' => true,
                ],
                'keep'         => 4,
            ],
        ],
    ],
];

Directory structure

LDH deploys the following directory structure on first deploy

.
├── current -> /var/www/vhosts/example.org/releases/1498833243
├── ldh.json
├── patches
│   └── 0001-Update-readme.md.patch
├── releases
│   └── 1498833243
└── shared

As you can see, LDH makes a static link from /current to /releases/1496845077.
You you only have to point your vhost to the /current/public for your Laravel website to work.

License

FOSSA Status

laravel-deploy-helper's People

Contributors

fossabot avatar ramonsmit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

laravel-deploy-helper's Issues

Problem with basic Auth + Bitbucket

Hi

I'm using a private repo on Bitbucket.
The config is set like: "http://user:[email protected]/repo.git"

But I'm receiving the next error:
fatal: unable to access 'https://username:passwordbitbucket.org/rest/of-the-repo-url.
Note that username:passwordbitbucket.org is together.

I have some symbols in the password, the last one symbol is next to the @ symbol of the URL. I think that something is clearing the symbols to extract username and password but is failing because is not expecting symbols.

I you don't understand well the problem, I can provide more info.

Thanks in advance.

Error first deploy

Hi

I'm trying to deploy, and get the following error:

[production] Trying to login into remote SSH
[production] Reading config file from remote server
[production] ldh.json does not exists.

 Do you want to initialize LDH here? (yes/no) [no]:
 > yes

 [ErrorException]                                     
 ksort() expects parameter 1 to be array, null given

In the remote server all the files are created but the file ldh.json is empty.
In the question "Do you want...." I've tried both yes/no

Any help would be appreciated.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.