Fork me on GitHub
#boot
<
2016-02-10
>
jethroksy01:02:21

ubermain is awesome btw, don't really know how it works but it does hahaha

jethroksy02:02:00

can someone explain why I can't connect to my repl that I booted up in docker?

micha02:02:31

@jethroksy: you probably need to use the --port option when you start the docker container

micha02:02:44

to expose the port the repl server is runing on

jethroksy02:02:49

it's started at port 1337 and exposed

micha02:02:21

you need to specify 127.0.0.1 for the client

jethroksy02:02:41

I get another error

micha02:02:48

can ou netcat to the port?

micha02:02:28

i guess the first thing you want to try is can you connect to the repl from inside the docker container

micha02:02:46

if you can then you want to see if the port is open outside the container

jethroksy02:02:24

not sure how netcat works

jethroksy02:02:31

nc 127.0.0.1 1337

micha02:02:28

or telnet

jethroksy02:02:31

I added the -u flag and typed some random stuff it says connection refused

micha02:02:50

i'd see if i could connect inside the container first

jethroksy02:02:52

but is it not tcp

micha02:02:57

to make sure the thing is running

jethroksy02:02:07

alright, sec

jethroksy02:02:34

it's running

micha02:02:25

that looks good, ok

micha02:02:48

oh i see the problem i think

micha02:02:59

you need to use 0.0.0.0 when you start the server in the container

micha02:02:06

otherwise it can't expose the port

jethroksy02:02:19

so in my build.boot i need to change the host

micha02:02:27

yeah for the server

micha02:02:39

the client will need to connect to 127.0.0.1 i believe

micha02:02:48

or the ip of the nic

micha02:02:58

i don't think you can connect a socket to 0.0.0.0

jethroksy02:02:08

web works on 0.0.0.0

micha02:02:23

TIL a thing

jethroksy02:02:40

i think it's a docker thing

jethroksy02:02:50

or a linux docker thing

jethroksy02:02:01

it doesn't use boot2docker under the hood...?

micha02:02:15

if you're on linux you don't use boot2docker

jethroksy02:02:29

I would if i used docker-machine + virtualbo

micha02:02:31

i think there is a replacement for boot2docker for osx now

jethroksy02:02:41

docker-machine is super cool

micha02:02:49

oh maybe that's the one

jethroksy02:02:51

hmm i set the host option

jethroksy02:02:57

no visible difference

jethroksy02:02:00

i'm looking at @jaen 's example code

jethroksy02:02:03

he used :bind

jethroksy02:02:31

that might do it

jethroksy02:02:52

yup that solves it!

jethroksy02:02:09

(and the repl runs on 0.0.0.0:1337)

micha02:02:41

i'm not sure if we need separate bind and host

jethroksy02:02:37

just read the docs

jethroksy02:02:40

bind is for server

jethroksy02:02:50

not sure about the terminology here

jethroksy02:02:11

host always sounds like a server thing to me

jethroksy02:02:26

then again as with OSS changing it would be breaking

jethroksy04:02:38

does ubermain pack stuff in :resource-paths too?

jethroksy04:02:47

hmm i inspected the jar and they're inside

pesterhazy07:02:02

@micha, @jethroksy , 0.0.0.0 specified as an address while connecting is equivalent to 127.0.0.1, but it's a sort of an implementation detail that people probably shouldn't rely on. Not even sure it works in all OSs/browsers

martinklepsch07:02:32

@pesterhazy: hah, I remember us having this conversation!

pesterhazy07:02:53

ah, that was you simple_smile

dm309:02:31

is there blessed way to load an initial ns when the repl starts? Like lein does with user.clj

pesterhazy09:02:20

there's an :init-ns option, @dm3

dm309:02:00

ok, will try that

thomas09:02:21

Good morning!!

thomas09:02:21

Hopefully a quick questionā€¦ I can now build a uberjar with boot, but how do I include the generated JS files in the uberjar?

thomas09:02:31

they are missing at the moment šŸ˜ž

thomas09:02:09

hmm ok.. the contents of my resources/ seems to be included in my .jar fileā€¦ but NOT in the resources dir.

