Question

I'm trying to compile Snap Framework for Haskell on my ubuntu vps with VERY limited ram (220mb) and I keep getting errors about running out of memory when using "cabal install snap". I have tried to increase the swap size but because it is a OpenVZ box there is essentially no swap that exists.

My question is then is there some way I can use an external machine to compile all the files and then have them transfer to the correct locations on the VPS as if I had compiled it locally there?

Or if anyone else has any other suggestions on how I might be able to get this to work please let me know.

Was it helpful?

Solution

As Thomas M. DuBuisson stated you just need to compile the entire project into the final binary and copy that and all the project files (html, js, etc.) over to the server. Because the entire project is compiled and includes a webserver those are the only files you need.

So to reiterate the steps.

  1. Get a different machine with the same operating system that can compile the framework. In my case I had a local virtual machine do it.

  2. Compile the entire Snap project using that machine.

  3. Copy the compiled project (binary, and web files) to the other machine (that can't compile).

  4. Run the binary. It includes a server so there should not be any other dependencies. Unless your project utilizes dynamic libraries. In that case copy those over as well.

This works because the actual Snap Server is included with the Snap Framework application when you compile it. The answer is actually much simpler then I thought, and I was just overcomplicating it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top