Fork me on GitHub
#beginners
<
2016-05-09
>
jonschoning03:05:25

is it possible to run grimoire completely locally?

arrdem14:05:07

Yes, there are directions in the Readme for doing so.

arrdem14:05:16

Feel free to bug me if you run into problems.

arrdem14:05:27

@jonschoning:

jonschoning16:05:32

@arrdem there are directions in https://github.com/clojure-grimoire/grimoire/blob/master/README.md ? Specifically, I'm interested in running the grimoire app without needing a continuous internet connection to http://www.conj.io

arrdem16:05:18

@jonschoning: https://www.conj.io/contributing under "Building & Running".

arrdem16:05:13

Yeah you can do that, although running a local webapp probably isn't that power efficient. I've thought in the past about building a more efficient lib-grimoire derived local/repl client but haven't had time/interest/motivation.

arrdem16:05:20

If one were so motivated, there's probably some work that could be done to disable stuff like the analytics javascript and server components in a "run locally" context. But right now it's all always on.

jonschoning16:05:44

@arrdem I had no problem with make setup; lein serve to run the server - I do see the default "search" page but all the links still point to http://www.conj.io

arrdem16:05:33

Argh yeah you don't want lein serve. One sec.

arrdem16:05:44

@jonschoning: lein with-profile dev run -m grimoire.web.service should do it.

arrdem16:05:25

if you look at the project.clj, the serve alias is jut defined to be lein run with the server profile, which sets the site's base url to be

jonschoning16:05:12

ahh, that did the trick, thanks!!

arrdem16:05:53

Sure! You're on a very short list of people who've tried to run Grimoire themselves, let me know if you have any problems.

jonschoning16:05:17

thanks; appreciate the assistance simple_smile

arrdem16:05:23

Also remember to do the make setup otherwise you won't have any data files to serve from.

agi_underground18:05:19

hi, app needs ":main" in project, some tutor tell define it like ":main myproject.core" but in project directory i can not find .core file, how to solve this?

agi_underground18:05:52

this happens when i deploy my app to heroku

agile_geek18:05:06

@agi_underground: have you got a myproject/core.clj file in your project? Are you using lein uberjar to build this and then running it using java -jar <uberjar name.jar>?

agile_geek18:05:33

Where you substitute your project namespace for myproject and the name of the uberjar generated by lein uberjar for <uberjar name.jar>

agi_underground18:05:50

no i not have core.clj

agile_geek18:05:26

That's why the :main myproject.core doesn't find anything

agile_geek18:05:10

it's looking for a namespace myproject.core in a file core.clj in a dir myproject with a fn -main

agile_geek18:05:39

This -main fn bootstraps your application

agile_geek18:05:19

Your -main doesn't have to be in a namespace called core

agile_geek18:05:48

it can be in any ns but whatever you pick needs to be referenced by :main in project.clj

agi_underground18:05:58

when i deploy project to heroku, service themeself build and run project. What i need to do, for specify :main ?

agile_geek18:05:02

you can even have the fn called something else

agi_underground18:05:57

project type is compojure app

agile_geek18:05:16

I haven't deployed to Heroku for ages

agile_geek18:05:30

are you following a tutorial

agi_underground18:05:53

and when i run lein ring server locally, they work good

agi_underground18:05:03

without any :main

agile_geek18:05:55

That's because your using the 'lein ring' plugin

agile_geek18:05:02

heroku is not

agi_underground18:05:50

maybe i need to declare main func someware in handler? make wrapper for init func?

agile_geek18:05:53

Heroku is expecting an uberjar with everything packaged as a jar (I expect, I can't tell without knowing what commands you are using)

agile_geek18:05:39

That would work if you add a fn (call it -main for conventions sake) and then reference it in the :main in the project.clj

agile_geek18:05:52

but you probably need to uberjar it

agile_geek18:05:05

How is Heroku running your app?

agi_underground18:05:00

width command "lein trampoline run"

agile_geek18:05:45

So that expects a :main to reference a ns with a -main fn

agi_underground18:05:55

error from server log - Exception in thread "main" java.lang.ClassNotFoundException: myproject.core

agile_geek18:05:30

so if you call your init from -main and then reference the ns that has your -main in it in the project.clj

agile_geek18:05:02

for example, I put my -main in mywebapp.handler

skadinyo18:05:09

Try lein new app ... then see the project clj and core.clj it help me alot when trying to understand :main

agile_geek18:05:34

and add :main mywebapp.handler

agile_geek18:05:04

debug by running lein run or lein trampoline run locally

agile_geek18:05:18

when that works locally it will work in Heroku

agile_geek18:05:59

Here's a Heroku tutorial that walks through running it as an uberjar https://devcenter.heroku.com/articles/clojure-web-application

hoopes19:05:10

if i wanted to include a util lib of mine among a couple different projects, what's my best move? Add my github repo to project.clj somehow? Clone it somehwere, and alter my classpath? Will it get wrapped up in the uberjar when it's built? (Thanks!!!)

hoopes20:05:37

...follow-up: Can I just check out my repo to ~/src/my-lib and use :source-paths to "include" it (i'm coming from python, where i'd just fiddle with sys.path if i really had to during dev)

tom21:05:06

@hoopes: Are you going to be editing each project a lot?

hoopes21:05:38

yeah? it's just to share some utility functions between related projects

hoopes21:05:53

that looks like just what i need

hoopes21:05:30

thanks @tom !

roberto22:05:06

is there a way to make an xhr requests that uses xml as its body instead of json. I couldn’t find how to do this with clj-http.

agi_underground22:05:28

i`m here, and i`m have question) how i can handle postgres exceptions like HTTP ERROR 500, that display my connection data(username db-name)?

agi_underground22:05:37

i`m try like this: (try (sql/with-query-results res ["select * from users where id = ?" id] (first res)) (catch Exception _ {:status 400 :body "Invalid data"}))))