[Nix-dev] Tips on deploying a Scala Play application

4levels 4levels at gmail.com
Wed Jul 6 04:31:36 CEST 2016


Hi Teo,

I've come quite far in setting up things, but I keep running into building
errors.
It has everything to do with me removing all references to parsets and
postgres and renaming things here and there, trying to merge them with the
current deploy setup.

Do I understand correctly that parsets is a library to store data, using
postgres in the background?  I'd like to start using Event Sourcing with
Scala / Akka so I don't need a datastore like parsets, correct?  I'm very
unsure about this as I literally started today with learning Scala / Play.
I got my toes wet with Java before but that's really it.

Something else I found interesting as I'm quite an Nginx fan and have nginx
running with proxies already: Nginx has capabilities to deal with Java in
different ways, as proxy or tied with eg Clojure for even faster results..

The journey continues ;-)


Kind regards,

Erik

On Tue, Jul 5, 2016 at 10:23 PM 4levels <4levels at gmail.com> wrote:

> Hi Teo,
>
> Thank you for your explanation and quick qualitative response!
>
> I'll be looking at your code asap and report back with my experiences ;-)
>
> Kind regards,
>
> Erik
>
> On Tue, Jul 5, 2016, 22:08 Teo Klestrup Röijezon <teo at nullable.se> wrote:
>
>> Hi,
>>
>> A JRE should be enough for running it, but you need sbt and a JDK for
>> building. I've got a derivation for a Play website at
>> https://github.com/BlocklandGlass/ParseTS-Playground/blob/master/parsets-playground.nix,
>> with the NixOS/NixOps setup at
>> https://github.com/BlocklandGlass/ParseTS-Playground/tree/master/deployment
>> .
>>
>> The gist of it is to run "sbt stage" in the build phase, and to then take
>> "target/universal/stage" as your build output. However, you'll also need to
>> wrap the launcher script to add your JRE and to add gawk (which the
>> launcher script requires). Finally, on any modern system (such as NixOS)
>> you'll also want to disable Play's PID file management, since systemd takes
>> care of that anyway. I didn't in that script, but you'll probably also want
>> to add a testing phase as part of the build.
>>
>> The big drawback with this approach is that SBT downloads all
>> dependencies from the internet on demand, which won't work on a Nix setup
>> with proper isolation (ideally, builds should only have network access if
>> they deterministically produce a given hash).
>>
>> I've been toying with the idea of writing a sbt2nix SBT plugin that
>> generates Nix definitions to build a local maven mirror for the
>> dependencies, but I haven't got around to that (yet).
>>
>> // Teo
>>
>> On 5 July 2016 at 21:52, 4levels <4levels at gmail.com> wrote:
>>
>>> Hi Nix-devs,
>>>
>>> This is a plain request for assistance / best practices for using Nixos
>>> with Java / Scala / Play.  Akka with EventSourcing are also a topic of
>>> interest.
>>>
>>> I'm currently trying to get a Scala Play app up and running on my nixOps
>>> deployed machines.  As I'm very unfamiliar with running Java based apps,
>>> I'd like to know if someone has experience on the common pitfalls and tips
>>> on keeping the servers healthy (I just caused my laptop's 8 cores to go
>>> 100% without being able to stop the server started by the activator call).
>>>
>>> I've seen some related packages in nixpkgs and have many questions like
>>> eg. do I need sbt (which seems to provide typesafe - activator) and a jdk
>>> on the production servers or are is a jre sufficient? How do I deploy and
>>> run a Java app developed locally?
>>> And how do I set-up a local nixos vm for Java development?
>>>
>>> I'm still investigating and learning a lot myself, so nix-related
>>> knowledge is my main concern here (as I need to figure out the rest myself
>>> anyway ;-)
>>>
>>> I'll be happy to share my findings and configuration / setup..
>>>
>>>
>>> Kind regards,
>>>
>>> Erik
>>>
>>> _______________________________________________
>>> nix-dev mailing list
>>> nix-dev at lists.science.uu.nl
>>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160706/6a09ca87/attachment.html>


More information about the nix-dev mailing list