Giter Club home page Giter Club logo

magallanes's Introduction

Magallanes

Linters Tests 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 magephp.com

Installing

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

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

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

vendor/bin/mage version

Codename Galactica

Each new mayor version of Magallanes will have a codename (like Ubuntu), version 3 was Nostromo, version 4 was Discovery One, and in the current version it is Galactica, in homage to the space battleship from the TV series Battlestar Galactica, both the '70s and the mind blowing revision of 2005.

magallanes's People

Contributors

aglejberman avatar andres-montanez avatar artur-tud avatar euphoryx1 avatar freebuu avatar fritzmg avatar galicantensoft avatar iambrosi avatar tadcka avatar thepanz avatar tmerekrutacja avatar toflar avatar tomasliubinas 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magallanes's Issues

Accessing environment and general settings from tasks

Hi,
What is the best way to access settings from the general.yml and the environment yaml files from task scripts?
I want to add an array to the yaml file for settings for a task, but cant find how to get the data (i keep hitting object is protected errors)
I see there is a way to get all settings under 'deployment' but it would be tidier to have my settings outside the normal blocks.

thanks
M

git clone not working

Hi,
getting the following at the moment when trying to clone :

git clone https://github.com/andres-montanez/Magallanes.git
Cloning into Magallanes...
remote: Counting objects: 980, done.
remote: Compressing objects: 100% (554/554), done.
remote: Total 980 (delta 373), reused 925 (delta 346)
Receiving objects: 100% (980/980), 156.58 KiB, done.
Resolving deltas: 100% (373/373), done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistant object 1653b63
fatal: Cannot update the ref 'HEAD'.

M

Change time not permitted

Hello!

I'm using Mage to provision my VPS in DigitalOcean.

It looks like time updating is not permitted for deployment user.

The deployment directory is owned by www-data:www-data and deployment user is a user:user, but he is in www-data group so he can manipulate all the files in this directory, but can't change timestamps.

How do I solve this issue? I can not login to the server with www-data user as it is not a normal user. Is it possible to change active user after login (use sudo for example)?

Is there a way to disable time setting for deployed files?

P/S: the server OS is Ubuntu Server 14.04 x32.

Thank you!

Deploy with releases keeps unsuccessful deploy but deletes successful

  1. suggestion: The oldest release should be deleted only if the current deploy is successful, and deleted otherwise, currently if we maintain 3 releases and we have 3 unsuccessful deploys we will end up with current link to missing release dir and no working release to revert to.
  2. suggestion: The deployment with release support can first deploy to tmp dir, let say releases/tmp, this way we can benefit from rsync check and upload only new files.
  3. suggestion: deploy from repo source but only from one directory, this way we can benefit from git pull deployment branch (if we use git) and download only latest updates not the whole repo in tmp dir and then delete it. Currently if I try this with static from and scm the scm/update on pre-deploy would not update it because it checks scm == 'git' but scm is array with full git config.

If you like these suggestions I would love to contribute to this wonderful project, yet simple but very powerful and extendable.

Additional rsync options

Hi. What about adding a configuration option to include arbitrary rsync options? For example, --delete and --delete-excluded could be useful when using the incremental strategy.

Debug mode

Hi,
When I try to deploy, "rsync" is frozen.
Sometimes it spend a lot of time.
Is there "debug mode" ?
Thanks

Isidro

$ mage version
Running Magallanes version 0.9.14
$ php -v
PHP 5.4.9-4~precise+1 (cli) (built: Nov 30 2012 10:42:23)

Localize output

Hey,

It would be great to be able to translate the output of the application. Any ideas on this? Would do it myself, but I don't have the time right now.

Regards

Dry run option

Hi.
This seems to be the exact library I was looking for ! Thank you for that.
I used to run commands like those in Magallanes in a very awkward code, written in Shell scripts. I couldn't even get my co-workers to help me maintain the code.
The install of Magallanses using Composer is smooth, so is the configuration.
But I have two questions:
1/ Is there a way to do a dry-run ? If yes how ?
2/ For the connection without a passphrase, how can I set the path to the private key file ? The only way I found is by defining an alias in ~/.ssh/config and using the Host alias in the environment configuration.

Current release doesn't include git deployment

Hi

On the website you suggest git-rebase as a strategy, the code for it exists but the DeployCommand doesn't know of it:

