{"id":18248255,"url":"https://github.com/district09/robo-digipolis-deploy","last_synced_at":"2025-04-04T15:32:21.378Z","repository":{"id":16559875,"uuid":"80022156","full_name":"district09/robo-digipolis-deploy","owner":"district09","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-23T08:24:35.000Z","size":184,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2024-04-23T13:05:36.503Z","etag":null,"topics":["d09check22","deploy","deployment","robo","robo-digipolis-deploy","robo-tasks","web"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/district09.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2017-01-25T14:30:54.000Z","updated_at":"2024-06-21T16:19:59.712Z","dependencies_parsed_at":"2023-12-21T16:01:25.135Z","dependency_job_id":"2de75e1c-a492-4f1f-835c-ff72ada0077e","html_url":"https://github.com/district09/robo-digipolis-deploy","commit_stats":{"total_commits":147,"total_committers":2,"mean_commits":73.5,"dds":"0.027210884353741527","last_synced_commit":"2ad912aa3ad9925ee5c52589192dac8d32797846"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district09%2Frobo-digipolis-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/district09","download_url":"https://codeload.github.com/district09/robo-digipolis-deploy/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247203061,"owners_count":20900906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["d09check22","deploy","deployment","robo","robo-digipolis-deploy","robo-tasks","web"],"created_at":"2024-11-05T09:36:23.851Z","updated_at":"2025-04-04T15:32:16.369Z","avatar_url":"https://github.com/district09.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Robo Digipolis Deploy\n\nDeploy tasks for Robo Task Runner\n\n[![Latest Stable Version](https://poser.pugx.org/digipolisgent/robo-digipolis-deploy/v/stable)](https://packagist.org/packages/digipolisgent/robo-digipolis-deploy)\n[![Latest Unstable Version](https://poser.pugx.org/digipolisgent/robo-digipolis-deploy/v/unstable)](https://packagist.org/packages/digipolisgent/robo-digipolis-deploy)\n[![Total Downloads](https://poser.pugx.org/digipolisgent/robo-digipolis-deploy/downloads)](https://packagist.org/packages/digipolisgent/robo-digipolis-deploy)\n[![License](https://poser.pugx.org/digipolisgent/robo-digipolis-deploy/license)](https://packagist.org/packages/digipolisgent/robo-digipolis-deploy)\n\n[![Build Status](https://travis-ci.org/digipolisgent/robo-digipolis-deploy.svg?branch=develop)](https://travis-ci.org/digipolisgent/robo-digipolis-deploy)\n[![Maintainability](https://api.codeclimate.com/v1/badges/eced33c8f045644486cb/maintainability)](https://codeclimate.com/github/digipolisgent/robo-digipolis-deploy/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/eced33c8f045644486cb/test_coverage)](https://codeclimate.com/github/digipolisgent/robo-digipolis-deploy/test_coverage)\n[![PHP 7 ready](https://php7ready.timesplinter.ch/digipolisgent/robo-digipolis-deploy/develop/badge.svg)](https://travis-ci.org/digipolisgent/robo-digipolis-deploy)\n\n## Tasks in this package\n\n### PushPackage\n\n```php\n$auth = new \\DigipolisGent\\Robo\\Task\\Deploy\\Ssh\\Auth\\KeyFile('user', '/home/myuser/.ssh/id_dsa');\n$result = $this-\u003etaskPushPackage('192.168.1.1', $auth)\n    -\u003eport(8022)\n    -\u003etimeout(15)\n    -\u003edestinationFolder('/folder/on/server')\n    -\u003epackage('/path/to/local/package.tar.gz')\n    -\u003erun();\n```\n\n### SFTP\n\n```php\n$auth = new \\DigipolisGent\\Robo\\Task\\Deploy\\Ssh\\Auth\\KeyFile('user', '/home/myuser/.ssh/id_dsa');\n$result = $this-\u003etaskSFTP('192.168.1.1', $auth)\n    -\u003eport(8022)\n    -\u003etimeout(15)\n    // Download file from server.\n    -\u003eget('/path/to/remote/file.txt', '/path/to/local/file.txt')\n    // Upload file to server.\n    -\u003eput('/path/to/remote/file.txt', '/path/to/local/file.txt')\n    -\u003erun();\n```\n\n### Ssh\n\n```php\n$auth = new \\DigipolisGent\\Robo\\Task\\Deploy\\Ssh\\Auth\\KeyFile('user', '/home/myuser/.ssh/id_dsa');\n$result = $this-\u003etaskSsh('192.168.1.1', $auth)\n    -\u003eport(8022)\n    -\u003etimeout(15)\n    // Set the remote directory to execute the commands in.\n    -\u003eremoteDirectory('/path/to/remote/dir')\n    -\u003eexec('composer install')\n    -\u003erun();\n```\n\n### SymlinkFolderFileContents\n\n```php\n$result = $this\n    -\u003etaskSymlinkFolderFileContents('/path/to/source', '/path/to/destination')\n    -\u003erun();\n```\n\nAs this command will most likely be used to symlink config files on a server\nduring deployment, this task should be used in a command that runs on the\nserver. For example:\n\nRoboFile.php on the server (let's say 192.168.1.1 in folder /path/to/remote/dir):\n\n```php\n\u003c?php\n\nclass RoboFile extends \\Robo\\Tasks\n{\n    use \\DigipolisGent\\Robo\\Task\\Deploy\\loadTasks;\n\n    /**\n     * Creates the symlinks.\n     */\n    public function symlinks($source, $dest)\n    {\n        $this\n            -\u003etaskSymlinkFolderFileContents($source, $dest)\n            -\u003erun();\n    }\n}\n\n```\n\nRoboFile.php on the build server / your local machine:\n\n```php\n\u003c?php\n\nclass RoboFile extends \\Robo\\Tasks\n{\n    use \\DigipolisGent\\Robo\\Task\\Deploy\\loadTasks;\n\n    /**\n     * Creates the symlinks.\n     */\n    public function symlinks($source, $dest)\n    {\n        $auth = new \\DigipolisGent\\Robo\\Task\\Deploy\\Ssh\\Auth\\KeyFile('user', '/home/myuser/.ssh/id_dsa');\n        $this-\u003etaskSsh('192.168.1.1', $auth)\n            -\u003eport(8022)\n            -\u003etimeout(15)\n            -\u003eremoteDirectory('/path/to/remote/dir')\n            -\u003eexec('vendor/bin/robo symlink ' . $source . ' ' . $dest)\n            -\u003erun();\n    }\n}\n\n```\n\n### DatabaseBackup\n\n```php\n$filesystemConfig = [\n    'local' =\u003e [\n        'type' =\u003e 'Local',\n        'root' =\u003e '/home/myuser/backups',\n    ],\n];\n\n$dbConfig = [\n    'development' =\u003e [\n        'type' =\u003e 'mysql',\n        'host' =\u003e 'localhost',\n        'port' =\u003e '3306',\n        'user' =\u003e 'root',\n        'pass' =\u003e 'password',\n        'database' =\u003e 'test',\n        'singleTransaction' =\u003e true,\n        'ignoreTables' =\u003e [],\n    ],\n    'production' =\u003e [\n        'type' =\u003e 'mysql',\n        'host' =\u003e 'localhost',\n        'port' =\u003e '3306',\n        'user' =\u003e 'root',\n        'pass' =\u003e 'password',\n        'database' =\u003e 'test',\n        'ignoreTables' =\u003e [],\n        'structureTables' =\u003e [],\n        'tables' =\u003e [],\n        'dataOnly' =\u003e false,\n        'orderedDump' =\u003e false,\n        'singleTransaction' =\u003e true,\n        'extra' =\u003e '--opt',\n    ],\n];\n// Store a backup of the development database in /home/myuser/backups/dev.sql.tar.gz.\n$result = $this-\u003etaskDatabaseBackup($filesystemConfig, $dbConfig)\n    -\u003edatabase('development')\n    -\u003edestination('dev.sql')\n    -\u003ecompression('tar')\n    -\u003erun();\n\n```\n\n### DatabaseRestore\n\n```php\n$filesystemConfig = [\n    'local' =\u003e [\n        'type' =\u003e 'Local',\n        'root' =\u003e '/home/myuser/backups',\n    ],\n];\n\n$dbConfig = [\n    'development' =\u003e [\n        'type' =\u003e 'mysql',\n        'host' =\u003e 'localhost',\n        'port' =\u003e '3306',\n        'user' =\u003e 'root',\n        'pass' =\u003e 'password',\n        'database' =\u003e 'test',\n        'singleTransaction' =\u003e true,\n        'ignoreTables' =\u003e [],\n    ],\n    'production' =\u003e [\n        'type' =\u003e 'mysql',\n        'host' =\u003e 'localhost',\n        'port' =\u003e '3306',\n        'user' =\u003e 'root',\n        'pass' =\u003e 'password',\n        'database' =\u003e 'test',\n        'ignoreTables' =\u003e [],\n        'structureTables' =\u003e [],\n        'tables' =\u003e [],\n        'dataOnly' =\u003e false,\n        'orderedDump' =\u003e false,\n        'singleTransaction' =\u003e true,\n        'extra' =\u003e '--opt',\n    ],\n];\n// Restore a backup of the development database located at /home/myuser/backups/dev.sql.tar.gz.\n$result = $this-\u003etaskDatabaseRestore($filesystemConfig, $dbConfig)\n    -\u003edatabase('development')\n    -\u003esource('dev.sql.tar.gz')\n    -\u003ecompression('tar')\n    -\u003erun();\n\n```\n\n#### File system configuration options\n\nMore information on the configuration options for the file systems can be found\nat \u003chttps://github.com/backup-manager/backup-manager\u003e.\n\n#### Database configuration options\n\nMore information on the configuration options for the databases can be found\nat \u003chttps://github.com/backup-manager/backup-manager\u003e. However, we provide our\nown MySql database handler. The configuration options are explained below:\n\n```php\n$dbConfig = [\n    'production' =\u003e [\n        // Specify it's a mysql database.\n        'type' =\u003e 'mysql',\n        // Specify the database credentials.\n        'host' =\u003e 'localhost',\n        'port' =\u003e '3306',\n        'user' =\u003e 'root',\n        'pass' =\u003e 'password',\n        'database' =\u003e 'test',\n        // Tables to exclude from the export. This option will be ignored if the\n        // 'tables' configuration option is set, because all tables will be\n        // excluded except the ones specified in the 'tables' option. Therefore,\n        // adding a table to the 'ignoreTables' would be the same as omitting it\n        // from tbe 'tables' option if that option has a non-empty) value.\n        'ignoreTables' =\u003e [],\n        // Tables to only export the table structure for. A good example would\n        // be a cache table, since most of the time you wouldn't want this\n        // table's data in a backup. The structure of the tables specified here\n        // will be exported even if the 'tables' configuration options has a\n        // (non-empty) value and these tables are not in it.\n        'structureTables' =\u003e [],\n        // Tables to export. Leave empty to export all tables (except those\n        // specified in the 'ignoreTables' configuration option).\n        'tables' =\u003e [],\n        // Export only data, not table structure.\n        'dataOnly' =\u003e false,\n        // Order by primary key and add line breaks for efficient diff in\n        // revision control. Slows down the dump.\n        'orderedDump' =\u003e false,\n        // If singleTransaction is set to true, the --single-transcation flag\n        // will be set. This is useful on transactional databases like InnoDB.\n        // http://dev.mysql.com/doc/refman/5.7/en/mysqldump.html#option_mysqldump_single-transaction\n        'singleTransaction' =\u003e true,\n        // Extra options to pass to mysqldump (e.g. '--opt --quick').\n        'extra' =\u003e '--opt',\n\n    ],\n];\n```\n\n## Commands in this package\n\nThis package provides default commands wich you can use in your `RoboFile.php`\nlike so:\n\n```php\nclass RoboFile extends \\Robo\\Tasks\n{\n    use \\DigipolisGent\\Robo\\Task\\Deploy\\Commands\\loadCommands;\n}\n```\n\n### digipolis:database-backup\n\n`vendor/bin/robo digipolis:database-backup [DATABASE] [OPTIONS]`\n\n#### Use events for default configuration\n\nImplement an [on-event hook](https://github.com/consolidation/annotated-command#on-event-hook)\nfor the digipolis-db-config event to return the datbase config\n[as specified above](#database-configuration-options) used by this command. For\nexample:\n\n```php\n/**\n * @hook on-event digipolis-db-config\n */\npublic function defaultDbConfig()\n{\n    $dbConfig = [];\n    $dbConfig['default'] = [\n        'type' =\u003e 'mysql',\n        'host' =\u003e 'localhost',\n        'port' =\u003e '3306',\n        'user' =\u003e 'root',\n        'pass' =\u003e '$up3r$3cr3tP@$$w0rD',\n        'database' =\u003e 'my_database',\n        'structureTables' =\u003e [],\n        'extra' =\u003e '--skip-add-locks --no-tablespaces',\n    ];\n\n    return $dbConfig;\n}\n```\n\n#### Arguments\n\n##### DATABASE\n\nThe database config key. See above for more details. In de given example, this\nargument would have to be 'production'. Defaults to 'default'.\n\n#### Options\n\n##### --file-system-config, -fsconf\n\nPath to a PHP file containing filesystem config as documented at\n\u003chttps://github.com/backup-manager/backup-manager\u003e. Defaults to the root\ndirectory of the local filesystem.\n\n##### --database-config, -dbconf\n\nPath to a PHP file containing database config as documented at\n\u003chttps://github.com/backup-manager/backup-manager\u003e. Defaults to a database with\nthe name of the current working directory as database name, on `localhost` port\n`3306`, user `root` and an empty password.\n\n##### --compression, -c\n\nThe compression to use for this backup. Defaults to `tar`.\n\n##### --destination, -d\n\nThe destination file for this backup. Defaults to `project.tar.gz` in the\ncurrent working directory.\n\n##### --destination-type, -dtype\n\nThe destination type (e.g. `local`, `dropbox`, `ftp`). Defaults to `local`.\n\n### digipolis:database-restore\n\n`vendor/bin/robo digipolis:database-restore [DATABASE] [OPTIONS]`\n\n#### Use events for default configuration\n\nImplement an [on-event hook](https://github.com/consolidation/annotated-command#on-event-hook)\nfor the digipolis-db-config event to return the datbase config\n[as specified above](#database-configuration-options) used by this command. For\nexample:\n\n```php\n/**\n * @hook on-event digipolis-db-config\n */\npublic function defaultDbConfig()\n{\n    $dbConfig = [];\n    $dbConfig['default'] = [\n        'type' =\u003e 'mysql',\n        'host' =\u003e 'localhost',\n        'port' =\u003e '3306',\n        'user' =\u003e 'root',\n        'pass' =\u003e '$up3r$3cr3tP@$$w0rD',\n        'database' =\u003e 'my_database',\n        'structureTables' =\u003e [],\n        'extra' =\u003e '--skip-add-locks --no-tablespaces',\n    ];\n\n    return $dbConfig;\n}\n```\n\n#### Arguments\n\n##### DATABASE\n\nThe database config key. See above for more details. In de given example, this\nargument would have to be 'production'. Defaults to 'default'.\n\n#### Options\n\n##### --file-system-config, -fsconf\n\nPath to a PHP file containing filesystem config as documented at\n\u003chttps://github.com/backup-manager/backup-manager\u003e. Defaults to the root\ndirectory of the local filesystem.\n\n##### --database-config, -dbconf\n\nPath to a PHP file containing database config as documented at\n\u003chttps://github.com/backup-manager/backup-manager\u003e. Defaults to a database with\nthe name of the current working directory as database name, on `localhost` port\n`3306`, user `root` and an empty password.\n\n##### --compression, -c\n\nThe compression of the given backup. Defaults to `tar`.\n\n##### --source, -s\n\nThe source file to restore. Defaults to `project.tar.gz` in the current working\ndirectory.\n\n##### --source-type, -stype\n\nThe source type (e.g. `local`, `dropbox`, `ftp`). Defaults to `local`.\n\n### digipolis:push-package\n\n`vendor/bin/robo digipolis:push-package USER HOST PACKAGE [DESTINATION] [OPTIONS]`\n\n#### Arguments\n\n##### USER\n\nThe user to connect to the host.\n\n##### HOST\n\nThe host to connect to.\n\n##### PACKAGE\n\nThe package (tar-file) to push.\n\n##### DESTINATION\n\nThe destination folder on the server. Defaults to the home directory of the\nuser.\n\n#### Options\n\n##### --password\n\nThe password to connect to the host.\n\n##### --key-file\n\nThe private key file to connect to the host.\n\n##### --port\n\nThe port to connect on. Defaults to `22`.\n\n##### --timeout\n\nThe timeout for the connection in seconds. Defaults to `10`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict09%2Frobo-digipolis-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistrict09%2Frobo-digipolis-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict09%2Frobo-digipolis-deploy/lists"}