The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2016-10-20

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:32 zivester joined #mojo
02:18 stryx` joined #mojo
02:30 mcsnolte joined #mojo
02:57 noganex_ joined #mojo
03:47 asarch joined #mojo
03:56 dabudabu joined #mojo
04:03 stryx` joined #mojo
04:57 blonewolfs joined #mojo
05:23 che-quest joined #mojo
05:38 mbudde joined #mojo
05:56 inokenty-w joined #mojo
06:26 * sri misses simpler times... when log files were actually in /var/log
06:33 dod joined #mojo
06:52 AndrewIsh joined #mojo
06:57 kes joined #mojo
07:01 kes joined #mojo
07:01 kes Hi. What does this mean: all arguments get localized automatically?
07:12 ashimema joined #mojo
07:15 trone joined #mojo
07:30 janl joined #mojo
07:59 osfabibisi joined #mojo
08:14 nic omg, thank you for the warnings about twitter in a browser.  I was puzzled why my battery life is no longer the wunderbar.  I guess it started when I began leaving a twitter tab open.  Gone gone gone.
08:28 rshadow joined #mojo
08:52 rubin joined #mojo
09:26 dp_ joined #mojo
09:31 che-quest joined #mojo
09:31 stryx` joined #mojo
09:58 alilles joined #mojo
10:01 VVelox joined #mojo
10:19 bpmedley kes : Do you have some context?
10:38 kes bpmedley: http://mojolicious.org/perldoc/Mojolicious/Controller#toc
10:39 kes err
10:39 kes http://mojolicious.org/perldoc/Mojolicious/Controller#render_to_string
10:40 kes that sentence from the doc
10:45 bpmedley kes: my $test = $c->render_to_string(inline => '<%= $joy . " " . $hello %>', joy => "What", hello => "wow");   <--  I believe that means the joy and hello arguments are available as $joy and $hello in the template..
10:46 kes I think about localization in context of l10n in that context
10:47 kes I thiank about localization as l10n in that context
10:59 bpmedley kes : I perused the code some more; however, I'm not seeing l10n (or similar) references.  I could have missed some, or simply not know what to look for..
11:01 kes bpmedley: thank you for clue about what that mean
11:08 brian_ joined #mojo
11:36 stryx` joined #mojo
11:37 fuogo joined #mojo
11:37 fuogo Hi all
11:37 bpmedley fuogo : Morning
11:38 brian__ joined #mojo
11:39 sri commute from work will be fun today... a racist organization is demonstrating around the suse building today... yay for nuremberg :S
11:39 fuogo I'm try to develop an application with multiple part (e.g., domain.com/program1 domain.com/program2 ... domain.com/programN) which share same base logic, but with some customization (mostly bootstrap template, some formulas, etc).... which plugin/approach should I look into?
11:40 fuogo previously i will develop 3 mojo lite app ...just duplicate over and hack it .... don't think it's a good idea anymore
11:41 bpmedley fuogo : https://metacpan.org/pod/Mojolicious::Plugin::Mount <-- Possibly this?
11:42 fuogo @bpmedley: yea I saw that and toadfarm ... but that's for individual application right? mine are like 90% of code is similar just little customization over here and there...
11:42 fuogo my thought would be they shared the same code base, and maybe some plugins system for some customize function/helper
11:43 bpmedley fuogo : Do they have the same routes and controller names?
11:43 fuogo something like a micro-CMS, with user, news management, some have fancier bootstrap templates, some have extra pages ... somethinkg like that
11:44 fuogo @bpmedly: i'm from mojo lite ... wanted to go mojolicious but I have difficulty understand the routes ... and I got tight deadline :)
11:55 bpmedley fuogo : https://gist.github.com/brianmed/731f72ee6c7d4857d994479b17d32b00 <-- How is this?
11:55 bpmedley sri : Oh wow!  Be careful.  Can you work from home?
11:59 nic not if he's already in the office ;)
11:59 bpmedley Doh.  No coffee for me just yet.
11:59 nic fuogo: I have quite a large app that matches that description
12:00 nic my users are in separate depts and can't necessarily see another's pages
12:00 nic but it's all one app
12:00 fuogo @bpmedley: looks good. but it still need N .pl script for that if i need to serves N sub-program?
12:01 bpmedley fuogo : I assumed you already had N .pl scripts.  If you want just one, then I'd probably do a different pattern..
12:01 nic what is your rationale for sub-programs rather than areas/groupings of routes/templates?
12:01 nic best not over-complicate
12:02 fuogo nic: because they share about 90% logic in common? i thought it would be save substantial amout of resources if i could put it in 1 script ... although the complication might be overkill
12:03 nic not one "script" -- you definitely want a full app rather than lite for that
12:03 fuogo I got a task need to display different news & announcement, report for like 25 vendors ... something like domain.com/vendor1 ... domain.com/vendor25
12:04 fuogo share the same database, event news & announcement are pull from same table... just different filter criteria
12:04 nic yes, you can even have the one app be served on different domains/addresses
12:04 fuogo the report is slightly complicated... while most using the same logic ... some of them might have different logic in generating report
12:04 nic do users need to see content even without authenticating?
12:05 fuogo and maybe few out of 25 will use different bootstrap template
12:05 fuogo nic: no, only open to members
12:05 nic templates are no problem
12:05 fuogo public won't see anything beside login page
12:05 nic and separate logic... that's handled by controllers
12:05 nic ah well, that's fairly easy then
12:06 nic it's more tricky/risky when you need to show the right content to unauthenticated users
12:06 bpmedley fuogo : http://mojolicious.org/perldoc/Mojolicious/Plugin/HeaderCondition <-- something like this?
12:06 nic so when they login, you store their 'area' in their cookie
12:06 fuogo now I'm trying to do a "get '/:vendor' => sub { ...$c->param('vendor'} store to stash... then redirect_to('/login')
12:06 nic For each route, you check their cookie allows access to that
12:06 fuogo and login will have a hidden field on the vendor value
12:06 fuogo something like that .... I'm still researching on this
12:07 bpmedley fuogo : get '/' => (host => qr/domain\.com/vendor1$/) => sub {...};
12:07 fuogo cool
12:07 nic my app has a side menu (quite nice icon-based with a little js) and each user group loads its own specific sidebar (with a default in case I don't define a specific sidebar)
12:07 bpmedley fuogo : The headercondition plugin may help get you started, and then you can migrate towards a full app when you get more time..
12:08 fuogo @bpmedley: yea that's my 2017 resolution ... to learn how to do the full app
12:09 bpmedley You could literally have 25 or more / routes and then a default / route after the HeaderCondition ones..
12:09 nic full app might be a lot simpler than you're thinking, and certainly makes source control that bit more manageable
12:11 itaipu joined #mojo
12:11 fuogo based on my initial study... full app I can use a base logic to handle everything ... then additional controller for those report module which need different logic.. and when it grow i can just add more controller .pm
12:13 bpmedley Gotta run, hope you get your app working the way you want..
12:17 fuogo thanks :)
12:33 tchaves joined #mojo
12:38 gizmomathboy joined #mojo
13:03 itaipu joined #mojo
13:13 ramortegui joined #mojo
13:14 blonewolfs joined #mojo
13:16 blonewolfs is there a way from within an app (non-lite) to determine how it was started?  i.e. morbo or hypnotoad or other?
13:17 rshadow1 joined #mojo
13:18 pink_mist perhaps it might work inspecting $0 ?
13:19 pink_mist normally morbo runs in development mode, and hypnotoad runs in production mode, so might be useful to check the mode too
13:19 pink_mist why is this a concern though?
13:20 pink_mist https://metacpan.org/pod/Mojolicious#mode
13:28 blonewolfs pink_mist: there is a plugin that i need (Mojolicious::Plugin::SetUserGroup) and it is not compatible with morbo so, i want to make sure it doesn't get loaded if i'm developing with morbo.
13:42 pink_mist so simply don't load it if mode eq development
13:44 itaipu joined #mojo
13:49 jberger nic: :)
13:51 jberger blonewolfs: you should only load that plugin if you are root
13:51 jberger I'm pretty sure that is documented in the plugin
13:55 jberger Ok so as i reread i see what you are saying
13:56 jberger But I'd put it slightly differently: because you aren't starting morbo as root either checking for root should be sufficient
13:57 jberger But finally I never start my app servers as root because I use nginx as a reverse proxy so it doesn't matter anyway
13:58 jberger Perhaps that is an option for you?
13:59 vicash i second jberger: always run your web apps as a restricted user
14:00 zivester joined #mojo
14:04 suede i third that. any vuln allowing file access and code execution and you're finished.
14:23 blonewolfs the app needs to start at system boot and as far as i'm aware, systemd starts everything as root.  that is why i need the plugin to drop the privs.  also, in final testing you want to run things like they will be in prod which means as root.  if i could start things up by hand and control the process, i would but, that is not an option in an enterprise environment.
14:25 blonewolfs so, i want to build as much safety and control into the app itself to, as much as possible, avoid the points you all are raising.
14:25 jberger blonewolfs: morbo is not the production server
14:26 jberger you should be using daemon or hypnotoad in production (better to use hypnotoad unless that isn't possible)
14:26 jberger systemd can start applications as non root as well, but then they can't bind to ports <1024
14:28 suede blonewolfs you can set the uid/gid of apps started with a systemd unit
14:28 vicash blonewolfs: prod doesn't mean root. even on standard Linux systems (assuming you're running Linux) Nginx/Apache run as a separate user like www-data or something else other than root.
14:29 vicash blonewolfs: you can use Cron to start applications on system startup as unprivileged users or if you want systemd then systemd can do that as well
14:31 blonewolfs i agree that morbo is not a production server but, i haven't been able to get hypnotoad to log debugging output so, i have to run my app as under morbo for testing and then switch to hypnotoad for final testing/prod.
14:31 blonewolfs suede: how do it set uid/gid in systemd?
14:31 itaipu_ joined #mojo
14:32 vicash blonewolfs: hypnotoad will not log debugging output by default. if your debug statements are truly necessary change them to info which will get logged. Otherwise start hypnotoad with MOJO_LOG_LEVEL=debug set
14:33 blonewolfs vicash: nginx/apache both start as root when started by the system and then they drop privs which is what i'm trying to do with Mojolicious::Plugin::SetUserGroup.
14:33 tyldis blonewolfs Because the bind to ports below 1023
14:33 tyldis they bind, even
14:33 suede blonewolfs you can set User= and Group= under the [Service] section of the file, but if what vicash is saying is true, you should just use hypnotoad behind nginx or apache
14:34 tyldis blonewolfs: Because the bind to ports below 1023, not because systemd cannot start as other user
14:36 blonewolfs suede: thank you.  i'll add that to my start script.
14:38 blonewolfs vicash is right about the low binding ports but, that is curable in linux with capabilities.  and my app needs to run standalone.  another production web server in front of a production web server is just a layer of abstraction that i don't want in the environment only to solve the low port issue.  if it served some other purpose, i might consider it.
14:40 blonewolfs tyldis: i agree the low port binding is why apache/nginx start as root.  that is part of my need also.
14:40 suede i usually compile ngx_pagespeed into my nginx instances so usually my deployment scripts include that
14:41 tyldis Yeah, I also prefer to do protocol optimizations on a frontend rather than inside mojo
14:44 blonewolfs tyldis: why not optimize your code directly?
14:44 vicash blonewolfs: the reverse proxy system allows you to add several instances of your web app accessible through the same port, allows HTTPS to be done by a faster server like Nginx rather than a slow Perl app, allows you to manage access using Basic/Digest authentication without rebuilding features in the web app, etc. allows easy failover etc. there are several advantages and it is a tried and tested method
14:46 janl joined #mojo
14:49 blonewolfs vicash: that all makes sense.  and in the bulk of situations would work well.
15:07 disputin joined #mojo
15:13 PryMar56 joined #mojo
15:14 tyldis blonewolfs: vhosts for instance, is better handled upstream - as well as protocol optimizations like caching and browser bugs.
15:14 tyldis I always have either nginx or haproxy in front, unless it's a smal lhome project.
15:16 blonewolfs tyldis: okay.  i understand.
15:29 suede blonewolfs: also for instance, if you use something like Caddy, you can automatically get LetsEncrypt certs too
15:30 suede Caddy is really nice
15:30 suede I'm using it in production for a bunch of stuff
15:36 blonewolfs suede: i don't think i've ever heard of caddy.  do you have a link to it?
15:36 suede sure
15:36 suede blonewolfs https://caddyserver.com/
15:36 suede it has http/2, websockets, all the good stuff
15:37 blonewolfs suede: thanks.  i'll check it out.
15:50 Grinnz i... did mention the User= option for service scripts yesterday
16:08 stryx` joined #mojo
16:20 dod joined #mojo
16:25 dod joined #mojo
16:37 polettix joined #mojo
16:52 kryp joined #mojo
17:01 rshadow joined #mojo
17:07 rshadow joined #mojo
17:25 jrm21 joined #mojo
17:35 itaipu joined #mojo
17:40 disputin joined #mojo
17:45 kryp joined #mojo
17:49 jrm21 left #mojo
18:07 khfeng joined #mojo
18:39 jabberwok joined #mojo
18:54 disputin joined #mojo
19:05 khfeng joined #mojo
19:06 rshadow joined #mojo
19:17 abra joined #mojo
19:28 asarch joined #mojo
19:31 stokachu joined #mojo
19:49 polettix joined #mojo
19:54 abra_ joined #mojo
19:56 khfeng joined #mojo
20:01 itaipu joined #mojo
20:48 khfeng joined #mojo
21:10 ilbot2 joined #mojo
21:10 Topic for #mojo is now 🍩 nom nom | http://mojolicious.org | http://irclog.mojolicious.org | http://code-of-conduct.mojolicious.org
21:23 bpmedley suede : Do you have an example Caddyfile that works with Mojolicious?
21:24 suede sorry you're on your own
21:24 suede it's not that hard to write though
21:29 disputin joined #mojo
21:59 kryp joined #mojo
22:07 ccakes suede what type of loads are you putting through caddy in prod?
22:08 ccakes anything serious?
22:09 suede ccakes: nothing really serious, you'll have to load test it yourself. sorry :(
22:09 ccakes i really like the look of it
22:15 mra90 joined #mojo
23:33 cstamas joined #mojo
23:33 vytas joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary