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

IRC log for #mojo, 2016-07-10

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

All times shown according to UTC.

Time Nick Message
00:59 jberger bpmedley: that solution still doesn't allow for arbitrary commands to be sent, nor does it use pubsub
00:59 jberger could that mechanism be used to kill an active process?
01:05 meshl joined #mojo
01:51 bpmedley jberger: Are you saying i'm not using the pubsub pattern at all?
01:53 jberger it doesn't look like it could interrupt the wait, so it is essentially polling (if I read it right, which possibly I'm not)
01:54 jberger that looks more like a mailbox pattern (if that's the right word)
01:56 bpmedley jberger: i think you're correct, i'm not sure if i mis-interpreted the vision
01:57 bpmedley Also, how can an arbitrary command be sent?
02:05 jberger I think I would start with sending arbitrary signal-like values (to be run by "kill")
02:06 jberger other than that, probably by defining a runnable function beforehand, much like defining tasks
02:06 jberger I'd kinda have to see what sri has in mind
02:09 bpmedley jberger: I'm also eager to see what sri had in mind; also, in answer to your earlier question about killing an active process: yes, I think it's possible, and wouldn't take much code (I think).   Would you like me to add a kill msg?
02:51 noganex_ joined #mojo
04:13 kaare joined #mojo
06:23 Vandal joined #mojo
08:19 dod joined #mojo
08:24 dod joined #mojo
09:23 PORTUGAL joined #mojo
10:42 kid51 joined #mojo
12:02 dod joined #mojo
12:04 kaare joined #mojo
12:33 sri perl keeps gaining on tiobe http://i.imgur.com/qFLtCOr.png
12:33 sri curious trend
12:51 cuechan joined #mojo
13:08 mishanti1 joined #mojo
13:08 good_news_everyon joined #mojo
13:08 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vKG2d
13:08 good_news_everyon mojo/master 242afe3 Sebastian Riedel: fix a few typos
13:08 good_news_everyon left #mojo
13:18 mishanti1 joined #mojo
13:18 mishanti1 I don't think I'll ever get used to rebooting.
13:19 bpmedley mishanti1: Rebooting?
13:19 mishanti1 bpmedley: Yeah, powering down machines.
13:19 bpmedley Sorry, what I'm asking is what you are mean by "get used to".
13:21 mishanti1 bpmedley: Each time I have to do it it feels like so much wasted time. Starting everything back up after reboot.
13:21 mishanti1 Though I do know that it is not such a big deal, it is just the irrational part of me protesting. :)
13:21 bpmedley I see your point.  That process could be streamlined, especially with lots of extra stuff on server hardware.
13:22 mishanti1 bpmedley: On server hardwae yes. There everything is bootsafe, so that I do not worry about at all. :)
13:23 mishanti1 On my regular machines / devboxes I have a lot of random stuff running that I am not even close to making bootsafe.
13:24 bpmedley Interesting, by bootsafe do you mean "start up properly on boot"?
13:24 bpmedley If so, sounds like a reboot is like flailing around in a candy store.. :-P
13:26 mishanti1 bpmedley: I like it when a reboot is something that can be done at any time, without anything being affected (much).
13:26 bpmedley mishanti1: That makes sense.  I was just kidding around..
13:27 mishanti1 bpmedley: by "bootsafe" I mean "return to function like it was supposed to". That entails all services etc going back to running in a normal kind of way.
13:32 bpmedley For dev boxes, I wonder if Linux could have a flag in /proc/### that denotes the cmd should re-run on boot.  Then init scripts could save and restore state.
13:44 dotan joined #mojo
13:47 vicash bpmedley: you can use @reboot in crontab
13:47 vicash bpmedley: @reboot can be done at the user level... unlike /etc/rc.local which is done at the superuser level
13:54 bpmedley vicash: That makes sense.
13:55 bpmedley Possibly changing topic: If you're sending a few hundred thousand emails via minion, then how can progress be shown for the job?
13:57 vicash bpmedley: i use update_run_status() with the 'running' state and pass a serialized object to it. then i retrieve the state regularly to display progress
14:03 bpmedley vicash: Is update_run_status a custom sub?
14:05 vicash bpmedley: sorry. yes it is. i wrote it myself for my app but forgot that.
14:05 bpmedley Cool, can you share the relevant parts?
14:06 vicash bpmedley: what i do for tracking progress is during the task just invoke $job->app->model->update_run_status($job_id,$status,$object) where the update_run_status() sub is defined in my Model class.
14:07 vicash bpmedley: this sub then just writes the status and object to a custom table in the database which I then read when the progress bar needs to be displayed
14:07 vicash bpmedley: once the job is marked finished then the table entries for that job_id are removed
14:08 bpmedley vicash: I see.  You store a separate state outside of the minion tables?
14:08 vicash bpmedley: yes that's how i do it..
14:10 vicash bpmedley: there might be better ways to do this, but this is what i came up with. since i am already storing all the job_id's of scheduled tasks with Minion to display on a screen, i just added an extra TEXT column for state and keep updating that column while the job completes
14:12 bpmedley Thanks for sharing, I'll probably do something similar.
14:13 vicash bpmedley: sure. no problem. did you ever get to finish that dashboard for minion jobs . i think you called it "minion ui'
14:14 bumpy joined #mojo
14:15 bpmedley vicash: I believe that UI works, just needs some polish.  If my freelance continues (which I hope it does), then I'll have more reason to polish the UI.  Is there something specific you need?  Perhaps msg me privately?
14:23 mishanti1 joined #mojo
14:47 kid51 left #mojo
15:23 mishanti1 Have been converting some TT templates to Mojo::Templates this weekend. M::T templates are such a joy working with compared to TT templates.
15:23 mishanti1 Great work!
15:29 dod joined #mojo
15:47 dod joined #mojo
15:48 dod joined #mojo
16:08 sri wow https://github.com/Microsoft/BashOnWindows/issues/637
16:09 nothing joined #mojo
16:16 anton joined #mojo
16:17 nothing hi folks, bit new to perl and my googles aren't helping much on the following two items:
16:18 nothing if I send an invalid query to mojolicious, it returns an error page with debug info, I'd like to turn it off but can't see how
16:18 nothing basically just don't want to reveal what the service is running on
16:19 nothing and secondly, I can see some information about logging, but ideally I'd like to log things like origin IP, request URI and user agent, and haven't found something that tells me how to do that
16:19 bpmedley nothing: How are you deploying?
16:19 nothing do I have to break out all of the parts from the incoming request header manually?
16:20 sri i guess we need to explain that better in the docs
16:20 nothing bpmedley - not sure of the scope of that question
16:20 nothing I'm running a perl script as a daemon on debian
16:20 bpmedley nothing: Are you concerned about a production deployment that shows too much info?
16:21 nothing sorta, if you call running it off a VM at home as production :P
16:21 bpmedley nothing: Perhaps something like: ./myapp.pl daemon -m production -l http://*:8080
16:21 nothing it's exposed to the internets
16:21 nothing ahh so the -m flag defaults to debug?
16:21 bpmedley nothing: See the -m?  That set the "mode".  You can also use MOJO_MODE env var.
16:21 nothing I was expecting it to be some config within the script
16:22 nothing was looking in the wrong place :)
16:23 nothing ok, that part was easy enough
16:23 bpmedley nothing: Also, r.e. logging, do you want to log every request?
16:23 nothing yes
16:24 nothing although I might change that later, if it gets too noisy
16:24 nothing at first though I'll be curious as to what gets tried against my server
16:24 bpmedley I've used an under for that.  There's a few ways to approach the situation.
16:25 bpmedley Wait, you may just want an AccessLog plugin.
16:25 bpmedley nothing: https://metacpan.org/pod/Mojolicious::Plugin::AccessLog <-- I use htat one
16:26 nothing sounds likely, I just want to write something like "<timestamp> <source IP> <source port> <HTTP method> <request URI> <user agent>"
16:26 bpmedley plugin(AccessLog => {log => app->home->rel_file("log/access.log"), format => '%h %l %u %t "%r" %>s %b %D "%{Referer}i" "%{User-Agent}i"'});
16:28 bpmedley You might be able to simplify that (especially the format line).  I thought you might want an example.
16:30 nothing if I just want to log to /var/log/mojo.log I can remove the app->home-> etc right?
16:30 nothing and just specify a literal string "/var/log/mojo.log"
16:30 bpmedley Yes, that sounds accurate.
16:30 dod joined #mojo
16:34 nothing how do I get the plugin? "Can't locate Mojo/Plugin/AccessLog.pm in @INC" - can't find it with apt-cache search
16:34 bpmedley nothing: do you have cpanm?  If so, then you can: $ cpanm Mojolicious::Plugin::AccessLog
16:35 nothing I do now :)
16:36 nothing huh, just installed that plugin but I get the same error
16:36 bpmedley Are you using a user installed perl?
16:37 nothing nope
16:37 nothing just /usr/bin/perl on debian jessie
16:38 bpmedley nothing: Try this: $ perl -MMojolicious::Plugin::AccessLog -E 'say "worked"'
16:40 nothing worked with two Ms
16:40 nothing do I need to call it within the script as MMojolicious?
16:40 bpmedley Odd.  Are you using a full or lite app?
16:40 nothing ahh. Lite
16:41 bpmedley What's your "plugin" line in the app?
16:41 nothing ha
16:41 marty joined #mojo
16:41 nothing that's the one, it was Mojo::Plugin::AccessLog
16:42 nothing d'oh
16:42 bpmedley Cool.  We like easy issues.. :)
16:46 good_news_everyon joined #mojo
16:46 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vKGXO
16:46 good_news_everyon mojo/master 6544090 Sebastian Riedel: explain how mode changes affect built-in exception and not_found pages
16:46 good_news_everyon left #mojo
16:47 nothing awesome, it's working :D
16:47 nothing thank you!
16:55 sri still not entirely happy with those sections, maybe some reorganizing would be good
16:57 sri information is a little distributed, between the exception/not_found section in the beginning of the tutorial, the mode section in the end of the tutorial, and the custom exception/not_found section in the rendering guide
17:04 sri hmm, new laptop is still 400km distance from me, but planned delivery is tomorrow
17:04 sri *crosses fingers*
17:11 nothing what's the appropriate way to output static html? I can see rendering text, but I don't want to put the whole HTML as a string inside the script
17:12 nothing I would rather have it as a separate file and tell the app to return the contents of the file
17:12 nothing but when I try to look for the way to do it, I get lost in instructions for templating
17:12 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Tutorial#Static-files
17:13 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Serving-static-files
17:14 asarch joined #mojo
17:15 nothing will it know to use public/index.html when there is a request to '/'?
17:16 sri no
17:19 bpmedley nothing: get '/' => sub { shift->reply->static('index.html') }; <-- Perhaps a route like that?
17:20 bpmedley Although, that's basically the same as the Rendering example, isn't it.. my bad..
17:21 cuechan joined #mojo
17:21 nothing that's doing what the rendering thing wasn't though
17:46 dod joined #mojo
17:46 dod joined #mojo
17:47 bpmedley sri: You might consider: a) Referencing the Rendering Guide at the end of Tutorial#Mode and Tutorial#Built-in-exception-and-not_found-pages and b) Adding a paragraph about sensitive information in the Rendering Guide after "... The renderer will always try to find ..."
17:48 bpmedley I could make an example git diff, if you'd like..
17:52 sri sorry, i don't have enough time
18:10 nic http://news.dose.com/news/28328/Unemployed-People-Hawaii-Is-Literally-Begging-You-To-Go-Work-There
18:15 mib_vbkb4i joined #mojo
18:20 lluad joined #mojo
18:22 drivebyJerk joined #mojo
18:24 drivebyJerk If I want my plugins to contain static content is it legit to just shove their path into the static path when they load?
18:26 sri http://mojolicious.org/perldoc/Mojolicious/Guides/Rendering#Bundling-assets-with-plugins
18:27 drivebyJerk it's almost like people have asked this question before ...
18:28 Grinnz drivebyJerk, a lot of the documentation is literally written to answer questions that have been asked :)
18:31 drivebyJerk Handy.
19:50 marty joined #mojo
19:51 marty joined #mojo
20:01 cuechan joined #mojo
20:34 dvinciguerra joined #mojo
20:40 cuechan joined #mojo
21:01 CHYC joined #mojo
21:30 cuechan_ joined #mojo
22:01 meshl joined #mojo
22:26 PryMar56 joined #mojo
22:28 dvinciguerra joined #mojo
22:37 eseyman joined #mojo
22:46 marty joined #mojo
22:47 seatek joined #mojo
22:52 trone joined #mojo
23:38 PORTUGAL joined #mojo

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