Skip to content

sourcebroker/deployer-typo3-media

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deployer-typo3-media

http://img.shields.io/packagist/v/sourcebroker/deployer-typo3-media.svg?style=flat https://img.shields.io/badge/license-MIT-blue.svg?style=flat

This package allows to sync media between instances using host data stored in deployer configuration.

It allows to copy files to your local instance, copy files between instances, but also symlink files instead of copy to save disk space (if the staging instance is at the same server as production).

This package only extends sourcebroker/deployer-extended-media with settings specific for TYPO3 CMS.

  1. Install package with composer:

    composer require sourcebroker/deployer-typo3-media
    
  2. Put following lines on the beginning of your deploy.php:

    require_once(__DIR__ . '/vendor/autoload.php');
    
    new \SourceBroker\DeployerLoader\Loader([
      ['get' => 'sourcebroker/deployer-typo3-media'],
    ]);
    
  3. Create .env file (or .env.local) in your project root. The .env (or .env.local) file should be out of git because you need to store there information about instance name in var INSTANCE. The INSTANCE value must correspond to host() name.

    For following real, example configuration:

    <?php
    
    namespace Deployer;
    
    require_once(__DIR__ . '/vendor/autoload.php');
    
    new \SourceBroker\DeployerLoader\Loader([
      ['get' => 'sourcebroker/deployer-typo3-media'],
    ]);
    
    host('production')
        ->setHostname('vm-dev.example.com')
        ->setRemoteUser('deploy')
        ->set('bin/php', '/usr/bin/php8.4')
        ->set('deploy_path', '~/t3base13/production');
    
    host('staging')
        ->setHostname('vm-dev.example.com')
        ->setRemoteUser('deploy')
        ->set('bin/php', '/usr/bin/php8.4')
        ->set('deploy_path', '~/t3base13/staging');
    

    you would need to create file .env (or .env.local) with following content:

    1. INSTANCE=production at host defined by host('production')
    2. INSTANCE=staging at host defined by host('staging')
    3. INSTANCE=local at your local env (laptop)

    As an alternative you can also not create any env file but make sure that the env variable INSTANCE exists in system at hosts defined in deployer (and also at your local host).

TYPO3 sync folder is fileadmin with exclusion of _processed_ folder.

set('media', function () {
 return [
     'filter' => [
         '+ /' . get('web_path'),
         '+ /' . get('web_path') . 'fileadmin/',
         '- /' . get('web_path') . 'fileadmin/_processed_/*',
         '+ /' . get('web_path') . 'fileadmin/**',
         '- *'
     ]
 ];
});

The commands for synchronizing media for the example above configuration would be:

  • For syncing media from production to local instance (usually your laptop):

    dep media:pull production
    
  • For syncing media from production to staging instance is:

    dep media:copy production --options=target:staging
    
  • For syncing media from production to staging, creating symlinks to each file in shared folder if both instances are at the same server. Good to safe space on disk:

    dep media:link production --options=target:staging
    
  • For syncing media from local to staging: (use with care - generally not recommended)

    dep media:push staging
    
  • For syncing media from local to production: (use with care! - generally strongly not recommended)

    dep media:push production
    

For more options and way to extend sync process visit sourcebroker/deployer-extended-media.

See https://github.com/sourcebroker/deployer-typo3-media/blob/master/CHANGELOG.rst

About

TYPO3 CMS config for sourcebroker/deployer-extended-media.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages