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

IRC log for #mojo, 2016-05-26

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

All times shown according to UTC.

Time Nick Message
01:06 jacoby_ joined #mojo
01:07 rabbit joined #mojo
01:09 rabbit I've got Apache setup for Reverse Proxy to Mojo. I do *not* want static requests to pass by Mojo, so I'm trying to setup the Proxy directive to prevent that (but it's not working). Any clues on the best way to normally do this? Note, for the sake of this example, all static is via /syr/ and everything is dynamic and should go via mojo.
01:09 rabbit <Proxy *> Order Allow,Deny Allow from all Deny from env=is_static </Proxy>
01:10 rabbit But that's not working.
01:10 rabbit Note, I've defined is_static as: SetEnvIf Request_URI "^/syr/" is_static
01:11 rabbit and everything *else* is dynamic and should go via mojo
01:12 rabbit Note, in case it was not clear, all this is in my Apache virtual hosts, of course.
01:16 haarg proxy blocks are for using apache as a forward proxy server (as configured in your browser)
01:20 haarg <Location "/">ProxyPass "http://backend/"</Location><Location "/syr/">ProxyPass "!"</Location>
01:29 iamb rabbit: in case you don't see it, that means your <Proxy *> block will allow anyone who can talk to that server to forward proxy anything it can reach. you'll want to remove that especially quickly if it's internet-facing. :(
01:36 rabbit haarg: so you are saying to setup a Location directive to limit what goes to backend mojo server, right? And iamb: you are saying what?
01:37 haarg proxy blocks like you were trying to use are generally for forward proxies
01:37 haarg as in, they allow people to use your server as a proxy to access arbitrary sites
01:38 haarg for a reverse proxy, use ProxyPass. what i showed is one approach that proxies everything except /syr/ to a different server
01:38 haarg there are different approaches that would accomplish the same thing, but that is one that should work
01:39 rabbit Got it. OK We'll see if that works.
01:39 rabbit Thanks.
01:44 rabbit haarg: very ultra sweet. Works.
01:46 rabbit Sooooo what about ProxyPassReverse? Should I put that inside location, as well? (It's working without it.)
01:46 rabbit Note, both ProxyPass and ProxyPassReverse are configd identically.
02:07 VVelox joined #mojo
02:23 oalders how do i do template includes with Mojo::Template?
02:25 jberger oalders: you don't
02:25 jberger Or more likely you do it with slurp
02:26 jberger Mojo::Template is just the syntax not the helpers
02:27 oalders OK, works for me.  Thanks. :)
02:27 jberger Where/how are you using Template by itself?
02:29 jberger If you are anywhere inside an app you can use render_to_string
02:29 oalders I'm just rendering templates in the usual way.  I just wanted to keep some content in a file that I would keep external to the template
02:29 jberger So this is in ep?
02:29 oalders ie a privacy policy.  it's easier to diff changes if i don't keep it in a template
02:30 jberger If this is ep then use "include"
02:30 oalders ah
02:31 jberger There is a difference, perhaps that isn't clear
02:31 jberger ep DOES have the app helpers
02:31 jberger The reason you use Mojo::Template directly is usually because you are outside of an app context
02:32 jberger Rendering LaTeX or something say
02:32 jberger So I misunderstood you
02:32 jberger Sorry
02:32 oalders I guess I should have phrased that better. :)
02:32 jberger You didn't know
02:33 jberger That's why i circled back to check
02:33 oalders Where is "include" documented?
02:33 oalders I've been googling that word and not coming up with anything
02:34 jberger http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Partial-templates
02:34 jberger Generally the Rendering guide is the first place to look for anything ep relayed
02:34 jberger Related
02:35 oalders don't know how i missed that
02:35 oalders jberger++
02:35 jberger The odd thing about ep is that it is built up of several different application concepts rolled into one "format"
02:36 jberger So the guide is a good place to tie it together
02:51 noganex joined #mojo
02:55 lluad joined #mojo
03:39 inokenty-w joined #mojo
04:14 indianowl joined #mojo
04:14 indiaowl314 joined #mojo
04:32 jacoby__ joined #mojo
04:43 jacoby joined #mojo
04:56 che-quest joined #mojo
04:56 che-quest Hi guys. A question:
04:57 che-quest does i must erect two separate Mojo::UserAgent's when requests going to two diffrent domains? I want alive connections.
05:08 preaction how can you have alive connections to two different domains? a connection is to a single domain
05:24 che-quest yep, TCP - single, but expected Mojo can be smart )
05:37 cpan_mojo Mojolicious-Plugin-ServerStatus-0.04 by FUKAI https://metacpan.org/release/FUKAI/Mojolicious-Plugin-ServerStatus-0.04
05:41 tempire joined #mojo
05:54 dod joined #mojo
05:55 Adurah Erect UAs... oh my.
05:59 dod joined #mojo
06:50 punter joined #mojo
06:57 Atog Mojo Pr0n!
07:06 nicomen erect user's agent? ;)
07:07 nicomen che-quest: you can reuse the same Mojo::UserAgent for many requests, I'm unsure if it will keep keep-alive connections around when you are doing a new request though
07:45 martin joined #mojo
07:51 Vandal joined #mojo
08:41 * sri wonders if he should keep the replacement macbook or just sell it for a dell
08:47 tempire joined #mojo
08:50 punter joined #mojo
09:37 * pink_mist would sell it for a dell -- but then I've never been a fan of macs
11:11 dantti_laptop joined #mojo
11:12 waghso joined #mojo
11:30 AndChat|5025 joined #mojo
11:30 AndChat|5025 left #mojo
11:33 sri looks like i'd be losing 200-300 euros :/
11:34 pink_mist damn :/
11:56 vicash is the macbook cheaper in the US compared to EU ?
11:57 sri think so
11:57 sri taxes should be very different too
11:57 vicash taxes are by state here.. about 7% for my state
11:59 vicash seems like there is an arbitrage opportunity for those who come for conferences to the US from the EU and buy macs here for cheaper and then sell it back in the EU for lesser than what Apple sells it for
11:59 sri think if you buy it in the us you also get less warranty
12:00 sri eu is 2 years by law
12:00 sri wouldn't be surprised if that increases the price too
12:00 vicash possible.. apple's extra warranty is $129 or something which is approx. 100 euro
12:02 jberger Ok you all had your childish giggle over an innuendo laden word, let's just not make it a habit ok?
12:05 vicash che-quest: you have to read Mojo::UserAgent's perldoc to see how to do non-blocking GET requests. Then you can fire two GET requests simultaneously to open 2 connections and wait for them to complete using Mojo::IOLoop
12:08 icjs joined #mojo
12:08 icjs hullo! is there anyway i can limit what the mojo error template shows if an exception is thrown? at the moment it dumps the config file in there which i want to avoid (for starters)
12:08 jberger che-quest / nicomen: keep alive works just fine across multiple domains/connections
12:09 nicomen using the same instance?
12:09 icjs i tried running with "morbo -m production" but it makes little visible difference to the template
12:09 che-quest vicash: okay, i simple sequentially requests
12:09 jberger icjs: that only galena in development mode
12:09 vicash che-quest: it is right there  in the documentation an example of doing concurrent GET requests
12:09 jberger Happens. Bah!
12:09 icjs jberger, uh "galena"?
12:10 vicash icjs: you can create your own exception.template and it will override the default template
12:10 jberger A combination of swipe type, early morning, and not enough coffee
12:10 vicash jberger: what app do you use for IRC on phone ?
12:11 jberger Convos
12:11 jberger Not its fault tho, if anything its my keyboard app
12:11 che-quest jberger: I have expected this (ua)
12:11 vicash thanks. does it show link previews when you post a link ?
12:12 jberger che-quest: it is easy enough to test by making a script that does repeated requests to multiple domains, run it with MOJO_USERAGENT_DEBUG=1
12:13 jberger on the latter requests it should two you that it is reusing the connection
12:13 jberger sigh, s/two/tell/
12:13 * jberger gets coffee
12:14 che-quest jberger: thks!
12:15 jberger vicash: yep
12:16 icjs jberger, hmm, i've changed mode => "production" in my mojo config file and restarted but i still see the same error template with the config dumped. the title of the page is "Server error (development mode)"
12:17 icjs jberger, i run it with: morbo script/foo -l http://\*:<my port>
12:17 sri now i'm curious how good intellij is for perl development http://blog.booking.com/perl-intellij-plugin.html?utm_source=twitterfeed&amp;utm_medium=twitter
12:17 jberger icjs: Try MOJO_MODE=production in your environment
12:18 vicash icjs: morbo --help will tell you the mode commandline switch
12:18 jberger I don't think the mode gets read out of a config file
12:18 pink_mist using morbo for production at all seems less than ideal
12:18 jberger Though -m should work i thought
12:18 icjs jberger, yeah, it seems to work if i do:  morbo -m production
12:19 icjs pink_mist, we're using hypnotoad but i am working on my vm to verify this
12:20 icjs jberger, ok, so it's not possible to use a mojo configfile param to switch into production
12:20 icjs ?
12:20 sri config file is too late
12:21 jberger icjs: the mode can be used to load the config file
12:21 sri see mode specific config files http://mojolicious.org/perldoc/Mojolicious/Plugin/Config#DESCRIPTION
12:21 jberger So as sri says, it would be too late
12:22 icjs sri, ah of course, thanks guys
12:22 jberger Also the log file is named for the mode,so it would be too late for that too
12:23 ashimema joined #mojo
12:23 icjs would running in development mode also incur some performance overhead?
12:23 sri yes
12:23 icjs sri, quite a bit?
12:23 sri yes
12:24 jberger icjs: once you get to production you'll set the mode via the environment in the system init script probably
12:24 icjs we've been runing our API in production in development mode (though not yet fully live) - responses taking up to 2s in some cases
12:24 sri hypnotoad defaults to production, so most people don't bother setting it
12:24 sri morbo = development, hypnotoad = production
12:24 icjs jberger, yup - i'm thinking set MOJO_MODE
12:24 sri works for most people
12:25 jberger sri: ahhh that's true too, see it is too early
12:25 sri customizing the mode with -m or so is usually just done to test something specific
12:27 pink_mist humm, does morbo incur *less* performance crippling if it's in production mode?
12:27 sri one week with a potato quality laptop is going to be painful :S
12:27 sri this non-retina screen hurts my eyes :,(
12:27 sri pink_mist: yes
12:28 sri the morbo file watcher is very inefficient though and burns a lot of cpu
12:29 sri you have to differentiate between morbo and daemon though
12:29 sri daemon is a perfectly reasonable choice for single process deployment
12:31 icjs sri, i'm hoping you work with twin 24" monitors! otherwise the perl foundation should buy them for you
12:31 sri we have four web servers in core basically
12:31 sri icjs: they should!
12:32 jontaylor joined #mojo
12:32 sri daemon, morbo, prefork, hypnotoad
12:32 sri morbo is an extension of daemon, and hypnotoad an extension of prefork
12:33 sri morbo adds an inefficient but portable restarter, and hypnotoad zero downtime restarts
12:34 sri prefork itself happens to be an extension of daemon, to add a pool of worker processes
12:35 sri and all of them default to development mode except for hypnotoad
12:37 sri re potato laptops, before the whole macbook meltdown i was aiming for a setup like this https://www.youtube.com/watch?v=_rhYn8M_rvw
12:46 AndrewIsh joined #mojo
12:48 CW joined #mojo
12:57 nic heh, what a nice surprise; installed IntelliJ IDEA and a popup says it has "Mojolicious helpers support"
12:57 sri :)
12:58 sri oh, sending back the broken macbook yesterday i had a good laugh when i saw the local ups access point, which happens to be a side business of a tanning salon xD
13:00 nic I really like the crossover of businesses that's been developing.  It's fairly common to find that your local fuel station is also a parcel exchange point
13:01 nic that's at the main counter.  I've also seen lockers outside round the back and thought "that's surely only for drugs"
13:02 ramortegui joined #mojo
13:02 jontaylor joined #mojo
13:03 sri so many weird crossovers here lately
13:03 sri butcher shop is also the post office
13:04 nic lol
13:05 Kripton joined #mojo
13:06 nic our dedicated PO got replaced recently by a half-and-half.  I feel pretty awkward walking through a posh gift shop to pick up a parcel, but waiting with the (vegetarian) kids in a butcher shop would be a whole lot worse
13:37 tchaves joined #mojo
14:02 mcsnolte joined #mojo
14:44 icjs if i run hypnotoad in the foreground with "hypnotoad -f" - that means there is just one worker thread serving requests rioght? setting workers/clients=4 has no effect when running -f
14:47 dvinciguerra joined #mojo
14:49 bpmedley icjs: What does ps tell you?
14:53 icjs bpmedley, i'm being lazy :) "pgrep -fl <app>" shows 5 itesm - the boss and 4 workers so i guess -f refers to the boss process being foregrounded
14:54 icjs that is good - i need -f to run that bad boy in Docker
14:54 itaipu joined #mojo
15:40 jberger heh, there's no good way to test "websocket_not_ok" for doing say auth in the handshake
15:41 jberger I was making an example for someone
15:41 jberger https://gist.github.com/jberger/145e996feed64914d7802efd460bf48d
15:41 jberger and I had to cheat and use a get route
15:42 jberger because I couldn't make the auth failure work as websocket_ok (clearly) and I could get it to route for get_ok('/auth/echo')->status_is(403)
15:42 jberger because it didn't route so I got 404 instead
15:42 jberger so I had to cheat and call the route a get
15:42 jberger so that the failed call would route
15:45 jberger not really a problem, just an interesting thing to think about
15:50 lluad joined #mojo
15:54 jacoby joined #mojo
15:56 jacoby joined #mojo
15:56 sri the code looks rather sketchy https://github.com/kraih/mojo/pull/964
15:59 jberger certainly I'd only do length once
15:59 jberger and shouldn't $offset // 0 be unnecessary?
16:01 sri and that's ignoring the big picture questions
16:07 jberger oh, I was specifically considering the code because you mentioned that it looked sketchy
16:07 jberger I don't do much in the way of reading partial files so I shouldn't comment
16:12 dod joined #mojo
16:12 Kripton joined #mojo
16:20 pink_mist hmm, wasn't the way substr() works with offsets outside the string changed in a not-very-recent perl?
16:20 pink_mist or am I misremembering something?
16:22 pink_mist hmm, looking through the perldeltas I think I was misremembering
16:23 pink_mist I bet it was the lvalue substr stuff that changed in 5.16 that I was thinking of
16:29 go|dfish joined #mojo
16:47 kaare joined #mojo
16:58 jontaylor joined #mojo
17:01 gizmomathboy joined #mojo
17:12 jontaylor_ joined #mojo
18:32 disputin joined #mojo
18:36 Kripton joined #mojo
18:44 punter joined #mojo
20:01 disputin joined #mojo
20:09 mpapec joined #mojo
20:12 Kripton joined #mojo
20:15 disputin joined #mojo
20:17 disputin joined #mojo
20:27 disputin joined #mojo
21:07 disputin joined #mojo
21:21 disputin joined #mojo
21:22 bpmedley sri: A co-worker loves Intellij for Perl.  The debugger, syntax highlighting, etc work real well.
21:23 disputin joined #mojo
22:02 trwww joined #mojo
23:25 trwww joined #mojo

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