thomas10:02:08

and thus my compojure server canā€™t find them

martinklepsch10:02:32

@thomas: how do you serve those files? if you serve them using wrap-resource they just need to be in the jar not in any particular directory (unless you specify a prefix)

thomas10:02:26

my compojure server serves some HTML that loads some JS and some CSS.

thomas10:02:39

previously I had those in my resources/ dir

mobileink12:02:08

core/aot still broken. it looks like core/add-resource is having no effect. i inserted a line to print the compile path, so i can see that the files are indeed being compiled to a temp dir in ~/.boot/cache but they are not being copied to the target dir.

mobileink12:02:51

the only way i can get it to work is to drop the fileset stuff and just set the compile-path to the output classes directory.

martinklepsch13:02:30

@mobileink: have you tried looking at the fileset with boot aot show --fileset?

mobileink13:02:19

didn't know about that, nice. it shows the correct list of files.

mobileink13:02:44

then boot aot -a emits a "Compiling..." message for each of the .clj files listed by boot aot show --fileset. but no class files are produce in the output dir.

martinklepsch13:02:07

@mobileink: what does the complete task you're using look like?

mobileink13:02:54

just boot aot -a . do you want my build.boot?

martinklepsch13:02:20

@mobileink: try boot aot -a target

mobileink13:02:30

ok, that generates files in ./target, although I have :target-path #{"build"} in build.boot

mobileink13:02:03

it also copies the .css file that is in the fileset, which is surprising

martinklepsch13:02:26

Do you have a boot.properties file that sets BOOT_EMIT_TARGET?

martinklepsch13:02:43

as long as that file was in one of your :resource-paths thats expected

mobileink13:02:20

~/.boot/boot.properties has BOOT_EMIT_TARGET=no

martinklepsch13:02:21

@mobileink: the implicit syncing to target is being deprecated. use the target task's options to influence into which directory the fileset is synced

martinklepsch13:02:47

@mobileink: that's why the files have not been saved into build previously

mobileink13:02:42

is proper use of target documented somewhere? i thought tasks were supposed to be independent, no? how do i use target's options in the aot task, or in a task I write?

martinklepsch14:02:54

@mobileink: you don'tā€”tasks work on/interact via the fileset, syncing the fileset to the filesystem is just another thing you can do with it

mobileink14:02:18

aha, so the actual task carried out by target is to configure syncing? that would make more sense - i never understood how "target" could be a task. oy. just realized i'm treating "target" as a noun - you mean it as a verb, right?

alandipert14:02:04

@mobileink: right, the target task syncs a fileset to a place on the user's filesystem

alandipert14:02:34

tasks only care about the fileset value, which is anonymous in that it doesn't correspond to a place on disk the user or tasks need to care about

mobileink14:02:38

does target actually carry out the sync, or just configure it?

alandipert14:02:23

in previous versoins of boot an internal/inaccessible thing did the sync, and it still does by default

alandipert14:02:43

but then we realized that was the wrong default and made a target task so it can be done explicitly

mobileink14:02:46

ok, i'm starting to grok to general design idea (finally). working in filesets does seem to require a certain shift in thinking.

alandipert14:02:03

yeah it's pretty weird congrats for hanging on šŸ˜„

mobileink14:02:07

thanks for writing boot! i'm pretty optimistic about it, actually - years ago i did release engineering for a multiplatform product so got very familiar with make and autoconf stuff, later looked into cmake and various other, then had to deal with gradle, leiningen, etc. i actually spend a few weeks designing my own idea of a build tool a few years back. boot is looking pretty good.

alandipert14:02:30

wow, thanks!

mobileink14:02:13

it seems like a good design idea, and i think using Clojure is the killer feature.

alandipert14:02:29

the key thing was lifting the problem to the clojure value level

alandipert14:02:34

"what if the filesystem was an immutable value"

alandipert14:02:44

i hope other things do this in the future

alandipert14:02:20

i have a sad every time i need to use other build things now šŸ˜¢

mobileink14:02:12

