Fork me on GitHub
#hoplon
<
2016-05-12
>
leontalbot00:05:44

@devn didn't know about Electron. I think Hoplon targets browser apps. Don't know if it is possible to decently interface with js lib for desktop apps.

leontalbot01:05:38

@micha @piotrek it doesn't answer your question but today I needed to reuse rpc fn, passing message-cells as params.

leontalbot01:05:41

(defn conj-db! [success-cell error-cell process-cell]
  (mkremote 'app.api/conj-db!
            success-cell error-cell process-cell))

leontalbot01:05:12

And then I call it in a hl page, "closure style"

leontalbot01:05:55

(defc form-send-success nil)
(defc form-send-error nil)
(defc form-send-process [])

((rpc/conj-db! 
   form-send-success
   form-send-error 
   form-send-process)
 form-data)

leontalbot01:05:22

Untested, but that was what I had in mind

leontalbot01:05:04

So I can reuse rpc for multiple pages, each of which have their own message-cells

leontalbot01:05:36

Again untested

leontalbot01:05:31

((get-widget-data result-cell errors-cell loading-cell) date-from date-to)

thedavidmeister02:05:35

@alandipert: thanks! actually, making information go in two directions is something i might need a hand with later

thedavidmeister02:05:22

@alandipert: also, not sure if you remember, but you gave me this snippet ages ago to help me get up and running on heroku

thedavidmeister02:05:27

