-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
163 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#zend_extension=opcache.so | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.validate_timestamps=0 | ||
opcache.save_comments=0 | ||
opcache.enable_file_override=1 | ||
opcache.huge_code_pages=1 | ||
|
||
mysqlnd.collect_statistics = Off | ||
|
||
memory_limit = 512M | ||
|
||
opcache.jit_buffer_size = 128M | ||
opcache.jit = tracing | ||
|
||
disable_functions=header,header_remove,headers_sent,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,set_time_limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
require_once __DIR__ . '/vendor/autoload.php'; | ||
|
||
|
||
use Adapterman\Adapterman; | ||
use Workerman\Worker; | ||
use Workerman\Lib\Timer; | ||
|
||
Adapterman::init(); | ||
|
||
$http_worker = new Worker('http://0.0.0.0:8080'); | ||
$http_worker->count = (int) shell_exec('nproc') * 4; | ||
$http_worker->name = 'AdapterMan-Laravel'; | ||
$http_worker->onWorkerStart = function () { | ||
Header::$date = gmdate('D, d M Y H:i:s').' GMT'; | ||
Timer::add(1, function() { | ||
Header::$date = gmdate('D, d M Y H:i:s').' GMT'; | ||
}); | ||
//init(); | ||
require __DIR__.'/start.php'; | ||
}; | ||
|
||
$http_worker->onMessage = static function ($connection, $request) { | ||
|
||
$connection->send(run()); | ||
}; | ||
|
||
Worker::runAll(); | ||
|
||
class Header { | ||
public static $date; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
use App\Kernel; | ||
use Symfony\Component\Dotenv\Dotenv; | ||
use Symfony\Component\ErrorHandler\Debug; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
require __DIR__.'/vendor/autoload.php'; | ||
|
||
(new Dotenv())->bootEnv(__DIR__.'/.env'); | ||
|
||
if ($_SERVER['APP_DEBUG']) { | ||
umask(0000); | ||
|
||
Debug::enable(); | ||
} | ||
|
||
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { | ||
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); | ||
} | ||
|
||
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { | ||
Request::setTrustedHosts([$trustedHosts]); | ||
} | ||
|
||
global $kernel; | ||
|
||
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); | ||
|
||
function run() | ||
{ | ||
global $kernel; | ||
|
||
ob_start(); | ||
try { | ||
$request = Request::createFromGlobals(); | ||
$response = $kernel->handle($request); | ||
$response->send(); | ||
|
||
header('Date: ' . Header::$date); // To pass the bench, nginx auto add it | ||
|
||
$kernel->terminate($request, $response); | ||
} catch (Throwable $e) { | ||
echo $e->getMessage(); | ||
} | ||
|
||
return ob_get_clean(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null | ||
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php | ||
RUN apt-get update -yqq > /dev/null && \ | ||
apt-get install -yqq git unzip \ | ||
php8.1-cli php8.1-mysql php8.1-mbstring php8.1-xml php8.1-curl > /dev/null | ||
|
||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
|
||
RUN apt-get install -y php-pear php8.1-dev libevent-dev > /dev/null | ||
RUN pecl install event-3.0.8 > /dev/null && echo "extension=event.so" > /etc/php/8.1/cli/conf.d/event.ini | ||
|
||
EXPOSE 8080 | ||
|
||
WORKDIR /symfony | ||
ADD ./composer.json /symfony/ | ||
RUN mkdir -m 777 -p /symfony/var/cache/{dev,prod} /symfony/var/log | ||
RUN composer install --no-dev --no-scripts | ||
|
||
# downgrade to doctrine-dbal 2.12 => due to a bug in version 2.13 | ||
# see https://github.com/doctrine/dbal/issues/4603 | ||
#RUN composer require doctrine/orm:2.10.2 -W | ||
#RUN composer require doctrine/dbal:2.12.x -W | ||
|
||
ADD . /symfony | ||
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload --no-dev --classmap-authoritative | ||
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod | ||
|
||
# removes hardcoded option `ATTR_STATEMENT_CLASS` conflicting with `ATTR_PERSISTENT`. Hack not needed when upgrading to Doctrine 3 | ||
# see https://github.com/doctrine/dbal/issues/2315 | ||
#RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php | ||
|
||
RUN php bin/console cache:clear | ||
|
||
COPY deploy/conf/cli-php.ini /etc/php/8.1/cli/php.ini | ||
|
||
CMD php server.php start |