Fork me on GitHub
#boot
<
2016-07-23
>
richiardiandrea02:07:27

Finishing my day with a successful boot test notify -a -T pillsbury always makes me smile

micha02:07:48

haha me too

richiardiandrea02:07:05

it is the best theme ever!

isekream13:07:29

hey guys i'm new too clojure and i'm having a real hard time with boot

isekream13:07:08

I managed to get a "saapas" project up and running but I am not sure how the "watch/ reload" stuff works

isekream13:07:58

what is responsible for watching and reloading changes in cljs files? and does the browser auto-reload auto-refresh or do I do that manually?

nha14:07:28

Have you seen this file ? https://github.com/Deraen/saapas/blob/master/build.boot#L75-L82 The watch and reload tasks are there

isekream14:07:54

WELL THIS IS WHAT'S WEIRD

isekream14:07:22

this is an almost duplicate of my configuration minus the port and address settings

isekream14:07:41

so i'm not sure WHY it's not updating @nha

isekream14:07:41

does it have anything to do with me not having vim? I am running this in a vagrant virtualbox

isekream14:07:41

i have also set specific ports but everything seems to connect without errors.

isekream14:07:58

what could cause the browser NOT to be updated?

micha14:07:49

@isekream: does the browser js console show a message that the websocket connected and all that?

nha14:07:49

@isekream: definitely nothing to do with vim. The message should be "Reload websocket connected."

isekream14:07:02

yeah i get that

isekream14:07:12

"realod web socket connected"

isekream14:07:59

but when i edit the html, less or cljs files i do not see it being reflected unless I MANUALLY reload the browser i.e. F5

isekream14:07:08

do i need to "clean" anything so the browser doesn't get caught with cached files?

isekream14:07:12

Below is my log output ---------------------------------------- Starting reload server on <ws://localhost:9001> Writing adzerk/boot_reload/init2403.cljs to connect to <ws://0.0.0.0:9001>... Writing boot_cljs_repl.cljs... Starting file watcher (CTRL-C to quit)... Compiling {less}... 2 changed files. Adding :require adzerk.boot-reload.init2403 to main.cljs.edn... nREPL server started on port 9000 on host 0.0.0.0 - <nrepl://0.0.0.0:9000> Adding :require adzerk.boot-cljs-repl to main.cljs.edn... Compiling ClojureScript... ? js/main.js

isekream15:07:09

what does the ? js/main.js part mean?

isekream15:07:56

how important is are the sequence calls in executing tasks? should it be start-server-> watch->repl->cljs->reload?

micha15:07:50

reload should come before cljs

micha15:07:01

it generates cljs namespaces that need to be compiled

micha15:07:41

there aren't any stale files or anything with boot, so you're good there

micha15:07:46

there isn't a clean task

isekream15:07:49

can't explain why files are not being updated

isekream16:07:03

and why the browser not reload

isekream16:07:06

i'm using opera

isekream16:07:14

i guess boot only works with chrome?

isekream16:07:06

i don't have chrome on my system

isekream16:07:15

i don't have chrome on my system

isekream16:07:33

does boot work in vagrant? maybe that's the problem?

isekream16:07:53

ok question how do you update a file? via repl? or editor?

isekream16:07:33

i mean get the web page to come up

isekream16:07:33

i get the logs

isekream16:07:33

the console outputs

isekream16:07:39

says web sockets updated? but nothing happening when i try to edit/ modify any of the files....NOTHING happens no logs no compilation sequence no browser reload. i literally have to F5 everytime i edit the page

isekream16:07:50

ah i'm looking at a boot.clj file in the saapas project and i note (disbale-realod!) i not it was set

isekream16:07:57

could this be whats' causing it?

isekream16:07:28

if cljs files are loaded in the cache how does the project know when system files are modified?

isekream16:07:21

when looking at the logs after running boot dev

isekream16:07:26

i notice this bit Compiling ClojureScript... ? js/main.js Elapsed time: 49.659 sec

isekream16:07:44

does it mean it can't find the target directory?

isekream16:07:54

not sure because everything seems to load fine

isekream16:07:18

got to admit ....nodejs was so much simpler

micha17:07:27

@isekream: can you paste your build.boot file?

micha17:07:36

or make a repo with what you have

micha17:07:45

that would be the easiest thing

micha17:07:20