once I get a little more experience I expect to pitch in with some boot documentation. do you guys have one of those O'Reilly-style books in the works? not volunteering, just think boot deserves some detailed docs and handholding for noobs.

alandipert14:02:45

i'm not aware of one... but yeah that would be awesome

alandipert14:02:50

and thanks in advance for docs help

alandipert14:02:14

i feel like a "cookbook" treatment could maybe serve people best atm, parts of the wiki are kind of like that

alandipert14:02:44

but really anything you feel like contributing is most welcome

mobileink14:02:22

I would recommend changing "target" to "sync" or something that more obviously reflects its function. I had no idea what it was until just now.

mobileink14:02:53

How does a "Troubleshooting" page for the wiki sound? I'm going to write up a brief description of the problem I just had - where's my aot output? - but there's no obvious page for it on the wiki.

alandipert14:02:18

that sounds excellent

thomas14:02:56

hi, I have played a bit more and as mentioned above I can get my JS/CSS files in my jar fileā€¦ but I seem to lose the dir structure. Is there a way the dir structure can be maintained when adding file to the (uber)jar?

thomas14:02:35

I have tried :resource-paths and :directories so far.

jethroksy14:02:54

@thomas had the same problem today

jethroksy15:02:09

it ended up referencing files from outside the jar

jethroksy15:02:11

i ended up with: - target/project.jar - resources/public/...

jethroksy15:02:20

those two in some project root

thomas15:02:43

@jethroksy: that is far from idealā€¦ I would like to deploy just one artefact ideally.

jethroksy15:02:53

understandably

jethroksy15:02:11

are you using ubermain?

thomas15:02:11

ok, might do that as a work around.

jethroksy15:02:22

I'd love the correct solution as well

jethroksy15:02:37

I'm using yada, I figured that out by trial and error

thomas15:02:48

this my deftask:

thomas15:02:14

part of it at least

jethroksy15:02:52

the problem is unlikely a boot one

jethroksy15:02:32

you'll need something to add the artefacts into your jvm classpath and load it from there

jethroksy15:02:49

I wish I knew, but I don't šŸ˜•

laforge4915:02:46

If you add your artifact directory to the resources path, doesn't it put it in the jar and maintain the structure?

thomas15:02:15

but if boot could add the files to the (uber)jar and maintain the dir structure, wouldnā€™t that solve the problem?

thomas15:02:27

@laforge49: it doesnā€™t seem to do that šŸ˜ž

laforge4915:02:10

Create an issue!

thomas15:02:31

yesā€¦ I will.

jethroksy15:02:50

the directory structure is maintained in the jar

jethroksy15:02:16

it's just that whatever you're using to serve up the stuff isn't referring to it

martinklepsch16:02:12

@juhoteperi: should @import "../module/_xyz" work with sass4clj?

mobileink16:02:28

FYI I just added two new pages to the wiki: https://github.com/boot-clj/boot/wiki/Boot-Troubleshooting and https://github.com/boot-clj/boot/wiki/FAQ, with info on BOOT_EMIT_TARGET and the target task.

mobileink16:02:06

Please take a look at advise if you see any misinfo.

jethroksy16:02:44

Regarding ^ @micha you could, but it would work only one way: either the jar works or serving it from boot works

micha16:02:37

i think that's a problem with how the jar is constructed

micha16:02:02

you should be able to have the same classpath in the jar as what you have when you serve from boot

jethroksy16:02:15

So it is an issue?

micha16:02:17

alternatively you can use the sift task to move things around

micha16:02:23

i don't think it's a boot issue

jethroksy16:02:46

That's what I thought too

jethroksy16:02:00

But it's something boot should be able to universally solve

micha16:02:02

it's a feature that the files are relative to the classpath and not directly related to the files in the filesystem

micha16:02:32

i think i'm not seeing the problem

jethroksy16:02:51

For my case I have code like (yada "resources/public")

micha16:02:07

(yada "public")

micha16:02:18

leave off the resources, no?

jethroksy16:02:46

If I do that

jethroksy16:02:19

Then I have to set-env :resource-paths to #{"resources/public"}

jethroksy16:02:27

Then the jar structure would change again wouldn't it

