Re: [Mojolicious] Hosting Mojolicious project in web Server

336 views
Skip to first unread message
Message has been deleted

Денис Ильиных

unread,
Feb 22, 2016, 10:51:30 AM2/22/16
to mojol...@googlegroups.com
Digital ocean :)

понедельник, 22 февраля 2016 г. пользователь написал:
 Hello everyone, i had completely developed an application in perl with mojolicious framework. since i am new to perl and its frameworks i don't know how to upload the project to the server or hosting the project online. if it is possible to host the project with apache server. well and good , please let me know how to do it! and also tell me know the other ways of deploying the project online. Thanks in advanced.

--
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.


--
С уважением.
Ильиных Денис
Программист
Компания "GT-Shop.ru"
Телефон: +7(963) 995-7616

Jan Henning Thorsen

unread,
Feb 22, 2016, 10:54:15 AM2/22/16
to Mojolicious

moulees...@jothisoftware.com

unread,
Feb 26, 2016, 3:08:30 AM2/26/16
to Mojolicious

moulees...@jothisoftware.com

unread,
Feb 26, 2016, 3:26:25 AM2/26/16
to Mojolicious
Hello Thorsen,

Thanks for the reply, Tried deploying the mojolicious application with Apache using 'mod_perl' which is working, still having few issues like routing and timeouts

when its opened in a new tab or on refreshing the page, sometime its works. 


Am looking forward for the solution, thanks in advance.





My Virtual Host Configuration looks something like this :-


<VirtualHost *:8600>
DocumentRoot /path/app
SetEnv APPLICATION_ENV 'development'
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Perl>
$ENV{PLACK_ENV} = 'production';
$ENV{MOJO_HOME} = '/path/app';
$ENV{MOJO_MODE} = 'deployment';
</Perl>
<Location />
SetHandler perl-script
PerlResponseHandler Plack::Handler::Apache2
PerlSetVar psgi_app /path/app
AllowOverride None
# Allow open access:

Require all granted

</Location>

</VirtualHost>

s...@alexbyk.com

unread,
Feb 26, 2016, 3:32:05 AM2/26/16
to mojol...@googlegroups.com
Using apache + mod_perl with mojolicious isn't very wise decision.

I suggest iptables + hypnotoad or nginx + hypnotoad . Both of them are much simpler and faster





--

Luc Didry

unread,
Feb 26, 2016, 3:37:14 AM2/26/16
to mojol...@googlegroups.com, s...@alexbyk.com
vendredi 26 février 2016, 10:32:00 CET s...@alexbyk.com wrote:
> Using apache + mod_perl with mojolicious isn't very wise decision.
>
> I suggest iptables + hypnotoad or nginx + hypnotoad . Both of them are
> much simpler and faster

Apache + mod_proxy can do the job too (but websockets needs an other module,
and configuration is a pain).
--
Luc
http://www.fiat-tux.fr/
Internet n'est pas compliqué, Internet est ce que vous en faites.

moulees...@jothisoftware.com

unread,
Feb 26, 2016, 3:37:49 AM2/26/16
to Mojolicious
Thanks for the reply Alex.
I had already tried with Hypnotoad, it is working fine, but the thing is my requirement is to do with Apache server only. so kindly help me in sorting out the above mentioned issues. 

Jan Henning Thorsen

unread,
Feb 26, 2016, 3:39:13 AM2/26/16
to Mojolicious
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+unsubscribe@googlegroups.com.

moulees...@jothisoftware.com

unread,
Feb 26, 2016, 3:43:51 AM2/26/16
to Mojolicious, s...@alexbyk.com, l...@didry.org
well ready to take up the pain, since i have to stick to the requirements. 
so kindly let me know  how to achieve hosting the mojolicious application with apache  + mod_perl / mod_proxy

Luc Didry

unread,
Feb 26, 2016, 4:01:55 AM2/26/16
to moulees...@jothisoftware.com, Mojolicious, s...@alexbyk.com
vendredi 26 février 2016, 00:43:50 CET moulees...@jothisoftware.com wrote:
> well ready to take up the pain, since i have to stick to the requirements.
> so kindly let me know how to achieve hosting the mojolicious application
> with apache + mod_perl / mod_proxy

You can have a look at the end of
https://git.framasoft.org/luc/lufi/wikis/installation, there's an
exemple of an apache + mod_proxy + mod_proxy_wstunnel and hypnotoad.

Mouleeshwaran Guru