there may be some issue with how you have vagrant set up

micha17:07:25

i can't really help with that

isekream17:07:30

with the exception of the host names and ports the boot file is pretty much the same

micha18:07:18

@isekream: how are you running it?

isekream18:07:40

@micha i am not even sure what you mean by that i have a ubuntu virtual box running on OSX i'm running boot dev from the bash at root level. I have 3 ports available on the vagrant box all of which have responded well as i am able to repl remotely using http://atom.io editor

isekream18:07:47

i am able to view the demo app via the browser through localhost. i get the "reload connected" console.log

micha18:07:00

and when you edit a file in http://atom.io, does it rebuild?

micha18:07:17

are you on OSX?

isekream18:07:21

not to me knowledge

micha18:07:38

you'd see a thing with "elapsed time 0.123s" or something

isekream18:07:40

running ubuntu in virtual box on OSX

micha18:07:53

boot would print that

micha18:07:58

when it rebuilds

isekream18:07:11

well it happens on 1st run

micha18:07:30

i wonder if vagrant isn't seeing the changes

micha18:07:42

are you sure the volume is mapped correctly?

micha18:07:50

can you diff the file in the vm and see your changes?

isekream18:07:58

otherwise i would not see the files

micha18:07:37

just verify that when you update in atom it really is visible in the vm

micha18:07:53

i have had issues with docker on OSX with this

micha18:07:08

and the solution there was to use the rsync method of mapping the volume

isekream18:07:11

well let me try it

isekream18:07:44

i confirm that i see the changes in vim

micha18:07:02

but boot does not rebuild?

micha18:07:39

can you try without vagrant? just to eliminate vagrant configuration as a cause

micha18:07:28

i think all you need is boot.sh and java 1.7+

micha18:07:49

java 1.8 is preferable

micha18:07:04

but 1.7 also works

isekream18:07:51

i edited the file in vim

isekream18:07:56

and it worked!

micha18:07:55

vim is running inside the vm, but atom is not?

micha18:07:54

i wonder if the vm isn't firing the filesystem events properly

isekream18:07:13

vim is on the VM

micha18:07:36

what if you use vim in OSX to edit?

micha18:07:47

maybe http://atom.io is doing something weird?

flyboarder18:07:51

@isekream: how are you mounting the folders?

isekream18:07:36

i am config.vm.synced_folder ".", "/home/vagrant/app"

isekream18:07:54

the folder syncs with the copy in the VM

flyboarder18:07:59

"atom locks files over the network and does not release them”, seems to be a known issue for a while now

isekream18:07:12

all this time

isekream18:07:23

been at this for 1 week

isekream18:07:33

😞 😞

isekream18:07:46

i connect to the repl via atom

isekream18:07:58

and i see the changes in atom int he vim

isekream18:07:07

so i'm not sure what the locking has to do with it?

flyboarder18:07:20

but I bet there is some lock that prevents boot from getting the update about the change

isekream18:07:22

the end result is atom CAN modify the file

isekream18:07:34

well technically

isekream18:07:48

is copied over to the vagrant folder

isekream18:07:14

could it be the boot isn't seeing the copy rather than edit?

isekream18:07:20

edit/ saved

flyboarder18:07:37

it’s probably a sync issue

isekream18:07:56

@flyboarder: care to elaborate?

flyboarder19:07:43

like however vagrant filesystem is syncing the copy, there is probably something that isnt releasing the copy so things think that an action on the file is still taking place

micha19:07:52

it could be that atom is interfering with that somehow

isekream19:07:05

well here's what happened

isekream19:07:10

i modified the file in atom

micha19:07:15

if you run boot with the -vv option like boot -vv dev you can see a lot of debug output

isekream19:07:19

and note there was no reload

isekream19:07:25

so i opened it up in vim

micha19:07:34

vim in the vm or in OSX?

isekream19:07:53

vim in the vm

isekream19:07:57

vimid in the vm

micha19:07:09

what if you edit with vim in the host?

isekream19:07:23

gonna try that

micha19:07:26

that would be an illuminating experiment i think

isekream19:07:41

side note what is this -> ;; :open-file "vim --servername 0.0.0.0 --remote-silent +norm%sG%s| %s"

isekream19:07:57

it was a parameter in reload that i commented out as I wasn't using vim

micha19:07:14

oh that's for when you click on an error message in the heads up display i think

micha19:07:27

it can navigate you to the place where the problem was

isekream19:07:53

so i opened up the file in vim from on the host

isekream19:07:06

modified it

isekream19:07:14

when back into the guest

isekream19:07:23

browser reload

isekream19:07:47

i guess the thing is VM syncing is not the same as vim editing

flyboarder19:07:47

Ok but could you see the changes in vim guest os?

micha19:07:50

sounds like some kind of caching/buffering issue in the syncing between vm and host

micha19:07:09

like it's not really updating the file until something opens it

micha19:07:22

what if you change the file in the host

micha19:07:32

and then you stat it in the vm?

isekream19:07:34

nothing happens

micha19:07:42

like using stat(1)

isekream19:07:58

the changes are reflected only when i touch it in the guest

isekream19:07:03

rather thant the host

micha19:07:14

opening the file in vim shouldn't change anything

micha19:07:27

boot rebuilds just when you open the file in vim in the guest, right?

isekream19:07:32

mind us that in VM its two different files that get sync'd over the network

micha19:07:33

like you don't need to save it?

micha19:07:50

so what about ls -l or stat?

isekream19:07:58

in the guest?

micha19:07:58

does that also trigger a rebuild?

micha19:07:14

i'm curious what's triggering the rebuild, opening the file or just statting it

isekream19:07:44

opening the file

micha19:07:48

it's impractical for boot to open every file, of course

micha19:07:13

are you running with boot -vv dev?

micha19:07:28

if so do you see anything printed when you edit the file in the host?

isekream19:07:31

but this would mean that the reload is tied to only when the file is opened or saved rather than copied?

micha19:07:40

there is a lot of debug output about the filesystem watcher state in there

micha19:07:57

well the reload is triggered by the watch task

micha19:07:08

which just invokes the rest of the pipeline

micha19:07:26

(the pipeline is nested middleware, each layer invoked from the previous one)

micha19:07:48

the watch task itself is triggered by a callback set on the filesystem events api

isekream19:07:01

filesystem event

isekream19:07:09

then copying should be an event?

isekream19:07:17

i guess everyone assumed we would be editing

micha19:07:33

well when you edit a file it will fire an event, or when you create a new file, etc

isekream19:07:42

the file is being edited in the host environment and then copied to the guys environment

isekream19:07:04

that is the problem

micha19:07:06

copying would involve either overwriting the target or modifying it in place, or creating it if it doesn't yet exist

flyboarder19:07:14

Have you tried turning off udp in vagrant nfs settings?

micha19:07:16

all of those should trigger a fsevent

isekream19:07:35

no @flyboarder what will that prove?

isekream19:07:48

hang on i'm going to run a test with -vv on

micha19:07:55

yeah i mean it works fine without vagrant, or even in vagrant without the filesystem volume syncing

flyboarder19:07:55

I'm wondering if vagrant is the issue

flyboarder19:07:16

I'm looking at its docs for file syncing

micha19:07:28

definitely looks like that's the culprit to me

micha19:07:11

like i said above, we had to use rsync with docker on OSX because of similar issues

micha19:07:34

actually the issues we saw were even worse, sometimes it would make corrupted or truncated files

flyboarder19:07:37

You could also try the rsync option

flyboarder19:07:45

Vagrant has an rsync option

isekream19:07:03

ok tried editing in atom which would sync the file in the guest and nothing happened

isekream19:07:16

then i vim'd it in the guest and got a whole bunch of commiting

isekream19:07:20

then ---------

isekream19:07:21

Commit complete. Released [email protected][Permits = 1]... Acquired [email protected][Permits = 0]... Syncing project dirs to temp dirs... Filesystem: copying js/main.cljs.edn... Filesystem: copying frontend/.core.cljs.swp... Sync complete. Released [email protected][Permits = 1]...

micha19:07:30

looks good

micha19:07:44

among all that garbage is specific information about the fsevents

micha19:07:56

like which files it thinks changed etc

micha19:07:05

but that looks normal to me

micha19:07:20

so i think it's very likely the syncing that's not working correctly

micha19:07:25

the vagrant configuration

micha19:07:37

because boot is just using the linux filesystem events api there

micha19:07:57

and it's not getting any events when you edit in the host

isekream19:07:28

going to try the rsync

isekream19:07:48