switch ($this->getConfig()->deployment('strategy', 'guess')) {
case 'disabled':
$deployStrategy = 'deployment/strategy/disabled';
break;
case 'rsync':
$deployStrategy = 'deployment/strategy/rsync';
break;
case 'targz':
$deployStrategy = 'deployment/strategy/tar-gz';
break;
case 'guess':
default:
if ($this->getConfig()->release('enabled', false) == true) {
$deployStrategy = 'deployment/strategy/tar-gz';
} else {
$deployStrategy = 'deployment/strategy/rsync';
}
break;
}

cant get usergroup info from command line

in this file Mage/Task/BuiltIn/Deployment/ReleaseTask.php
Line : 58
there is a check if ($resultFetch && $userGroup != '') but at the line 68 even if userGroup is empty it still runs the command and it fails. Error : "missing argument for chown"
command : "chown releases"

Our environment is Centos 6.2 and the owner of the folder being deployed is different from "root"

Password override

Hello Andres,

First of all, great tool! I am currently trying to implement the tool in my projects. For ease of use we would like to add the password in the config, so it is included in the ssh/scp request. The program is going to be used on many different machines, so it would be preferable for it to be as much copy paste as possible.

It is definitely possible, and easy to implement. Any reason i isn't, and could it be an optional implementation in the future?

change the local source directory during execution

Is it posible/safe to change the local directory being used to deploy from while tasks are running?
eg.
pre-deploy task -> encrypts files from /tmp/deploy and saves them into /tmp/deploy.encrypted
task then changes the $this->getConfig()->deployment('from') path to '/tmp/deploy.encrypted' and deletes /tmp/deploy
rest of deploy tasks run using new directory

M

liquibase support

I recommend to add liquibase changelog support by deploying db schema changes...

problems update / last version

Hi,
I update with lastest version but something wrong :|

I try to deploy, the warning is

$ mage deploy go:testing

Warning! No hosts defined, skipping deployment tasks.

but list releases works

$ mage releases list to:testing
Starting Magallanes

Releases available on XXX

    Release: 20120920102742 - Date: 2012-09-20 10:27:42 - Index:  0
    Release: 20120920094619 - Date: 2012-09-20 09:46:19 - Index: -1
    Release: 20120920093917 - Date: 2012-09-20 09:39:17 - Index: -2
    Release: 20120920093650 - Date: 2012-09-20 09:36:50 - Index: -3
    Release: 20120920093212 - Date: 2012-09-20 09:32:12 - Index: -4
    Release: 20120920092819 - Date: 2012-09-20 09:28:19 - Index: -5
    Release: 20120920091842 - Date: 2012-09-20 09:18:42 - Index: -6

Thanks!

Notify user when the YAML is not correct

Hi,
Im trying to write a new task to run on pre-deploy, I have used scm/clonetask as a template for my new task, and entered the following into my enviroment file :
tasks:
pre-deploy:
- ioncube/encrypt
on-deply:
post-deploy:
but it doesnt seam to call the task file (output from mage command only shows one task being run and thats the inital clone command)
My task script is in : Mage\Task\BuiltIn\Ioncube\EncryptTask.php

and starts with :
namespace Mage\Task\BuiltIn\Ioncube;

use Mage\Task\AbstractTask;

class EncryptTask extends AbstractTask
{

Do I need to register the new task in some way to make it usable?

thanks

m

TarGZ deployment method problem

When we triy to deploy to our production CentOS 6.2 server from our Ubuntu 12.04 machine using TarGZ method, deployment process completes successfully but the remote folder seems to be empty. However, Rsync method works just fine. Releasing option is also enabled.

Pass custom flags to the deployment task

I need to pass a custom flag to the rsync task, have you considered how this could be done?
I was thinking of doing a pull request to allow the following in the config

strategy:
    rsync:
      - rsyncFlags: -abc

