Re: [Mojolicious] Reverse Proxy

2019-09-09 Thread Илья Рассадин
Hi! Reverse proxy (such as Nginx) can proxy different requests to the 
different apps based on different params.


For example, you have an application doing auth and application doing 
something only for the authorized users. So domain auth.app.com could be 
proxied to auth app and domain internal.app.com to the second app.


You can do it based on whatever nginx supports - host, location, some 
get args or header in request and so on.


On 10/09/2019 09:16, Stefan Adams wrote:
From the Cookbook#Reverse Proxy 
: 



/[A reverse proxy] can provide a lot of benefits, like terminating
SSL connections from the outside, limiting the number of
concurrent open sockets towards the Mojolicious application (or
even using Unix sockets), balancing load across multiple
instances, *or supporting several applications through the same
IP/port*./


What steps are necessary to support several applications through the 
same IP/port?


I'm picturing having two separate Mojolicious applications running in 
two separate system processes, each with their own Perl binary even.  
What is necessary to reverse proxy a connection to these two separate 
apps listening on the same IP/port?  How does the reverse proxy 
(nginx) know which process should get the request proxied to it?


Or am I misunderstanding what is stated in bold above?
--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFSkT_YXpnUbakT%3DO%2Bi1y99vVxpg8rVo%3D8V33LUtLhNfPQ%40mail.gmail.com 
.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/3878db06-79f7-9958-13f2-93714714849b%40gmail.com.


Re: [Mojolicious] Mojo::UserAgent installed successfully but gives while coding

2019-06-02 Thread Илья Рассадин
My guess is you installed Mojolicious into perlbrew library path, but 
running program with system perl.


For example, you have this shebang line (first line in script)

#!/usr/bin/perl

You need to change it to perlbrew perl. I guess, the right way to do it 
is line


#!/usr/bin/env perl

Read this perlbrew article for details how and why it works 
https://perlbrew.pl/Dealing-with-shebangs.html


On 02/06/2019 15:50, Tanya Sahni wrote:

Hi

This is a new information for me.. I have done installation using cpanm 
although now I completely confused that my program is using which perl. And I 
do have perlbrew folder , sorry for not being so informative about the 
situation I am newbie to perl. I tried various attempts to install Mojolicious 
and one was also adding “requires Mojolicious” in the cpanfile file.

It would be great help if you could help me know how to differentiate between 
the perl I am using for my code ? is it using System perl or my installed perl 
? What’s the difference using cpanm or other way affects these perl?



--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/4a616b2c-1874-282b-da3d-cf8731e8ed7c%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Mojo::UserAgent installed successfully but gives while coding

2019-06-02 Thread Илья Рассадин

Hi!

How did you install Mojolicious exactly? With cpanm, with git or some 
other way?


Do you use system perl bundled with MacOSX, or do you install your own 
version with plenv/perlbrew?


See this article for details 
https://www.effectiveperlprogramming.com/2015/11/apple-recommends-installing-your-own-perl/



On 02/06/2019 14:43, Tanya Sahni wrote:
But when I type only this line of code"use Mojo::UserAgent" it gives 
following error:


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/5422152d-cedf-9a97-ad74-7edcfc5db7ef%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Sharing memory amongst hypnotoad workers

2019-05-15 Thread Илья Рассадин

Hi!

As you said, you can use any type of external database.

If you're looking for something more simple - try Cache::FastMMap.

The only way to do that without external modules (just perl core + 
Mojolicious) I can think of is a file, but you need to use some locking 
mechanism like flock.


If you can use external modules - it's better to do that. If you need 
persistent storage - using external database like Redis is probably the 
most appropriate solution.


On 16/05/2019 09:24, Veesh Goldman wrote:
What are my options if I need all of my workers to share some bit of 
dynamic data? Let's say there's some counter that needs to be 
incremented every time something happens, but is only relevant while 
the app is running. Do I need to use a DB for that, or Redis or 
memcached, or is there something built in to help with that.
I'm assuming that the memory isn't shared because the process forks to 
make the workers.

Thanks
--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/CAO-W_8CrrP-DXxPP_TXxP7wf-dQY1e7nezqSgFHe8BTo6_853Q%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/ad4f971b-9cc8-1cd6-f101-e0c63fadc672%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Mojo::SQLite && foreign keys support ?

2019-05-08 Thread Илья Рассадин

To clarify Dan's answer about state variables (mostly, for myself).

If you run separate apps in the same process like these.

my $app1 = Test::Mojo->new('MyApp')->app;

my $app2 = Test::Mojo->new('MyApp')->app;

# now $app1->sqlite and $app2->sqlite is the same state variable.

You got two apps in the same process and they share the same state variable.

On 09/05/2019 07:01, Dan Book wrote:
A lexical variable is still bound to a scope, even if it's the file 
scope. If that scope is run again (such as creating another instance 
of the same application) then that will have a separate instance of 
that lexical variable. State variables are initialized once and shared 
between any access for the rest of that process. It can't know what 
outer scope you might have wanted to store it in. It can still be 
useful but you have to make sure that's what you want.


