Support for fast deploy

This commit is contained in:
Matteo Gheza 2020-12-29 23:55:28 +01:00
parent e3cd470b55
commit c41c2c2383
3 changed files with 88 additions and 1 deletions

4
.gitignore vendored
View File

@ -515,4 +515,6 @@ sw.js
/server/cypress/screenshots
!/server/cypress/screenshots/.gitkeep
/server/cypress/videos
!/server/cypress/videos/.gitkeep
!/server/cypress/videos/.gitkeep
deployment_remotes.php

73
deployment.php Normal file
View File

@ -0,0 +1,73 @@
<?php
$baseConfig = [
'local' => 'server',
'ignore' => '
.git*
.github
.vscode
*.json
!resources/dist/manifest.json
resources/src
resources/node_modules
resources/webpack*
cypress
error-log/exception*
error-log/*.log
config.old.php
config.php
*tests*
*tests
*examples*
*examples
*Makefile*
*.md
*.rst
*.txt
*.sh
*editorconfig
*doc*
*.yml
*.travis*
*.eslintrc*
*.phpstorm*
*.php_cs*
*.xml
*LICENSE*
*CREDITS*
*VERSION*
*CHANGELOG*
*phpcs*
*phpstan*
*phpunit*
vendor/nikic/fast-route/test
vendor/twig/twig/src/Node/Expression/Test
vendor/twig/twig/src/Test
vendor/tracy/tracy/tools
*.lock
',
'before' => [
'local: cd server && composer update --no-dev -o',
'local: cd server/resources && npm run prod'
],
'after' => [
'local: cd server && composer install'
],
'filePermissions' => "0644",
'dirPermissions' => "0755"
];
try {
require("deployment_remotes.php");
} catch (\Throwable $th) {
print("ERROR: no 'deployment_remotes.php' file.".PHP_EOL);
print("Rename 'deployment_remotes.sample.php' in 'deployment_remotes.php' and edit remotes config.".PHP_EOL);
exit();
}
$config = [];
foreach ($remotes as $key => $value) {
$config[$key] = array_merge($value, $baseConfig);
}
return $config;

View File

@ -0,0 +1,12 @@
<?php
// you can use ftps://, sftp://, file:// or phpsec:// protocols (sftp requires SSH2 extension; phpsec uses phpseclib library)
$remotes = [
'testing' => [
'remote' => 'sftp://user:secretpassword@ftp.example.com/directory_testing',
],
'production' => [
'remote' => 'ftp://ftp.example.com/directory',
'user' => 'user',
'password' => 'secretpassword'
]
];