The script I included in my example assumes that there is a "deploy" user
that owns the "/deploy" directory and everything in it.

- James


On 28 December 2013 19:18, Ahmet Zeynel <azeyn...@gmail.com> wrote:

> Earlier I changed the permissions in /deploy but now I put it back to root
> and now I have:
>
> z@ubuntu:/deploy$ ll
> total 8164
>  drwxr-xr-x  2 root root    4096 Dec 27 08:20 ./
> drwxr-xr-x 24 root root    4096 Dec 27 08:09 ../
>  -rw-r--r--  1 root root 8351715 Dec 27 08:20
> my-webapp-0.1.0-standalone.jar
>
> and now when try to start as root I get this:
>
> root@ubuntu:/deploy# start nomilkforme
>  start: Job failed to start
>
>
> On Sat, Dec 28, 2013 at 1:16 PM, James Reeves <ja...@booleanknot.com>wrote:
>
>> Upstart gives you useful tools like respawning failed services, log
>> rotation, and starting on server boot.
>>
>> Have you checked the logs in /var/log/upstart/nomilkforme.log? Perhaps
>> it's got something to do with the permissions of the deploy directory.
>>
>> - James
>>
>>
>> On 28 December 2013 17:08, Zeynel <azeyn...@gmail.com> wrote:
>>
>>> I tried it like this and it seems to work:
>>>
>>> z@ubuntu:/etc/nginx/sites-available$ export PORT=4000
>>> z@ubuntu:/etc/nginx/sites-available$ java -jar
>>> /deploy/my-webapp-0.1.0-standalone.jar
>>> 2013-12-28 11:58:16.307:INFO:oejs.Server:jetty-7.x.y-SNAPSHOT
>>> 2013-12-28 11:58:16.409:INFO:oejs.AbstractConnector:Started
>>> SelectChannelConnector@0.0.0.0:4000
>>>
>>> What's wrong with deploying it like this?
>>>
>>> On Saturday, December 28, 2013 10:53:29 AM UTC-4, Zeynel wrote:
>>>>
>>>> Can I deploy this as explained here http://www.luminusweb.net/
>>>> docs/deployment.md#running_standalone with
>>>>
>>>>
>>>>
>>>> java -jar myapp-0.1.0-SNAPSHOT-standalone.jar
>>>>
>>>>
>>>> On Wednesday, December 25, 2013 10:06:58 AM UTC-4, James Reeves wrote:
>>>>>
>>>>> I currently serve a web app on a Ubuntu server. Here's the
>>>>> configuration I use:
>>>>>
>>>>> In "/etc/nginx/sites-available/<app-name>":
>>>>>
>>>>> server {
>>>>>     listen 80;
>>>>>
>>>>>     location / {
>>>>>         proxy_set_header  X-Real-IP        $remote_addr;
>>>>>         proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
>>>>>         proxy_set_header  Host             $http_host;
>>>>>         proxy_redirect    off;
>>>>>          proxy_pass        http://127.0.0.1:4000;
>>>>>     }
>>>>>  }
>>>>>
>>>>>
>>>>> Then I enable this configuration by adding a symbolic link:
>>>>>
>>>>> cd /etc/nginx/sites-enabled
>>>>> ln -s <app-name> ../sites-available/<app-name>
>>>>>
>>>>>
>>>>> Then I create an upstart job to run the server in
>>>>> "/etc/init/<app-name>.conf:
>>>>>
>>>>> description "<description of server>"
>>>>> author "<your name>"
>>>>>
>>>>> start on startup
>>>>> stop on shutdown
>>>>>
>>>>> setuid deploy
>>>>> chdir /deploy
>>>>> console log
>>>>>
>>>>> env PORT=4000
>>>>> exec java -jar <name of uberjar file>.jar
>>>>>
>>>>>
>>>>> The jar file I place in "/deploy", a directory I've added in at the
>>>>> top level.
>>>>>
>>>>> If all goes according to plan, then I can reload nginx and start my
>>>>> server:
>>>>>
>>>>> reload nginx
>>>>>
>>>>> start <app-name>
>>>>>
>>>>>
>>>>> Hope that helps.
>>>>>
>>>>> - James
>>>>>
>>>>>
>>>>>
>>>>> On 25 December 2013 11:42, Zeynel <azey...@gmail.com> wrote:
>>>>>
>>>>>> Ok, I worked through the tutorial referenced http://clojure-doc.
>>>>>> org/articles/tutorials/basic_web_development.html#build-and-run-itand I 
>>>>>> created a jar file and ran it with $ java -jar -my-webapp.jar. This
>>>>>> works. But my understanding is that this is would not work for 
>>>>>> production.
>>>>>> I need to use nginx as proxy to jetty (or immutant?). I am trying to 
>>>>>> figure
>>>>>> out the correct configuration for jetty and nginx. Each tutorial appears 
>>>>>> to
>>>>>> be different and so far I couldn't make it work.
>>>>>>
>>>>>>
>>>>>> On Friday, December 20, 2013 9:39:07 AM UTC-4, David Della Costa
>>>>>> wrote:
>>>>>>
>>>>>>> Hi Zeynel,
>>>>>>>
>>>>>>> I don't know if setting things up the way I've laid out there is
>>>>>>> such a
>>>>>>> great idea.  What I would do instead is set the port and whatnot in
>>>>>>> the
>>>>>>> jetty configuration inside of ring, assuming that's what you're
>>>>>>> using
>>>>>>> (this assumes a lot about how your app is set up, so let me know if
>>>>>>> this
>>>>>>> doesn't match your setup):
>>>>>>>
>>>>>>> http://ring-clojure.github.io/ring/ring.adapter.jetty.html
>>>>>>>
>>>>>>> Then, I would compile an uberjar with lein, like so:
>>>>>>>
>>>>>>> $ lein uberjar
>>>>>>>
>>>>>>> In your startup script, as Curtis laid out, call the jar file using
>>>>>>> something like:
>>>>>>>
>>>>>>> /path/to/java -jar /path/to/uberjar
>>>>>>>
>>>>>>> That will be much simpler than what I have in my tutorial...which I
>>>>>>> should really update, now that you mention it!
>>>>>>>
>>>>>>> DD
>>>>>>>
>>>>>>> (2013/12/19 9:28), Zeynel wrote:
>>>>>>> > I am following your tutorial, but I am stuck with Jetty
>>>>>>> configuration.
>>>>>>> > My installation does not seem to have a /contexts directory. Where
>>>>>>> is it?
>>>>>>> >
>>>>>>> > On Tuesday, December 17, 2013 9:02:19 AM UTC-4, David Della Costa
>>>>>>> wrote:
>>>>>>> >
>>>>>>> >     I have not done this specifically with Nginx but I suspect you
>>>>>>> probably
>>>>>>> >     want something like what I set up with Apache + Jetty:
>>>>>>> >
>>>>>>> >     https://github.com/ddellacosta/Clojure-under-Jetty-and-
>>>>>>> Apache#setting-up-jetty-with-apache-httpd
>>>>>>> >     <https://github.com/ddellacosta/Clojure-under-Jetty-and-
>>>>>>> Apache#setting-up-jetty-with-apache-httpd>
>>>>>>> >
>>>>>>> >
>>>>>>> >     That is, set up Nginx to act as a proxy for Jetty:
>>>>>>> >
>>>>>>> >     http://nginx.org/en/docs/beginners_guide.html#proxy
>>>>>>> >     <http://nginx.org/en/docs/beginners_guide.html#proxy>
>>>>>>> >
>>>>>>> >     One difference with how I would do it these days (vs. what I
>>>>>>> wrote in
>>>>>>> >     the piece above) is that I would probably simply push out an
>>>>>>> uberjar
>>>>>>> >     with lein which I would run with Java via an init script--for
>>>>>>> example,
>>>>>>> >     if using Ubuntu:
>>>>>>> >
>>>>>>> >     http://upstart.ubuntu.com/cookbook/#run-a-java-application
>>>>>>> >     <http://upstart.ubuntu.com/cookbook/#run-a-java-application>
>>>>>>> >
>>>>>>> >     So, I would imagine the basic construction would be something
>>>>>>> like:
>>>>>>> >     ring
>>>>>>> >     app w/jetty or http-kit, packaged as an uberjar (lein
>>>>>>> uberjar), then
>>>>>>> >     set
>>>>>>> >     up to run via an init script (via upstart in your case) on an
>>>>>>> >     alternative port, which is proxied by Nginx as in the link
>>>>>>> above.
>>>>>>> >
>>>>>>> >     Hope this helps--
>>>>>>> >
>>>>>>> >     DD
>>>>>>> >
>>>>>>> >     (2013/12/17 21:44), Zeynel wrote:
>>>>>>> >     > I've set up a home server with ubuntu and nginx and I can
>>>>>>> serve
>>>>>>> >     static
>>>>>>> >     > pages. Now I want to add clojure but I am not sure what I
>>>>>>> need to
>>>>>>> >     do. I
>>>>>>> >     > asked the same question in StackOverflow but for some reason
>>>>>>> it is
>>>>>>> >     voted
>>>>>>> >     > to be
>>>>>>> >     > closed:
>>>>>>> >     http://stackoverflow.com/questions/20632987/how-to-serve-
>>>>>>> clojure-pages-with-nginx
>>>>>>> >     <http://stackoverflow.com/questions/20632987/how-to-serve-
>>>>>>> clojure-pages-with-nginx>
>>>>>>> >
>>>>>>> >     >
>>>>>>> >     > Can you please direct me to documentation where I can read
>>>>>>> about
>>>>>>> >     this?
>>>>>>> >     > Some issues that I don't understand are: how do I tell nginx
>>>>>>> that
>>>>>>> >     I am
>>>>>>> >     > using clojure? Where do I install clojure, in the server?
>>>>>>> Where do I
>>>>>>> >     > create the clojure files? Thanks.
>>>>>>> >     >
>>>>>>> >     > --
>>>>>>> >     > --
>>>>>>> >     > You received this message because you are subscribed to the
>>>>>>> Google
>>>>>>> >     > Groups "Clojure" group.
>>>>>>> >     > To post to this group, send email to clo...@googlegroups.com
>>>>>>> >     <javascript:>
>>>>>>> >     > Note that posts from new members are moderated - please be
>>>>>>> patient
>>>>>>> >     with
>>>>>>> >     > your first post.
>>>>>>> >     > To unsubscribe from this group, send email to
>>>>>>> >     > clojure+u...@googlegroups.com <javascript:>
>>>>>>> >     > For more options, visit this group at
>>>>>>> >     > http://groups.google.com/group/clojure?hl=en
>>>>>>> >     <http://groups.google.com/group/clojure?hl=en>
>>>>>>> >     > ---
>>>>>>> >     > You received this message because you are subscribed to the
>>>>>>> Google
>>>>>>> >     > Groups "Clojure" group.
>>>>>>> >     > To unsubscribe from this group and stop receiving emails
>>>>>>> from it,
>>>>>>> >     send
>>>>>>> >     > an email to clojure+u...@googlegroups.com <javascript:>.
>>>>>>> >     > For more options, visit https://groups.google.com/grou
>>>>>>> ps/opt_out
>>>>>>> >     <https://groups.google.com/groups/opt_out>.
>>>>>>> >
>>>>>>> > --
>>>>>>> > --
>>>>>>> > You received this message because you are subscribed to the Google
>>>>>>> > Groups "Clojure" group.
>>>>>>> > To post to this group, send email to clo...@googlegroups.com
>>>>>>> > Note that posts from new members are moderated - please be patient
>>>>>>> with
>>>>>>> > your first post.
>>>>>>> > To unsubscribe from this group, send email to
>>>>>>> > clojure+u...@googlegroups.com
>>>>>>> > For more options, visit this group at
>>>>>>> > http://groups.google.com/group/clojure?hl=en
>>>>>>> > ---
>>>>>>> > You received this message because you are subscribed to the Google
>>>>>>> > Groups "Clojure" group.
>>>>>>> > To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send
>>>>>>> > an email to clojure+u...@googlegroups.com.
>>>>>>> > For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>
>>>>>>  --
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Clojure" group.
>>>>>> To post to this group, send email to clo...@googlegroups.com
>>>>>> Note that posts from new members are moderated - please be patient
>>>>>> with your first post.
>>>>>> To unsubscribe from this group, send email to
>>>>>> clojure+u...@googlegroups.com
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/clojure?hl=en
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Clojure" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to clojure+u...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>
>>>>>
>>>>>
>>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to