-Dan

On Wed, May 8, 2019 at 11:45 PM Veesh Goldman > wrote:




On Wed, May 8, 2019, 5:55 PM Dan Book mailto:gri...@gmail.com>> wrote:


Alternatively you can use 'state $sqlite = ' inside the helper
but this approach breaks the ability to run multiple separate
apps in the same process, because it will make one $sqlite per
whole process.

-Dan



Could you expound on this problem? I thought state is just a
shortcut to closing over a lexical variable.
-- 
You received this message because you are subscribed to the Google

Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to mojolicious+unsubscr...@googlegroups.com
.
To post to this group, send email to mojolicious@googlegroups.com
.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit

https://groups.google.com/d/msgid/mojolicious/CAO-W_8CVM9NnBMXuyvHi_FCT7p8%2B11FxTn6it9%3D%3D2JpUr78nfw%40mail.gmail.com

.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/CABMkAVUWJc-rYw4DhThw9YGcp7OdCh3d0djXRoPLpRkq-vESZg%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/e9a40bd8-f099-b2b1-d578-41a22e2b7371%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Set correct rights to unix socket with Mojo::Server::Daemon

2019-05-01 Thread Илья Рассадин

Thanks for your advice.

But

1) It's requirement from my devops collegue and I need to achieve it 
somehow. Just tell "some people think that your approach is wrong and 
insecure" is not a valid solution in my case.


2) Other apps (like php-fpm) allows to set up socket rights, as well as 
socket user and groups via config file. Hypnotoad (and other mojo 
daemons) has no such options, at least I'm not aware of them. Instead, 
hypnotoad relies on user umask.


I think (though most likely mistaken), this option should be available 
to mojo daemons. If a process runs from root, then it should be able to 
create socket, change permissions according to configuration (or safe 
default) and then fork children with another user permissions and from 
that moment relies on user umask.


Is there any thoughts from Mojolicious core team about it?

On 01/05/2019 05:43, Charlie Brady wrote:

IMO you *never* want to use 777. Use user or group id of the socket file
to control whether nginx can write to it.

On Wed, 24 Apr 2019, �~Xл�~L�~O Ра�~A�~Aадин wrote:


Hi!

I want to run my mojo app with hypnotoad listening on unix socket. conf file
looks like this

{

  ...

     hypnotoad => {
     listen  => ['http+unix://%2Ftmp%2Fmy_app.sock'],
     workers => 2,
     proxy => 1,
     },

}

And then file /tmp/my_app.sock has 755 rights (according to user umask).

But I need to change it to 777 to allow nginx to write queries to socket.

Is there a proper recommended way to achieve that goal?

--

Best Regards, Ilya 'elcamlost' Rassadin.



--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Set correct rights to unix socket with Mojo::Server::Daemon

2019-04-26 Thread Илья Рассадин

Hi!

I want to run my mojo app with hypnotoad listening on unix socket. conf 
file looks like this


{

 ...

    hypnotoad => {
    listen  => ['http+unix://%2Ftmp%2Fmy_app.sock'],
    workers => 2,
    proxy => 1,
    },

}

And then file /tmp/my_app.sock has 755 rights (according to user umask).

But I need to change it to 777 to allow nginx to write queries to socket.

Is there a proper recommended way to achieve that goal?

--

Best Regards, Ilya 'elcamlost' Rassadin.

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] MUA::Transactor::add_generator

2019-03-12 Thread Илья Рассадин

Hi!

name "add_generator" leads me to the idea, that there can be more than 
one aws sign generators. apply_generator or set_generator makes it 
clear, that there can be only one.


And by the way, why don't you encapsulate generator logic inside role 
AWSSign role?


So, code could be something like

my $ua = Mojo::UserAgent->with_roles('+AWSSign')->new(max_redirects => 5);

my $tx = $ua->build_tx(...);

On 13/03/2019 01:18, Stefan Adams wrote:
Thanks, Dan!  I updated the gist 
 
with your recommendation, and my new synopsis is this:


Mojo::AWS::Signature4->add_generator($ua => 'sign');
my $tx = $ua->build_tx(GET => '...' => sign => {service => 'ec2'});


Does add_generator feel like the right method name for this?  Maybe 
apply_generator, instead?


On Tue, Mar 12, 2019 at 4:45 PM Dan Book > wrote:


That seems like the appropriate mechanism to me. If you want to
provide a convenience method, I would instead provide one that
takes the $ua object and an optional generator name, and calls
->add_generator itself. It would also be subclassable since it
could call a method on $self instead of __PACKAGE__.
-Dan

On Tue, Mar 12, 2019 at 5:22 PM Stefan Adams mailto:s1037...@gmail.com>> wrote:

