The PHP Deployment Tool

Overview

Magallanes

SymfonyInsight Build Status Coverage Status Code Quality Latest Stable Version Pre Release Total Downloads License

What's Magallanes?

Magallanes is a deployment tool for made with PHP for PHP applications; it's quite simple to use and manage. For more information and documentation please visit https://magephp.com

Installing

Simply add the following dependency to your project’s composer.json file:

    "require-dev": {
        "andres-montanez/magallanes": "^4.0"
    }

Finally you can use Magallanes from the vendor's bin:

vendor/bin/mage version

Codename Discovery One

Each new mayor version of Magallanes will have a codename (like Ubuntu), version 3 was Nostromo, and in the current version it is Discovery One, in homage to the spaceship from the ground breaking film 2001: A Space Odyssey (1968).

Comments
  • New use-sudo option

    New use-sudo option

    Hello,

    In some cases a server doesn't have a root user, and in order to deploy with Magallanes, an user with sudo permissions is needed (e.g. where I work because a security policy servers shouldn't have a root user). Maybe it is not an ideal scenario, but sometimes as a developer you have to manage with this kind of restrictions. So I have added a new option (use-sudo) to execute all deployment commands as sudo. The activation of this option is straightforward, and by default is set to false:

    deployment:
      user: foo
      use-sudo: true
    

    I've changed the TarGzTask too. Because you can't do an scp to a folder wich needs sudo permissions, when use-sudo is enabled, the tar.gz is previously uploaded to /tmp and after that it is moved to the right destination.

    I hope you can find it useful :)

    Regards

    NOTE: Related issues: #111

    v1 
    opened by csuarez 32
  • Git rebase strategy doesn't create directory for release

    Git rebase strategy doesn't create directory for release

    Hi, I am trying a git rebase strategy and according to a log and from what I checked in the code it seems that during git rebase strategy a directory for the release is not created. Here is start of the log for last release.

    2015-01-23 11:10:38 -- Starting Magallanes--------------
    2015-01-23 11:10:38 -- Logging enabled $ ssh  -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] "sh -c
    2015-01-23 11:10:38 -- Logging enabled: /path/to/app/.mage/logs/log-20150123-111038.log
    2015-01-23 11:10:38 -- Deploy summary
    2015-01-23 11:10:38 -- Environment: production----------
    2015-01-23 11:10:38 -- Release ID:  20150123111038------
    2015-01-23 11:10:38 -- ---- Executing: $ rm /tmp/magefnXdW5 /tmp/magefnXdW5.tar.gz
    2015-01-23 11:10:38 -- No Pre-Deployment tasks defined.
    2015-01-23 11:10:38 -- Deploying to server.com
    2015-01-23 11:10:38 -- Running Deploy via Git Rebase [built-in] ...
    2015-01-23 11:10:38 -- Run remote command cd /var/www/app && cd releases/20150123111038 && git fetch origin
    2015-01-23 11:10:38 -- ---------------------------------path/to/app/releases/20150123111533 && app/console cache:clear --env=prod --no-warmup
    2015-01-23 11:10:38 -- ---- Executing: $ ssh  -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] "sh -c
    \"cd /var/www/app && cd releases/20150123111038 && git fetch origin\""=/dev/null -o StrictHostKeyChecking=no [email protected] "sh -c
    2015-01-23 11:10:38 -- sh: line 0: cd: releases/20150123111038: No such file or directoryo-warmup\""
    

    Folder 20150123111038 isn't created and deployment failed.

    Bug Feedback Needed v1 
    opened by Trudko 30
  • using git tag instead of timestamp for releases

    using git tag instead of timestamp for releases

    I think it would be very handy if we can combined magallanes with gitflow and use git tag to deploy a release.

    for example I tag my master branch with v1.2.3, then I deploy this tag to production using

    bin/mage deploy --release=v1.2.3 to:dev

    Is there a workaround to make such a thing?

    Really nice tool by the way.

    Feature Request v1 
    opened by alwex 19
  • Fixes #159: PHPUnit tests tuning

    Fixes #159: PHPUnit tests tuning

    Hey, As I mentioned in #159 , I've done some fixes and corrections for PHPUnit test environment for Magallanes. I've also noticed and fixed following problems:

    • lack of phpunit in bin directory while doing installing dependencies by composer. I've fixed that by adding bin-dir to composer.json
    • no colors... for phpunit output :) Changed phpunit default configuration in phpunit.xml.dist
    • coverage - I've added coversDefaultClass and covers in test class to be sure that those test methods test that what we want to test

    Please free to code-review! @SenseException @andres-montanez

    PS. Sorry, I had to close previous PR, because I accidentally compared it to master branch again :(

    Improvement v1 
    opened by eps90 16
  • Custom global tasks

    Custom global tasks

    Hey there,

    What (if any) is the policy about creating custom tasks, for multiple projects? These can not be placed with the project, it would be better to place them in the Magallanes folder.

    This works if I create a custom folder in BuiltIn and put them there. However, that is not preferable when working with version control, ie git.

    Can you add a default folder next to BuiltIn, maybe called Global, whose contents have a git ignore? Or does anyone have a better idea?

    I would like to hear your thoughts!

    Feature Request v1 
    opened by JoeSimsen 16
  • Environment variables support

    Environment variables support

    Hi devs! Recently I've noticed there is abandoned #160 issue, however I think this is gonna be useful for many of Magallanes users.

    • Environent variables can be set by passing options to general config...
    # .mage/config/general.yml
    name: My fantastic App
    email: [email protected]
    env:
      variables:  
        node_path: "/bin/node"
        symfony_env: prod
    
    • ... or environment config...
    # .mage/config/environment/production.yml
    deployment:
      user: root
      from: ./
      to: /var/www/vhosts/example.com/www
    env:
      variables:
        symfony_env: prod
    
    • ... or even task config!
    # .mage/config/environment/production.yml
    tasks:
      pre-deploy:
        - scm/update
      on-deploy:
        - symfony2/cache-warmup: { env: prod, env: { variables: {env1: key1} } }
      # short way
        - symfony2/cache-warmup: { env: prod, env.variables: {env1: key1} }
    

    When you run the command, the set variables are prepended to the original command:

    $ SYMFONY_ENV=prod composer install
    

    (Note: The script does not uppercases variables, they're gonna be passed in the same way you typed them in config)

    Given variables have the following priorities:

    • Task parameters and command line parameters
    • Environment config parameters
    • General config parameters

    That means, if you have the env variable in your task configuration and there's an env var in your environment configuration, the task's one will override the environment's config.

    The scripts allows also to prepend all system's environment variables, but it needs proper setting in your php.ini for CLI:

    # php.ini
    variables_order="EGPCS"
    

    Then, you can set your settings from .bashrc or .zshrc, like:

    # .zshrc
    export NODE_PATH="bin/node"
    

    System's env variables has the lowest prority to give you ability to override them in config.

    Warning: Including system's environment variables can slow down the applicattion, so use it carefully. Feel free to review and comment! I know there's gonna be do much more, all sugestions are welcome!

    Feedback Needed Improvement v1 
    opened by eps90 15
  • Documentation & contributor guidelines

    Documentation & contributor guidelines

    I'm not sure this is the right place to start this up as there is a MagallanesSite repository where the documentation is today but i feel like i'll have more feedback here, so here i am.

    I wanted to start by saying i really like the website it exposes very clearly the basics of how Mage works and how basic configurations can be done.

    That said, it becomes a lot more frustrating when you're trying to use built-in tasks for example. As any young project it is understandable that not everything is well documented and most people are used to go have a look at the code to have a better understanding of how it works. The problem for tasks is that they're not easy to read and more importantly it is difficult to see how they can be configured with specific parameters.

    I'd like to help, hopefully with some task contributors, to improve this. What i see here is 2 different things to do :

    1. Documentation : It should be updated with the last PR's improvements and also each task contributor should also contribute to its documentation. We could provide a default template for a documented task to make it more easy.
    2. Contributor guidelines : We should encourage common good practices in order to have a consistent application. Today each contributed task is written a bit differently, there are arguments that are camel cased, others lower cased etc... Tasks code is not much documented either. This guide should address this so people reading the code could figure out more easily what it is doing. We shouldn't forget that we're dealing with deployment here, a very sensitive task when it comes to production. Users should easily find out how everything works.

    To conclude, i feel that Mage is a very underestimated product and i think that contributing to these 2 things is going to definitely improve Mage adoption. That, and unit tests of course ;)

    Any input on this ?

    Improvement v1 
    opened by jhuet 15
  • Command factory tests

    Command factory tests

    I was reviewing the project code to check which classes can be tested easily (#44), but I'm afraid there will be bigger refactoring steps in the future before many classes of the project can be tested.

    For now, I contribute small tests of the command factory, creating build in and custom commands. For custom commands, I created some dummy commands to be able to check exceptions and returned command instances.

    I guess next time will be a PR with refactored code.

    Improvement v1 
    opened by SenseException 15
  • A failed build returns 0

    A failed build returns 0

    user@host:/home/user/jenkins/builds$ mage deploy to:production
    Starting Magallanes
        Logging enabled: /home/user/jenkins/builds/.mage/logs/log-20140919-122423.log
    
        There is already an instance of Magallanes running!
    
    Finished Magallanes
    

    and if echo last returned code, i get 0

    user@host:/home/user/jenkins/builds$ echo $?
    0
    

    next case

    user@host:/home/user/jenkins/builds$ mage deploy to:production
    Starting Magallanes
        Logging enabled: /home/user/jenkins/builds/.mage/logs/log-20140919-123408.log
    
        Deploy summary
            Environment: production
            Release ID:  20140919123408
    
        Starting Pre-Deployment tasks:
            Running Start composer ... OK
        Finished Pre-Deployment tasks: 1/1 tasks done.
    
    
        Deploying to 10.101.100.254:22
            Running Deploy via Rsync (with Releases) [built-in] ... FAIL
            Running Make Shared Folder ... FAIL
        Deployment to 10.101.100.254:22 completed: 0/2 tasks done.
    
    
        A total of 2 deployment tasks failed: ABORTING
    
        No Post-Deployment tasks defined.
    
    
        Time for deployment: 3 minutes 9 seconds.
        Average time per host: 3 minutes 9 seconds.
        Total time: 3 minutes 11 seconds.
    
    Finished Magallanes
    

    returned

    user@host:/home/user/jenkins/builds$ echo $?
    0
    

    and My CI server with jenkins, sends to me message about successful build.

    Bug Feedback Needed v1 
    opened by gudron 15
  • Feature/task permissions

    Feature/task permissions

    Adds the filesystem\permissions task to allow change of permissions on given paths. Change will be done on local or remote host depending on the stage of the deployment. Usage could be :

       on-deploy:
         - filesystem/permissions:
             paths:
                 - /var/www/myapp/app/cache
                 - /var/www/myapp/app/logs
             recursive: false
             checkPathsExist: true
             owner: www-data:www-data
             rights: 775
    

    Also adds the task filesystem\permissions-writable-by-web-server wich extends filesystem\permissions with default values in order to give web server user rights to write on given paths. Usage could be :

       on-deploy:
         - filesystem/permissions-writable-by-web-server:
             paths:
                 - /var/www/myapp/app/cache
                 - /var/www/myapp/app/logs
             recursive: false
             checkPathsExist: true
    

    Finally, i added a last task filesystem/permissions-readable-only-by-web-server that also extends filesystem\permissions but this time in order to give only to web server user read permissions on given paths. Usage could be :

       on-deploy:
         - filesystem/permissions-readable-only-by-web-server:
             paths:
                 - /var/www/myapp/app/config/config.yml
                 - /var/www/myapp/app/config/parameters.yml
             recursive: false
             checkPathsExist: true
    
    Feature Request v1 
    opened by jhuet 14
  • Escaping issue when using echo

    Escaping issue when using echo

    Hey Andres,

    I know this is rather a question but I just can't figure out the issue and I'm so confused now that I thought i'd just submit an issue and maybe you know why this isn't working immediately :-D

    I have a task that writes updated content to my Symfony parameters.yml during the on-deploy stage. In Mage v1 this worked perfectly fine like this:

    $this->runCommandRemote("echo " . escapeshellarg($content) . " > app/config/parameters.yml");
    

    I tried the very same for Nostromo but it just doesn't want to work in whatever way I try to get it to work :-(

    $process = $this->runtime->runRemoteCommand(
        sprintf('echo %s > app/config/parameters.yml', escapeshellarg($content)),
        true
    );
    

    The error message in the log file is the following:

    bash: -c: line 0: unexpected EOF while looking for matching `"' bash: -c: line 8: syntax error: unexpected end of file
    

    I noticed that you wrapped the whole sh -c command in " in v1 (https://github.com/andres-montanez/Magallanes/blob/1.0/Mage/Task/AbstractTask.php#L209) but you don't do this anymore in v3 anymore: https://github.com/andres-montanez/Magallanes/blob/master/src/Runtime/Runtime.php#L428

    Is this due to something the Symfony Process component does internally? Or do you see why this is not working? Thank you for your help, really appreciate it :-)

    Bug 
    opened by Toflar 13
  • Add support for monolog/monolog 3.x.x

    Add support for monolog/monolog 3.x.x

    With Symfony 6.1, we have the following error when installing the library :

    andres-montanez/magallanes 5.0.0 requires monolog/monolog ^2.5 -> found monolog/monolog[2.5.0, 2.6.0, 2.7.0, 2.8.0] but the package is fixed to 3.1.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

    opened by bastien70 0
Releases(5.0.0)
  • 5.0.0(Apr 15, 2022)

    • v5 series release.
    • Refactored for Symfony 6 and PHP 8.
    • Added strong types.
    • Removed task composer/self-update.
    • Allow exec task to interpolate %environment% and %release%.
    • Added new sleep task to day execution [PR#414].
    • Added new symlink option to define the name of symbolic link on the Release [PR#425].
    • Improved Windows compatibility [PR#427].
    • Added new log_limit option to limit how many logs are kept [Issue#403].
    • Add new deploy option --tag to specify deploying a specific tag [Issue#192] [Issue#315].
    • Added new scp_flags option for the scp command when SSH flags are incompatible with [Issue#439].
    Source code(tar.gz)
    Source code(zip)
  • 4.1.1(Feb 20, 2021)

  • 4.1.0(Feb 19, 2021)

    • PHP 8 and Symfony 5 compatibility [PR#448]
    • Timeout option for SSH [PR#436]
    • Improve compatibility with Windows [PR#434] [PR#429]
    • Improve config load [PR#422]
    • Bug fixes [PR#448] [PR#424]
    • Readme Update [PR#438]
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Apr 2, 2018)

    • v4 series release
    • Refactored for Symfony 4 and PHP 7.1
    • Symfony Pool Clear task added
    • Symfony Pool Prune task added
    • Symfony Assetic task removed
    Source code(tar.gz)
    Source code(zip)
  • 3.4.0(Mar 29, 2018)

    • [Issue#380] Throw exception if log_dir is defined but directory doesn't exists
    • [BUGFIX] [Issue#405] Malformed ssh command when defining host:port notation
    • [Issue#415] Remove timeout on Deploy with Tar or Rsync tasks
    Source code(tar.gz)
    Source code(zip)
  • 3.3.0(Jul 22, 2017)

    • [PR#386] Allow to define timeout (default 120s) for symfony/assetic-dump task.
    • [PR#392] Allow to define Host Port in Host configuration.
    • Allow to specify the binary path of tar on for create and extract
    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Apr 15, 2017)

    • Allow to pre-register Custom Tasks
    • [PR#365] New option "from" to define deployment start point
    • Allow to define excludes in the global scope.
    • Improve code quality, remove duplications on Symfony Tasks.
    • Improve code quality, remove duplications on Composer Tasks.
    • [PR#364] Allow to define custom timeout to Composer:Install
    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Feb 25, 2017)

    • Add new Exec task to execute arbitrary shell commands
    • Add new Composer task, to update phar (composer/self-update)
    • [#344] Allow to flag Filesystem tasks
    • [PR#346] Add new File System task, to change file's modes (fs/chmod)
    • [BUGFIX] [PR#342] Ignore empty exclude lines
    • [PR#330] Allow Composer task options to be overwritten at environment level
    • [PR#330] Add new method Runtime::getMergedOption to merge ConfigOption and EnvOption
    • [Documentation] [PR#333] Improve example config file
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Feb 11, 2017)

  • 3.0.0(Jan 31, 2017)

  • 1.0.7(Jan 6, 2017)

  • 1.0.6(Apr 12, 2015)

  • 1.0.5(Mar 8, 2015)

    Changelog:

    • Bug #195 by @spongeben - Fix first deploy bug
    • Bug #187 by @eps90 - Create release directory for GitRebase strategy
    • Improvement #196 by @eps90 - Add Travis and Coveralls support
    • Improvement #167 by @SenseException - Add CommandFactory unit tests
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Sep 13, 2014)

  • 1.0.1(Mar 16, 2014)

    • Update SPYC Library
    • Issue #43 - Exit code should indicate that something failed.
    • Issue #45 - Adds "ssh_needs_tty" which appends "-t" to the ssh.
    • Issue #45 - Rsync is incremental if there are previous releases.
    • Issue #46 - Add post-release tasks on rollback #46
    Source code(tar.gz)
    Source code(zip)
Owner
Andrés Montañez
Andrés Montañez
Deployer based deployment for WordPress with media and database synchronisation.

deployer-extended-wordpress What does it do? Should I use "deployer-extended-wordpress" or "deployer-extended-wordpress-composer"? Dependencies Instal

SourceBroker 24 Dec 11, 2022
PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.

P H I N G Thank you for using PHING! PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant. You can do anything wit

The Phing Project 1.1k Jan 7, 2023
Deploy your PHP with PHP. Inspired by Capistrano and Vlad.

Pomander A light-weight flexible deployment tool for deploying web applications. This project was inspired by Capistrano and Vlad the Deployer, as wel

Mike Kruk 202 Oct 18, 2022
PHP transpiler - Write and deploy modern PHP 8 code, today.

Phabel Write and deploy modern PHP 8 code, today. This is a transpiler that allows native usage of PHP 8+ features and especially syntax in projects a

Phabel 219 Dec 31, 2022
Elegant SSH tasks for PHP.

Laravel Envoy Introduction Laravel Envoy provides a clean, minimal syntax for defining common tasks you run on your remote servers. Using Blade style

The Laravel Framework 1.5k Dec 20, 2022
A deployer library for PHP 5.3

Plum An object oriented deployer library Installation and configuration Plum does not provide and autoloader but follow the PSR-0 convention. $plum =

Julien Brochet 87 Feb 5, 2022
The PHP Deployment Tool

Magallanes What's Magallanes? Magallanes is a deployment tool for made with PHP for PHP applications; it's quite simple to use and manage. For more in

Andrés Montañez 685 Dec 25, 2022
Deployer is a free and open source deployment tool.

Deployer Deployer is a PHP Application deployment system powered by Laravel 6.0, written & maintained by Stephen Ball. Check out the releases, license

Stephen Ball 886 Dec 15, 2022
A simple php (lumen) app for sharing sensitive text (basically like onetimesecret), but with full end-to-end AES-256-GCM encryption so even the server has no access to the data, and developed with very simple deployment in mind.

A simple php (lumen) app for sharing sensitive text (basically like onetimesecret), but with full end-to-end AES-256-GCM encryption so even the server has no access to the data, and developed with very simple deployment in mind.

Alan Woo 51 Nov 21, 2022
Deployer is a PHP Application deployment system powered by Laravel

Deployer is a PHP Application deployment system powered by Laravel 5.5, written & maintained by Stephen Ball.

Stephen Ball 886 Dec 15, 2022
Deployer based deployment for WordPress with media and database synchronisation.

deployer-extended-wordpress What does it do? Should I use "deployer-extended-wordpress" or "deployer-extended-wordpress-composer"? Dependencies Instal

SourceBroker 24 Dec 11, 2022
Laradeploy offers you to automate deployment using a GitHub webhook.

Introduction Laradeploy offers you to automate deployment using a GitHub webhook. Simple and fast just make a git push to GitHub deploy the new modifi

Gentrit Abazi 10 Feb 21, 2022
🚀WordPress Plugin Boilerplate using modern web techs like TypeScript, SASS, and so on... on top of a local development environment with Docker and predefined GitLab CI for continous integration and deployment!

WP React Starter: WordPress React Boilerplate DEPRECATED: WP React Starter was a "research project" of devowl.io for the development of our WordPress

devowl.io GmbH 344 Jan 1, 2023
Laravel EKS Deployment Tools with Helm

Infra Laravel Deployment Laravel Kubernetes (EKS) Deployment Tools Prerequirements Docker Docker-Compose AWS CLI Helm Terraform Terraform Provider AWS

DevOps Corner Indonesia 14 Dec 16, 2022
🚀 Zero-downtime deployment out-of-the-box

?? Laravel Deployer Looking for the old Laravel Deployer? Click here. Laravel Deployer is no longer the package it used to be. Since that package was

Loris Leiva 1.6k Dec 31, 2022
Repository untuk menyimpan tugas Implementasi Dan Deployment Sistem

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Alif Rachmad Kurniawan 1 Nov 23, 2021
Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Nextcloud All In One Beta This is beta software and not production ready. But feel free to use it at your own risk! We expect there to be rough edges

Nextcloud 1.1k Jan 4, 2023
A Laravel package to speed up deployment by skipping asset compilation whenever possible.

Airdrop for Laravel Read the full docs at hammerstone.dev/airdrop/docs. Hammerstone Airdrop for Laravel is a package that speeds up your deploys by sk

Hammerstone 160 Nov 24, 2022