micha16:02:30

i don't see why

micha16:02:41

:resource-paths #{"resources"}

micha16:02:47

and (yada "public")

micha16:02:00

that should work in both jar and local dev

jethroksy16:02:06

With public inside resources?

jethroksy16:02:21

I can't see why I didn't try that before

jethroksy16:02:34

I'm pretty sure it didn't work for me for some reason

jethroksy16:02:43

But yes its not fundamentally a boot issue

micha16:02:09

the idea is to provide a consistent interface to the files and whatnot

micha16:02:14

via the fileset

micha16:02:45

tasks don't know or care where the files come from

micha16:02:57

and in fact the files in the fileset are anonymous unnamed objects

micha16:02:07

associated with a resource path in the classpath

jethroksy16:02:24

Another thing: in 3.0 are the files still going to be locked?

jethroksy16:02:39

Files output in target

micha16:02:40

in 2.6.0-SNAPSHOT it should be fixed

micha16:02:56

can you try and let me know if it works?

jethroksy16:02:08

I had some problems with ubermain on 2.6.0 so I downgraded

micha16:02:14

you should be able to put 2.6.0-SNAPSHOT in a boot.properties file

micha16:02:32

yeah there could be a regression

jethroksy16:02:33

I'll upgrade again in the morning and let you know

micha16:02:40

which is why it would be good to test

jethroksy16:02:42

It was a class path thing

jethroksy16:02:54

Couldn't find some core namespace

jethroksy16:02:10

I'll try first thing in the morning

jethroksy16:02:16

Boot wouldn't release the locks on my target files even if shut down gracefully within docker

micha16:02:33

oh, docker is another thing

micha16:02:48

also boot doesn't lock anything

jethroksy16:02:22

But if I do boot dev I see the locks too

mobileink16:02:31

@alandipert: while we're at it, ok with you if I start adding wikipages for the predefined tasks? I've found I have to do a considerable amount of time digging around on the web to figure out how to use them, e.g. checkout (not to mention aot and target). might as well put the info on the wiki where it can be easily found.

jethroksy16:02:45

They disappear when I stop the tasl

micha16:02:49

i didn't write any code that locks files

jethroksy16:02:10

Anyway I'll try snapshot

micha16:02:22

how are you seeing locks?

jethroksy16:02:40

File permissions become read only

jethroksy16:02:40

In fact .nrepl-port is also affected

micha16:02:52

that's windows

jethroksy16:02:59

@mobileink predefined tasks have in built docs

jethroksy16:02:09

But I'm running arch on all my machines

jethroksy16:02:04

In fact most community tasks work the same way

micha16:02:10

files in the fileset are set to be read only

micha16:02:21

because if you write to them the fileset will be corrupted

micha16:02:30

and behavior from there on out is undefined

micha16:02:52

the fileset files are in an immutable content addressed store

jethroksy16:02:53

Iirc you mentioned they were hard links

micha16:02:04

hard links to those files in the store yes

micha16:02:18

so the links must have the same permissions as the files they link to

jethroksy16:02:28

The hard links are released when boot is terminated

micha16:02:43

they're filesystem hard links

micha16:02:54

they still point to things in the temp directories

micha16:02:13

but those temp directories are no longer referenced by anything when boot exits

micha16:02:23

and they will be deleted the next time boot runs

micha16:02:35

that will leave the hard links remaining

jethroksy16:02:40

That makes a lot more sense

jethroksy16:02:49

I was visualizing it wrongly

jethroksy16:02:12

In many ways I make a terrible programmer xD

mobileink17:02:18

@jethroksy: That's true, and once you know what you're doing boot <task> -h is very helpful. But when you're learning - well, when I was learning, at least - usage summaries are not very helpful. As I mentioned, I've had to spend a lot of time searching the web for explanations and examples, and even then I've had to go to the source to really understand. The point of wiki docs is that you have room to actually explain things.

laforge4917:02:07

So as you understand something that took some effort, add it to the wiki. If it is wrong, it can be corrected. If it is write, it helps the next guy.

laforge4917:02:03

