This repository has been archived on 2024-05-20. You can view files and clone it, but cannot push or open issues or pull requests.
PriceyBotPanel/deploy.php

49 lines
1.0 KiB
PHP

<?php
namespace Deployer;
require 'recipe/laravel.php';
require 'contrib/npm.php';
// Config
set('git_ssh_command', 'ssh');
set('repository', 'ssh://git@ssh.git.lovelynet.net:9001/PriceyBot/PriceyBotPanel.git');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
set('http_user', 'nginx');
set('http_group', 'nginx');
set('writable_mode', 'chmod');
// Hosts
host('production')
->set('hostname', 'vps.benjamyn.love')
->set('port', '22')
->set('remote_user', 'root')
->set('deploy_path', '/opt/PriceyBotPanel');
// Tasks
task('npm:build', function () {
$command = match (get('alias')) {
'production' => 'production',
'staging' => 'development',
default => 'production'
};
run("cd {{release_path}} && {{bin/npm}} run {$command}");
});
task('perm:fix', function () {
run("chown -R nginx:nginx /opt/PriceyBotPanel");
});
// Hooks
after('deploy:vendors', 'npm:install');
after('npm:install', 'npm:build');
after('npm:build', 'perm:fix');
after('deploy:failed', 'deploy:unlock');