This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Installs: 713

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 0


dev-master 2012-07-24 17:58 UTC

This package is auto-updated.

Last update: 2021-05-19 03:14:50 UTC


This Bundle provides commands to update remote installations directly from your command line.

app/console mopa:update:remote yourremote


Installation is quite easy

Step 1: Installation using your composer.json:

    "require": {
        "mopa/remote-update-bundle": "dev-master",

Step 2: Include the following bundles in your AppKernel.php:

Make sure you do not include bundles twice if you already use them.

// application/ApplicationKernel
public function registerBundles()
    return array(
        // ...
        new Mopa\Bundle\RemoteUpdateBundle\MopaRemoteUpdateBundle(),
        new Mopa\Bundle\WSSEAuthenticationBundle\MopaWSSEAuthenticationBundle(),
        new Sensio\Bundle\BuzzBundle\SensioBuzzBundle(),
        new FOS\RestBundle\FOSRestBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle($this)
        // ...

Step 2: Add the necessary routing information to your routing.yml

    type:     rest
    resource: "@MopaRemoteUpdateBundle/Resources/config/routing.yml"

Step 3: Add the necessary firewall configurations to your security.yml

To protect the api from public we need a firewall and a user provider:

            pattern:   ^/mopa/update/api/.*
                nonce_dir: null
                lifetime: 300
                provider: in_memory # the user provider providing you user with the role ROLE_REMOTE_UPDATER

if you do not have any user providers or no chance to add the ROLE_REMOTE_UPDATER to your user add this too:

                    '%mopa_remote_update_user%':  { password: '%mopa_remote_update_password%', roles: 'ROLE_REMOTE_UPDATER' }

And in your parameters.yml:

    mopa_remote_update_url: http://yourhost
    mopa_remote_update_user: changethis
    mopa_remote_update_password: changethat

Step 4: Add the necessary configuration to your config.yml

Import the necessary configuration in your config.yml:

    - { resource: @MopaRemoteUpdateBundle/Resources/config/config.yml }

If you do not have a dbal connection in your project also include the sqlite config:

    - { resource: @MopaRemoteUpdateBundle/Resources/config/config.yml }
    - { resource: @MopaRemoteUpdateBundle/Resources/config/database.yml }

If you do not want to have this feature in your productive environment, just include all this in your config_dev.yml just make sure dependencies are set correct, same for AppKernel and Bundles.

Setup your remotes in your config.yml:

        my_remote: # the alias to use on console, you can define as many remotes as you like
            url: %mopa_remote_update_url% # the url to your side might also be https
            username: %mopa_remote_update_user% # your username
            password: %mopa_remote_update_password% # your password
            preUpdate: git pull # optional: a command to run before composer updates the vendors, e.g. update your main application
            postUpdate: bin/ -w # optional: a command to run after composer updates
            updater: live # either live or cron see further down howto deal with cron
    composer: /usr/sbin/composer.phar # optional: sets the path to the composer binary if it cant be found

there is a usefule postUpdate packaged which has several features:

bin/ -h

To get a description

The bin/envvars.default has to be copied to bin/envvars and editied, to make app/cache and app/logs wirtable for webserver.

Step 5: update/create the schema:

app/console doctrine:schema:update  --force

Step 6(Optional): configure cron updater:

If you can not use the live updater, e.g. because your webserver does not have permissions to update the vendors, you can create a cronjob on the remote machine to execute the updates:

*/5   *   *   *  *    /path/to/your/app/console mopa:update:check # checks every 5 minutes if there is a new update job in queue

To log the output e.g. for debugging you could use:

*/5   *   *   *  *    /path/to/your/app/console mopa:update:check -v >> /path/to/your/app/logs/mopa_remote_update.log

Step 7: commit your changes to your favorite vcs and setup your remote.

Now its time to push the same to your server and make sure everything is working as expected. You should also check the postUpdate command an composer are found.

To test the update you can use

app/console mopa:update:local my_remote

Step 8(Optional): ignore MopaRemoteUpdateBundle bin files

Optionally add this to your vcs ignore file (e.g. .gitignore):

# ignore MopaRemoteUpdateBundle bin files