Google Groups

Re: [Yesod] Re: How to run Yesod apps for actual services


Drew Haven Apr 10, 2012 6:22 PM
Posted in group: Yesod Web Framework
I wish I could just copy the files up, but my server runs an older
version of libgmp than my devel box, so the binary complains about a
lack of libgmp.so.10 if I just copy it.  As such my deployment process
looks like:

git pull && cabal clean && cabal configure && cabal build

Then I just restart the various app instances.

I haven't bothered to automate it.  I'm wondering if there is a trick
to get around my library issues.

It's all behind an Apache instance through a reverse proxy.  I don't
have enough load that I've had to do static content through Apache.

Drew Haven
drew....@gmail.com

On Tue, Apr 10, 2012 at 10:55 AM, Vagif Verdi <vagif...@gmail.com> wrote:
> Here's how i setup my yesod app in production:
>
> 1. create folder /srv/awesome-app
> 2. Move necessary files there (static folder, config folder)
> 3. create a bin folder in there
> 4. drop your app exe into a bin folder. I usually name them like
> awesome-app-2012-04-10-1
> 5. create a bash script in the /srv/awesome-app/ folder
>
> #!/bin/bash
>
> cd /srv/awesome-app
>
> exec bin/awesome-app-2012-03-19-1 Production +RTS -N 2>&1 | logger -p
> local3.info
>
> The parts after -N is for logging using syslog-ng. You can remove them if
> you do not need that.
>
> And finally.
>
> put this into your /etc/inittab file:
>
> z1:2345:respawn:/srv/awesome-app/start-app
>
> This will start your app on boot, and also restart it if it crashes.
>
> How to update it ?
>
> 1. Put new exe awesome-app-2012-04-10-2 into /srv/awesome-app/bin folder.
> 2. Change the start-app script to refer to the new exe.
> 3. kill the current app. The new app will start automatically.
>
>
> On Tuesday, April 10, 2012 3:02:26 AM UTC-7, Kazu wrote:
>>
>> Hello,
>>
>> I read the book but I cannot find how to run Yesod apps for actual
>> services.
>>
>> In short I would like to ask:
>> Q1) Where should we run Yesod apps
>> Q2) How to deamonize Yesod apps
>>
>> 1)
>>
>> "yesod init" says that "cd foo && cabal install". This
>> means that Yesod application "foo" is installed to the cabal
>> directory.
>>
>> We develop the application with "yesod devel".
>>
>> For service in, I would like to compile it. [1] recommends
>> "cabal clean && cabal configure && cabal build". So, we have
>> "dist/build/foo/foo".
>>
>> If we run "dist/build/foo/foo" in the top of scaffold directory
>> ("foo"), this Yesod app works because "config/setting.yml" exists.
>>
>> So, it seems to me that Yesod team assumes that a complied app should
>> be run in the top of scaffold directory.
>>
>> But what about the Yesod app installed in the cabal directory?  If
>> this is not necessary, I would suggest to print "cabal install
>> --only-dependencies".
>>
>> 2)
>>
>> And if my understanding is correct, Yesod apps cannot be daemonized by
>> itself. Should users run Yesod apps with, for instance, the "screen"
>> command?
>>
>> Cheers,
>>
>> [1] http://www.yesodweb.com/book/deploying-your-webapp
>>
>> --Kazu
>>
>