Skip to content

Commit

Permalink
Merge pull request #52 from sumocoders/php8
Browse files Browse the repository at this point in the history
Php 8
  • Loading branch information
Sander authored Sep 29, 2021
2 parents 43e84b4 + fa11033 commit 2f48a0e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .php-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4
8.0
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
"name": "sumocoders/framework",
"type": "project",
"license": "proprietary",
"minimum-stability": "beta",
"require": {
"php": "^7.4 | ^8.0",
"php": "^7.4 || ^8.0",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-sodium": "*",
"symfony/flex": "^1.6.2"
},
"flex-require": {
"beberlei/doctrineextensions": "^1.2",
"doctrine/doctrine-migrations-bundle": "^2.0",
"sentry/sentry-symfony": "^3.1",
"sumocoders/framework-core-bundle": "^5.0",
"beberlei/doctrineextensions": "^1.3",
"doctrine/doctrine-migrations-bundle": "^3.0",
"sentry/sentry-symfony": "^4.0",
"sumocoders/framework-core-bundle": "^5.1.3",
"symfony/apache-pack": "^1.0.1",
"symfony/debug-bundle": "^5.3",
"symfony/dotenv": "^5.3",
Expand Down Expand Up @@ -42,7 +43,7 @@
"symfony/debug-pack": "*",
"symfony/panther": "^1.0",
"symfony/phpunit-bridge": "^5.2",
"tijsverkoyen/deployer-sumo": "^1.5"
"tijsverkoyen/deployer-sumo": "^2.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
77 changes: 42 additions & 35 deletions deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,52 @@

namespace Deployer;

require 'recipe/symfony4.php';
require 'recipe/cachetool.php';
require 'recipe/sentry.php';
require 'recipe/symfony.php';
require 'contrib/cachetool.php';
require __DIR__ . '/vendor/tijsverkoyen/deployer-sumo/sumo.php';

// Define some variables
set('client', '$client');
set('project', '$project');
set('repository', '$repository');
set('production_url', '$productionUrl');
set('sentry_organization', '$sentryOrganization');
set('sentry_project_slug', '$sentryProjectSlug');
set('sentry_token', '$sentryToken');
set('production_user', '$productionUser');
set('php_version', '8.0');

// Define staging
host('dev02.sumocoders.eu')
->user('sites')
->stage('staging')
->setRemoteUser('sites')
->set('labels', ['stage' => 'staging'])
->set('deploy_path', '~/apps/{{client}}/{{project}}')
->set('branch', 'staging')
->set('bin/php', 'php7.4')
->set('bin/composer', '{{bin/php}} /home/sites/apps/{{client}}/{{project}}/shared/composer.phar')
->set('cachetool', '/var/run/php_74_fpm_sites.sock')
->set('document_root', '~/php74/{{client}}/{{project}}');
->set('bin/php', '{{php_binary}}')
->set('cachetool', '/var/run/php_{{php_version_numeric}}_fpm_sites.sock')
->set('document_root', '~/php{{php_version_numeric}}/{{client}}/{{project}}');

// Define production
//host('$host')
// ->user('sites')
// ->stage('production')
// ->set('deploy_path', '~/apps/{{client}}/{{project}}')
// ->setRemoteUser('{{production_user}}')
// ->set('labels', ['stage' => 'production'])
// ->port(2244)
// ->set('deploy_path', '~/wwwroot')
// ->set('branch', 'master')
// ->set('bin/php', '$phpBinary')
// ->set('cachetool', '$socketPath')
// ->set('document_root', '~/php72/{{client}}/{{project}}');
// ->set('bin/php', '{{php_binary}}')
// ->set('document_root', '~/wwwroot/www')
// ->set('http_user', '{{production_user}}')
// ->set('writable_mode', 'chmod'); Cloudstar only

/*************************
* No need to edit below *
*************************/

set('php_binary', function () {
return 'php' . get('php_version');
});

set('php_version_numeric', function () {
return (int) filter_var(get('bin/php'), FILTER_SANITIZE_NUMBER_INT);
});

set('use_relative_symlink', false);

// Shared files/dirs between deploys
Expand All @@ -53,20 +60,19 @@
// Disallow stats
set('allow_anonymous_stats', false);

// Composer
set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest');

// Sentry
set(
'sentry',
[
'organization' => get('sentry_organization'),
'projects' => [
get('sentry_project_slug'),
],
'token' => get('sentry_token')
]
);
/*
* Composer
* Deployer also has this download&run snippet in its core, but they only use it
* when a global `composer` option isn't available. We always want to use the
* phar version from shared so we overwrite the default behaviour here.
*/
set('shared_folder', '{{deploy_path}}/shared');
set('bin/composer', function () {
if (!test('[ -f {{shared_folder}}/composer.phar ]')) {
run("cd {{shared_folder}} && curl -sLO https://getcomposer.org/download/latest-stable/composer.phar");
}
return '{{bin/php}} {{shared_folder}}/composer.phar';
});

/*****************
* Task sections *
Expand All @@ -75,9 +81,10 @@
task(
'build:assets:npm',
function () {
if (commandExist('nvm')) {
run('nvm install');
run('nvm exec npm run build');
$nvmPath = trim(shell_exec('echo $HOME/.nvm/nvm.sh'));

if (file_exists($nvmPath)) {
run('. ' . $nvmPath . ' && nvm use && nvm exec npm run build');
} else {
run('npm run build');
}
Expand Down
13 changes: 10 additions & 3 deletions src/Skeleton/PostCreateProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,16 @@ private static function reconfigureApplication(Event $event): void
$content = file_get_contents($projectDir . '/config/packages/sentry.yaml');
$insert = [
' options:',
' excluded_exceptions:',
' - \'Symfony\Component\HttpKernel\Exception\NotFoundHttpException\'',
' - \'Symfony\Component\Security\Core\Exception\AccessDeniedException\'',
' integrations:',
' - \'Sentry\Integration\IgnoreErrorsIntegration\'',
'',
'services:',
' Sentry\Integration\IgnoreErrorsIntegration:',
' arguments:',
' $options:',
' ignore_exceptions:',
' - \'Symfony\Component\HttpKernel\Exception\NotFoundHttpException\'',
' - \'Symfony\Component\Security\Core\Exception\AccessDeniedException\'',
];
$content = self::insertStringAtPosition(
$content,
Expand Down

0 comments on commit 2f48a0e

Please sign in to comment.