@micha you mentioned something about you having the same issue....how did u resolve it?

micha19:07:08

this looks relevant

micha19:07:18

we used rsync instead of mapping the volume

micha19:07:37

looks like nfs doesn't support inotify

micha19:07:48

which would mean that the changes are invisible to the watch task

flyboarder19:07:12

This needs to go on the wiki!

micha19:07:22

@isekream: you can verify this for sure with the inotifywait program in the guest

isekream19:07:43

πŸ‘ i guess this whole week of sleepless night and energy life soul sucking agony has finally paid off huh 😞

micha19:07:52

haha sorry about that

micha19:07:01

why are you using vagrant, if i may ask?

micha19:07:10

boot works great on OSX

isekream19:07:22

trying to keep the OSX clean of installs

isekream19:07:32

i have too many environments for various projects

isekream19:07:45

my disk space is deminishing

flyboarder19:07:58

@isekream: I have this issue also, means rebuilding my Mac every so often

isekream19:07:12

so when i need to run a particular env for project i prefer to box it in

micha19:07:21

i guess one debugging technique for VMs is to first try working entirely inside the vm

isekream19:07:36

then just back it up to a NAS

isekream19:07:42

then rove the project from the mac

isekream19:07:53

my OS X has been good to me

isekream19:07:00

don't wanna see her gain too much weigth

micha19:07:42

lol i just get a new one every couple of years

isekream19:07:43

will check out the notify program

micha19:07:44

the inotify-tools package has stuff you can use in shell scripts to access the fsevents api directly

micha19:07:05

my guess is that those tools won't see the events fire either

micha19:07:09

in the guest

micha19:07:27

if that's the case then we've isolated the cause of your issue

isekream19:07:48

ok well before i go with the rsync which i gotta admit i'm not keen on doing

isekream19:07:58

i'm gonna try the notify stuff

isekream19:07:46

gonna let u guys know what happens in a bit

isekream19:07:29

question @micha do i run inotify before or after running boot?

micha19:07:45

after, i think

micha19:07:56

@isekream: like for example:

micha19:07:23

$ inotifywait src/foop.cljs

micha19:07:41

then edit foop.cljs in the host

micha19:07:50

and see if it prints something

micha19:07:45

don't even really need boot to be involved i guess

micha19:07:53

to test the inotify stuff

isekream20:07:44

@micha @flyboarder tried using inotifywait and the following happened :-

isekream20:07:04

editing the host file turned up nothing

isekream20:07:20

but editing the guys file did

isekream20:07:26

vagrant is doing something

micha20:07:40

yeah if it's using NFS to sync then that would explain it

micha20:07:13

does atom have a server/client mode?

micha20:07:18

like vim and emacs have?

micha20:07:26

cause then you could have the atom server running in the vm

micha20:07:34

and connect to it from the client in the host

micha20:07:38

and that would solve that problem

isekream20:07:35

hmm not sure will check

flyboarder20:07:48

@isekream: what is the issue with using rsync?

flyboarder20:07:57

apparently rsync-auto is the default behaviour for vagrant with rsync

flyboarder20:07:26

I would imagine that the forced sync would fire the fs events

flyboarder20:07:48

you can also run rsync with sudo on guest

flyboarder20:07:05

if the destination folder is restriced

isekream20:07:36

still checking running into some errors with vagrant and rsync

isekream20:07:44

this is outside the scope though so

isekream20:07:48

debugging........

isekream20:07:03

@flyboarder: @micha: YOOUUUREEEKKAAA! we did it!

isekream20:07:43

using vagrant with rsync triggers reloading when modified outside the guest environment

isekream20:07:20

yep reload events triggered

isekream20:07:07

thanks guys for the extra help. I'm hoping the boot heads take note of this and add this to the troubleshooting/ support documentation

madstap22:07:31

I'm trying to install boot, and I've copy-pasted the sudo bash -c "cd /usr/local/bin && curl -fsSLo boot && chmod 755 boot" command from the README. But when I try something like boot repl I get this error. Can anyone give me any pointers?

Exception in thread "main" java.io.IOException: No such file or directory
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createTempFile(File.java:2024)
	at Boot.download(Boot.java:168)
	at Boot.install(Boot.java:224)
	at Boot.main(Boot.java:250)

madstap22:07:16

Please ignore that... It worked all of a sudden....