 strategy
    targz:
      - tarCreateFlags: -abc
      - tarExtractFlags: - abc
      - scpFlags: - abc

Deploy by local copy

Hi. This is more of a question than an issue. What about including a deployment option for the rsync strategy which only performs a local copy (without ssh)? Many development machines are also used as staging machines, so this could be useful in my opinion. If it's something you're willing to add, I can take care of the pull request.

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!

Remove statics

The current program makes use of a lot of statics. Therefore the program is not easily testable.

I volunteer to solve this, adding unittests as I do so.

Thoughts?

"Releaseing" failed

Hey, there!

I'm trying to use Magallanes for deploying my web app to the production server. And actually it looks pretty cool.

But, I've encountered some problem.

On the final stage of the deployment, i'm getting the following output:

Starting the Releaseing
    Releasing on host example.com ... FAIL
Finished the Releaseing

I have the following entries in my log file:

2013-12-19 06:23:02 -- ---------------------------------
2013-12-19 06:23:02 -- OK
2013-12-19 06:23:02 -- Deployment to example.com completed: 2/2 tasks done.
2013-12-19 06:23:02 -- Starting the Releaseing
2013-12-19 06:23:02 -- Releasing on host example.com ... 
2013-12-19 06:23:02 -- ---------------------------------
2013-12-19 06:23:02 -- ---- Executing: $ ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] "cd /var/www/example.com && ls -ld . | awk '{print \$3\":\"\$4}'"
2013-12-19 06:23:03 -- www-data:www-data
2013-12-19 06:23:03 -- ---------------------------------
2013-12-19 06:23:03 -- ---------------------------------
2013-12-19 06:23:03 -- ---- Executing: $ ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] "cd /var/www/example.com && rm -f current ; ln -sf releases/20131219062246 current && chown -h www-data:www-data current && chown -R www-data:www-data releases/20131219062246"
2013-12-19 06:23:04 -- chown: changing ownership of ‘current’: Operation not permitted
2013-12-19 06:23:04 -- ---------------------------------
2013-12-19 06:23:04 -- ---------------------------------
2013-12-19 06:23:04 -- ---- Executing: $ ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected] "cd /var/www/example.com && chown www-data:www-data releases"
2013-12-19 06:23:05 -- chown: changing ownership of ‘releases’: Operation not permitted
2013-12-19 06:23:05 -- ---------------------------------
2013-12-19 06:23:05 -- FAIL
2013-12-19 06:23:05 -- Finished the Releaseing

Looks like it's trying to chown some files, but I'm running deployment without root privileges.

Could you tell me what is the problem and how to fix it?

And what is "Releaseing"? It looks like typo = )

mage add environment XXX - You must specify a name for the environment.

Hi,
When I try to create a new enviroment in my new project

$ mage init
$ mage add environment production
Starting Magallanes

You must specify a name for the environment.

Finished Magallanes

:|

The init command create the structure

$ tree .mage/
.mage/
├── config
│   ├── environment
│   ├── general.yml
│   └── scm.yml
├── logs
└── tasks

Rollback error

Hey,

When attempting a rollback, I accidentally typed "--releas=-1", wich of course is wrong. When this happened however, Mage did not generate an error, but rolled back to 0, wich technically did nothing.

Is it possible to give an error, or maybe make --release mandatory? And what is the use of --release=0, since that's where you are starting from right?

some failed deploys in row break symlink current

for example:

#production
deployment:
  user: deploy
  from: ./
  to: /var/www/mage-test
  excludes:
releases:
  enabled: true
  max: 2
  symlink: current
  directory: releases
hosts:
  - mage-test-host
tasks:
  pre-deploy:
  on-deploy:
    - fail
  post-release:
  post-deploy:

Custom task:

namespace Task;

use Mage\Task\AbstractTask;

class Fail extends AbstractTask
{
    public function getName()
    {
        return 'Fail!!!';
    }

    public function run()
    {
        $result = $this->runCommandRemote('unavailable_command');

        return $result;
    }
}

if remove custom task fail from production.yml deployment is successfull.
after successful deploy two failed deploys break a symlink "current"

$ ls -alh
lrwxrwxrwx  current -> releases/20140402130809
drwxrwxr-x  releases

$ ls -alh releases/
drwxr-xr-x 20140402130830
drwxr-xr-x 20140402130840

no root install

Hi,
It's posible to install Magallanes from local user? ($HOME/magallanes)
Thanks!

unable to find on composer packagist

Hi,
In your install notes you say that this can be installed via composer, but i cant find your package anyware on the packagist site.
Is it listed under some other name, or are you going to put it on packagist in the future?

thanks

M

Parallel deployment

I'm currently using capistrano, but I'm not completly happy with it.
I really like the simplicity of Magallanes, and it's close to what I would have written myself, but I'm missing parallel execution of the steps.
For instance, uploading & extracting of the .tgzs would be faster if it would happen on all hosts at the same time.

Ioncube encoding task

Hi there,
I have now compleated my ioncube php encoder task.
Would you be insterested in including it?
It requires 1 extra function to be added to your original code to allow tasks to extract data from the envirmonet config file.

M

--no-color option needed

Hello, again, Andres.

