Skip to content

[Ubiquity] update workerman to PHP8 #6312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions frameworks/PHP/ubiquity/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"database": "MySQL",
"framework": "ubiquity",
"language": "PHP",
"flavor": "PHP7",
"flavor": "PHP8",
"orm": "Full",
"platform": "FPM/FastCGI",
"webserver": "nginx",
Expand All @@ -26,8 +26,6 @@
"versus": "php"
},
"workerman": {
"json_url": "/Json_",
"plaintext_url": "/Plaintext_",
"db_url": "/Db_",
"query_url": "/Db_/query/",
"fortune_url": "/Fortunes_",
Expand All @@ -39,7 +37,7 @@
"database": "Postgres",
"framework": "Ubiquity",
"language": "PHP",
"flavor": "PHP7",
"flavor": "PHP8",
"orm": "Full",
"platform": "workerman",
"webserver": "none",
Expand Down Expand Up @@ -114,7 +112,8 @@
"database_os": "Linux",
"display_name": "ubiquity-roadrunner",
"notes": "",
"versus": "php"
"versus": "php",
"tags": ["broken"]
},
"roadrunner-mysql": {
"db_url": "/DbMy",
Expand All @@ -135,7 +134,8 @@
"database_os": "Linux",
"display_name": "ubiquity-roadrunner-mysql",
"notes": "",
"versus": "php"
"versus": "php",
"tags": ["broken"]
},
"workerman-mysql": {
"db_url": "/DbMy",
Expand All @@ -148,7 +148,7 @@
"database": "Mysql",
"framework": "Ubiquity",
"language": "PHP",
"flavor": "PHP7",
"flavor": "PHP8",
"orm": "Full",
"platform": "workerman",
"webserver": "none",
Expand All @@ -169,7 +169,7 @@
"database": "MongoDB",
"framework": "Ubiquity",
"language": "PHP",
"flavor": "PHP7",
"flavor": "PHP8",
"orm": "Full",
"platform": "workerman",
"webserver": "none",
Expand All @@ -179,6 +179,29 @@
"notes": "",
"versus": "php"
},
"workerman-raw": {
"json_url": "/Json_",
"plaintext_url": "/Plaintext_",
"db_url": "/DbRaw",
"query_url": "/DbRaw/query/",
"fortune_url": "/FortunesRaw",
"update_url": "/DbRaw/update/",
"port": 8080,
"approach": "Realistic",
"classification": "Fullstack",
"database": "Postgres",
"framework": "Ubiquity",
"language": "PHP",
"flavor": "PHP8",
"orm": "raw",
"platform": "workerman",
"webserver": "none",
"os": "Linux",
"database_os": "Linux",
"display_name": "ubiquity-workerman-raw",
"notes": "",
"versus": "workerman"
},
"ngx": {
"json_url": "/Json_",
"plaintext_url": "/Plaintext_",
Expand Down
2 changes: 1 addition & 1 deletion frameworks/PHP/ubiquity/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"require-dev" : {
"monolog/monolog" : "^1.24",
"mindplay/annotations" : "^1.3"
"phpmv/ubiquity-annotations" : "^0.0"
},
"autoload" : {
"psr-4" : {
Expand Down
19 changes: 17 additions & 2 deletions frameworks/PHP/ubiquity/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ webserver = "nginx"
versus = "ngx_php"

[workerman]
urls.plaintext = "/Plaintext_"
urls.json = "/Json_"
urls.db = "/Db_"
urls.query = "/Db_/query/"
urls.update = "/Db_/update/"
Expand Down Expand Up @@ -132,6 +130,23 @@ platform = "workerman"
webserver = "none"
versus = "php"

[workerman-raw]
urls.plaintext = "/Plaintext_"
urls.json = "/Json_"
urls.db = "/DbRaw"
urls.query = "/DbRaw/query/"
urls.update = "/DbRaw/update/"
urls.fortune = "/FortunesRaw"
approach = "Realistic"
classification = "Fullstack"
database = "Postgres"
database_os = "Linux"
os = "Linux"
orm = "raw"
platform = "workerman"
webserver = "none"
versus = "php"

[swoole-mysql]
urls.db = "/DbMy"
urls.query = "/DbMy/query/"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
\Ubiquity\cache\CacheManager::startProd($config);

\Ubiquity\cache\CacheManager::warmUpControllers([
\controllers\Plaintext_::class,
\controllers\Json_::class,
\controllers\DbRaw::class,
\controllers\FortunesRaw::class
]);

$workerServer->onWorkerStart = function () use ($config) {
$db = \Ubiquity\db\Database::start('pgsql', $config);
\controllers\DbRaw::warmup($db);
\controllers\FortunesRaw::warmup($db);
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
echo "End Loading\n";

\Ubiquity\cache\CacheManager::warmUpControllers([
\controllers\Plaintext_::class,
\controllers\Json_::class,
\controllers\Db_::class,
\controllers\Fortunes_::class,
\controllers\Cache::class
Expand All @@ -25,4 +23,3 @@
\controllers\Db_::warmup();
\controllers\Fortunes_::warmup();
};

14 changes: 7 additions & 7 deletions frameworks/PHP/ubiquity/ubiquity-workerman-mongo.dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@

FROM ubuntu:20.04
FROM ubuntu:20.10

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 php7.4 php7.4-common php7.4-cli php7.4-mongodb > /dev/null
apt-get install -yqq git php8.0-cli php8.0-mongodb php8.0-xml > /dev/null

RUN apt-get install -yqq composer > /dev/null

RUN apt-get install -y php-pear php-dev libevent-dev > /dev/null
RUN apt-get install -y php-pear php8.0-dev libevent-dev > /dev/null
RUN pecl install event-3.0.2 > /dev/null && echo "extension=event.so" > /etc/php/8.0/cli/conf.d/event.ini

RUN printf "\n\n /usr/lib/x86_64-linux-gnu/\n\n\nno\n\n\n" | pecl install event > /dev/null && echo "extension=event.so" > /etc/php/7.4/cli/conf.d/event.ini

COPY deploy/conf/php-async.ini /etc/php/7.4/cli/php.ini
COPY deploy/conf/php-async.ini /etc/php/8.0/cli/php.ini

ADD ./ /ubiquity

Expand All @@ -37,7 +36,8 @@ RUN chmod 777 -R /ubiquity/.ubiquity/*

COPY deploy/conf/workerman/mongo/workerServices.php app/config/workerServices.php

RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/7.4/cli/php.ini
RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/8.0/cli/php.ini
RUN echo "opcache.jit_buffer_size=128M\nopcache.jit=tracing\n" >> /etc/php/8.0/cli/php.ini

EXPOSE 8080

Expand Down
14 changes: 7 additions & 7 deletions frameworks/PHP/ubiquity/ubiquity-workerman-mysql.dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

FROM ubuntu:20.04
FROM ubuntu:20.10

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 php7.4 php7.4-common php7.4-cli php7.4-mysql > /dev/null
apt-get install -yqq git php8.0-cli php8.0-mysql php8.0-xml > /dev/null

RUN apt-get install -yqq composer > /dev/null

RUN apt-get install -y php-pear php-dev libevent-dev > /dev/null
RUN printf "\n\n /usr/lib/x86_64-linux-gnu/\n\n\nno\n\n\n" | pecl install event > /dev/null && echo "extension=event.so" > /etc/php/7.4/cli/conf.d/event.ini
RUN apt-get install -y php-pear php8.0-dev libevent-dev > /dev/null
RUN pecl install event-3.0.2 > /dev/null && echo "extension=event.so" > /etc/php/8.0/cli/conf.d/event.ini

COPY deploy/conf/php-async.ini /etc/php/7.4/cli/php.ini
COPY deploy/conf/php-async.ini /etc/php/8.0/cli/php.ini

ADD ./ /ubiquity
WORKDIR /ubiquity
Expand All @@ -35,7 +34,8 @@ RUN chmod 777 -R /ubiquity/.ubiquity/*

COPY deploy/conf/workerman/mysql/workerServices.php app/config/workerServices.php

RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/7.4/cli/php.ini
RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/8.0/cli/php.ini
RUN echo "opcache.jit_buffer_size=128M\nopcache.jit=tracing\n" >> /etc/php/8.0/cli/php.ini

EXPOSE 8080

Expand Down
43 changes: 43 additions & 0 deletions frameworks/PHP/ubiquity/ubiquity-workerman-raw.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

FROM ubuntu:20.10

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 php8.0-cli php8.0-pgsql php8.0-xml > /dev/null

RUN apt-get install -yqq composer > /dev/null

RUN apt-get install -y php-pear php8.0-dev libevent-dev > /dev/null
RUN pecl install event-3.0.2 > /dev/null && echo "extension=event.so" > /etc/php/8.0/cli/conf.d/event.ini

COPY deploy/conf/php-async.ini /etc/php/8.0/cli/php.ini

ADD ./ /ubiquity
WORKDIR /ubiquity

RUN chmod -R 777 /ubiquity

RUN ["chmod", "+x", "deploy/run/install-composer.sh"]

RUN deploy/run/install-composer.sh

RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq git unzip > /dev/null

RUN php composer.phar require phpmv/ubiquity-devtools:dev-master phpmv/ubiquity-workerman:dev-master --quiet

RUN php composer.phar install --optimize-autoloader --classmap-authoritative --no-dev --quiet

RUN chmod 777 -R /ubiquity/.ubiquity/*

COPY deploy/conf/workerman/pgsql/raw/workerServices.php app/config/workerServices.php

RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php\n" >> /etc/php/8.0/cli/php.ini
RUN echo "opcache.jit_buffer_size=128M\nopcache.jit=tracing\n" >> /etc/php/8.0/cli/php.ini

EXPOSE 8080

CMD /ubiquity/vendor/bin/Ubiquity serve -t=workerman -p=8080 -h=0.0.0.0
13 changes: 7 additions & 6 deletions frameworks/PHP/ubiquity/ubiquity-workerman.dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

FROM ubuntu:20.04
FROM ubuntu:20.10

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 php7.4 php7.4-common php7.4-cli php7.4-pgsql > /dev/null
apt-get install -yqq git php8.0-cli php8.0-pgsql php8.0-xml > /dev/null

RUN apt-get install -yqq composer > /dev/null

RUN apt-get install -y php-pear php-dev libevent-dev > /dev/null
RUN printf "\n\n /usr/lib/x86_64-linux-gnu/\n\n\nno\n\n\n" | pecl install event > /dev/null && echo "extension=event.so" > /etc/php/7.4/cli/conf.d/event.ini
RUN apt-get install -y php-pear php8.0-dev libevent-dev > /dev/null
RUN pecl install event-3.0.2 > /dev/null && echo "extension=event.so" > /etc/php/8.0/cli/conf.d/event.ini

COPY deploy/conf/php-async.ini /etc/php/7.4/cli/php.ini
COPY deploy/conf/php-async.ini /etc/php/8.0/cli/php.ini

ADD ./ /ubiquity
WORKDIR /ubiquity
Expand All @@ -35,7 +35,8 @@ RUN chmod 777 -R /ubiquity/.ubiquity/*

COPY deploy/conf/workerman/pgsql/workerServices.php app/config/workerServices.php

RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php" >> /etc/php/7.4/cli/php.ini
RUN echo "opcache.preload=/ubiquity/app/config/preloader.script.php\n" >> /etc/php/8.0/cli/php.ini
RUN echo "opcache.jit_buffer_size=128M\nopcache.jit=function\n" >> /etc/php/8.0/cli/php.ini

EXPOSE 8080

Expand Down