Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Add TYPO3 rsync recipe #3754

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/recipe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* [Sulu Recipe](/docs/recipe/sulu.md)
* [Symfony Recipe](/docs/recipe/symfony.md)
* [TYPO3 Recipe](/docs/recipe/typo3.md)
* [TYPO3 rsync Recipe](/docs/recipe/typo3_rsync.md)
* [WordPress Recipe](/docs/recipe/wordpress.md)
* [Yii2 Recipe](/docs/recipe/yii.md)
* [Zend Framework Recipe](/docs/recipe/zend_framework.md)
208 changes: 208 additions & 0 deletions docs/recipe/typo3_rsync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/typo3_rsync.php -->
<!-- Then run bin/docgen -->

# How to Deploy a TYPO3 rsync Project

```php
require 'recipe/typo3_rsync.php';
```

[Source](/recipe/typo3_rsync.php)

Deployer is a free and open source deployment tool written in PHP.
It helps you to deploy your TYPO3 rsync application to a server.
It is very easy to use and has a lot of features.

Three main features of Deployer are:
- **Provisioning** - provision your server for you.
- **Zero downtime deployment** - deploy your application without a downtime.
- **Rollbacks** - rollback your application to a previous version, if something goes wrong.

Additionally, Deployer has a lot of other features, like:
- **Easy to use** - Deployer is very easy to use. It has a simple and intuitive syntax.
- **Fast** - Deployer is very fast. It uses parallel connections to deploy your application.
- **Secure** - Deployer uses SSH to connect to your server.
- **Supports all major PHP frameworks** - Deployer supports all major PHP frameworks.

You can read more about Deployer in [Getting Started](/docs/getting-started.md).

The [deploy](#deploy) task of **TYPO3 rsync** consists of:
* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy
* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy
* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release
* [rsync](/docs/contrib/rsync.md#rsync) – Rsync local->remote
* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs
* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs
* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) – Creates symlink to release
* [typo3:extension:setup](/docs/recipe/typo3_rsync.md#typo3extensionsetup) – TYPO3 - Set up all extensions
* [typo3:cache:flush](/docs/recipe/typo3_rsync.md#typo3cacheflush) – TYPO3 - Cache clearing for all caches
* [typo3:language:update](/docs/recipe/typo3_rsync.md#typo3languageupdate) – TYPO3 - Update the language files of all activated extensions
* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) – Unlocks deploy
* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) – Cleanup old releases


The typo3_rsync recipe is based on the [common](/docs/recipe/common.md) recipe.

## Configuration
### typo3_webroot
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L12)

DocumentRoot / WebRoot for the TYPO3 installation

```php title="Default value"
'public'
```


### bin/typo3
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L17)

Path to TYPO3 cli

```php title="Default value"
'vendor/bin/typo3'
```


### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L22)

Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.

Shared directories

```php title="Default value"
[
'{{typo3_webroot}}/fileadmin',
'{{typo3_webroot}}/typo3temp',
'{{typo3_webroot}}/uploads'
]
```


### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L31)

Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.

Shared files

```php title="Default value"
[
'{{typo3_webroot}}/.htaccess',
'config/system/settings.php',
]
```


### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L39)

Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.

Writeable directories

```php title="Default value"
[
'{{typo3_webroot}}/fileadmin',
'var',
]
```


### rsync
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L65)



```php title="Default value"
[
'exclude' => array_merge(get('shared_dirs'), get('shared_files'), $exclude),
'exclude-file' => false,
'include' => ['vendor'],
'include-file' => false,
'filter' => ['dir-merge,-n /.gitignore'],
'filter-file' => false,
'filter-perdir' => false,
'flags' => 'avz',
'options' => ['delete', 'keep-dirlinks', 'links'],
'timeout' => 600
]
```



## Tasks

### typo3:cache:warmup
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L79)

TYPO3 - Cache warmup for all caches.




### typo3:cache:flush
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L85)

TYPO3 - Cache clearing for all caches.




### typo3:language:update
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L91)

TYPO3 - Update the language files of all activated extensions.




### typo3:extension:setup
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L97)

TYPO3 - Set up all extensions.




### deploy:update_code
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L105)



Configure "deploy" task group.


### deploy:info
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L106)






### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/typo3_rsync.php#L109)

Deploys a TYPO3 project.




This task is group task which contains next tasks:
* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup)
* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock)
* [deploy:release](/docs/recipe/deploy/release.md#deployrelease)
* [rsync](/docs/contrib/rsync.md#rsync)
* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared)
* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable)
* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink)
* [typo3:extension:setup](/docs/recipe/typo3_rsync.md#typo3extensionsetup)
* [typo3:cache:flush](/docs/recipe/typo3_rsync.md#typo3cacheflush)
* [typo3:language:update](/docs/recipe/typo3_rsync.md#typo3languageupdate)
* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock)
* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup)


125 changes: 125 additions & 0 deletions recipe/typo3_rsync.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?php
namespace Deployer;

require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../contrib/rsync.php';

add('recipes', ['typo3_rsync']);

/**
* DocumentRoot / WebRoot for the TYPO3 installation
*/
set('typo3_webroot', 'public');

/**
* Path to TYPO3 cli
*/
set('bin/typo3', 'vendor/bin/typo3');

/**
* Shared directories
*/
set('shared_dirs', [
'{{typo3_webroot}}/fileadmin',
'{{typo3_webroot}}/typo3temp',
'{{typo3_webroot}}/uploads'
]);

/**
* Shared files
*/
set('shared_files', [
'{{typo3_webroot}}/.htaccess',
'config/system/settings.php',
]);

/**
* Writeable directories
*/
set('writable_dirs', [
'{{typo3_webroot}}/fileadmin',
'var',
]);

$exclude = [
'.Build',
'.git',
'.gitlab',
'.ddev',
'.deployer',
'.idea',
'.DS_Store',
'.gitlab-ci.yml',
'.npm',
'deploy.yaml',
'package.json',
'package-lock.json',
'node_modules/',
'var/',
'public/fileadmin/',
'public/typo3temp/',
'config/system/additional.php',
'config/system/settings.php',
];

set('rsync', [
'exclude' => array_merge(get('shared_dirs'), get('shared_files'), $exclude),
'exclude-file' => false,
'include' => ['vendor'],
'include-file' => false,
'filter' => ['dir-merge,-n /.gitignore'],
'filter-file' => false,
'filter-perdir' => false,
'flags' => 'avz',
'options' => ['delete', 'keep-dirlinks', 'links'],
'timeout' => 600
]);

desc('TYPO3 - Cache warmup for all caches');
task('typo3:cache:warmup', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} cache:warmup');
});

desc('TYPO3 - Cache clearing for all caches');
task('typo3:cache:flush', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} cache:flush');
});

desc('TYPO3 - Update the language files of all activated extensions');
task('typo3:language:update', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} language:update');
});

desc('TYPO3 - Set up all extensions');
task('typo3:extension:setup', function () {
cd('{{release_path}}');
run('{{bin/php}} {{bin/typo3}} extension:setup');
});

/**
* Configure "deploy" task group.
*/
task('deploy:update_code')->hidden()->disable();
task('deploy:info')->hidden()->disable();

desc('Deploys a TYPO3 project');
task('deploy', [
'deploy:setup',
'deploy:lock',
'deploy:release',
'rsync',
'deploy:shared',
'deploy:writable',
'deploy:symlink',
'typo3:extension:setup',
'typo3:cache:flush',
'typo3:language:update',
'deploy:unlock',
'deploy:cleanup',
'deploy:success'
]);

after('deploy:failed', 'deploy:unlock');
Loading