(deftask build-heroku-war
  "Build a war for deployment"
  []
  (comp
    (hoplon)
    (cljs :optimizations :advanced)
    (prerender)
    (uber :as-jars true)
    (web :serve 'app.handler/app)
    (war)
    (target :dir #{"target_prod"})))

thedavidmeister02:05:41

how do I get that to use http-kit?

thedavidmeister02:05:46

apparently that is needed for sente to work

thedavidmeister02:05:19

this is what my local dev looks like

thedavidmeister02:05:22

(comp
    (watch)
    (serve
      :port    8000
      :handler 'app.handler/app
      :init 'app.network.core/start-router!
      :cleanup 'app.network.core/stop-router!
      :httpkit true)
    (speak)
    (hoplon)
    (reload)
    (cljs)
    (target :dir #{"target_dev"})))

thedavidmeister02:05:22

@micha that navy video is cool, i think @meeli might start using it in a training course she runs on FE development (she already mentions hoplon simple_smile )

thedavidmeister02:05:46

@alandipert: mostly, i noticed that the web task doesn’t take the same parameters as the serve task

micha03:05:57

do you have a servlet container that runs http-kit to deploy to?

micha03:05:23

the war file is the servlet part that is loaded into a servlet container like jetty or tomcat

micha03:05:32

that is the web server basically

micha03:05:07

if you want to run http-kit i think you'll need to deploy an uberjar or something like that, not a war file

alandipert03:05:22

this navy computer video is incredibly well produced

alandipert03:05:40

these animations and illustrations are so much better than the powerpoint garbage of today

alandipert03:05:21

the concept of making a continuous computer out of gears, also awesome

alandipert03:05:32

no need to settle on your number system or endianness

alandipert03:05:48

unitless values

micha03:05:52

you still need to decide if negative numbers are to the left or right

alandipert03:05:01

that's true, or if negative is even a thing lol

alandipert03:05:10

i guess also you need to scale it to the bounds of your inputs

alandipert03:05:24

it's like a nomogram in this way

micha03:05:44

there is a sweet video about "planetary gears" from the army too

micha03:05:54

that's how they make the tank transmissions for the tracks

micha03:05:10

like how you can make one set of tracks go in reverse and the other ahead etc

micha03:05:28

ingenious gears

alandipert03:05:06

it's sweet the way training videos break down the concept into themes

alandipert03:05:09

like The Working Surface

alandipert03:05:22

like aspects of the problem relevant to the domain

alandipert03:05:32

so you have perfect working vocab for this subset of things about gears

micha03:05:47

i was looking at how you machine gears

micha03:05:52

there is a ton of nomenclature there

micha03:05:04

"dimetrical pitch" is a good one

micha03:05:29

i can imagine being a machinist

micha03:05:41

that's basically what we do

micha03:05:59

like their job was to construct machines that make parts of other machines

micha03:05:10

like to machine a gear you need to construct a jig

alandipert03:05:17

functional form = jig

micha03:05:22

so you can cut the gear accurately

micha03:05:27

well like "tooling"

micha03:05:43

we make computer programs to make parts of computer programs

alandipert03:05:52

i was thinking in the language itself though

alandipert03:05:01

mostly machinery to support the very limited machine that solves the problem

micha03:05:37

well like if you want to build a really complicated machine, like the navy targeting computer

micha03:05:49

you need to build a bunch of other machines first

micha03:05:54

that help you manufacture the parts

micha03:05:05

and of course those are built with other machines

micha03:05:22

pretty much the same thing we do

alandipert03:05:10

unfortunately because it's cheap to store and ship the software they make us change it in place all the time

micha03:05:15

their "spec" was some drawing from the engineering department

micha03:05:20

that may or may not make sense

micha03:05:32

i think it was the same though

micha03:05:43

like the dude in the drafting room can draw anything

alandipert03:05:54

true, then the machinists are the ones who really have to figure it out

thedavidmeister03:05:58

yeah, seriously, like someone just says “make this reciprocal curve"

micha03:05:02

but the machinist looks at it and says "we can't make that at that cost"

thedavidmeister03:05:03

and that’s the spec

micha03:05:32

yeah and they had to invent fiendishly clever tooling

micha03:05:46

"dividing plates" are interesting

alandipert03:05:54

seems like a legit way to work though, somebody needs to cut the problem down into smaller more attackable problems

micha03:05:55

like if you need to cut a gear with 40 teeth

micha03:05:15

you need a thing that can precisely divide a circle into 40 parts

micha03:05:34

and that you can connect to your milling machine to turn the gear when you cut it

micha03:05:45

and you use the machine to make that thing

micha03:05:38

yeah i think we're basically machinists

alandipert03:05:39

satisfying to think about

micha03:05:47

and the "engineer" is the business guy

thedavidmeister03:05:33

@micha i think i just need to know more about how java works

thedavidmeister03:05:51

@micha @alandipert helped me gloss over that bit when i first got setup

thedavidmeister03:05:59

this is what heroku is doing

thedavidmeister03:05:01

java $JAVA_OPTS -jar webapp-runner.jar ${WEBAPP_RUNNER_OPTS:-"--expand-war"} --port $PORT ./target_prod/project.war

micha03:05:28

@thedavidmeister: so you can make a uberjar and just run it like that, no?

micha03:05:41

instead of the webapp-runner.jar, whatever that is

alandipert03:05:51

we made an app like this for work, i'll share relevant parts

alandipert03:05:06

the build.boot. the build task makes an executable jar, the main class of which is sinmara.main-class https://gist.github.com/alandipert/2a8ea734cf0e8a013e949620791a01d4

alandipert03:05:59

main class is basically stub that exists just to be AOT'd. all it does is call sinmara.run/-main https://gist.github.com/alandipert/bcea48dc2eb0e3502d4b5566180ecb0e

thedavidmeister03:05:01

i guess webapp-runner is something heroku does

alandipert03:05:51

sinmara.run is where we actually start the web app using run-jetty. this is where you'd start your app to run with http-kit - https://gist.github.com/alandipert/a2326dd6fe669a4ca4f00e316eb39a8f

alandipert03:05:22

so to build for deployment you do boot build which makes target/project.jar

thedavidmeister03:05:50

so i have a server thing that is running my code for me

alandipert03:05:50

and to run in prod do java -jar target/project.jar

thedavidmeister03:05:55

but i want my code to run a server thing inside it

alandipert03:05:06

i think so, yeah

alandipert03:05:15

basically you want your program to be the entrypoint

alandipert03:05:22

not the web server they provide

thedavidmeister03:05:36

yeah, that would give me a lot more control

alandipert03:05:40

i think this is achievable with a Procfile or something but my heroku is rusty

thedavidmeister03:05:47

that would have made zero sense to me when i was first getting setup, lol

alandipert03:05:12

welcome to the java world, all shenanigans all the time

alandipert03:05:32

i think owning the entrypoint is the way of the future, in this age of virtualization

thedavidmeister03:05:32

i definitely feel like a lot of this would make more sense if i had a java background

alandipert03:05:42

web app containers etc existed kind of because they didn't have docker or VMs imo

thedavidmeister03:05:56

yeah, where do you guys normally host your stuff?

thedavidmeister03:05:06

i’m getting one of the guys at work into clojure

thedavidmeister03:05:16

and he’s been messing around with docker

micha03:05:25

also war files were good for enterprise things where they needed to have like a multi tenant thing

micha03:05:40

different pieces of the organization deploying their application in the same server

micha03:05:48

so none of them could own it

thedavidmeister03:05:06

yeah, that’s no my goal

alandipert03:05:10

yeah coconut VMs

thedavidmeister03:05:03

straight AWS is pretty “raw"

alandipert03:05:10

i found docker great for local dev, but i'm :thumbsdown: for deploying to it

alandipert03:05:18

or otherwise relying on it in prod

alandipert03:05:31

docker compose is esp. awesome for local dev

thedavidmeister03:05:42

why bad for production?

alandipert03:05:00

we have VMs already to virtualize unix environments

alandipert03:05:23

they don't come up as quickly as docker containers, but then most apps don't restart constantly

alandipert03:05:42

sticking with VM also removes a debugging layer that can get pretty hairy

thedavidmeister03:05:53

yeah, at work we use vagrant, with a new environment for each branch

thedavidmeister03:05:07

getting it up and down fast is pretty critical there

thedavidmeister03:05:16

so we will probably move to docker at some point

alandipert03:05:12

if you use vagrant to build images then it starts to compete with docker for startup time probly

alandipert03:05:25

that's what we're moving toward at work, with chef anyway

thedavidmeister03:05:31

we rebake our images each night automatically

alandipert03:05:33

using our legacy chef things to build images, that we then deploy from

thedavidmeister03:05:39

then send the images to the devs using btsync

thedavidmeister03:05:52

if they have to build the environment from scratch each time it’s very slow, like 20m

alandipert03:05:59

oh, so this is for devs tho

alandipert03:05:02

so :thumbsup: docker then

thedavidmeister03:05:04

but if they just pull up an image it’s like 4m

thedavidmeister03:05:20

yeah, well we set all this up when docker was pretty new

alandipert03:05:42

seems like moving to docker for this would be pretty straightforward

thedavidmeister03:05:01

yes, but it’s a matter of priorities, not whether we can/can’t do it 🙂

alandipert03:05:07

ahah yes i know that feel

thedavidmeister03:05:23

atm we’re focussing on automating our workflows more

thedavidmeister03:05:46

like, reporting, reminders, merge conflict resolution, release management, etc.

thedavidmeister03:05:01

well, for my side projects, i like to have a service that isn’t sudo style setup on linux boxes

thedavidmeister03:05:41

more time tinkering on the application layer, less time managing the environment 🙂

thedavidmeister03:05:42

so @alandipert you wouldn’t want to use something like https://www.tutum.co/?

micha03:05:04

i'm highly skeptical of the "any cloud" things

alandipert03:05:12

i would for a side project or experiment

alandipert03:05:24

but for anything i need to maintain for months or years it needs to be no magic

alandipert03:05:36

since i'm going to end up building my own infrastructure regardless

thedavidmeister03:05:52

haha, i think of it more like “outsourcing” rather than “magic” 😛

alandipert03:05:54

better to build around stable elements than layer magic

micha03:05:15

fundamentally you need to understand the platform

micha03:05:34

these tools that wrap AWS apis don't really solve the problem

micha03:05:47

especially when they attempt to wrap every possible api

micha03:05:52

then it's just madness

micha03:05:17

the time spent figuring out how to reverse engineer their stupid scripts is time you could spend just studying the underlying thing

thedavidmeister03:05:24

that’s fine to say if you’re the one doing the understanding

thedavidmeister03:05:33

but at some point, there will be people in the business who don’t understand

micha03:05:55

that's foolish

micha03:05:08

but if that's how it is then you can do it the other way

micha03:05:19

and just keep selecting a new framework every 6 months

thedavidmeister03:05:27

it’s not foolish, it’s reality

thedavidmeister03:05:30

you hire a new person

thedavidmeister03:05:35

on day 1 they don’t understand everything

alandipert03:05:41

from a business standpoint, it's scary to build infrastructure on any platform that hasn't existed for very long, as the platform is subject to acquisition/shutdown/heavy change

alandipert03:05:50

this is another point for AWS

alandipert03:05:10

they are excellent at managing change so far and aren't going anywher

micha03:05:17

if your people don't understand the platform and instead of studying that add layers of cruft on top of it, that's not good for business

micha03:05:34

but it's true that some business like that

thedavidmeister03:05:36

it’s not just understanding though

thedavidmeister03:05:06

what if you need to have certain SLAs that are 24/7 but you aren’t in a place to have a team on call 24/7

thedavidmeister03:05:12

you might need to start offloading some risk

micha03:05:15

then you're fucked

micha03:05:25

get insurance

alandipert03:05:30

yes :thumbsdown: to the sales guy who made that deal lol

alandipert03:05:44

"oh yeah bro we have people on call 24/7 no sweat"

thedavidmeister03:05:12

but there’s always grey areas

micha03:05:20

hiring outside people to be the 24/7 guys isn't going to be cheaper i don't think

alandipert03:05:26

i mean i have acquaintances

alandipert03:05:38

who crapped out some ruby on rails thing, hosted on heroku for free, and sold the business for 100k a few months later

alandipert03:05:44

clearly they are winning

micha03:05:12

yeah i want that job

alandipert03:05:14

so it's definitely not that expedient magical platforms are always bad

thedavidmeister03:05:24

that sounds pretty great actually

micha03:05:24

well i want to hire them

alandipert03:05:30

aha you can't

alandipert03:05:38

magical people such as these can't be hired

thedavidmeister03:05:40

as long as you can reproduce that magic

micha03:05:47

lol right

micha03:05:00

i don't really want to hire them lol

thedavidmeister03:05:18

realistically, you want to “cofound” with them i think 😉

micha03:05:37

eh i'm not that kind of gambler

micha03:05:52

like i used to play poker a bit

alandipert03:05:54

there just isn't an easy way to make these decisions i don'tthink

alandipert03:05:58

depends on the team, the business, etc

micha03:05:08

then i realized that the time i spent studying that could be spent doing something "productive"

micha03:05:18

but maybe that's dumb

alandipert03:05:22

i just know personally that if i'm going to be involved with something that i want it to succeed, and to do that i will need full access

alandipert03:05:43

i don't want to log in to some web console to right click on something to make go

micha03:05:12

like take chef for instance

micha03:05:35

we have tons of problems with it

thedavidmeister03:05:36

yeah, but there is a cost to the full access bit

alandipert03:05:45

the cost is you can't hire as many idiots

micha03:05:45

and it takes just as much knowledge to fix that

thedavidmeister03:05:48

oh man, i’ve never seen anyone have a good time with chef...

alandipert03:05:50

so hiring gets harder

micha03:05:50

and under pressure too

thedavidmeister03:05:59

the cost is also your time as well

micha03:05:02

like in the middle of a deploy things go wrong

thedavidmeister03:05:05

time is hard to manage

alandipert03:05:12

it is, but i'd call that cost an investment

alandipert03:05:20

vs time learning magical things which is a gamble

thedavidmeister03:05:21

sure, it is an investment

micha03:05:30

it's not even an investment

thedavidmeister03:05:32

and every investment has an opportunity cost vs. other investments 😛

micha03:05:33

it's way cheaper

micha03:05:47

like if you don't understand AWS, chef is not going to help you

alandipert03:05:49

true, since you can usually start applying instantly

micha03:05:57

when it fails you will still need to know what the underlying thing is doing

micha03:05:03

if you are responsible for the thing

thedavidmeister03:05:08

also, it’s not really fair to say that everyone who doesn’t know AWS inside out is an idiot

micha03:05:10

so now you need to know two things

thedavidmeister03:05:15

you won’t get a very diverse team with that approach 😞

micha03:05:23

you only need to learn though

micha03:05:29

it's not that you need to know it already

micha03:05:42

my point is that there is no alternative

micha04:05:01

like adding tools on top of AWS doesn't solve the problem of not knowing how anything the tools are using works

micha04:05:13

those tools will still go wrong

micha04:05:20

and then you have two problwms instead of one

thedavidmeister04:05:31

but we’re building our own tools to help automate tasks

alandipert04:05:37

also i didn't mean to imply that about people who don't know AWS

thedavidmeister04:05:39

it’s not that much different in one sense

thedavidmeister04:05:36

i think ultimately, i’d prefer to just have something reasonably portable, and frequently re-assess the situation

micha04:05:40

AWS has only a small number of things that you need to know really

thedavidmeister04:05:43

and move if it makes sense to

micha04:05:48

a handful of things

micha04:05:56

in order to do pretty much anything

micha04:05:09

it's like a week of study at most

micha04:05:35

maybe 2 weeks, it's hard to remember now lol

thedavidmeister04:05:52

hah, i think probably 2 weeks to get setup

thedavidmeister04:05:01

but more if you want to get into security and change management

alandipert04:05:20

another example from work

alandipert04:05:29

like 2 yrs ago i needed to stand up a new app

alandipert04:05:40

so i went with easy & fast, an AWS service called elastic beanstalk

alandipert04:05:59

which AWS built on top of many of their own services using dozens of shell scripts and some web console

alandipert04:05:27

the stuff they added on top made it easy and fast to get running

alandipert04:05:35

but debugging, monitoring, scaling all were very difficult as a result

alandipert04:05:48

so over time the cost of owning the app increased

alandipert04:05:06

since every problem was multiplied by the problems inherent in debugging something magical

micha04:05:27

all the secret knowledge compiled in little .ebextensions files

micha04:05:34

from stack overflow

alandipert04:05:34

yes, tons of DSLs and lifecycles

alandipert04:05:38

marks of the beaste

thedavidmeister04:05:46

yeah that’s true

micha04:05:46

hacking and reverse engineering their ruby scripts

thedavidmeister04:05:58

so i guess you hit a point where it made sense to move

alandipert04:05:12

yeah totally

alandipert04:05:16

it was organic

thedavidmeister04:05:24

i like having a free heroku account that magically got me setup without knowing a thing about java

thedavidmeister04:05:31

and now i’m looking to take it a little further

alandipert04:05:31

but the key thing i think is that we didn't move to some other magical thing

thedavidmeister04:05:38

i bet i’ll get to a point where it makes sense for me to move again

alandipert04:05:38

instead we went a level deeper

thedavidmeister04:05:49

yeah, that is fair

alandipert04:05:09

like my rails buddies

alandipert04:05:12

super into docker now

alandipert04:05:14

it's the new magical thing

thedavidmeister04:05:24

but i won’t look back and be like “heroku sucked”, i’ll just be like “i outgrew that setup"

alandipert04:05:30

right, totally

alandipert04:05:48

if you're at all interested in AWS you may be interested where we landed

alandipert04:05:58

micha identified like the 3 things we need to use from AWS to make awesome web and worker apps

thedavidmeister04:05:59

but hold that thought

thedavidmeister04:05:05

i have an appointment to get to

alandipert04:05:27

will do. gonna sleep soon but it was fun to chat!

alandipert04:05:58

cells from CL, in clj/s

alandipert04:05:18

hoplon shoutout in readme. has weird/cool ideas, like "awakening"

thedavidmeister05:05:12

i was actually just about to ask if javelin could be used in clj

thedavidmeister05:05:15

maybe i should look at this too

thedavidmeister05:05:17

the ephemerality looks interesting

thedavidmeister05:05:12

i was vaguely wondering how to get a subscription of changes coming from rethinkdb into the cell model, without explicitly resetting things to nil after every change

micha13:05:14

if you have to set to nil it's not "changes" though right?

micha13:05:26

that's a good thing

micha13:05:14

if you want to know that you talked to rethink db just have it include a timestamp or transaction id

micha13:05:24

timestamp vs ephemeral i think explicit timestamp or sequence number is superior

thedavidmeister14:05:22

@micha yeah i’m working on a timestamp + sequence number for inserts and queries atm

thedavidmeister14:05:45

(-> (rq/db r/rethinkdb-db)
                    (rq/table r/rethinkdb-table)

                    (rq/order-by {:index (rq/desc "stamp-tx")})
                    (rq/group ["e" "a"])
                    (rq/limit 1)

                    (rq/run conn)))

thedavidmeister14:05:53

i don’t yet know how to get changefeeds working

thedavidmeister14:05:57

about to ask in the other chat room 🙂

thedavidmeister15:05:27

ah, and now i can learn how channels work

thedavidmeister15:05:37

the joys of being a noob >.<

micha16:05:57

the fun part