Skip to content

Commit

Permalink
Add Contao recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhj committed Dec 20, 2021
1 parent 5992169 commit 79ec38f
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 0 deletions.
100 changes: 100 additions & 0 deletions docs/recipe/contao.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit recipe/contao.php -->
<!-- Then run bin/docgen -->

# contao

[Source](/recipe/contao.php)

* Requires
* [symfony](/docs/recipe/symfony.md)

## Configuration
### bin/console
[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L20)

Overrides [bin/console](/docs/recipe/symfony.md#bin/console) from `recipe/symfony.php`.





### contao_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L24)





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

Overrides [public_path](/docs/recipe/provision/website.md#public_path) from `recipe/provision/website.php`.

The public path is the path to be set as DocumentRoot and is defined in the `composer.json` of the project
but defaults to `public` from Contao 5.0 on.
This path is relative from the [current_path](/docs/recipe/common.md#current_path), see [`recipe/provision/website.php`](/docs/recipe/provision/website.php#public_path).




## Tasks

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

Run Contao migrations.

This task updates the database. A database backup is saved automatically as a default.


### contao:manager:download
[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L46)

Download the Contao Manager.

Optional task to download the `contao-manager.phar.php` in the public path. Make sure to
set a password on first access!


### contao:install:lock
[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L51)

Lock the Contao Install Tool.




### contao:maintenance:enable
[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L56)

Enable maintenance mode.




### contao:maintenance:disable
[Source](https://github.com/deployphp/deployer/blob/master/recipe/contao.php#L61)

Disable maintenance mode.




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

Deploy the project.




This task is group task which contains next tasks:
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors)
* [contao:maintenance:enable](/docs/recipe/contao.md#contaomaintenanceenable)
* [contao:migrate](/docs/recipe/contao.md#contaomigrate)
* [contao:maintenance:disable](/docs/recipe/contao.md#contaomaintenancedisable)
* [deploy:publish](/docs/recipe/common.md#deploypublish)


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

require_once __DIR__ . '/symfony.php';

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

add('shared_files', ['config/parameters.yml']);

add('shared_dirs', [
'assets/images',
'contao-manager',
'files',
'public/share',
'system/config',
'var/backups',
'var/logs',
]);

set('bin/console', function () {
return '{{release_or_current_path}}/vendor/bin/contao-console';
});

set('contao_version', function () {
return run('{{bin/console}} contao:version');
});

// The public path is the path to be set as DocumentRoot and is defined in the `composer.json` of the project
// but defaults to `public` from Contao 5.0 on.
// This path is relative from the {{current_path}}, see [`recipe/provision/website.php`](/docs/recipe/provision/website.php#public_path).
set('public_path', function () {
$composerConfig = json_decode(file_get_contents('./composer.json'), true, 512, JSON_THROW_ON_ERROR);

return $composerConfig['extra']['public-dir'] ?? 'public';
});

// This task updates the database. A database backup is saved automatically as a default.
desc('Run Contao migrations');
task('contao:migrate', function () {
run('{{bin/php}} {{bin/console}} contao:migrate {{console_options}}');
});

// Optional task to download the `contao-manager.phar.php` in the public path. Make sure to
// set a password on first access!
desc('Download the Contao Manager');
task('contao:manager:download', function () {
run('curl -LsO https://download.contao.org/contao-manager/stable/contao-manager.phar && mv contao-manager.phar {{release_or_current_path}}/{{public_path}}/contao-manager.phar.php');
});

desc('Lock the Contao Install Tool');
task('contao:install:lock', function () {
run('{{bin/php}} {{bin/console}} contao:install:lock {{console_options}}');
});

desc('Enable maintenance mode');
task('contao:maintenance:enable', function () {
run('{{bin/php}} {{bin/console}} contao:maintenance-mode --enable {{console_options}}');
});

desc('Disable maintenance mode');
task('contao:maintenance:disable', function () {
run('{{bin/php}} {{bin/console}} contao:maintenance-mode --disable {{console_options}}');
});

desc('Deploy the project');
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'contao:maintenance:enable',
'contao:migrate',
'contao:maintenance:disable',
'deploy:publish',
]);

0 comments on commit 79ec38f

Please sign in to comment.