I built a generator for AWS Signature4 requests
. 
This generator calculates a signed Authorization header for
the request.  Is this a good use of the Transactor generator
feature?

As you can see from L13


of the supplied test, I make my generator available this way:

$ua->transactor->add_generator(Mojo::AWS::Signature4::generator);


Is this the best mechanism available to share this generator,
or is there a recommended standard convention?  When I go to
document it for publishing, is that what I should have in the
synopsis section? It almost feels like there should be a
plugin mechanism for Mojo::UserAgent.

Thanks for any advice and comments you have!

Stefan
-- 
You received this message because you are subscribed to the

Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to mojolicious+unsubscr...@googlegroups.com
.
To post to this group, send email to
mojolicious@googlegroups.com
.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google

Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to mojolicious+unsubscr...@googlegroups.com
.
To post to this group, send email to mojolicious@googlegroups.com
.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: How to proper test minion job with Test::Mojo in smoke test

2019-01-14 Thread Илья Рассадин

Hi!

Solved my problem with mocking.

Now model has a sub, returning Mojo::Message::Response object.

And in test I mock this function to return special Response.

On 11/01/2019 20:39, Илья Рассадин wrote:

Hi! I faced an issue during cover my application with tests.

Prerequisites:

* I'm using docker-compose to run application and tests locally.
* I have main app and minion tasks.

One of app's features is to deal with goods and associated images.
Usually I read goods list and its metadata (including image urls) from 
external source (like rss feed).
Also app has (openapi) rest route, and I can post good object there to 
create entries in database and so on.

And I want to test this rest route.

Is good created? Is associated images succecfully parsed and saved? 
App uses minions for this tasks.


So in my test I want to post good object to rest endpoint, than 
perform minion jobs and than test that good entries in (test) database 
and images are ok.


Now the problem:

minion task parses original image and create several cropped and 
resized versions. To get original image task uses Mojo::UserAgent.
In my test I put images locally, save host_port part of Test::Mojo 
server url into env variable and later in minion task generate links 
to image from good metadata path and this env var. I expected, that 
Mojo::UserAgent can download image from Test::Mojo server, but it 
fails. Looks like it's bad idea and Test::Mojo is not working that way.


Probably I can do something similar to what i want with 
Test::Fake::HTTPD. But maybe there is a chance to do it in mojo way?


Any help would be appreciated.

--

Best Regards, Ilya Rassadin



--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] How to proper test minion job with Test::Mojo in smoke test

2019-01-11 Thread Илья Рассадин

Hi! I faced an issue during cover my application with tests.

Prerequisites:

* I'm using docker-compose to run application and tests locally.
* I have main app and minion tasks.

One of app's features is to deal with goods and associated images.
Usually I read goods list and its metadata (including image urls) from 
external source (like rss feed).
Also app has (openapi) rest route, and I can post good object there to 
create entries in database and so on.

And I want to test this rest route.

Is good created? Is associated images succecfully parsed and saved? App 
uses minions for this tasks.


So in my test I want to post good object to rest endpoint, than perform 
minion jobs and than test that good entries in (test) database and 
images are ok.


Now the problem:

minion task parses original image and create several cropped and resized 
versions. To get original image task uses Mojo::UserAgent.
In my test I put images locally, save host_port part of Test::Mojo 
server url into env variable and later in minion task generate links to 
image from good metadata path and this env var. I expected, that 
Mojo::UserAgent can download image from Test::Mojo server, but it fails. 
Looks like it's bad idea and Test::Mojo is not working that way.


Probably I can do something similar to what i want with 
Test::Fake::HTTPD. But maybe there is a chance to do it in mojo way?


Any help would be appreciated.

--

Best Regards, Ilya Rassadin

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Checking proxy information

2019-01-08 Thread Илья Рассадин

Hi!

Mojo::UserAgent has proxy attribute. You can set it up request, catch 
error and if error is related to proxy, set next proxy and retry request.


On 07/01/2019 12:42, Veesh Goldman wrote:

I'm working on a project that requires cycling through a list of proxies.

I've been trying to implement a feature that when a proxy fails to 
connect, it switches to the next one. The problem is that I can't 
figure out how to tell from a Mojo::Transaction which proxy was used 
by the useragent. Any help is appreciated.



--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Configuration override via Test::Mojo not being used

2018-09-27 Thread Илья Рассадин

Config overriding works only for full apps

#! /usr/bin/env perl use Mojo::Base-strict; use Test::More; use Test::Mojo; 
package Foo; use Mojo::Base'Mojolicious', -signatures; sub startup ($self) {
$self->plugin(Config => {default => {jack => 'squat'}}); 
$self->routes->get('/')->to('main#index'); }

package Foo::Controller::Main; use Mojo::Base'Mojolicious::Controller', -signatures; sub index 
($c) {$c->render(text => $c->app->config->{jack}) }