The thing is, the topics you have difficulty with will vary from person to person. And who will take the time to carefully document something unless they were the one having trouble reasoning it out.

laforge4917:02:25

So there is never any point in complaining about the lack of material in the wiki. Only with complaining about inaccurate or dated material in the wiki.

laforge4917:02:17

And even then, once you've confirmed that the wiki was wrong, you can fix it yourself.

laforge4917:02:41

For myself, I have no js background and find even the simplest things in clojurescript rather difficult. So I've written a series of demo programs. https://github.com/aatree/aademos

jethroksy17:02:50

I was just pointing out that it was there, in case he didn't know. No complaints were made simple_smile

laforge4917:02:41

I thought this was a complaint: As I mentioned, I've had to spend a lot of time searching the web for explanations and examples, and even then I've had to go to the source to really understand. The point of wiki docs is that you have room to actually explain things.

mobileink17:02:48

@jethrosky: no prob,

mobileink17:02:53

@laforge49, @jethrosky: didn't mean it as a complaint, just an explanation of why I want stuff on the wiki

laforge4917:02:23

I've got tons of issues like that myself.

jethroksy17:02:39

I feel like the main turnoff for boot is that there are quite a few concepts to familiarize yourself with

jethroksy17:02:04

When things stop working its hard to figure out what went wrong

laforge4917:02:24

The only reason why I can manage at all is because my needs are small and I've gotten a lot of help.

jethroksy17:02:25

Really takes a while to ease in

jethroksy17:02:06

IMO its not something docs would immediately solve

laforge4917:02:07

How many days have I lost due to the error messages coming out of clojurescript? (shudder)

jethroksy17:02:28

Which is why micha has been such a huge help answering all our questions

mobileink17:02:29

@jethroksy: depends on the doc. really well written documentation goes a long way. unfortunately writing great doc is maybe even harder than writing great code. but we should try anyway.

laforge4917:02:17

If you do a bad job, some one else may fix or replace it. "That doc was really bad--even I can do better!" simple_smile

flyboarder18:02:36

@seancorfield: boot-expectations ..... I think I might like tests again :)

seancorfield18:02:14

Glad to help steer you back to the light šŸ˜¼

juhoteperi18:02:54

@martinklepsch: Re sass4clj, it's highly probable that there are some problems with relative imports currently, but if they work in other implementations they should also work with sass4clj (i.e. if they don't, it's a bug)

thomas21:02:58

@micha I have made some progress on this now (having read your conversation above)...

thomas21:02:10

but still not quite thereā€¦

thomas21:02:26

and that file is in: public/app.out/cljs_deps.js notice the missing js

micha21:02:18

you can move your .cljs.edn file

micha21:02:25

into a js subdirectory

thomas21:02:15

is that a sift task?

micha21:02:53

i mean the source file

micha21:02:36

although really where the deps.js file is should be an implementation detail

micha21:02:55

i would just change the html so it loads from wherever the js is

thomas21:02:37

but this in from the generated JS codeā€¦ I have update my html all ready

thomas21:02:13

yes.. I am very confusedā€¦ but thank you for all your help so far. it has been most welcome!!!

thomas21:02:51

is there a way to tell the cljs compiler where to put its output. in the cljsbuild on lein there is.

micha21:02:49

you do that by creating a .cljs.edn file

micha21:02:04

the location of that file provides all the configuration needed

thomas21:02:37

ok, Iā€™ll have a look at that one.

micha21:02:48

because with lein the :output-dir, :output-to, :source-map, :source-map-path, and :optimizations are all dependent on each other

micha21:02:29

if you start with just a simple thing, like this

micha21:02:37

mkdir src/foo
echo '(ns foo.bar) (println "hello")' > src/foo/bar.cljs
boot -d boot-cljs -s src cljs

micha21:02:47

with no build.boot file or anything

micha21:02:55

that's the best way to start

micha21:02:22

then you can create a .cljs.edn file

micha21:02:27

and so forth

micha21:02:39

without compojure etc

thomas21:02:21

ok I found itā€¦. going to play with that tomorrow.

thomas21:02:26

thank you again!!!

micha21:02:08

np! šŸ»