Fork me on GitHub
#hoplon
<
2015-10-09
>
roberto01:10:32

I just started playing with hoplon, and I’m trying to load the generated js by a hoplon project on another server. I’m doing this because I’m thinking of deploying the generated hoplon js file to a cdn and just load it into the html of a server. However, the generated html is looking for index.html.out/goog/base.js, which isn’t present in that path in the server.

roberto01:10:49

how can I modify the hoplon file so it searches for goog/base.js somewhere else?

roberto01:10:15

Or is this discouraged? If so, how do people deploy hoplon apps in production?

roberto02:10:51

Okay, I got it working using advanced optimisations for cljs in dev. Would be interested to know the recommended approach.

mynomoto02:10:14

@roberto: for production builds, advanced compilation is the recommended approach. During dev, the default (none) is faster.

roberto02:10:32

yeah, I understand, but I am building the hoplon app separate from the server. So in dev I wanted to be able to load the hoplon produced assets in the server app. Mainly because of authentication and wanted to conserve the flow.

roberto02:10:02

I can just switch to having the front-end and back-end in one app, but wanted to avoid that for now.

mynomoto02:10:40

Do you have a local server or is a remote one?

roberto02:10:55

local server for dev

mynomoto02:10:40

And you are copying the compiled file to the path the server uses for static content?

roberto02:10:05

no, in dev, I’m just loading it from the hoplon app that is running in dev mode

roberto02:10:21

in prod, will load from a cdn

mynomoto02:10:07

So in this case during dev you don't need to use advanced compilation. Only use it before sending it to the cdn. It will generate just one js file in this situation.

roberto02:10:42

yeah, I know, but in dev, without advanced optimisations, it can’t find goog.base.js

mynomoto02:10:07

Oh, that's unexpected.

roberto02:10:11

because it is looking for it in index.html.out/goog/base.js

mynomoto02:10:23

Did you use the template to generate the project?

roberto02:10:31

so, I wanted to see if I can modify the first part of the path

roberto02:10:34

yeah, I did

roberto02:10:47

I think we might be miscommunicating

roberto02:10:06

you are assuming that the project I created contains both front-end and back-end

roberto02:10:34

which is fine, I might just go down that route, I just don’t want to figure out how to deploy a boot app to Heroku.

mynomoto02:10:49

Yeah, I agree on the miscommunication. So if you used the hoplon template it has only the front end. No backend there. There is a serve task but is only for serving static assets.

roberto02:10:01

yeah, I know.

roberto02:10:29

I only wanted to focus on hoplon for now, didn’t want to yak shave with boot just to get familiar with hoplon.

roberto02:10:05

looks like I won’t be able to avoid it any further

mynomoto02:10:00

Yeah, hoplon doesn't work without boot. The files it generates are static and will work were you put them, but you will need boot to compile them.

roberto02:10:44

yep. I might still be able to keep my intended work-flow if I figure out how to use jwt in clojure ….

roberto02:10:53

hmm, decisions, decisions

mynomoto02:10:08

I use hoplon at work and all front end apps are static, nothing is bundled with the backend. We just deploy on s3 with cloudfront.

mynomoto02:10:53

I will be back in a bit.

roberto02:10:53

how does your dev workflow look?

roberto02:10:02

thank you a lot for the help

mynomoto02:10:16

The dev setup is like the one on the template. Run boot dev and point the browser to localhost:8000. Change some files, save and check the new compiled page. Rinse, repeat.

roberto02:10:47

yeah, how do you deal with auth in dev ?

roberto02:10:17

so, the main reason I wanted to load the assets in the server was because I’m using oauth.

roberto02:10:56

if I didn’t have to deal with authentication, this would be simple.

mynomoto02:10:02

We whitelist localhost on the port we use on dev for oauth.

roberto02:10:46

oh, cool. Thank you. Will do that.

levitanong06:10:15

Hi all, random question: Why do the hlisp files have a .hl extension? Why not just keep them .cljs?