unread,
Feb 26, 2016, 5:10:48 AM2/26/16
to mojol...@googlegroups.com
just add a look of above link (mod_proxy). How does the virtual host config will get addressed to the project directory (Mojo App) ?

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 a topic in the Google Groups "Mojolicious" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mojolicious/y4Pejp0E_JA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mojolicious...@googlegroups.com.
Message has been deleted

Charlie Brady

unread,
Feb 27, 2016, 10:29:09 AM2/27/16
to Mojolicious

On Fri, 26 Feb 2016, moulees...@jothisoftware.com wrote:

> just add a look of above link (mod_proxy). How does the virtual host config
> will get addressed to the project directory (Mojo App) ?

You need to run the mojo app on a different port nnnn (e.g. by using
hypnotoad). Then you configure mod_proxy to proxy the virtual host to
localhost:nnnn.

The mod_proxy configuration doesn't need to know anything about the
project directory - just what port (nnnn) the application is bound to.

Read the docs that Luc provided a link to.

moulees...@jothisoftware.com

unread,
Feb 29, 2016, 2:11:28 AM2/29/16
to Mojolicious, charli...@budge.apana.org.au
Thanks a lot Charlie. Now it is working fine.
And i also wanted to know is this the recommended way of deploying the application in real time?  Do i have to run the Built-In server(Daemon/hypnotoad) each and every time? 

moulees...@jothisoftware.com

unread,
Feb 29, 2016, 8:30:16 AM2/29/16
to Mojolicious, charli...@budge.apana.org.au
Hello Charlie,

Here is a summary of actions i tried based on the postings posted by you, Thorsen and Luc.

1. Used morbo and mod_proxy and verified changes to controllers and templates are respected without restarting morbo

morbo -w lib/ -w templates/ script/my_app -l "http://*:2999"

There is no change in mod_proxy configuration i have posted earlier

2. Used plackup and mod_proxy and verified changes to controllers and templates are respected without killing and restarting plackup

plackup -R templates/ ./script/my_app -l localhost:2999




Here are my questions

1. What is the best practice to deploy a mojolicious app to production? should i stick to morbo or plackup or hypnotoad? 

2. How do we stop these middleware(morbo/plackup/hypnotoad) instead of killing them using ctrl +C in development mode? Should i just create a shell script to kill the process using pid? 

3. I undertstand from one of the earlier posts, using mod_perl may not be a good idea. Is it ok to use mod_proxy?

4. Even though the requirement is to deploy our app on apache, would it be possible to create a webserver neutral deployment? I have tried going through psgi materials but i was stuck with the same routing issue i posted earlier.

Any help on this would be appreciated.



On Saturday, February 27, 2016 at 8:59:09 PM UTC+5:30, Charlie Brady wrote:

Jan Henning Thorsen

unread,
Feb 29, 2016, 8:54:06 AM2/29/16
to Mojolicious, charli...@budge.apana.org.au
I think the answers depends on your situation, but here is what I do, both at work and in personal projects:

1. Deploy with morbo, plackup, hypnotoad
"morbo" is not a best practice. You need very specific reasons to use that in production. "morbo" is for development, because it has the ability to restart the server when files on disk are changed. I don't know much about "plackup", but what I do know is that it will render the non-blocking features in Mojolicious useless. So if you have any place where you use a callback, a delay or something else non-blocking i would recommend NOT using anything that use plack.

In production I would use "hypnotoad" if you are on some unix based system and "prefork" if you are on windows. Both are indeed very fast web servers and they fork "workers" so you can handle multiple requests, even if your application is "blocking". Multiple workers are also a good idea if you are writing non-blocking applications, since it allows Perl to use multiple CPUs.

The only reason I see for using plackup is if you have a legacy plack application that have to run in the same process.

2. Stopping the processes.
"hypnotoad" can be be stopped with "hypnotoad -s /path/to/youapp.pl". The other servers (prefork, daemon, morbo) run in the foreground, so you just need to kill them yourself. I don't know of any init scripts, but it should be easy enough to write one, since they run in the foreground.

3. mod_perl/mod_proxy
Yes. mod_proxy is a good idea. I think the setup I've seen the most is using "nginx" in front of "hypnotoad". nginx is often used instead of Apache, especially when all you need is "mod_proxy".

4. Webserver neutral deployment
Not sure if I understand the question. Mojolicious already detects the environment it is running in. The most neutral deployment (in my opinion) is to use a reverse proxy config in the frontend web server.

5. Plack
Why are you looking at Plack? Do you have any existing Plack apps? If so: Start Mojolicious using hypnotoad and then the plack app in a different Starman server. If you don't have any Plack apps: Don't use any plack tools!
Reply all
Reply to author
Forward
0 new messages