I use deployer through the teamcity and in logs have something like that:

  • [15:07:36][Step 1/1] [1;30mDeploy summary [0m
  • [15:07:36][Step 1/1] [1;30mEnvironment: [0m [0;35mrc [0m
  • [15:07:36][Step 1/1] [1;30mRelease ID: [0m [0;35m20131218130736 [0m
  • [15:07:36][Step 1/1] [1;30mSCM Branch: [0m [0;35mrc [0m

Undefined property generalTemplate

Hi,
Have just installed version 0.9.14 from github, and got the following error when trying
mage init

PHP Notice: Undefined property: Mage\Command\BuiltIn\InitCommand::$generalTemplate in /opt/magallanes/0.9.14/Mage/Command/BuiltIn/InitCommand.php on line 86
Error!! Unable to generate the configuration.

This appears to be because Line 86 of the InitCommand.php file curently says :
$this->generalTemplate
where I think it should say :
$this->getGeneralConfigTemplate()

Can anyone else confirm this?

thanks

M

Ability to introduce the hostname variable in the deployment path

Usually I have to deploy applications to hostnames that are really CNAME records pointing to the same physical server.

To avoid collisions on file paths, I always put the hostname in the deployment path.

It would be great to have the ability to modify the to: param in the configuration file including the hostname variable

Something like this:

#production
deployment:
  ...
  to: /var/www/vhosts/{hostname}/www
hosts:
  - s01.example.com:22
  - s02.example.com

would deploy to: /var/www/vhosts/s01.example.com/www in one server and to /var/www/vhosts/s02.example.com/www in the other one

Rollback shortcut

Hey,

I've noticed we mostly rollbacked 1 version. Can we make a shortcut for rollbacking?
In my opinion mage rollback to:production should be enough to quickly revert what you just deployed.

Other question: why is the 'releases' word necessary in this command?

Not rsync method

Now in Deploy.php:71

array_unshift($tasksToRun, 'deployment/rsync');

And how deploy not rsync?
for example git pull in server

Not sending emails

Hello,

I added and updated the sample content from general.yml in the docs folder to my general.yml in my .mage/config folder but its not sending any emails. Is this feature suppose to be working?

Link all files in "shared/" by default

What do you think about linking all files and folders in shared/ by default?

Adding each file in the configuration make it hard to read, as you have to state them all in one line. The line for symlinked files can get very long.

A different approach could be to provide a parameter for the LinkSharedFiles to enable the symlinking of all files in shared/. Something like:
- Filesystem/LinkSharedFiles: {link_all_files: true}

Abort Deployment when Pre-Deploy task fails

Hi,

What is the correct way to fail a task?
I can see the : throw new SkipException
But this allows the deployment process to continue.
Is there a 'proper' way exception to throw that indicates deployment should stop?
Also, is there a process for cleaning up temp files if an exception is thrown?

Can't clone the repo

Hi,

Trying to clone the repo via https got this error :
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistant object cebced4
fatal: Cannot update the ref 'HEAD'.

Any help ?

Mage's exit code is incorrect?

I'm not sure how to test this thoroughly but it looks like Magallanes is not returning error exit code when errors happen.

It complicates my deployment shell script because I can't catch an error to stop it's execution.

Here's example of the shell script:

#!/usr/bin/env bash

# Terminating script if something goes wrong
set -e

TARGET=${1:-"production"}

mage deploy to:$TARGET

# some other commands

echo; echo "Done!";

change directory to release

Hi,
I try to change the directory to release, using complete path but it's empty.
My file testing.yml

testing

deployment:
user: my_user
from: ./
to: /var/www/my_user/www/my_app_deploy
excludes:
- build
releases:
enabled: true
max: 10
symlink: current
directory: : /var/www/my_user/releases
hosts:

  • myhost.mydomain.com
    tasks:
    #pre-deploy:
    #- scm/update
    on-deploy:
- deployment/rsync

My idea to structure directories are:

-> document root or alias directory /var/www/my_user/www/my_app_deploy
-> release: path no access from webserver /var/www/my_user/releases

It's posible? Thanks

Resolve symlinks during deployment

Hey!

I have some symlinks in my project directory. Is it possible to deploy them as a target files/directories and not as a symlinks, i.e. resolve them during deployment?

I'm using TAR deployment method.

Thanks!

Issue with #63

Hi,

Just a small bug introduced with #63.It doesn't use the symlink option as defined in the release but a hard coded "current" path instead. (line 64)
So if this path is modified, the "ls" command throw an error as it cant find it

Benjamin

Namespacing

Namespace classes (as composer.json requires PHP >= 5.3).

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.