r.sendecky
r.sendecky

Reputation: 10353

Haskell Snap: Application deployment and run-time dependencies

Cleaning the Snap project source directory (removing dist) makes the following complaint:

A web handler threw an exception. Details:
GHC error: can't find a package database at dist/package.conf.inplace

So if I clean the source directory it stops working? Does this only happens if I compile with development flag?

This brings me to the question of snap application deployment. What do we actually rsync to the server and what are the run-time dependencies? I, of coourse, dont want to install the whole haskell platform on the deployment server. All I need on the server is the project executable and the static files like *.tpl, *.css, etc. Is this correct?

I can see two ways to deploy the application: rsync the executable and its dependencies or create a binary distribution tarball and shift it to the server. What is the common practice?

What files exactly do I need to include in the binary tarball or rsync script to satisfy all the run-time dependencies?

Thanks

Upvotes: 5

Views: 446

Answers (1)

Carl
Carl

Reputation: 27003

First, yes, that's just the result of using development mode. It uses all kinds of artifacts from your compile environment. (This is the only way it can ensure it duplicates your compile environment properly when doing dynamic reloading.) If you remove them, it will stop working.

But in production mode, the binary and static resources are all you need. Well, and whatever dynamic libraries GHC links the executable to. This is mostly just standard stuff like libc. The only one that's sometimes missing on standard linux installs is libgmp. Of course, if you're using any FFI code that binds to other dynamic libs, you'll need to be sure those libs are covered too.

Upvotes: 3

Related Questions