package main; my $t = Test::Mojo->new(Foo => {jack => 'flack'}); $t->get_ok('/')
  ->content_is('flack')
  ->or(sub {say STDERR$t->app->dumper(shift->tx->res->body) }); done_testing();

On 27/09/2018 18:14, Scott Wiersdorf wrote:

I should have added that I’m running 8.01.



--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] How do you generate a "Content-Length" header in a multipart request?

2018-09-18 Thread Илья Рассадин

Hi!

Please, provide a code example (with any paste service, like 
gist.github.com), so we can see how you  create request object and give 
you advice.



On 18/09/2018 19:50, Steve Dondley wrote:
I'm starting a new thread related to the previous one regarding making 
a batch api request to Google's API. I keep getting "Bad Reqeust" 
responses from Google after making a batch API call (other calls work 
fine).


Looking at the api documentation for batch api requests 
 it says each 
part of the multipart request should have a content length. Here is 
the example Google supplies:


POST /batch/farm/v1 HTTP/1.1
Authorization: Beareryour_auth_token
Host: www.googleapis.com
Content-Type: multipart/mixed; boundary=batch_foobarbaz
Content-Length:total_content_length

--batch_foobarbaz
Content-Type: application/http
Content-ID: 

GET /farm/v1/animals/pony

--batch_foobarbaz
Content-Type: application/http
Content-ID: 

PUT /farm/v1/animals/sheep
Content-Type: application/json
Content-Length:part_content_length
If-Match: "etag/sheep"

{
   "animalName": "sheep",
   "animalAge": "5"
   "peltColor": "green",
}

--batch_foobarbaz
Content-Type: application/http
Content-ID: 

GET /farm/v1/animals
If-None-Match: "etag/animals"

--batch_foobarbaz--


The requests I'm generating with mojolicious do not have the 
"part_content_length." Here's mine:


|
POST /batch/gmail/v1 HTTP/1.1
Authorization:BearerA_REAL_TOKEN_GOES_HERE
Host:www.googleapis.com
Accept-Encoding:gzip
Content-Length:120
User-Agent:Mojolicious(Perl)
Content-Type:multipart/mixed;boundary=nS2CX


--nS2CX
Content-Type:application/http


GET /gmail/v1/users/sdond...@gmail.com/messages/165eb111fcf21503
--nS2CX--

|


My question is, does Mojolicious provide a way to automatically 
generate a content length header for these parts? If not, which parts 
of the message get counted toward this length and how do I calculate 
it (assuming UTF-8)?


--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Re: List of All Optional Modules?

2018-09-09 Thread Илья Рассадин
I think, you can get the most complete list of optional deps with "mojo 
version" command.


Output should looks like this

CORE
  Perl    (v5.26.1, linux)
  Mojolicious (7.94, Doughnut)

OPTIONAL
  Cpanel::JSON::XS 4.04+  (4.06)
  EV 4.0+ (4.22)
  IO::Socket::Socks 0.64+ (n/a)
  IO::Socket::SSL 2.009+  (2.052)
  Net::DNS::Native 0.15+  (n/a)
  Role::Tiny 2.01+    (2.06)


But it should be the same as in FAQ.

On 09/09/2018 10:03, Viktor Nacht wrote:
Thank you very much for the reply and the link. I did already see 
that, but to a native English speaker, "such as" sounds like a sample 
list, not a complete list. If it is complete, that's awesome.


I agree with you about the cpanfile in the sense that it would be nice 
pass an env var or an arg via cpanm to include them all. Or maybe a 
command. Couple be a module that tracks with the main dist.


In any case I love Mojolicious and I'm thankful for all the hard work, 
and I like the way it thinks.


V

--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] List of All Optional Modules?

2018-09-08 Thread Илья Рассадин

Hi!

See 
https://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#Why-doesnt-Mojolicious-have-any-dependencies


And I was surprised that there is no cpanfile in project. Cpanfile 
recommends and suggests feature is a nice to way to declare such 
optional dependencies.


On 09/09/2018 03:00, Viktor Nacht wrote:
Is there a singular list of all of the optional/suggested/recommended 
modules for Mojolicious? I know they're listed in docs, but they 
(seem) to be split between the relevant guide/command/module. I'd like 
to include all of them as a kind of "complete" Mojolicious install.


I searched the Mojo docs, Google and this group. I apologize if that 
has been covered already.


V


--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Multiple SSL certs

2018-05-14 Thread Илья Рассадин

Hi!

Using Mojolicious as a proxy instead of Nginx looks like hammering nails 
with screwdriver. It's possible, but hammer is much more effective tool 
for the job.


If You can configure Nginx for this, just do it.

On 5/13/18 4:24 PM, Stefan Adams wrote:
I'm using Toadfarm to mount several apps into a single Mojolicious 
instance. Is it possible for Mojolicious to handle different certs for 
each of those mounted apps, or do I need to continue to run Nginx in 
front to handle that?


Can I use Mojolicious as an alternative to Nginx for being a proxy to 
apps behind a firewall?

--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Good namespace for personal plugin?

2018-05-08 Thread Илья Рассадин
If you sure that your modules has no value outside your projects, cpan 
is not right place to store them.


You could use darkpan to install your local modules, centralize updates 
and so on.


Such modules can be installed via cpanm/carton/carmel

See https://metacpan.org/pod/Carton#Specifying-a-CPAN-distribution



On 5/8/18 5:27 PM, John Scoles wrote:


In a word 'yes' it is a bad idea


http://prepan.org/



PrePAN - Social Reviewing for Perl Modules 
prepan.org
PrePAN provides a place to discuss your modules. Are there any similar 
ones? I'm not confident about the implementation... How can I 
distribute the module in keeping with CPAN's conventions?


is a good place to check such things.


Personal namespaces are to be avoided except where there are encouraged


Such as in Dist-Zilla plugin bundles


I might be acceptable to but all of you stuff in a top name-space like 
Mojolicious::Che or alike but then I dont' control it








*From:* mojolicious@googlegroups.com  on 
behalf of Luc Didry 

*Sent:* May 8, 2018 9:43 AM
*To:* Mojolicious
*Subject:* [Mojolicious] Good namespace for personal plugin?
Hello,

I have a few plugins that I wrote for my softwares and that I use
amongst different projects. They are not published on CPAN.

For now, I copy them in my projects and I have to update in my
differents projects each time they evolve.

A better way for that would be to publish them and update them from
CPAN.

1. Would it be an acceptable thing? (I don't want to pollute CPAN or
Mojolicious::Plugin namespace)
2. What would be a good namespace for those plugins? Would
Mojolicious::Plugin::XXX::NameOfThePlugin be OK? (with XXX something
personal)

Thanks for advices.
--
Luc
https://fiat-tux.fr/


Fiat Tux | Debian, GNU/Linux et geekeries en tout genre ... 


fiat-tux.fr
Le 14 juillet 2016, j’ai lancé mes pages Tipeee et Libe­ra­pay.. La 
récom­pense de base est l’ap­pa­ri­tion sur une page mensuelle de 
remer­cie­ments… voici celle de mars !




https://luc.frama.io/
Internet n'est pas compliqué, Internet est ce que vous en faites.

--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com.

To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious 
.
For more options, visit https://groups.google.com/d/optout 
.

--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Nordic Perl Workshop and Mojoconf in Oslo

2018-05-08 Thread Илья Рассадин

Hi!

Is english main language for the conference talks?

On 5/8/18 10:15 AM, Jan Henning Thorsen wrote:

Nordic Perl Workshop 2018 will be held in Oslo, 6 - 7 September, 2018.

The conference topic is “Perl in the cloud”, with focus on web 
development, and deployment methods. We are pleased to announce that 
we will have members from the Mojolicious core team attending and a 
track dedicated to the Mojolicious real-time web framework.


* You can get information about tickets 
here: http://oslo.pm/npw2018/tickets

* And submit your talk here: http://oslo.pm/npw2018/
* Follow the hashtag #mojoconf and/or #npw2018 on Twitter for 
updates. https://twitter.com/marcusramberg/status/993750724608774144



See you later this year!
--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Nginx Unit 1.0 released

2018-05-05 Thread Илья Рассадин

Hi!

Recently (month ago) the stable version of nginx unit application server 
was released https://www.nginx.com/blog/nginx-unit-1-0-released/


Did anyone try to launch Mojolicious with nginx unit? What do you think, 
is it worth trying to do it?




Best Regards.

Ilya Rassadin.

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Re: trying to catch a clic on a link

2018-02-19 Thread Илья Рассадин

Do you have any server dispatching requests before Mojolicious?

Nginx or Apache maybe?

On 2/19/18 7:51 PM, amka1...@gmail.com wrote:

app->hook(before_dispatch => sub {
  my $c = shift;
  print "Hi\n";
});

don't react for the links (to .../public folder).

Have you please another idea ?
--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Re: Basic HTTP auth and plugin "Directory"

2018-02-16 Thread Илья Рассадин

Hi!

Looks like basic_auth helper always return perl true value.

You need to use check_auth mehod instead with auth helper, or use 
basic_auth helper directly within controller.


But the most important question, why not to use apache or nginx directly 
to solve your problem?


On 2/16/18 5:33 PM, Luc Larochelle wrote:
I realized maybe I didn't express my need : I want users to access the 
files from the webpage a-la Apache. So the files and directories have 
to be displayed.





On Thursday, 15 February 2018 13:53:37 UTC-5, Luc Larochelle wrote:

Hi,

I've been working with the plugin 'Directory' to serve files on a
given path. This works as expected and is pretty straight forward.

However, I would like to limit access to the ressource with Basic
HTTP Authentication dialog from the web browser.  I can render
text "OK" if basic_auth meets the desired criterias but can't seem
to control the behavior of the plugin



I tried creating a auth helper and use it with the under directive
as shown below (among many other experiments, but this code seems
the most logic to me). Still, the plugin would render without
asking for authentication before.

Can you please help me achieve this ?


use Mojolicious::Lite;
plugin 'basic_auth_plus';

helper auth => sub {
  my $self = shift;
  return 1 if
     $self->basic_auth(
       "Realm Name" => {
                     username => 'username',
                     password => 'password'
                   }
                )
};


|under sub { my $self = shift; return 1 if $self->auth;
$self->render(text => 'denied'); return; };|

||

|get '/' {|

||plugin ('Directory', root=>"/my/path")->start;

}

--
You received this message because you are subscribed to the Google 
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to mojolicious+unsubscr...@googlegroups.com 
.
To post to this group, send email to mojolicious@googlegroups.com 
.

Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Migrations are always run inside transaction

2018-02-07 Thread Илья Рассадин

Hi!

On my new project I finally started using Mojo::Pg::Migrations but ran 
into a problem.


All migrations are wrapped within transactions. But some schema changes, 
such as enum type modifications can not be run inside transactions.


And code falls with message

DBD::Pg::st execute failed: ERROR:  ALTER TYPE ... ADD cannot run inside 
a transaction block at 
/path/to/project/local/lib/perl5/Mojo/Pg/Migrations.pm line 66


As I can see, for now there is no way to disable transaction for some 
migrations.


So, what do you think, is it a good feature?

Other frameworks, such as rails and laravel implemented this due to the 
same idea,


https://github.com/laravel/framework/pull/22757

https://github.com/rails/rails/pull/9507

--

Best regards

Ilya Rassadin.

--
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Excessive stop/start hypnotoad workers

2018-02-06 Thread Илья Рассадин
Looks like this is behaviour of a gracefull_timeout attribute of 
Mojo::Server::Hypnotoad
>From the docs 
https://metacpan.org/pod/Mojo::Server::Hypnotoad#graceful_timeout

Maximum amount of time in seconds stopping a worker gracefully may take 
before being forced, defaults to the value of "graceful_timeout" in 
Mojo::Server::Prefork 
. Note 
that this value should usually be a little larger than the maximum amount 
of time you expect any one request to take.


So you need to set graceful_timeout, not only inactivity_timeout to achieve 
desired behaviour.

вторник, 6 февраля 2018 г., 8:52:54 UTC+3 пользователь Mikhail написал:
>
> $ mojo version
>> CORE
>>   Perl(v5.26.1, linux)
>>   Mojolicious (7.61, Doughnut)
>>
>> OPTIONAL
>>   EV 4.0+ (4.22)
>>   IO::Socket::Socks 0.64+ (n/a)
>>   IO::Socket::SSL 1.94+   (2.052)
>>   Net::DNS::Native 0.15+  (n/a)
>>   Role::Tiny 2.01+(2.06)
>>
>>
> Hi!
>
> I have a trouble with Mojolicious project serves by hypnotoad. My problem 
> occur on requesting heavy SQL data.
>
> I had increase $c->inactivity_timeout(600) in some controller action.
>
> At the log I see that the workers go down on that actions/requests:
>
> Fr 2 Feb 09:52:31 [d] Mojolicious:131 POST "/some/report/data"
>> Fr 2 Feb 09:52:31 [d] Mojolicious::Routes:162 Routing to controller 
>> "Controll::Some::Report" and action "data"
>> Fr 2 Feb 09:53:03 [i] Mojo::Server::Prefork:128 Stopping worker 1526 
>> gracefully (120 seconds)
>> Fr 2 Feb 09:53:03 [i] Mojo::Server::Prefork:162 Worker 726 started
>> Fr 2 Feb 09:53:10 [d] Mojolicious::Controller:211 200 OK (38.658608s, 
>> 0.026/s)
>> Fr 2 Feb 09:53:10 [i] Mojo::Server::Prefork:173 Worker 1526 stopped
>>
>>
>
> On each request workers go down and new one start. Browser get data 
> successfully.
>  
>
> Another requests to other fast time actions has normal behavior - without 
> stopping workers.
>
>
> This is not very big problem but little bit miss proper.
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Mojo::Base get all attributes names

2018-02-06 Thread Илья Рассадин
To be fare, Mouse can do it as well. And Moo too (but not with support of 
Moose Meta Object Protocol).

понедельник, 5 февраля 2018 г., 21:13:19 UTC+3 пользователь Charlie Brady 
написал:
>
>
> On Mon, 5 Feb 2018, Dan Book wrote: 
>
> > Introspection capabilities are a feature of Moose. 
>
> Moose, however, adds many, many more dependencies than Mojo::Base... 
>
> > 
> > On Mon, Feb 5, 2018 at 5:14 AM, Konstantin Cherednichenko < 
> > dshadow...@gmail.com > wrote: 
> > 
> > > Hello! 
> > > 
> > > Is there any easy way to get all attributes names? 
> > > 
> > > I tried to get it via ISA but I also got methods names... I just want 
> to 
> > > get "propA" and "propB"... 
> > > Could someone please help me? 
> > > 
> > > My example: 
> > > 
> > > #!/usr/bin/env perl 
> > > 
> > > package A; 
> > > use Mojo::Base -base; 
> > > 
> > > has propA => 123; 
> > > has propB => 'val'; 
> > > 
> > > sub get_props_names 
> > > { 
> > > my $self = shift; 
> > > 
> > > my %names = (); 
> > > 
> > > { 
> > > my $base_class = ref($self); 
> > > 
> > > no strict 'refs'; 
> > > 
> > > foreach my $class ($base_class, @{"${base_class}::ISA"}) 
> > > { 
> > > foreach my $name (keys %{"${class}::"}) 
> > > { 
> > > $names{$name} ||= 1; 
> > > } 
> > > } 
> > > }; 
> > > 
> > > return [sort keys %names]; 
> > > } 
> > > 
> > > package main; 
> > > use Mojo::Base -strict; 
> > > use Data::Dumper; 
> > > 
> > > my $obj = A->new; 
> > > 
> > > say Dumper($obj->get_props_names); 
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> Groups 
> > > "Mojolicious" group. 
> > > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > > email to mojolicious...@googlegroups.com . 
> > > To post to this group, send email to mojol...@googlegroups.com 
> . 
> > > Visit this group at https://groups.google.com/group/mojolicious. 
> > > For more options, visit https://groups.google.com/d/optout. 
> > > 
> > 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] SQL::Abstract::Pg

2018-02-03 Thread Илья Рассадин
I think, the case is not about inserting bulk data from one table to 
another.

For example, we can buffer minion jobs via enqueue and insert them to 
minion_jobs all at once in the end of request.

That feature also is very valuable for highload project if you want to 
store some kind of logs in the database.

So bulk inserts is definitely a good thing and I use them a lot in my daily 
job.

PS: by the way, PostgreSQL supports bulk updates... Maybe, it should be in 
a feature list too. 



суббота, 3 февраля 2018 г., 9:40:55 UTC+3 пользователь Abel Abraham 
Camarillo Ojeda написал:
>
> On Fri, Feb 2, 2018 at 10:16 PM, Stefan Adams  > wrote: 
> > 
> > 
> > On Thu, Feb 1, 2018 at 6:42 AM, Sebastian Riedel  > wrote: 
> >> 
> >> > I spoke with you about this briefly on Twitter, but just figured I'd 
> put 
> >> > it 
> >> > out here, too.  What about multiple record inserts on a single call? 
> >> > Twitter thread. 
> >> 
> >> Yes, it's possible, not sure about how useful it would actually be 
> though. 
> > 
> > 
> > This makes sense!  I'm able to do this below, which is all that I really 
> > need: 
> > 
> >   my $i = $pg->db->dbh->prepare('insert into b (first, last, birthday, 
> age, 
> > phone) values(?, ?, ?, ?, ?)'); 
> > 
> >   my $results = $pg->db->select('a', [qw/first last birthday age 
> phone/], 
> > undef, {limit => $limit, offset => 1}); 
> > 
> >   while ( my $next = $results->array ) { 
> > 
> > $i->execute(@$next); 
> > 
> >   } 
> > 
>
> in postgres you should be able, in case of inserting from one table to 
> other: 
>
> insert into b (first, last, birthday, age, phone) select first, last, 
> ..., phone from a; 
>
> and you save the whole round-trip of data. 
>
> > FWIW, I ran a quick benchmark on 3 different algorithms to insert bulk 
> data 
> > into a database, and the method above was the fastest by far.  Is there 
> a 
> > better / faster algorithm still to use for inserting bulk data? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Mojolicious" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to mojolicious...@googlegroups.com . 
> > To post to this group, send email to mojol...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/mojolicious. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Minion::Backend::Redis

2018-01-04 Thread Илья Рассадин

Finished my first attempt to implelement Redis Backend

My benchmark results

Clean start with 1 jobs
Enqueued 1 jobs in 9.98849105834961 seconds (1001.152/s)
29165 has started 4 workers
4 workers finished 1000 jobs each in 155.357006072998 seconds (25.747/s)
29165 has started 4 workers
4 workers finished 1000 jobs each in 121.667289972305 seconds (32.877/s)
Requesting job info 100 times
Received job info 100 times in 0.120177030563354 seconds (832.106/s)
Requesting stats 100 times
Received stats 100 times in 0.540313005447388 seconds (185.078/s)
Repairing 100 times
Repaired 100 times in 9.60826873779297e-05 seconds (1040770.223/s)

And Dan's benchmark result on my enviroment

