Best deployment method for Hakyll websites (with Stack)?

Hello, Note, this is not a Hakyll question, after all. I’m trying to host a hakyll website on a CentOS 7 server. I want to replicate the setup I had with the previous site, made with Jekyll: at each push on the git repository (hosted on the same server), the branch is recompiled and deployed to the web server. I already have the git hooks in place etc… The problem is how to manage the installation of ghc, hakyll, and their dependencies. I really really wish to have a clean solution. I really like stack, but its “per-user” directories make me wonder. The site compilation has to be performed by the git user account, which does not have an home directory. Can I setup a stack installation of a set of packages and then point stack to use that and only that? Also, how about the integration with docker? Is it really so painless as it is advertised? If I’ve understood correctly, I could install the docker image with stackage packages already installed, and tell stack to use that image with docker, having the site compilation sandboxed. Is it feasible? Thank you for any advice, Nicola

I'm not sure if it answers your question, but: stack's installation doesn't
have to be user-local, it just has to be somewhere that the user has write
access to. The default in $HOME/.stack, but this can be overridden by
setting the STACK_ROOT environment variable. So for example, this could
work:
sudo mkdir /opt/stack
sudo chown git /opt/stack
export STACK_ROOT=/opt/stack
stack build hakyll
Using Docker will mean that you get all of the Stackage packages available
without needing to compile them, and could be a great solution. Check out
the Wiki page for more information on getting started with it:
https://github.com/commercialhaskell/stack/wiki/Docker
On Thu, Sep 10, 2015 at 4:49 PM, Nicola Gigante
Hello,
Note, this is not a Hakyll question, after all.
I’m trying to host a hakyll website on a CentOS 7 server. I want to replicate the setup I had with the previous site, made with Jekyll: at each push on the git repository (hosted on the same server), the branch is recompiled and deployed to the web server.
I already have the git hooks in place etc… The problem is how to manage the installation of ghc, hakyll, and their dependencies.
I really really wish to have a clean solution. I really like stack, but its “per-user” directories make me wonder. The site compilation has to be performed by the git user account, which does not have an home directory. Can I setup a stack installation of a set of packages and then point stack to use that and only that?
Also, how about the integration with docker? Is it really so painless as it is advertised? If I’ve understood correctly, I could install the docker image with stackage packages already installed, and tell stack to use that image with docker, having the site compilation sandboxed. Is it feasible?
Thank you for any advice, Nicola
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

Also, how about the integration with docker? Is it really so painless as
it is advertised? If I’ve understood correctly, I could install the docker image with stackage packages already installed, and tell stack to use that image with docker, having the site compilation sandboxed. Is it feasible?
The compilation is sandboxed, but ~/.stack is still used for things like default configuration and the build plan cache, and <project>/.stack-work is still used for build artifacts. Otherwise, every build would have to start completely from scratch (since each stack build creates a new container).
If you need complete isolation from anything on the host OS, you’re better off running stack from within a Docker container you create yourself (using docker run). You can still use the images we publish https://hub.docker.com/u/fpco/, you just wouldn’t be using setting docker: true in your stack.yaml.

Does the web server *need* to be able to compile the website? Building and serving a static site are separate concerns. I build my Hakyll sites locally (and just switched some of them to stack), and deploy just the _site directory to a static content server. I wrote my own tool to do this with Amazon S3, but you could probably rsync or scp the files to a public directory on your CentOS web server. That's what the Hakyll docs suggest: http://jaspervdj.be/hakyll/reference/Hakyll-Core-Configuration.html My site.hs: https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L247 The tool I wrote: http://www.celador.mn/widely/ A comparable service that hosts static content: https://divshot.com/ Nicola Gigante writes:
Hello,
Note, this is not a Hakyll question, after all.
I’m trying to host a hakyll website on a CentOS 7 server. I want to replicate the setup I had with the previous site, made with Jekyll: at each push on the git repository (hosted on the same server), the branch is recompiled and deployed to the web server.
I already have the git hooks in place etc… The problem is how to manage the installation of ghc, hakyll, and their dependencies.
I really really wish to have a clean solution. I really like stack, but its “per-user” directories make me wonder. The site compilation has to be performed by the git user account, which does not have an home directory. Can I setup a stack installation of a set of packages and then point stack to use that and only that?
Also, how about the integration with docker? Is it really so painless as it is advertised? If I’ve understood correctly, I could install the docker image with stackage packages already installed, and tell stack to use that image with docker, having the site compilation sandboxed. Is it feasible?
Thank you for any advice, Nicola
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-- Kyle Marek-Spartz

The way I deploy my website (kane.cx) is exactly as you do with Jekyll. I do own the server though, so I just installed ghc/hakyll. You can always push as a user with a home directory and give it access to the relevant htdocs directory (using ACLs if neccessary). Docker sounds like a cleaner idea, but I haven't done anything with it except set up some pre-packaged stuff. On 9/10/2015 3:49 PM, Nicola Gigante wrote:
Hello,
Note, this is not a Hakyll question, after all.
I’m trying to host a hakyll website on a CentOS 7 server. I want to replicate the setup I had with the previous site, made with Jekyll: at each push on the git repository (hosted on the same server), the branch is recompiled and deployed to the web server.
I already have the git hooks in place etc… The problem is how to manage the installation of ghc, hakyll, and their dependencies.
I really really wish to have a clean solution. I really like stack, but its “per-user” directories make me wonder. The site compilation has to be performed by the git user account, which does not have an home directory. Can I setup a stack installation of a set of packages and then point stack to use that and only that?
Also, how about the integration with docker? Is it really so painless as it is advertised? If I’ve understood correctly, I could install the docker image with stackage packages already installed, and tell stack to use that image with docker, having the site compilation sandboxed. Is it feasible?
Thank you for any advice, Nicola
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (5)
-
David Kraeutmann
-
Emanuel Borsboom
-
Kyle Marek-Spartz
-
Michael Snoyman
-
Nicola Gigante