bilbofox / deploy-remote
Remote side of deploy tool - handling deploy requests.
Requires
- php: ^8.1
- ext-zip: *
- guzzlehttp/guzzle: ^7 || ^8
- nette/utils: ^4.1
- psr/log: ^3.0
- slim/slim: ^4.15
This package is auto-updated.
Last update: 2026-08-12 18:26:18 UTC
README
This is a remote side of deploy tool - handling deploy requests.
Installation
App using this package is supposed to be put on server, where it listens to incoming deploy requests.
After installation by:
composer require bilbofox/deploy-remote
We should create a simple app by using the application factory from this package:
use Bilbofox\DeployRemote\AppFactory; require_once __DIR__ . '/vendor/autoload.php'; // For example... $rootDir = '/my/web/root'; $cryptDir = $rootDir . '/crypt'; $packsDir = __DIR__ . '/packs'; // Optional logger $logger = new My\Psr3\Logger(); $appFactory = new AppFactory( rootDir: $rootDir, cryptDir: $cryptDir, packsDir: $packsDir, ); $appFactory->setLogger($logger); $app = $appFactory->create(); $app->run();
Parameters
Constructor parameters for AppFactory are explained here. These are the main configuration settings for the app:
string $rootDir- Root directory of the server, from which paths are calculatedstring $cryptDir- Path for directory with additional files added to unpacked packs, inside should match path from root to projectstring $packsDir- Temporary directory for unpacked packs?string $basePath = null- Basepath for application or null for autodetectionbool $debug = false- Debug mode on/off
Usage
App listens to POST requests at its root path. Requests are normally generated by the client-side package of this deploy tool, so there is no need to send them manually.
But for explanation purposes, here is an example of the JSON request body:
{
"pack": "zip-pack_abcde12345.zip",
"target": "www/projects/my-project"
}
packis filename of a pack file inside$packsDirdirectory - it's usually copied there by client-tool.targetis a subpath inside$rootDirdirectory - leading to the target project destination.
The flow of the deployment process is then quite simple:
- Client-side tool copies pack with project contents via some remote method (FTP usually) to
$packsDirdirectory on server - Client-side tool sends a POST request with pack filename
<pack>and target path<target>to the project. - This tool unpacks pack at
$packsDir/<pack>and then moves it to$rootDir/<target>directory. It also backs up the old project directory temporarily just in case. - After that it adds additional files from
$cryptDir/<target>directory to the project directory. For example, configuration files with sensitive data etc. - And that's it! After that it simply returns HTTP 200 OK.