{"id":20961781,"url":"https://github.com/heimrichhannot/deployer-recipes","last_synced_at":"2026-02-27T15:06:49.402Z","repository":{"id":223516737,"uuid":"750885524","full_name":"heimrichhannot/deployer-recipes","owner":"heimrichhannot","description":"Deployer recipes used by @heimrichhannot","archived":false,"fork":false,"pushed_at":"2026-01-22T10:04:28.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-02-20T23:14:03.954Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heimrichhannot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-31T14:16:07.000Z","updated_at":"2026-01-22T10:02:43.000Z","dependencies_parsed_at":"2025-01-06T11:19:30.611Z","dependency_job_id":"5bba837f-f7eb-467f-b7d4-6738b31960f6","html_url":"https://github.com/heimrichhannot/deployer-recipes","commit_stats":null,"previous_names":["heimrichhannot/deployer-recipes"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/heimrichhannot/deployer-recipes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fdeployer-recipes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fdeployer-recipes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fdeployer-recipes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fdeployer-recipes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heimrichhannot","download_url":"https://codeload.github.com/heimrichhannot/deployer-recipes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fdeployer-recipes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29901241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:46:13.553Z","status":"ssl_error","status_checked_at":"2026-02-27T14:46:10.522Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T02:17:19.839Z","updated_at":"2026-02-27T15:06:49.396Z","avatar_url":"https://github.com/heimrichhannot.png","language":"PHP","readme":"# deployer-recipes\nDeployer recipes used at [Heimrich \u0026 Hannot GmbH](https://www.heimrich-hannot.de).\n\n## Install\n\nTo use our recipes, require this package with composer.\n```shell\ncomposer require --dev heimrichhannot/deployer-recipes\n```\n\nIt is _not_ required to install [Deployer](https://deployer.org/) separately, but you may do so with the following command.\n```shell\ncomposer require --dev deployer/deployer\n```\n\n## Usage with Contao 4.13+\n\nCreate a `deploy.php` file in your Contao project root directory\nand customize the following content according to your needs.\n```php\n\u003c?php # deploy.php\n\nnamespace Deployer;\n\ndate_default_timezone_set('Europe/Berlin');\n\nimport(__DIR__ . '/vendor/heimrichhannot/deployer-recipes/autoload.php');\nrecipe('contao');\n\nset('rsync_src', __DIR__);\n\nhost('www.example.org')\n    -\u003esetPort(22)\n    -\u003esetRemoteUser('www_data')\n    -\u003eset('public_url', 'https://www.example.org')\n    -\u003eset('http_user', 'www_data')\n    -\u003eset('public_dir', 'public')\n    -\u003eset('deploy_path', '/usr/www/users/{{remote_user}}/docroot')\n    -\u003eset('bin/php', 'php82')\n    -\u003eset('release_name', fn() =\u003e date('y-m-d_H-i-s'))\n    /** In case ACL is unavailable, use chmod instead */\n    // -\u003eset('writable_mode', 'chmod')\n;\n\nset('project_files', [\n    'composer.json',\n    'composer.lock',\n    'config/config.yaml',\n    'contao',\n    /** Change according to your project! */\n    'files/examplefolder', \n    'files/themes',\n    'src',\n    'templates',\n]);\n\nset('shared_dirs', [\n    'assets/images',\n    'contao-manager',\n    # 'files/maildrum',\n    # 'files/media',\n    # 'files/social-feed',\n    '{{public_path}}/share',\n    'var/backups',\n    'var/logs',\n]);\n\nset('shared_files', [\n    'config/parameters.yaml',\n    '{{public_path}}/.htaccess',\n    'system/config/localconfig.php',\n    '.env',\n    '.env.local',\n]);\n```\n```php\n/** @example Add project-specific files */\nadd('project_files', [\n    'config/routes.yaml',\n    'translations',\n]);\n\n/** @example Remove values from any variable */\nremove('project_files', [\n   'files/themes',\n   'templates'\n]);\n\n/** @example Add project-specific files to exclude from deploy */\nadd('exclude', [\n    '.githooks',\n]);\n\n/** @example Add a shared .htpasswd or any other file */\nadd('shared_files', [\n    '{{public_path}}/.htpasswd'\n]);\n\n/** @example Ask confirmation before running migrations */\nset('ask_confirm_migrate', true);\n\n/** @example Do not create backup on migration */\nset('create_db_backup', false);\n\n/** @example Reload PHP-FPM after deployment */\nset('reload_php_fcgi', true);\n\n/** @example Don't automatically deploy contao-manager */\nset('contao_manager_deploy', false);\n\n/** @example Disable confirmation input when going live */\nset('confirm_prod', false);\n\n/** @example Add yarn build task before deploying */\nbefore('deploy', 'ddev:yp');\n\n/** @example Deploy `files/themes`, which are shared and not updated by default */\nafter('deploy:shared', 'deploy:themes');\n\n/** @example Create symlinks on deployment */\nadd('symlinks', [\n    '{{public_dir}}/example' =\u003e '../relative/path/to/target',\n]);\n\n/** @example Adjust the number of stored releases */\nset('keep_releases', 10);\n```\n\n## Setup of multiple hosts or environments\n\nYou may set up multiple hosts or environments by using the `host()` function multiple times.\nIf you do not specify **[selectors](https://deployer.org/docs/7.x/selector)** (like labels) when running your deployer commands, you will be asked to choose which hosts to run that command for.\n\nIf you want to set common variables for all hosts, use the provided proxy function `broadcast()`, to call any number of methods on all previously defined hosts.\n\n\u003e [!IMPORTANT]\n\u003e Make sure to use **[labels](https://deployer.org/docs/7.x/selector)** to differentiate between environments when defining multiple hosts.\n\n```php\nhost('stage')\n    -\u003eset('public_url', 'https://stage.example.org')\n    -\u003esetLabels(['env' =\u003e 'stage'])\n;\n\nhost('production')\n    -\u003eset('public_url', 'https://www.example.org')\n    -\u003esetLabels(['env' =\u003e 'prod'])\n;\n\nbroadcast()\n    -\u003esetHostname('www.example.org')\n    -\u003esetPort(22)\n    -\u003esetRemoteUser('www_data')\n    -\u003eset('http_user', 'www_data')\n    -\u003eset('public_dir', 'public')\n    -\u003eset('deploy_path', '/usr/www/users/{{remote_user}}/docroot/{{alias}}')\n    -\u003eset('bin/php', 'php82')\n    -\u003eset('bin/composer', 'composer')\n    -\u003eset('release_name', fn() =\u003e date('y-m-d_H-i-s'))\n;\n```\n\nAlternatively, you may iterate over all hosts:\n\n```php\nforeach (getHosts() as $host) {\n    $host\n        -\u003esetHostname('www.example.org')\n        -\u003esetPort(22)\n        -\u003esetRemoteUser('www_data')\n        -\u003eset('http_user', 'www_data')\n        -\u003eset('public_dir', 'public')\n        -\u003eset('deploy_path', '/usr/www/users/{{remote_user}}/docroot/{{alias}}')\n        -\u003eset('bin/php', 'php82')\n        -\u003eset('bin/composer', 'composer')\n        -\u003eset('release_name', fn() =\u003e date('y-m-d_H-i-s'))\n    ;\n}\n```\n\n`getHosts()` is a shorthand for `Deployer::get()-\u003ehosts`.\n\n\u003e [!NOTE]\n\u003e This documentation might change in the future as there might be a better way to achieve this. Keep yourself posted.\n\n### The alias placeholder\n\nDepending on your setup, you may want to automatically place different environments on the same host in respective directories.\nYou can use the `{{alias}}` placeholder to differentiate between the hosts' aliases as environment names.\n\nFor example:\n```php\nhost('stage') // \u003c- this is the alias\n    -\u003esetRemoteUser('www_data')\n    -\u003eset('deploy_path', '/usr/www/users/{{remote_user}}/docroot/{{alias}}')\n; // will be evaluated to /usr/www/users/www_data/docroot/stage\n```\n\n## Utility Commands\n\n### Clear the cache on the remote server\n\n```bash\ndep cache:clear\n```\n\n### Clear opcache\n\n```bash\ndep opcache:clear\n```\n\n### Deploy assets only (encore build folder)\n\n```bash\ndep deploy:assets\n```\n\n### Database actions\n\n| Action                         | Command                                     |\n|--------------------------------|---------------------------------------------|\n| Clone remote database to local | \u003cpre lang=\"bash\"\u003edep db:pull\u003c/pre\u003e          |\n| Push local database to remote  | \u003cpre lang=\"bash\"\u003edep db:push\u003c/pre\u003e          |\n| Export remote database         | \u003cpre lang=\"bash\"\u003edep db:export:remote\u003c/pre\u003e |\n| Export local database          | \u003cpre lang=\"bash\"\u003edep db:export:local\u003c/pre\u003e  |\n| Import database on remote      | \u003cpre lang=\"bash\"\u003edep db:import:remote\u003c/pre\u003e |\n| Import database locally        | \u003cpre lang=\"bash\"\u003edep db:import:local\u003c/pre\u003e  |\n\nYou may alternatively use its alias `dep db:clone` for `dep db:pull`.\n\n#### What to do when `mysql` or `mysqldump` is unavailable\n\nYou can change the pull and push commands to use the `contao:backup` commands instead of `mysql` and `mysqldump`:\n\n```php\nset('db_dump_mode', 'contao');\n```\n\n\u003e [!NOTE]\n\u003e This will only work if your local and remote databases are compatible.\n\n## Contao-Manager automated Deployment\n\nContao-Manager is set to deploy automatically by default. If you prefer to disable this automatic deployment, you can configure the following variable in your deployment script:\n\n```php\nset('contao_manager_deploy', false);\n```\n\nContao-Manager will download the latest version of the Contao-Manager phar file and deploy it to `{{deploy_path}}/shared/{{public_dir}}/contao-manager.phar.php`. After that, it will be symlinked to `{{release_or_current_path}}/{{public_dir}}/contao-manager.phar.php`.\n\nIf it already exists, it will perform a self-update.\n\n### Conditional Deployment\n\nAutomated deployment of Contao-Manager will not proceed if there is a file named `contao-manager.phar.php` present in your `shared_files`.\n\nAn example in which automated deployment is skipped:\n```php\nadd('shared_files', [\n    '{{public_path}}/contao-manager.phar.php',\n]);\n```\n\nThis way, if you don't want the remote host to automatically fetch Contao-Manager from the internet, you can set up your shared files accordingly and don't need to touch `contao_manager_deploy`.\n\n### Sourcing Contao-Manager from a different location\n\nIf you want to change the source URL of `contao-manager.phar`, e.g., if you host your own Contao-Manager mirror, you can set the following variable:\n\n```php\n// this is the default value\nset('contao_manager_source', 'https://download.contao.org/contao-manager/stable/contao-manager.phar');\n```\n\n## Adding Symlinks\n\nYou can add symlinks to your deployment by using the `symlinks` configuration variable.\n\n```php\nadd('symlinks', [\n    'path/to/link' =\u003e '../relative/path/to/target',\n    '{{public_dir}}/example' =\u003e '../relative/path/to/another/target',\n]);\n```\n\nThe link path is relative to the `{{release_or_current_path}}` directory.\n\nTo regenerate symlinks after deployment, you can use the following command:\n\n```bash\ndep deploy:symlinks\n```\n\n## Work in Progress\n\nThese templates are still work in progress and not yet fully implemented. Use with caution or not at all. \n\n```php\n/** WIP: Deploy an htaccess file which will be renamed to .htaccess */\nset('htaccess_filename', '.htaccess.prod');\nafter('deploy:shared', 'deploy:htaccess');\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fdeployer-recipes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheimrichhannot%2Fdeployer-recipes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fdeployer-recipes/lists"}