alandipert13:10:07

@levitanong: re: .hl extension, we use that because the content isn't valid cljs, even tho the syntax is

alandipert13:10:35

and, because it's easy in most editors to recognize the extension as clj syntax for highlighting

levitanong14:10:05

Ahh, okay, thanks for the explanation, @alandipert!

flyboarder20:10:03

has anyone used friend authenticate with hoplon?

flyboarder20:10:14

this is probably more of a friend issue I would think

flyboarder22:10:52

nope it is infact giving me a castra.core exception but with the default Server Error message

symbit22:10:43

Has anyone gotten 'boot dev' with a hoplon project to work with windows after making a change to the index.cljs.hl file?

symbit22:10:54

changing the source file attempts to delete files in the .boot/cache/tmp/ directory. While this works in unix (deleting a file in use) you can't in Windows. You get the dreaded "The process cannot access the file because it is being used by another process." message when trying from the command line.

flyboarder22:10:39

I also had this issue

micha22:10:46

i hear it works with windows 10

flyboarder22:10:58

yeah that was my resolution

flyboarder22:10:10

would love to get more info if you are still having issues

micha22:10:18

oh right! i forgot

symbit22:10:28

Most big companies are still using W7.

micha22:10:57

the fileset stuff depends on being able to manage temp files without exposing them to the user

micha22:10:58

the problem is that somewhere some streams are being left open

symbit22:10:01

flyboarder your solution was to upgrade to W10?

micha22:10:23

forcing GC could fix that, but i don't know of any way to do that

flyboarder22:10:57

i am using boot in an app deployment scenario on windows, i only ran into that issue while developing on < Win10

symbit22:10:15

I haven't had to force a GC in several Java versions, it's System.gc();

micha22:10:37

that doesn't actually force it

micha22:10:51

there are probably tricks though, somehow

symbit22:10:54

Bummer. I'm don't have the liberty of upgrading from W7.

symbit22:10:26

Yeah, I think the terminology is request a gc to be performed.

micha22:10:56

streams get closed in their destructor if you don't explicitly close them

micha22:10:17

but they aren't finalized until they get garbage collected

micha22:10:30

so you end up with open streams for a short amount of time

symbit22:10:36

Micha, are you thinking the files that are trying to be deleted aren't closed in the first place?

micha22:10:55

yeah i think it's a pretty common thing for java programmers to do

micha22:10:31

normally Gc would run and the streams would close themselves

micha22:10:50

the things it's trying to delete are actually hard links

micha22:10:38

we make operations on the fileset efficient by moving hard links around instead of writing to files

symbit22:10:25

I wonder if you could create using WeakReferences might solve it.

symbit22:10:03

http://stackoverflow.com/questions/1481178/how-to-force-garbage-collection-in-java See post with 30 votes. However someone noted an issue with it.

micha22:10:20

this area of jvm programming is great

micha22:10:25

it's like alchemy

micha22:10:21

this might be the thing we need

symbit22:10:27

On save of the source, is it trying to clean up the current tmp directories and then create a new one?

micha22:10:51

no, it's moving where a hard link points to

micha22:10:01

all the actual files are stored in one directory

micha22:10:04

the "blob" dir

micha22:10:12

their names are the md5 hash of their contents

micha22:10:36

the files in the working directory that's on the classpath are just hard links into the blob dir

micha22:10:53

so when you change a file it gets copied into the blob dir first

micha23:10:09

then the hardlink gets updated to point to the new version

micha23:10:19

but the old version is still there in the blob dir

micha23:10:40

so you can hold onto a reference to a previous immutable fileset object

micha23:10:54

and you can basically restore the state of the filesystem from that

micha23:10:10

it would just more the hard links back to where they pointed previously

micha23:10:28

this is how we achieve the immutable fileset stuff

symbit23:10:40

Are you calling .close on the file streams explicitly, Micha?

symbit23:10:31

can you point me to the code that moves the hard links?