Switch to DuckDuckGo Search
   April 20, 2017  
< | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | >

Toggle Join/Part | bottom
[00:00:18] <ipalreadytaken> ok great
[00:00:29] <ipalreadytaken> so no we need to get your enviroment setup
[00:00:40] <ipalreadytaken> start by installing leiningen
[00:00:49] <ipalreadytaken> apparently it works on windows: https://leiningen.org/
[00:01:02] <ipalreadytaken> its jsut a java app so it should be fine
[00:02:27] <bradende> I see it has a chocolately (a powershell package manager) installation package, so I'll use that: 'choco install lein'
[00:04:46] <bradende> Nevermind, that ruins everything. However, cygwin will use the bash script just fine, according to the github readme for leiningen
[00:08:14] <bradende> Ok, I have lein, and can launch for example, "lein repl" and get an interactive session
[00:08:34] <ipalreadytaken> cool
[00:08:54] <ipalreadytaken> ok before we do a repl lets get a couple files setup
[00:09:05] <ipalreadytaken> cp resources/public/config/config.js.example resources/public/config/config.js
[00:09:23] <ipalreadytaken> cp config.json.example config.json
[00:09:57] <ipalreadytaken> then we need to open config.json and point it to your fifo server
[00:10:27] <bradende> Is that the "ws:" directive, presently commented out?
[00:11:37] <ipalreadytaken> no the proxy ip
[00:11:41] <ipalreadytaken> it shoudl be the only one in there
[00:12:33] <bradende> Ah, I have that in ~/config.json.example, but not in resources/public/config/config.js.example
[00:12:43] <ipalreadytaken> ype
[00:12:46] <ipalreadytaken> two different files
[00:12:56] <ipalreadytaken> you dnot need to change the /resouces...
[00:13:13] <bradende> Ah, I misread. Thank you.
[00:14:31] <bradende> Ok ~/config.json has the appropriate IP, previous value being 127.0.0.1.
[00:15:17] <ipalreadytaken> yep. basically when we run the test code there is a localhost server that proxys to your fifo install so we dont have to worry about CORS
[00:15:24] <ipalreadytaken> so now you can start a repl
[00:17:27] <bradende> I have a lein REPL; cerberus.server=>
[00:17:34] <ipalreadytaken> now start it
[00:17:38] <ipalreadytaken> (run)
[00:17:51] <bradende> (away!)
[00:18:02] <ipalreadytaken> ok so give it a minute to compile everything
[00:18:24] <ipalreadytaken> it will say something like Successfully compiled "resources/public/js/app.js" when it is ready
[00:21:22] <bradende> run responded immediately with: #object[cerberus.server$run 0x103baee5 "cerberus.server$run@103baee5"]
[00:22:42] <ipalreadytaken> it is probably still going
[00:22:55] <ipalreadytaken> or did it return a promp?
[00:23:04] <ipalreadytaken> s/promp/prompt
[00:23:06] <bradende> Ah, it did return a prompt.
[00:23:34] <bradende> I have a few java processes waiting on network IO.
[00:23:46] <ipalreadytaken> is port 8888 in use?
[00:24:58] <bradende> Not presently, not processes listinening on that port.
[00:25:30] <ipalreadytaken> any other output?
[00:27:26] <bradende> No, afraid not. CR/LF just results in a new line and a prompt.
[00:28:06] <ipalreadytaken> any error when starting the repl?
[00:29:19] <bradende> Initializes logging, then nREPL listening on 172.0.0.1 - no error, that I see.
[00:30:13] <ipalreadytaken> and you entered (run)
[00:30:17] <ipalreadytaken> including the parens?
[00:30:49] <bradende> Not including the parens. Apolgies - I'll boost my font size up in IRC.
[00:33:33] <bradende> Indeed, [~]$ netstat -a | grep 8888 shows a listening port, now.
[00:33:48] <ipalreadytaken> cool so open a web browser and make sure you can login
[00:34:43] <bradende> Indeed I can, which shows the Cerb interface and takes the login sucessfully.
[00:35:01] <ipalreadytaken> nice so we now have a working dev enviroment
[00:35:16] <ipalreadytaken> now open up sublime text
[00:35:20] <bradende> Now we just need a working developer.
[00:35:33] <bradende> Sub is indeed open with the entire project.
[00:36:10] <ipalreadytaken> so all the important code you need to worry about is in src/cljs/cerberus
[00:36:43] <ipalreadytaken> every page has its own directory. each directory has an api, create, and view file
[00:36:50] <ipalreadytaken> we need to work with the api and view
[00:37:15] <ipalreadytaken> lets start with the api so that when we work with the view we have something to call
[00:37:41] <ipalreadytaken> so if we look at the api docs: https://api.project-fifo.net/docs/
[00:38:42] <ipalreadytaken> and search "hostname" on the page the 6th results points us to the correct call
[00:40:04] <bradende> The definition: https://YOUR_APP_HOST/api/2/vms/:uuid/config ?
[00:40:45] <ipalreadytaken> the important part to notice is that there is a body paramater "hostname"
[00:40:53] <ipalreadytaken> we also see there is one called "alias"
[00:41:12] <bradende> Ah, and these are presently working in the Cerb UI.
[00:41:28] <ipalreadytaken> we know from use that the website allows us to change "alias" so lets just look for that in the api.cljs
[00:43:27] <bradende> Right, and there's only a few places in cljs/cerberus/vms/api.cljs where "alias" and "hostname" appear.
[00:43:49] <ipalreadytaken> look around line 139
[00:43:59] <ipalreadytaken> there is a function called change-alias
[00:45:14] <ipalreadytaken> so just copy the whole function to the line below it, and change alias for hostname (4x)
[00:46:24] <bradende> Ok, that's done.
[00:46:57] <ipalreadytaken> so if you save it, you should see a little message in yoru browser that the file has been updated. assuming there are no errors we can move on
[00:47:20] <bradende> I see the REPL console has sent the notification.
[00:48:01] <ipalreadytaken> and it was successfully compiled?
[00:49:17] <bradende> resources/public/js/app.js is the file that compiled, and it indicates success.
[00:49:52] <ipalreadytaken> cool
[00:50:01] <ipalreadytaken> ok so now lets look at the view
[00:52:12] <bradende> Sure. though a bit trickier this time: the "change alias" UI is very different from the "Hostname" and "DNS Domain" sections.
[00:52:57] <ipalreadytaken> yep. so lets look at the "dns resolvers" section because that is closest to what we want
[00:53:02] <bradende> The header for that section is "Networking", and appears only once in the file, that's a neato clue.
[00:53:31] <ipalreadytaken> shoudl be around line 230 or so
[00:54:16] <ipalreadytaken> there will be a list rouping with the title DNS Resolvers
[00:55:02] <bradende> Yes, 229 I think set's the location in the windows (a column on the right for buttons) (g/col {:md 2}
[00:55:39] <bradende> 230 defines a button, and we get into resolvers a bit further from there.
[00:55:58] <ipalreadytaken> yep so copy that whole section and paste it a few lines up where you see the current hostname code (group-li "Hostname: " (:hostname conf))
[00:56:04] <ipalreadytaken> i would keep the old code for now
[00:56:12] <ipalreadytaken> just put the new code one line down
[00:56:22] <ipalreadytaken> that way we have a reference for a few minutes
[00:57:36] <bradende> Sure, I grabbed the entire resolvers group, and placed a copy under Hostname.
[00:58:18] <ipalreadytaken> ok so now lets modify a few things
[00:58:44] <ipalreadytaken> first off there is a section at the begining that starts with "let"
[00:59:14] <ipalreadytaken> that is for tracking if the value is "dirty" and if hte input is ok
[01:00:08] <ipalreadytaken> lets delete everything out of there except hte "munchanged" line
[01:00:18] <ipalreadytaken> make sure not to delete the closing ]
[01:04:46] <bradende> Sorry, 221 starts with ("group-li :"DNS Resolvers " , the only "(let " I have deals with ;maintain_resolvers
[01:04:54] <bradende> So I'm a little turned around.
[01:05:20] <bradende> Line 199: (let [global_mr (true? (get-in app [root :elements uuid :config :maintain_resolvers])
[01:05:51] <ipalreadytaken> yes sorry 199
[01:06:05] <ipalreadytaken> (my line numbers changed because i already modified the code)
[01:06:26] <bradende> Ah, ok, I just wanted to make sure we're looking at the same-ish stuff.
[01:06:40] <bradende> I've actually taken the entire
[01:06:40] <bradende> (group-li "Hostname: " (:hostname conf))
[01:06:40] <bradende> (group-li "DNS Domain: " (:dns_domain conf))
[01:06:40] <bradende> (let [global_mr (true? (get-in app [root :elements uuid :config :maintain_resolvers]))
[01:06:40] <bradende> munchanged? (= global_mr (:maintain_resolvers state))
[01:06:40] <bradende> rcurrent (cstr/join ", " (:resolvers conf))
[01:06:41] <bradende> runchanged? (= rcurrent (:resolvers state))]
[01:06:41] <bradende> (group-li
[01:06:42] <bradende> (g/row
[01:06:42] <bradende> {}
[01:06:45] <bradende> Oh nooooo.
[01:06:51] <bradende> I didn't mean to paste that at all.
[01:07:22] <ipalreadytaken> you want lines 199-218
[01:07:51] <ipalreadytaken> correction 199- 227
[01:09:46] <bradende> I have 196-244 excepted to its own file, and 199-218 between hortname and dns domain, starting at line 2.
[01:11:04] <ipalreadytaken> line 2?
[01:12:05] <bradende> Line2is now (let [global_mr (true? (get-in app [root :elements uuid :config :maintain_resolvers]))", so I'll kill that and also remove "global_mr"'s closing bracket..
[01:12:26] <ipalreadytaken> oh dont modify it in its own file
[01:13:20] <bradende> Ah, ok.
[01:13:36] <ipalreadytaken> here is what my section looks like
[01:13:37] <ipalreadytaken> https://gist.github.com/kevinmeziere/e7a1d63f8b8e626c3d2f992fc7215de0
[01:13:49] <ipalreadytaken> i will expalin a couple of things about it
[01:14:34] <ipalreadytaken> ln3: just a cheater function for comparing the saved value to the value in the field so that we can see if "save" is an option
[01:14:54] <ipalreadytaken> ln9: the text field should update the hostname
[01:15:16] <ipalreadytaken> ln10: the displayed value should be the hostname from local state
[01:15:45] <ipalreadytaken> ln17: we use our function from ln3 to see if hte save buttun is enabled
[01:16:28] <ipalreadytaken> actaully looking at it now it would make more sense if that function is called hunchanged? as its a falsy test
[01:16:42] <ipalreadytaken> so change that in your code
[01:17:09] <ipalreadytaken> then lastly on ln20 we are calling the change-hostname function that we created in the api file
[01:17:26] <ipalreadytaken> there is one more small chnage we need to make to the file so once you are ready let me know
[01:17:56] <bradende> ln3 and ln17 's|hchanged|hunchanged'
[01:19:05] <ipalreadytaken> yea because we are checking if it was unchanged not if it was changed
[01:19:31] <ipalreadytaken> h is just short for hostname
[01:20:49] <bradende> "(= (:hostname state) (:hostname conf)" is the test, "h-un-changed" is the label convention for clarity?
[01:21:35] <bradende> (Really hunchanged, just broke it into parts for example only)
[01:21:43] <ipalreadytaken> yep
[01:22:49] <bradende> Ah, and "disabled?" or "hunchanged?", the "?" actually asks for a falsy/truthy test.
[01:23:46] <ipalreadytaken> nope the ? is just part of the name. it just is a hint to the programmer that we are going to return a true/false
[01:23:59] <ipalreadytaken> (= .... ) is the test
[01:24:11] <ipalreadytaken> (= Object1 Object2)
[01:24:17] <ipalreadytaken> we are testing if two strings are equal
[01:26:01] <bradende> Well, I'll be needing to read some clojure docs, for sure. I'm pretty sure I have the One True Clojure open in a browser tab at home. Oi.
[01:27:02] <ipalreadytaken> http://cljs.info/cheatsheet/ is a great reference
[01:30:13] <bradende> Right, so we've another small change in the file to make?
[01:31:20] <ipalreadytaken> yep so you can see that we are getting the "hostname" value in the object "state". (:hostname state)
[01:31:36] <ipalreadytaken> so we need to define that
[01:32:04] <ipalreadytaken> look around line 69 or so and you can see where we are defining "alias" for the objec tstate
[01:32:29] <ipalreadytaken> just copy that to one line underneath and then s/alias/hostname (sx)
[01:32:35] <ipalreadytaken> * (2x)
[01:32:41] <bradende> om/IInitState - object?
[01:33:20] <bradende> OK, the change is made.
[01:33:24] <ipalreadytaken> (init-state is a function definition
[01:33:40] <ipalreadytaken> so when an component is loaded it runs that once
[01:33:50] <ipalreadytaken> so we are just giving it a value
[01:33:56] <ipalreadytaken> * initial value
[01:34:07] <ipalreadytaken> and of course creating the key in the object
[01:34:13] <ipalreadytaken> so you shoudl be able to save now
[01:34:20] <ipalreadytaken> and try it in your browser
[01:34:25] <ipalreadytaken> (might have to refresh)
[01:34:49] <ipalreadytaken> also make sure you are using 127.0.0.1 not the ip of your fifo server (as we havent deployed yet)
[01:35:45] <bradende> Right, it compiled, browser notified, I have a button.
[01:36:19] <ipalreadytaken> you should also have a modifieable text field
[01:37:28] <bradende> Indeed, and modifying it, and clicking the button results in vmadm get being able to grab that hostname
[01:39:11] <ipalreadytaken> ok so 2 steps left
[01:39:38] <ipalreadytaken> 1) fix any indentaiton and cosmetic things, commit, and then push to github
[01:39:49] <ipalreadytaken> 2) copy resources/public/js/app.js to your fifo server so you can use it
[01:40:25] <ipalreadytaken> resources/public/js/app.js is the compiled file that contains your changes
[01:44:19] <bradende> Checked my current changed in git diff, caught a couple more whitespace errors.
[01:48:21] <bradende> Ok, thank ipalreadytaken. I know that was longer that you'd hoped.
[01:48:30] <ipalreadytaken> no worries
[01:49:08] <ipalreadytaken> once you PR i will merge it
[01:59:56] <bradende> Do I need permissions to make a PR?
[02:00:02] <ipalreadytaken> nope
[02:01:02] <bradende> I need to push to test, first, to pr? Or should I be doing something else entirely?
[02:01:16] <ipalreadytaken> did you fork it on git hub first?
[02:02:20] <bradende> Nope, I guess I'll just fix that now.
[02:02:43] <ipalreadytaken> fork cerb into your username
[02:03:06] <ipalreadytaken> then change the git origin to github.com/yourusername/cerberus
[02:03:12] <ipalreadytaken> (or whatever it says
[02:03:22] <ipalreadytaken> then push your changes
[02:03:37] <ipalreadytaken> then you can make a pr
[02:06:58] <bradende> I have done so.
[02:07:16] <bradende> So the pr #19 has been made.
[02:07:50] <bradende> I don't at all wish to seem ungrateful, but I must flee the office now before I'm trapped for the night.
[02:08:08] <ipalreadytaken> ok
[02:08:12] <ipalreadytaken> thanks for your work
[02:08:19] <bradende> I appreciate the tutorial, I'll try to apply this knowledge tomorrow.
[02:08:21] <ipalreadytaken> ill review and merge later
[02:08:24] <ipalreadytaken> cool!
[02:52:28] *** ipalreadytaken <ipalreadytaken!~ipalready@2602:306:ce81:aab0:90ec:65d5:7573:8671> has quit IRC (Ping timeout: 260 seconds)
[02:53:03] *** ipalreadytaken <ipalreadytaken!~ipalready@108-232-26-171.lightspeed.sndgca.sbcglobal.net> has joined #project-FiFo
[02:53:03] *** ChanServ sets mode: +o ipalreadytaken
[03:06:48] *** ipalreadytaken <ipalreadytaken!~ipalready@108-232-26-171.lightspeed.sndgca.sbcglobal.net> has quit IRC ()
[06:38:14] *** Schaeferhund <Schaeferhund!schaeferhu@gateway/shell/sameroom/x-vturhpzcuykyimkz> has quit IRC (Remote host closed the connection)
[06:42:12] *** Schaeferhund <Schaeferhund!schaeferhu@gateway/shell/sameroom/x-udleesxygsnuemlw> has joined #project-FiFo
[07:55:03] *** shyu <shyu!~shyu@106.38.122.2> has joined #project-FiFo
[07:59:22] *** Schaeferhund <Schaeferhund!schaeferhu@gateway/shell/sameroom/x-udleesxygsnuemlw> has quit IRC (Remote host closed the connection)
[08:00:14] *** Schaeferhund <Schaeferhund!schaeferhu@gateway/shell/sameroom/x-deahgijdfvxuncgc> has joined #project-FiFo
[08:07:34] *** Schaeferhund <Schaeferhund!schaeferhu@gateway/shell/sameroom/x-deahgijdfvxuncgc> has left #project-FiFo
[08:08:28] *** Schaeferhund <Schaeferhund!schaeferhu@gateway/shell/sameroom/x-deahgijdfvxuncgc> has joined #project-FiFo
[11:07:24] *** liuzhen <liuzhen!~textual@218.241.172.114> has joined #project-FiFo
[12:33:24] *** shyu <shyu!~shyu@106.38.122.2> has quit IRC (Quit: Textual IRC Client: www.textualapp.com)
[12:59:23] *** liuzhen <liuzhen!~textual@218.241.172.114> has quit IRC (Quit: My MacBook has gone to sleep. ZZZzzz…)
[13:38:56] *** faithful <faithful!1fc4b2d2@gateway/web/freenode/ip.31.196.178.210> has joined #project-FiFo
[13:43:57] <faithful> Hi, anybody here? I need some info about LeoFS packages provided by Project FiFo.
[13:52:27] *** faithful <faithful!1fc4b2d2@gateway/web/freenode/ip.31.196.178.210> has quit IRC (Quit: Page closed)
[14:16:53] <Schaeferhund> [Mark (mark)] Hi, I can try and help but I've been a bit out the loop for awhile, whats up?
[16:45:04] *** shyu <shyu!~shyu@114.250.86.25> has joined #project-FiFo
[16:45:33] *** shyu <shyu!~shyu@114.250.86.25> has quit IRC (Client Quit)
[16:49:15] *** torriz <torriz!~torriz@unaffiliated/torriz> has quit IRC (Read error: Connection reset by peer)
[16:51:54] *** torriz <torriz!~torriz@4.90-149-122.nextgentel.com> has joined #project-FiFo
[16:51:54] *** torriz <torriz!~torriz@4.90-149-122.nextgentel.com> has quit IRC (Changing host)
[16:51:54] *** torriz <torriz!~torriz@unaffiliated/torriz> has joined #project-FiFo
[17:16:32] *** torriz <torriz!~torriz@unaffiliated/torriz> has quit IRC (Ping timeout: 252 seconds)
[18:19:38] *** torriz <torriz!~torriz@4.90-149-122.nextgentel.com> has joined #project-FiFo
[18:19:38] *** torriz <torriz!~torriz@4.90-149-122.nextgentel.com> has quit IRC (Changing host)
[18:19:38] *** torriz <torriz!~torriz@unaffiliated/torriz> has joined #project-FiFo
[20:35:19] *** bradende is now known as Bradend
[20:35:37] *** Bradend is now known as Bradende
[22:01:52] *** tomww <tomww!~tom@unaffiliated/tomww> has quit IRC (Ping timeout: 260 seconds)
top

   April 20, 2017  
< | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | >