Pregunta

I have successfully used Nginx to deploy a Yesod app in my own Ubuntu server. The way I do it, I simply run yesod devel and Nginx does a reverse proxy to the correct port --> localhost:3000

However, there's one problem. How do you run yesod devel as a background process?

In Deploying Your Yesod Webapp, there's a section discussing server processes. It says to create an Upstart config file and start. After I created the Upstart config file, I executed the command sudo start yesodAppName.

The problem is that I'm unable to access my Yesod app. There's probably something I don't understand.

¿Fue útil?

Solución

I have successfully found the solution.

The Chapter Server Process in Deploying Your Yesod Webapp describes how to run a Yesod App as a server process. It says to create the following Upstart config file in /etc/init/mySite

description "My awesome Yesod application"
start on runlevel [2345];
stop on runlevel [!2345];
respawn
chdir /home/michael/sites/mysite
exec /home/michael/sites/mysite/dist/build/mysite/mysite

The problem is that the last line is incomplete. Yesod offers you to run your webapp in Development, Testing, Staging or Production mode. Therefore, you need to specify it in the exec command.

Here is an example:

exec /home/michael/sites/mysite/dist/build/mysite/mysite Development

or

exec /home/michael/sites/mysite/dist/build/mysite/mysite MODE

where MODE = Development, Testing, Staging or Production .

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top