2017 © Pedro Peláez
 

library env-deployer

Makes deploying Env super easy

image

alfred-nutile-inc/env-deployer

Makes deploying Env super easy

  • Wednesday, November 15, 2017
  • by alnutile
  • Repository
  • 17 Watchers
  • 13 Stars
  • 9,649 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

Build Status, (*1)

Env Deployer

Only works with 5.1 and greater, (*2)

See the video, (*3)

envdeploy, (*4)

This will take your local environment and deploy it to the selected server, (*5)

Your config file will have the list of servers, (*6)

For example say your .env looks like this, (*7)

The new Laravel tail library spatie/laravel-tail inspired and helped this a ton, (*8)

#@dev=dev
#@stage=stage
APP_ENV=local

#@dev=dev_db
#@stage=stage_db
DATABASE_NAME=local_db

If you run the command, (*9)

php artisan envdeployer:push dev

This will send you local to dev replacing the values as needed., (*10)

APP_ENV=dev
DATABASE_NAME=dev_db

This makes it super easy for local developers to merge their env to the different servers while at time keep a local .env and .env.example, (*11)

php artisan envdeployer:make-example

Would then setup example with random values, (*12)

php artisan envdeployer:share

Would place it on the config setting share path for the team member to write, (*13)

php artisan envdeployer:share get

To get and pull that down as their env settings., (*14)

Lastly, (*15)

php artisan envdeployer:get_and_merge dev

Would get dev and merge it into your local setting #@dev=foo as needed and adding values you are missing, (*16)

Install

You can install the package via composer:, (*17)

``` bash composer require 'alfred-nutile-inc/env-deployer:dev-master', (*18)

You must install this service provider:
```php
// config/app.php

'providers' => [
    ...
    'AlfredNutileInc\EnvDeployer\EnvDeployerServiceProvider',
    ...
];

Now to setup your config:, (*19)

``` bash php artisan vendor:publish --provider="AlfredNutileInc\EnvDeployer\EnvDeployerServiceProvider", (*20)

A file named ``envdeployer.php`` will be created in the config directory. The options you can set in the file should be self-explanatory.
```php

<?php

return [

    'connections' => [

        /*
         * The environment name.
         */
        'dev' => [

            /*
             * The hostname to send the env file to
             */
            'host'  => 'example_target.dev',

            /*
             * The username to be used when connecting to the server where the logs are located
             */
            'user' => 'vagrant',

            /*
             * The full path to the directory where the .env is located MUST end in /
             */
            'rootEnvDirectory' => '/home/vagrant/mysite/',

            'port' => 2222
        ],
    ],
];

RoadMap

Immediate Todo Items Make it a true laravel 5 library with config settings, (*21)

1) get file from target and merge into local, (*22)

2) share command so teams can share the file securely, (*23)

The Versions