Clean start with 1 jobs
Enqueued 1 jobs in 228.140287876129 seconds (43.833/s)
29268 has started 4 workers
4 workers finished 1000 jobs each in 295.22328209877 seconds (13.549/s)
29268 has started 4 workers
4 workers finished 1000 jobs each in 224.983679056168 seconds (17.779/s)
Requesting job info 100 times
Received job info 100 times in 3.12703800201416 seconds (31.979/s)
Requesting stats 100 times
Received stats 100 times in 0.699573993682861 seconds (142.944/s)
Repairing 100 times
Repaired 100 times in 1.10982012748718 seconds (90.105/s)


Some explanations:

I used redis expire feature to automatically delete jobs and workers, so 
repair results here is irrelevant. I just wrote empty function.


Next, I used MessagePack instead of JSON (with XS implementation on perl 
side) and lua scripts instead of transaction.


My next step is profile lua scripts (want to try this 
https://stackoverflow.com/questions/16370333/can-i-profile-lua-scripts-running-in-redis). 
So far, the only reason to store jobs as hashes is ability to check 
parents and delayed fields. I think, I can find another ways to store 
jobs and it can significantly improve performance.


So far, looks like it's worth the effort to continue. Enqueue is already 
bit faster than current pg backend(700 j/s for enqueue and 170 j/s for 
deque), so I want to believe there is a light in the end of tunnel and 
it's not the train.



31.12.2017 21:10, Dan Book пишет:
Please, I welcome any attempts at making it work! My development of 
the Redis backend is stalled because I have been unable to find a way 
to make the dequeue process efficient enough. I have copied the minion 
benchmark script with the modification to use Redis here: 
https://github.com/Grinnz/Minion-Backend-Redis/blob/master/examples/minion_bench.pl 



-Dan

On Sun, Dec 31, 2017 at 7:08 AM, Илья Рассадин <mailto:elcaml...@gmail.com>> wrote:


Hi!

I recently started to work on my own implementation for
Minion::Backend::Redis.

During code reading of Mojo::Backend::Pg, some questions were born
in my mind and I wrote email directly to Sebastian. Than's how I
found out about Dan Book's Redis backend
https://github.com/Grinnz/Minion-Backend-Redis
<https://github.com/Grinnz/Minion-Backend-Redis>

First of all, I think, it'll be great to write links to this
mailing list in Minion documentation. Now doc says "You can use
Minion <https://metacpan.org/pod/Minion> as a standalone job
queue", so it's not very clear that this mailing list is right
place to discuss minions.

And second, as far as I know, current redis backend is still under
construction. And I want to help make it as solid as Pg backend,
but faster.

Now, I'm trying to reimplement my own Backend not based on Dan's
code, but based on Pg backend. I'm widely using lua scripting and
Data::MessagePack module. Next I want to benchmark it against
Dan's current version and compare speed, performance and determine
max task rate per second. Trick thing with redis lua scripting,
that it is fast, but can be voracious CPU eater...
If I'm satisfied with the result, I'll make a PR to Dan's repo
with Redis backend

But if mojo team already have another plan for redis backend and
you need a couple of hardworking hands to help, I'm very motivated
and now you know how to find me. So feel free to contact me.


 PS: Happy New Year and great thanks to all Mojo team for your
great work.
-- 
You received this message because you are subscribed to the Google

Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to mojolicious+unsubscr...@googlegroups.com
<mailto:mojolicious+unsubscr...@googlegroups.com>.
To post to this group, send email to mojolicious@googlegroups.com
<mailto:mojolicious@googlegroups.com>.
Visit this group at https://groups.google.com/group/mojolicious
<https://groups.google.com/group/mojolicious>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout&g

[Mojolicious] Minion::Backend::Redis

2017-12-31 Thread Илья Рассадин
Hi!

I recently started to work on my own implementation for 
Minion::Backend::Redis.

During code reading of Mojo::Backend::Pg, some questions were born in my 
mind and I wrote email directly to Sebastian. Than's how I found out about 
Dan Book's Redis backend https://github.com/Grinnz/Minion-Backend-Redis

First of all, I think, it'll be great to write links to this mailing list 
in Minion documentation. Now doc says "You can use Minion 
 as a standalone job queue", so it's not 
very clear that this mailing list is right place to discuss minions.

And second, as far as I know, current redis backend is still under 
construction. And I want to help make it as solid as Pg backend, but faster.

Now, I'm trying to reimplement my own Backend not based on Dan's code, but 
based on Pg backend. I'm widely using lua scripting and Data::MessagePack 
module. Next I want to benchmark it against Dan's current version and 
compare speed, performance and determine max task rate per second. Trick 
thing with redis lua scripting, that it is fast, but can be voracious CPU 
eater...
If I'm satisfied with the result, I'll make a PR to Dan's repo with Redis 
backend

But if mojo team already have another plan for redis backend and you need a 
couple of hardworking hands to help, I'm very motivated and now you know 
how to find me. So feel free to contact me.


 PS: Happy New Year and great thanks to all Mojo team for your great work.

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.