Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:production profile two ways #22

Closed
ccfontes opened this issue Jun 18, 2013 · 8 comments
Closed

:production profile two ways #22

ccfontes opened this issue Jun 18, 2013 · 8 comments

Comments

@ccfontes
Copy link

Currently, what's the correct way to configure the :production profile?

As is in this repo's readme.md

:production {:app-specific "config"
             :mirrors {"central" "http://s3pository.herokuapp.com/maven-central"}}
web: lein with-profile offline,production trampoline run -m myapp.web

or?

as is on heroku dev center

:production {:misc "configuration" ; app-specific stuff
             :offline true
             :mirrors {#"central|clojars"
                       "http://s3pository.herokuapp.com/clojure"}}
web: lein with-profile production trampoline run -m myapp.web # 2.x
@ccfontes
Copy link
Author

I'm struggling with dependencies in production on heroku:

2013-06-19T18:44:47.583418+00:00 app[web.1]: Performing task 'trampoline' with profile(s): 'offline,production'
2013-06-19T18:44:47.727212+00:00 app[web.1]: This could be due to a typo in :dependencies or network issues.
2013-06-19T18:44:47.726982+00:00 app[web.1]: The repository system is offline but the artifact lein-ring:lein-ring:jar:0.8.5 is not available in the local repository.
2013-06-19T18:44:47.718520+00:00 app[web.1]: The repository system is offline but the artifact ccfontes:lein-cljsbuild:jar:0.3.2-no-exit is not available in the local repository.
2013-06-19T18:44:47.727736+00:00 app[web.1]: Error encountered performing task 'trampoline' with profile(s): 'offline,production'
2013-06-19T18:44:47.732194+00:00 app[web.1]: Could not resolve dependencies

:production profile:

:production {:app-specific "config"
                :mirrors {#"central|clojars"
                            "http://s3pository.herokuapp.com/clojure"}}

Tried a number of combinations, but without much success. Those two artifacts are very recent, and one of them is critical. Is it possible the mirror repo isn't updated recently, and if so, is it possible to update it soon?

@technomancy
Copy link
Contributor

Sorry you're having trouble here. Using this mirror for Clojars turned out to not be a great idea, and the buildpack was updated, but the docs were not, so thanks for catching this. I'll update the devcenter.

If the mirror is giving you trouble you can remove it from the production profile altogether to debug too.

@ccfontes
Copy link
Author

I removed the mirror altogether for debugging purposes. Profile is like this:

:production {:app-specific "config"}

Now I have alot of artifacts missing. I guess the previously configured mirror was providing some artifacts.

2013-06-20T10:20:52.848553+00:00 app[web.1]: The repository system is offline but the artifact ring-server:ring-server:jar:0.2.8 is not available in the local repository.
2013-06-20T10:20:52.848553+00:00 app[web.1]: The repository system is offline but the artifact com.fasterxml.jackson.core:jackson-core:jar:2.2.1 is not available in the local repository.
2013-06-20T10:20:52.848553+00:00 app[web.1]: The repository system is offline but the artifact cheshire:cheshire:jar:5.2.0 is not available in the local repository.
2013-06-20T10:20:52.856059+00:00 app[web.1]: The repository system is offline but the artifact com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.2.1 is not available in the local repository.
2013-06-20T10:20:52.856059+00:00 app[web.1]: The repository system is offline but the artifact tigris:tigris:jar:0.1.1 is not available in the local repository.
2013-06-20T10:20:52.887918+00:00 app[web.1]: The repository system is offline but the artifact org.clojure:tools.namespace:jar:0.1.3 is not available in the local repository.
2013-06-20T10:20:52.888618+00:00 app[web.1]: The repository system is offline but the artifact org.clojure:tools.logging:jar:0.2.4 is not available in the local repository.
2013-06-20T10:20:52.888418+00:00 app[web.1]: The repository system is offline but the artifact clout:clout:jar:1.1.0 is not available in the local repository.
2013-06-20T10:20:52.888740+00:00 app[web.1]: The repository system is offline but the artifact log4j:log4j:jar:1.2.17 is not available in the local repository.
2013-06-20T10:20:52.888885+00:00 app[web.1]: This could be due to a typo in :dependencies or network issues.
2013-06-20T10:20:52.889497+00:00 app[web.1]: Error encountered performing task 'trampoline' with profile(s): 'offline,production'
2013-06-20T10:20:52.889593+00:00 app[web.1]: Could not resolve dependencies

Some suggestions:

  • If the problem is about the mirror not being up to date, Isn't it possible to update the mirror more often? Most people have a staging environment anyway, so even if an error occur at that point, it's doable to wait some minutes or even a couple of hours so the mirror syncs with a main repo.
  • falling back to "online" when an artifact is not found, and hope that it doesn't trigger the boot timeout (at the same time syncing that artifact to the mirror).
  • falling back to "online" when an artifact is not found, and for each artifact that is fetched online, do not count that time for the boot timeout. (maybe this policy override is not possible from the buildback).

Finally, if the mirror is not a choice anymore, which is or will be to prevent the dreaded boot timeout error?

@technomancy
Copy link
Contributor

Finally, if the mirror is not a choice anymore, which is or will be to prevent the dreaded boot timeout error?

If dependency resolution is happening at app boot time, that's a problem. Dependencies should be resolved only during build time.

I've just pushed a change that disables the offline behaviour in the production profile. I've been making some changes on the uberjar branch; I'm thinking in the future I'll start recommending using Leiningen only during deployment and putting direct java invocations in the Procfile. If you want to try out the uberjar branch you can do so by setting BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-clojure.git#uberjar and changing your Procfile entry as the readme describes there. It's much easier to avoid this kind of issue if you use Leiningen only for deploying and not at runtime. I'd be interested in any feedback you have on that if you try it.

@technomancy
Copy link
Contributor

If that doesn't take care of things feel free to email me with your app name and I can take a closer look.

@ccfontes
Copy link
Author

"...and changing your Procfile entry as the readme describes there..."
Procfile in the readme still uses offline behaviour.

Fails to find lein - bin/build: line 4: lein: command not found:

-----> Fetching custom git buildpack... done
-----> Clojure (Leiningen 2) app detected
-----> Installing OpenJDK 1.6...done
-----> Using cached Leiningen 2.2.0
       Writing: lein script
-----> Building with Leiningen
       Found bin/build; running it instead of default lein invocation.
       Running: bin/build
       -----> Generating uberjar with Leiningen:
              Running: lein uberjar
              bin/build: line 4: lein: command not found
        !     Failed to create uberjar with Leiningen
 !     Failed to build.

 !     Push rejected, failed to compile Clojure (Leiningen 2) app

I'm using PATH as you told me:

PATH=.lein/bin:/usr/local/bin:/usr/bin:/bin JAVA_OPTS="-Xmx500m -Duser.home=$BUILD_DIR" lein uberjar 2>&1 | sed -u 's/^/       /'

I also have enviroment PATH defined in heroku with the exact same value.

@technomancy
Copy link
Contributor

I can't tell what's going on from your comment; if you email me your app name I can take a closer look.

@ccfontes
Copy link
Author

The push was rejected, so the above changes are not included. Hope this isn't a problem. Emailing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants