| Server IP : 164.138.27.172 / Your IP : 216.73.216.143 Web Server : nginx/1.27.4 System : Linux cookingdream 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : www-adm ( 1001) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /home/jonasn/dev/internetstiftelsen.se/ |
Upload File : |
<?php
namespace Deployer;
require 'recipe/common.php';
require 'recipe/npm.php';
require 'recipe/slack.php';
use Dotenv\Dotenv;
$dotenv = Dotenv::createMutable( __DIR__ );
if ( file_exists( __DIR__ . '/.env' ) ) {
$dotenv->load();
} else {
die( 'Please create an .env file to continue' );
}
// Project name
set( 'application', 'internetstiftelsen.se' );
// Project repository
set( 'repository', 'git@github.com:sewebb/internetstiftelsen.se.git' );
// [Optional] Allocate tty for git clone. Default value is false.
set( 'git_tty', true );
// Shared files/dirs between deploys
set(
'shared_files',
[
'.env',
'www/.htaccess',
'www/google7f53f1303f112850.html',
]
);
set(
'shared_dirs',
[
'www/app/uploads',
'www/docs',
]
);
// Writable dirs by web server
set(
'writable_dirs',
[]
);
set( 'allow_anonymous_stats', false );
set( 'slack_webhook', getenv( 'SLACK_WEBHOOK' ) );
set( 'slack_text', '_{{user}}_ deploying `{{branch}}` to *{{target}}*' );
set( 'slack_success_text', 'Deploy to *{{target}}* successful' );
set( 'slack_failure_text', 'Deploy to *{{target}}* failed' );
// Hosts
host( 'stage' )
->user( 'iis' )
->hostname( getenv( 'DEPLOY_STAGE_IP' ) )
->set( 'deploy_path', '/home/httpd/iis/{{application}}' );
host( 'prod' )
->user( 'iis' )
->hostname( getenv( 'DEPLOY_PROD_IP' ) )
->set( 'branch', 'master' )
->set( 'deploy_path', '/home/httpd/iis/{{application}}' );
host( 'ny' )
->user( 'www-adm' )
->hostname( getenv( 'DEPLOY_NY_IP' ) )
->set( 'deploy_path', '/var/www/ny.{{application}}' );
// Tasks
task( 'npm:production', 'npm run production' );
task(
'git:tag',
function () {
$host = get( 'hostname' );
if ( 'ny' === $host || 'stage' === $host ) {
return;
}
$git = get( 'bin/git' );
$date = run( 'date +"%y%m%d%H%M"' );
$release = get( 'release_name' );
$release_tag = 'v-' . $date . '-' . $release;
$branch = get( 'branch', 'unknown' );
$message = 'Deployed branch ' . $branch . ' to ' . $host;
run( "cd {{release_path}} && $git config user.name 'Deployer'" );
run( "cd {{release_path}} && $git config user.email 'git@deployer.vm'" );
run( "cd {{release_path}} && $git tag $release_tag -m '{$message}'" );
run( "cd {{release_path}} && $git push origin --tags" );
}
)->desc( 'Create release tag' );
task(
'wp-admin:setup',
function () {
run( 'cp ' . get( 'deploy_path' ) . '/current/deploy/.htaccess ' . get( 'deploy_path' ) . '/current/www/wp/wp-admin/' );
}
);
task(
'reload:php-fpm',
function () {
$host = get( 'hostname' );
if ( 'ny' === $host ) {
return;
} else {
run( 'sudo /etc/init.d/php7.4-fpm reload' );
}
}
);
desc( 'Deploy your project' );
task(
'deploy',
[
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:symlink',
'deploy:unlock',
'cleanup',
'success',
]
);
before( 'deploy', 'slack:notify' );
after( 'success', 'slack:notify:success' );
after( 'deploy:failed', 'slack:notify:failure' );
after( 'deploy', 'wp-admin:setup' );
after( 'deploy', 'reload:php-fpm' );
after( 'deploy:failed', 'deploy:unlock' );
after( 'deploy:shared', 'npm:install' );
after( 'deploy:shared', 'npm:production' );
after( 'success', 'git:tag' );