Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2016-08-05 18:17:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2016-07-20 09:29:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2016-08-05 18:17:33.000000000 +0200 @@ -1,0 +2,11 @@ +Tue Aug 2 05:33:41 UTC 2016 - co...@suse.com + +- updated to 7.01 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.01 2016-08-01 + - Improved support for systemd. + - Fixed a bug in Mojo::Server::Prefork where PID files would not contain a + newline character. + +------------------------------------------------------------------- Old: ---- Mojolicious-7.0.tar.gz New: ---- Mojolicious-7.01.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.xIRAjO/_old 2016-08-05 18:17:34.000000000 +0200 +++ /var/tmp/diff_new_pack.xIRAjO/_new 2016-08-05 18:17:34.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 7.0 +Version: 7.01 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-7.0.tar.gz -> Mojolicious-7.01.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/Changes new/Mojolicious-7.01/Changes --- old/Mojolicious-7.0/Changes 2016-07-19 01:28:43.000000000 +0200 +++ new/Mojolicious-7.01/Changes 2016-08-01 02:05:11.000000000 +0200 @@ -1,4 +1,9 @@ +7.01 2016-08-01 + - Improved support for systemd. + - Fixed a bug in Mojo::Server::Prefork where PID files would not contain a + newline character. + 7.0 2016-07-19 - Code name "Doughnut", this is a major release. - Removed Mojolicious::Plugin::Charset. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/META.json new/Mojolicious-7.01/META.json --- old/Mojolicious-7.0/META.json 2016-07-19 01:28:56.000000000 +0200 +++ new/Mojolicious-7.01/META.json 2016-08-01 20:45:57.000000000 +0200 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.0", + "version" : "7.01", "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/META.yml new/Mojolicious-7.01/META.yml --- old/Mojolicious-7.0/META.yml 2016-07-19 01:28:56.000000000 +0200 +++ new/Mojolicious-7.01/META.yml 2016-08-01 20:45:57.000000000 +0200 @@ -31,5 +31,5 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '7.0' +version: '7.01' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/README.md new/Mojolicious-7.01/README.md --- old/Mojolicious-7.0/README.md 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/README.md 2016-08-01 02:04:20.000000000 +0200 @@ -24,7 +24,7 @@ SNI, IDNA, HTTP/SOCKS5 proxy, Comet (long polling), keep-alive, connection pooling, timeout, cookie, multipart, and gzip compression support. * Built-in non-blocking I/O web server, supporting multiple event loops as - well as optional preforking and hot deployment, perfect for building + well as optional pre-forking and hot deployment, perfect for building highly scalable web services. * JSON and HTML/XML parser with CSS selector support. * Very clean, portable and object-oriented pure-Perl API with no hidden diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojo/Content.pm new/Mojolicious-7.01/lib/Mojo/Content.pm --- old/Mojolicious-7.0/lib/Mojo/Content.pm 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojo/Content.pm 2016-07-21 22:36:32.000000000 +0200 @@ -484,7 +484,7 @@ my $bool = $content->is_chunked; -Check if C<Transfer-Encoding> header indicates chunked tranfer encoding. +Check if C<Transfer-Encoding> header indicates chunked transfer encoding. =head2 is_compressed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojo/Server/Hypnotoad.pm new/Mojolicious-7.01/lib/Mojo/Server/Hypnotoad.pm --- old/Mojolicious-7.0/lib/Mojo/Server/Hypnotoad.pm 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojo/Server/Hypnotoad.pm 2016-08-01 02:01:37.000000000 +0200 @@ -22,7 +22,7 @@ my $c = $prefork->app->config($name) || {}; $self->upgrade_timeout($c->{upgrade_timeout}) if $c->{upgrade_timeout}; - # Prefork settings + # Pre-fork settings $prefork->reverse_proxy($c->{proxy}) if defined $c->{proxy}; $prefork->max_clients($c->{clients}) if $c->{clients}; $prefork->max_requests($c->{requests}) if $c->{requests}; @@ -56,7 +56,7 @@ weaken $self; $prefork->on(wait => sub { $self->_manage }); $prefork->on(reap => sub { $self->_cleanup(pop) }); - $prefork->on(finish => sub { $self->{finished} = 1 }); + $prefork->on(finish => sub { $self->_finish }); # Testing _exit('Everything looks good!') if $ENV{HYPNOTOAD_TEST}; @@ -87,6 +87,17 @@ sub _exit { say shift and exit 0 } +sub _finish { + my $self = shift; + + $self->{finish} = 1; + return unless my $new = $self->{new}; + + my $prefork = $self->prefork->cleanup(0); + unlink $prefork->pid_file; + $prefork->ensure_pid_file($new); +} + sub _hot_deploy { # Make sure server is running @@ -150,7 +161,7 @@ =head1 DESCRIPTION -L<Mojo::Server::Hypnotoad> is a full featured, UNIX optimized, preforking +L<Mojo::Server::Hypnotoad> is a full featured, UNIX optimized, pre-forking non-blocking I/O HTTP and WebSocket server, built around the very well tested and reliable L<Mojo::Server::Prefork>, with IPv6, TLS, SNI, Comet (long polling), keep-alive, multiple event loop and hot deployment support that just diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojo/Server/Prefork.pm new/Mojolicious-7.01/lib/Mojo/Server/Prefork.pm --- old/Mojolicious-7.0/lib/Mojo/Server/Prefork.pm 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojo/Server/Prefork.pm 2016-08-01 02:02:21.000000000 +0200 @@ -14,15 +14,7 @@ has pid_file => sub { catfile tmpdir, 'prefork.pid' }; has workers => 4; -sub DESTROY { - my $self = shift; - - # Worker - return unless $self->cleanup; - - # Manager - if (my $file = $self->pid_file) { unlink $file if -w $file } -} +sub DESTROY { unlink $_[0]->pid_file if $_[0]->cleanup } sub check_pid { my $file = shift->pid_file; @@ -34,12 +26,12 @@ return $pid if $pid && kill 0, $pid; # Not running - unlink $file if -w $file; + unlink $file; return undef; } sub ensure_pid_file { - my $self = shift; + my ($self, $pid) = @_; # Check if PID file already exists return if -e (my $file = $self->pid_file); @@ -50,7 +42,7 @@ unless open my $handle, '>', $file; $self->app->log->info(qq{Creating process id file "$file"}); chmod 0644, $handle; - print $handle $$; + print $handle "$pid\n"; } sub healthy { @@ -61,7 +53,7 @@ my $self = shift; # No fork emulation support - say 'Preforking does not support fork emulation.' and exit 0 + say 'Pre-forking does not support fork emulation.' and exit 0 if $Config{d_pseudofork}; # Pipe for worker communication @@ -99,7 +91,7 @@ # Spawn more workers if necessary and check PID file if (!$self->{finished}) { $self->_spawn while keys %{$self->{pool}} < $self->workers; - $self->ensure_pid_file; + $self->ensure_pid_file($$); } # Shutdown @@ -203,7 +195,7 @@ =head1 NAME -Mojo::Server::Prefork - Preforking non-blocking I/O HTTP and WebSocket server +Mojo::Server::Prefork - Pre-forking non-blocking I/O HTTP and WebSocket server =head1 SYNOPSIS @@ -229,7 +221,7 @@ =head1 DESCRIPTION -L<Mojo::Server::Prefork> is a full featured, UNIX optimized, preforking +L<Mojo::Server::Prefork> is a full featured, UNIX optimized, pre-forking non-blocking I/O HTTP and WebSocket server, built around the very well tested and reliable L<Mojo::Server::Daemon>, with IPv6, TLS, SNI, Comet (long polling), keep-alive and multiple event loop support. Note that the server uses signals @@ -432,7 +424,7 @@ =head2 ensure_pid_file - $prefork->ensure_pid_file; + $prefork->ensure_pid_file($pid); Ensure L</"pid_file"> exists. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojo/UserAgent/Transactor.pm new/Mojolicious-7.01/lib/Mojo/UserAgent/Transactor.pm --- old/Mojolicious-7.0/lib/Mojo/UserAgent/Transactor.pm 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojo/UserAgent/Transactor.pm 2016-07-26 00:26:00.000000000 +0200 @@ -97,14 +97,13 @@ } sub tx { - my $self = shift; + my ($self, $method, $url) = (shift, shift, shift); # Method and URL my $tx = Mojo::Transaction::HTTP->new; - my $req = $tx->req->method(shift); - my $url = shift; - $url = "http://$url" unless $url =~ m!^/|://!; - ref $url ? $req->url($url) : $req->url->parse($url); + my $req = $tx->req->method($method); + if (ref $url) { $req->url($url) } + else { $req->url->parse($url =~ m!^/|://! ? $url : "http://$url") } # Headers (we identify ourselves and accept gzip compression) my $headers = $req->headers; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojolicious/Command/prefork.pm new/Mojolicious-7.01/lib/Mojolicious/Command/prefork.pm --- old/Mojolicious-7.0/lib/Mojolicious/Command/prefork.pm 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojolicious/Command/prefork.pm 2016-08-01 02:03:01.000000000 +0200 @@ -5,7 +5,7 @@ use Mojo::Server::Prefork; has description => - 'Start application with preforking HTTP and WebSocket server'; + 'Start application with pre-forking HTTP and WebSocket server'; has usage => sub { shift->extract_usage }; sub run { @@ -36,7 +36,7 @@ =head1 NAME -Mojolicious::Command::prefork - Prefork command +Mojolicious::Command::prefork - Pre-fork command =head1 SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojolicious/Commands.pm new/Mojolicious-7.01/lib/Mojolicious/Commands.pm --- old/Mojolicious-7.0/lib/Mojolicious/Commands.pm 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojolicious/Commands.pm 2016-08-01 02:03:26.000000000 +0200 @@ -233,7 +233,7 @@ $ ./myapp.pl prefork Use L<Mojolicious::Command::prefork> to start application with standalone -preforking HTTP and WebSocket server. +pre-forking HTTP and WebSocket server. =head2 psgi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojolicious/Guides/Cookbook.pod new/Mojolicious-7.01/lib/Mojolicious/Guides/Cookbook.pod --- old/Mojolicious-7.0/lib/Mojolicious/Guides/Cookbook.pod 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojolicious/Guides/Cookbook.pod 2016-08-01 02:03:56.000000000 +0200 @@ -42,9 +42,25 @@ $ ./script/my_app daemon -l https://[::]:3000 Server available at https://[::]:3000 -On UNIX platforms you can also add preforking and switch to a multi-process -architecture with L<Mojolicious::Command::prefork>, to take advantage of -multiple CPU cores and copy-on-write memory management. +To manage the web server with systemd, you can use a unit configuration file +like this. + + [Unit] + Description=My Mojolicious application + After=network.target + + [Service] + Type=simple + ExecStart=/home/sri/myapp/script/my_app daemon -m production -l http://*:8080 + + [Install] + WantedBy=multi-user.target + +=head2 Pre-forking + +On UNIX platforms you can also add pre-forking to the built-in web server and +switch to a multi-process architecture with L<Mojolicious::Command::prefork>, to +take advantage of multiple CPU cores and copy-on-write memory management. $ ./script/my_app prefork Server available at http://127.0.0.1:3000 @@ -72,6 +88,21 @@ app->start; +And to manage the pre-forking web server with systemd, you can use a unit +configuration file like this. + + [Unit] + Description=My Mojolicious application + After=network.target + + [Service] + Type=simple + ExecStart=/home/sri/myapp/script/my_app prefork -m production -l http://*:8080 + KillMode=process + + [Install] + WantedBy=multi-user.target + =head2 Morbo After reading the L<Mojolicious::Guides::Tutorial>, you should already be @@ -90,7 +121,7 @@ =head2 Hypnotoad -For bigger applications L<Mojolicious> contains the UNIX optimized preforking +For bigger applications L<Mojolicious> contains the UNIX optimized pre-forking web server L<Mojo::Server::Hypnotoad>, which can take advantage of multiple CPU cores and copy-on-write memory management to scale up to thousands of concurrent client connections. @@ -101,7 +132,7 @@ |- Mojo::Server::Daemon [3] +- Mojo::Server::Daemon [4] -It is based on the L<Mojo::Server::Prefork> web server, which adds preforking +It is based on the L<Mojo::Server::Prefork> web server, which adds pre-forking to L<Mojo::Server::Daemon>, but optimized specifically for production environments out of the box. To start applications with it you can use the L<hypnotoad> script, which listens on port C<8080>, automatically daemonizes @@ -148,6 +179,23 @@ # myapp.conf {hypnotoad => {proxy => 1}}; +To manage Hypnotoad with systemd, you can use a unit configuration file like +this. + + [Unit] + Description=My Mojolicious application + After=network.target + + [Service] + Type=forking + PIDFile=/home/sri/myapp/script/hypnotoad.pid + ExecStart=/path/to/hypnotoad /home/sri/myapp/script/my_app + ExecReload=/path/to/hypnotoad /home/sri/myapp/script/my_app + KillMode=process + + [Install] + WantedBy=multi-user.target + =head2 Zero downtime software upgrades Hypnotoad makes zero downtime software upgrades (hot deployment) very simple, @@ -218,7 +266,7 @@ production environments is discouraged though, because as a result of how C<CGI> works, it is very slow and many web servers are making it exceptionally hard to configure properly. Additionally, many real-time web features, such as -WebSockets, are not avilable. +WebSockets, are not available. ScriptAlias / /home/sri/my_app/script/my_app/ @@ -762,7 +810,7 @@ hook after_build_tx => sub { my $tx = shift; - # Subscribe to "upgrade" event to indentify multipart uploads + # Subscribe to "upgrade" event to identify multipart uploads weaken $tx; $tx->req->content->on(upgrade => sub { my ($single, $multi) = @_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojolicious/Guides/FAQ.pod new/Mojolicious-7.01/lib/Mojolicious/Guides/FAQ.pod --- old/Mojolicious-7.0/lib/Mojolicious/Guides/FAQ.pod 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojolicious/Guides/FAQ.pod 2016-08-01 02:04:12.000000000 +0200 @@ -252,7 +252,7 @@ =head2 What does "Worker 31842 has no heartbeat, restarting" mean? As long as they are accepting new connections, worker processes of all built-in -preforking web servers send heartbeat messages to the manager process at +pre-forking web servers send heartbeat messages to the manager process at regular intervals, to signal that they are still responsive. A blocking operation such as an infinite loop in your application can prevent this, and will force the affected worker to be restarted after a timeout. This timeout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/lib/Mojolicious.pm new/Mojolicious-7.01/lib/Mojolicious.pm --- old/Mojolicious-7.0/lib/Mojolicious.pm 2016-07-19 01:28:43.000000000 +0200 +++ new/Mojolicious-7.01/lib/Mojolicious.pm 2016-07-31 18:57:15.000000000 +0200 @@ -43,7 +43,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.0'; +our $VERSION = '7.01'; sub AUTOLOAD { my $self = shift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/t/mojo/hypnotoad.t new/Mojolicious-7.01/t/mojo/hypnotoad.t --- old/Mojolicious-7.0/t/mojo/hypnotoad.t 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/t/mojo/hypnotoad.t 2016-07-30 17:37:32.000000000 +0200 @@ -121,6 +121,38 @@ is $tx->res->code, 200, 'right status'; is $tx->res->body, 'Hello Hypnotoad!', 'right content'; +# Update script (broken) +spurt <<'EOF', $script; +use Mojolicious::Lite; + +die if $ENV{HYPNOTOAD_PID}; + +app->start; +EOF +open my $hot_deploy, '-|', $^X, "$prefix/hypnotoad", $script; + +# Connection did not get lost +$tx = $ua->get("http://127.0.0.1:$port1/hello"); +ok $tx->is_finished, 'transaction is finished'; +ok $tx->keep_alive, 'connection will be kept alive'; +ok $tx->kept_alive, 'connection was kept alive'; +is $tx->res->code, 200, 'right status'; +is $tx->res->body, 'Hello Hypnotoad!', 'right content'; + +# Connection did not get lost (second port) +$tx = $ua->get("http://127.0.0.1:$port2/hello"); +ok $tx->is_finished, 'transaction is finished'; +ok $tx->keep_alive, 'connection will be kept alive'; +ok $tx->kept_alive, 'connection was kept alive'; +is $tx->res->code, 200, 'right status'; +is $tx->res->body, 'Hello Hypnotoad!', 'right content'; + +# Wait for hot deployment to fail +while (1) { + last if slurp($log) =~ qr/Zero downtime software upgrade failed/; + sleep 1; +} + # Update script spurt <<EOF, $script; use Mojolicious::Lite; @@ -145,7 +177,7 @@ app->start; EOF -open my $hot_deploy, '-|', $^X, "$prefix/hypnotoad", $script; +open $hot_deploy, '-|', $^X, "$prefix/hypnotoad", $script; # Connection did not get lost $tx = $ua->get("http://127.0.0.1:$port1/hello"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.0/t/mojo/prefork.t new/Mojolicious-7.01/t/mojo/prefork.t --- old/Mojolicious-7.0/t/mojo/prefork.t 2016-07-18 23:50:04.000000000 +0200 +++ new/Mojolicious-7.01/t/mojo/prefork.t 2016-07-29 23:16:29.000000000 +0200 @@ -12,18 +12,20 @@ use Mojo::IOLoop::Server; use Mojo::Server::Prefork; use Mojo::UserAgent; -use Mojo::Util 'spurt'; +use Mojo::Util 'slurp'; # Manage and clean up PID file my $prefork = Mojo::Server::Prefork->new; my $file = $prefork->pid_file; ok !$prefork->check_pid, 'no process id'; -spurt "\n", $file; +$prefork->ensure_pid_file(-23); ok -e $file, 'file exists'; +is slurp($file), "-23\n", 'right process id'; ok !$prefork->check_pid, 'no process id'; ok !-e $file, 'file has been cleaned up'; -$prefork->ensure_pid_file; +$prefork->ensure_pid_file($$); ok -e $file, 'file exists'; +is slurp($file), "$$\n", 'right process id'; is $prefork->check_pid, $$, 'right process id'; undef $prefork; ok !-e $file, 'file has been cleaned up'; @@ -34,7 +36,7 @@ $prefork->app->log->level('fatal'); my $log = ''; my $cb = $prefork->app->log->on(message => sub { $log .= pop }); -eval { $prefork->ensure_pid_file }; +eval { $prefork->ensure_pid_file($$) }; like $@, qr/Can't create process id file/, 'right error'; unlike $log, qr/Creating process id file/, 'right message'; like $log, qr/Can't create process id file/, 'right message';