Discussion:
[Lift] a FOSS project that uses Lift+jetty+revolver+akka
Vasya Novikov
2015-01-20 11:31:39 UTC
Permalink
I recently thought my hobby project may be worth introducing to the
mailing list, so here it is:

https://github.com/vn971/roboCup

Interesting things about the project:

* it's Lift-based :)

* it uses an embedded jetty instead of the "system-wide tomcat" stuff.
It uses `sbt-assembly` to produce the self-contained jar. (Note that one
can still output war-s compatible with tomcat by marking the jetty
dependency as "provided".)

* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.

* it has a correct configuration of `sbt-native-packager` plugin, suited
for Liftweb. So, one can produce "*.deb" and "*.rpm" files. I switched
to manual scripts and jar-s anyway, they seemed much more simpler. But
if you want to experiment with "sbt-native-packager", you can.

* it uses two lint-er settings and "scalariform" to keep the project a
little better maintained. More precisely, I used "-lint:" scalac options
and the `wartremover` plugin.

* the project uses both "akka" and "liftweb" actors.
It's quite known thought that these actor systems work transparently by
the `!` method, and my project is not an exception to this. If you still
want to be even more convinced, here's the exact line. We're sending a
message from an akka actor to a lift actor here:

https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/ru/ya/vn91/robotour/RegistrationCore.scala#L52

* initialization of the embedded jetty server can be seen here:

https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/bootstrap/liftweb/Start.scala


The project goal and contents are probably much less interesting. It's
about a game that isn't exactly popular, and you cannot even play the
game on this server because it only integrates with another server (not
mine, not FOSS).
So, it's rather a collection of interesting & working solutions that can
be taken as an example.
Hope it may be interesting, have fun.:)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vasya Novikov
2015-01-20 12:16:03 UTC
Permalink
* found out that lift-2.6 is out and updated some stuff.:)
Post by Vasya Novikov
I recently thought my hobby project may be worth introducing to the
https://github.com/vn971/roboCup
* it's Lift-based :)
* it uses an embedded jetty instead of the "system-wide tomcat" stuff.
It uses `sbt-assembly` to produce the self-contained jar. (Note that one
can still output war-s compatible with tomcat by marking the jetty
dependency as "provided".)
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
* it has a correct configuration of `sbt-native-packager` plugin, suited
for Liftweb. So, one can produce "*.deb" and "*.rpm" files. I switched
to manual scripts and jar-s anyway, they seemed much more simpler. But
if you want to experiment with "sbt-native-packager", you can.
* it uses two lint-er settings and "scalariform" to keep the project a
little better maintained. More precisely, I used "-lint:" scalac options
and the `wartremover` plugin.
* the project uses both "akka" and "liftweb" actors.
It's quite known thought that these actor systems work transparently by
the `!` method, and my project is not an exception to this. If you still
want to be even more convinced, here's the exact line. We're sending a
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/ru/ya/vn91/robotour/RegistrationCore.scala#L52
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/bootstrap/liftweb/Start.scala
The project goal and contents are probably much less interesting. It's
about a game that isn't exactly popular, and you cannot even play the
game on this server because it only integrates with another server (not
mine, not FOSS).
So, it's rather a collection of interesting & working solutions that can
be taken as an example.
Hope it may be interesting, have fun.:)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tyler Weir
2015-01-20 14:22:20 UTC
Permalink
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Intriguing, I'll have to take a look. :)
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vasya Novikov
2015-01-21 13:49:06 UTC
Permalink
Yeah, that's the property I like the most.

It's kind of atomic move from `xsbt-web-plugin` to
https://github.com/spray/sbt-revolver
and
https://github.com/sbt/sbt-assembly

BTW, I even thought about creating a specialized lift template for that.
Dunno if that would be interesting, and whether it would make sense to
integrate it to the official templates.
Post by Tyler Weir
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Joe Barnes
2015-01-22 22:17:35 UTC
Permalink
Very cool, and thanks for sharing! I'm interested in the embedded jetty
and the reloading stuff. I'll have to make some time to look this project
over. :)

Joe
Post by Vasya Novikov
Yeah, that's the property I like the most.
It's kind of atomic move from `xsbt-web-plugin` to
https://github.com/spray/sbt-revolver
and
https://github.com/sbt/sbt-assembly
BTW, I even thought about creating a specialized lift template for that.
Dunno if that would be interesting, and whether it would make sense to
integrate it to the official templates.
Post by Tyler Weir
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Antonio Salazar Cardozo
2015-01-23 05:17:30 UTC
Permalink
It sounds pretty cool, so if you can make a template for some of us to play
with and it improves the workflow, I think it'd be awesome to move the
official
templates to that.
Thanks,
Antonio
Post by Vasya Novikov
Yeah, that's the property I like the most.
It's kind of atomic move from `xsbt-web-plugin` to
https://github.com/spray/sbt-revolver
and
https://github.com/sbt/sbt-assembly
BTW, I even thought about creating a specialized lift template for that.
Dunno if that would be interesting, and whether it would make sense to
integrate it to the official templates.
Post by Tyler Weir
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alexej Bondarenko
2015-02-15 11:32:06 UTC
Permalink
Vasya, thank you for sharing! I have tried it in a project i'am currently
working on. Works pretty well.

Does anyone has an idea how to shut down such an application properly? I
use LiftRules unloadHooks to add some application cleanups (shut down akka
actors, close connections,...). But when i use sbt-revolver with re-stop,
this method is never called at all. (Or i am just using it in a wrong way
:) )

Alexej
Post by Vasya Novikov
Post by Tyler Weir
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Arkadiusz Burdach
2015-02-15 12:58:47 UTC
Permalink
Hi Alexej,

I think that you can add some extra cleanups after server.join() e.g.

actorSystem.stop()
actorSystem.awaitTermination()

As far as I understand how it works - when some changes are detected there
is a try to interrupt of all running threads. It cause interupption of
server.join() at the end. Please give a feedback if it helped you.

I have other problem using sbt-resolver. It restart application after
resources change which is annoying devloping client side code - it isn't
necessary with container:start approach because jetty has own mechanism for
this purpose. Somebody have an idea how to exclude webapps dir?

Arek

W dniu niedziela, 15 lutego 2015 12:32:06 UTC+1 uÅŒytkownik Alexej
Post by Alexej Bondarenko
Vasya, thank you for sharing! I have tried it in a project i'am currently
working on. Works pretty well.
Does anyone has an idea how to shut down such an application properly? I
use LiftRules unloadHooks to add some application cleanups (shut down akka
actors, close connections,...). But when i use sbt-revolver with re-stop,
this method is never called at all. (Or i am just using it in a wrong way
:) )
Alexej
Post by Vasya Novikov
Post by Tyler Weir
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after
source
Post by Tyler Weir
Post by Vasya Novikov
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vasya Novikov
2015-02-23 06:59:25 UTC
Permalink
Hi!
About application restarts when the resources change. I'd separate two
things: resources under "/src/main/resources" and under "/src/main/webapp".

Changes in the first dir WILL force SBT to restart. I'd say that's good,
there may be configuration things in this dir etc.

Changes in "webapp" dir will NOT force the application to restart, if
configured correctly. See the build.sbt trick in the project I
mentioned to see how it's done.
Post by Arkadiusz Burdach
Hi Alexej,
I think that you can add some extra cleanups after server.join() e.g.
actorSystem.stop()
actorSystem.awaitTermination()
As far as I understand how it works - when some changes are detected there
is a try to interrupt of all running threads. It cause interupption of
server.join() at the end. Please give a feedback if it helped you.
I have other problem using sbt-resolver. It restart application after
resources change which is annoying devloping client side code - it isn't
necessary with container:start approach because jetty has own mechanism for
this purpose. Somebody have an idea how to exclude webapps dir?
Arek
W dniu niedziela, 15 lutego 2015 12:32:06 UTC+1 użytkownik Alexej
Post by Alexej Bondarenko
Vasya, thank you for sharing! I have tried it in a project i'am currently
working on. Works pretty well.
Does anyone has an idea how to shut down such an application properly? I
use LiftRules unloadHooks to add some application cleanups (shut down akka
actors, close connections,...). But when i use sbt-revolver with re-stop,
this method is never called at all. (Or i am just using it in a wrong way
:) )
Alexej
Post by Vasya Novikov
Post by Tyler Weir
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after
source
Post by Tyler Weir
Post by Vasya Novikov
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alexej Bondarenko
2015-02-23 13:27:10 UTC
Permalink
Thanks Vasya!
Post by Vasya Novikov
Hi!
About application restarts when the resources change. I'd separate two
things: resources under "/src/main/resources" and under
"/src/main/webapp".
Changes in the first dir WILL force SBT to restart. I'd say that's good,
there may be configuration things in this dir etc.
Changes in "webapp" dir will NOT force the application to restart, if
configured correctly. See the build.sbt trick in the project I
mentioned to see how it's done.
Post by Arkadiusz Burdach
Hi Alexej,
I think that you can add some extra cleanups after server.join() e.g.
actorSystem.stop()
actorSystem.awaitTermination()
As far as I understand how it works - when some changes are detected
there
Post by Arkadiusz Burdach
is a try to interrupt of all running threads. It cause interupption of
server.join() at the end. Please give a feedback if it helped you.
I have other problem using sbt-resolver. It restart application after
resources change which is annoying devloping client side code - it isn't
necessary with container:start approach because jetty has own mechanism
for
Post by Arkadiusz Burdach
this purpose. Somebody have an idea how to exclude webapps dir?
Arek
W dniu niedziela, 15 lutego 2015 12:32:06 UTC+1 uÅŒytkownik Alexej
Post by Alexej Bondarenko
Vasya, thank you for sharing! I have tried it in a project i'am
currently
Post by Arkadiusz Burdach
Post by Alexej Bondarenko
working on. Works pretty well.
Does anyone has an idea how to shut down such an application properly?
I
Post by Arkadiusz Burdach
Post by Alexej Bondarenko
use LiftRules unloadHooks to add some application cleanups (shut down
akka
Post by Arkadiusz Burdach
Post by Alexej Bondarenko
actors, close connections,...). But when i use sbt-revolver with
re-stop,
Post by Arkadiusz Burdach
Post by Alexej Bondarenko
this method is never called at all. (Or i am just using it in a wrong
way
Post by Arkadiusz Burdach
Post by Alexej Bondarenko
:) )
Alexej
Post by Vasya Novikov
On Tuesday, January 20, 2015 at 6:31:49 AM UTC-5, Vasya Novikov
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do
the
Post by Arkadiusz Burdach
Post by Alexej Bondarenko
Post by Vasya Novikov
Post by Vasya Novikov
fast-reload cycle. This way SBT never gets "PermGen out of space".
It
Post by Arkadiusz Burdach
Post by Alexej Bondarenko
Post by Vasya Novikov
Post by Vasya Novikov
takes about 1-2 seconds to do a full server-restart cycle after
source
Post by Vasya Novikov
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vasya Novikov
2015-02-23 06:49:45 UTC
Permalink
Glad if you liked it!

Unfortunately, shutdown hooks are never run this way. It's the way how
Post by Vasya Novikov
https://github.com/spray/sbt-revolver
re-stop stops application. This is done by simply force-killing the
forked JVM. Note, that this means that shutdown hooks are not run (see #20).
Post by Vasya Novikov
https://github.com/spray/sbt-revolver/issues/20
Vasya, thank you for sharing! I have tried it in a project i'am currently
working on. Works pretty well.
Does anyone has an idea how to shut down such an application properly? I
use LiftRules unloadHooks to add some application cleanups (shut down akka
actors, close connections,...). But when i use sbt-revolver with re-stop,
this method is never called at all. (Or i am just using it in a wrong way
:) )
Alexej
Post by Vasya Novikov
Post by Tyler Weir
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Intriguing, I'll have to take a look. :)
--
Vasya Novikov
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Antonio Salazar Cardozo
2015-01-20 15:09:52 UTC
Permalink
Very cool, thanks for sharing this!
Antonio
Post by Vasya Novikov
I recently thought my hobby project may be worth introducing to the
https://github.com/vn971/roboCup
* it's Lift-based :)
* it uses an embedded jetty instead of the "system-wide tomcat" stuff.
It uses `sbt-assembly` to produce the self-contained jar. (Note that one
can still output war-s compatible with tomcat by marking the jetty
dependency as "provided".)
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
* it has a correct configuration of `sbt-native-packager` plugin, suited
for Liftweb. So, one can produce "*.deb" and "*.rpm" files. I switched
to manual scripts and jar-s anyway, they seemed much more simpler. But
if you want to experiment with "sbt-native-packager", you can.
* it uses two lint-er settings and "scalariform" to keep the project a
little better maintained. More precisely, I used "-lint:" scalac options
and the `wartremover` plugin.
* the project uses both "akka" and "liftweb" actors.
It's quite known thought that these actor systems work transparently by
the `!` method, and my project is not an exception to this. If you still
want to be even more convinced, here's the exact line. We're sending a
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/ru/ya/vn91/robotour/RegistrationCore.scala#L52
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/bootstrap/liftweb/Start.scala
The project goal and contents are probably much less interesting. It's
about a game that isn't exactly popular, and you cannot even play the
game on this server because it only integrates with another server (not
mine, not FOSS).
So, it's rather a collection of interesting & working solutions that can
be taken as an example.
Hope it may be interesting, have fun.:)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Brett Grace
2015-04-04 23:56:23 UTC
Permalink
I thought this would be cool for my weekend toy project:

* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
Post by Vasya Novikov
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Getting revolver working took a little digging for me. How much? I solemnly
swear, *no more than 30 seconds*. However, perhaps I can save somebody else
the bother.

I updated my plugins.sbt and build.sbt in accordance with the project and
the Revolver instructions, but it still needed an entry point to actually
start Jetty. Poking around led me to this answer to a question on
StackOverflow <http://stackoverflow.com/a/22685685/807730> by some fellow
calling himself "Vasya Novikov" linking some code
<https://gitorious.org/pointsgame/pointsgame/source/07e29455783e3a88bf7f7d01f8bc1b1d0d3cf81d:src/main/scala/bootstrap/liftweb/Start.scala>
which does exactly that, which was ultimately the solution, and which looks
*suspiciously* like this code on Github
<https://github.com/vn971/roboCup/blob/master/src/main/scala/bootstrap/liftweb/Start.scala>
.

A minimal, working, interpretation:

object TheApp extends App with Loggable {

logger.info("Starting Lift")

val port = Props.getInt("liftweb.port").openOr(8080)
val server = new Server(port)
val context = new WebAppContext

context.setWar("src/main/webapp")
server.setHandler(context)
server.start()
logger.info("Booted")

}


Now, on the weekends I both Lift *and* Revolve, like some sort of gimmicky
restaurant, or perhaps a 19th century labor saving deathtrap
<http://en.wikipedia.org/wiki/Paternoster>.
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vasya Novikov
2015-04-05 10:39:57 UTC
Permalink
Hi!

The fellow "calling himself Vasya Novikov" is the same person starting
this ML thread.:)
But unfortunately, there are some goals not covered by the "easy way"
you mentioned. You may want to:

1. launch the app locally with SBT `reStart`

2. package the app as a "jar" and launch it with `java -jar ...`

3. package the app as a "war" and move it to a JEE container, so that
the container will start the app itself.

4. NOT restart your app on html changes.

5. package and distribute as *.deb / *.rpm / *.exe ? Rare case though.

And it's not that easy to be compatible with 1-4. For example, :
context.setWar("src/main/webapp")
You do not have an "src" directory while working from inside a jar.

BTW, I'll probably edit my StackOverflow answer so it'll point to the
most correct example.
Post by Vasya Novikov
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
Post by Vasya Novikov
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
Getting revolver working took a little digging for me. How much? I solemnly
swear, *no more than 30 seconds*. However, perhaps I can save somebody else
the bother.
I updated my plugins.sbt and build.sbt in accordance with the project and
the Revolver instructions, but it still needed an entry point to actually
start Jetty. Poking around led me to this answer to a question on
StackOverflow <http://stackoverflow.com/a/22685685/807730> by some fellow
calling himself "Vasya Novikov" linking some code
<https://gitorious.org/pointsgame/pointsgame/source/07e29455783e3a88bf7f7d01f8bc1b1d0d3cf81d:src/main/scala/bootstrap/liftweb/Start.scala>
which does exactly that, which was ultimately the solution, and which looks
*suspiciously* like this code on Github
<https://github.com/vn971/roboCup/blob/master/src/main/scala/bootstrap/liftweb/Start.scala>
.
object TheApp extends App with Loggable {
logger.info("Starting Lift")
val port = Props.getInt("liftweb.port").openOr(8080)
val server = new Server(port)
val context = new WebAppContext
context.setWar("src/main/webapp")
server.setHandler(context)
server.start()
logger.info("Booted")
}
Now, on the weekends I both Lift *and* Revolve, like some sort of gimmicky
restaurant, or perhaps a 19th century labor saving deathtrap
<http://en.wikipedia.org/wiki/Paternoster>.
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vasya Novikov
2018-08-04 22:40:17 UTC
Permalink
Hi all.

I'm not sure anybody's following this thread, but I notice some people use
the shared project as an example of liftweb + sbt-revolver + jetty +
akka-actor project.
It was a shame to find it outdated after a while though. All fixed, the
project uses all the newest libraries now & still enjoys the fast
sbt-revolver turn-around speed.

Thanks,
Vasilii (I'm the topic-starter)
Post by Vasya Novikov
I recently thought my hobby project may be worth introducing to the
https://github.com/vn971/roboCup
* it's Lift-based :)
* it uses an embedded jetty instead of the "system-wide tomcat" stuff.
It uses `sbt-assembly` to produce the self-contained jar. (Note that one
can still output war-s compatible with tomcat by marking the jetty
dependency as "provided".)
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
* it has a correct configuration of `sbt-native-packager` plugin, suited
for Liftweb. So, one can produce "*.deb" and "*.rpm" files. I switched
to manual scripts and jar-s anyway, they seemed much more simpler. But
if you want to experiment with "sbt-native-packager", you can.
* it uses two lint-er settings and "scalariform" to keep the project a
little better maintained. More precisely, I used "-lint:" scalac options
and the `wartremover` plugin.
* the project uses both "akka" and "liftweb" actors.
It's quite known thought that these actor systems work transparently by
the `!` method, and my project is not an exception to this. If you still
want to be even more convinced, here's the exact line. We're sending a
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/ru/ya/vn91/robotour/RegistrationCore.scala#L52
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/bootstrap/liftweb/Start.scala
The project goal and contents are probably much less interesting. It's
about a game that isn't exactly popular, and you cannot even play the
game on this server because it only integrates with another server (not
mine, not FOSS).
So, it's rather a collection of interesting & working solutions that can
be taken as an example.
Hope it may be interesting, have fun.:)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Henrik Härkönen
2018-08-06 05:15:57 UTC
Permalink
Cool, thanks!

I find that interesting especially due to the usage of sbt-assembly and the
"Start" main object. Good example.

-Henrik
Post by Vasya Novikov
Hi all.
I'm not sure anybody's following this thread, but I notice some people use
the shared project as an example of liftweb + sbt-revolver + jetty +
akka-actor project.
It was a shame to find it outdated after a while though. All fixed, the
project uses all the newest libraries now & still enjoys the fast
sbt-revolver turn-around speed.
Thanks,
Vasilii (I'm the topic-starter)
Post by Vasya Novikov
I recently thought my hobby project may be worth introducing to the
https://github.com/vn971/roboCup
* it's Lift-based :)
* it uses an embedded jetty instead of the "system-wide tomcat" stuff.
It uses `sbt-assembly` to produce the self-contained jar. (Note that one
can still output war-s compatible with tomcat by marking the jetty
dependency as "provided".)
* it uses `spray-revolver` instead of the `xsbt-web-plugin` to do the
fast-reload cycle. This way SBT never gets "PermGen out of space". It
takes about 1-2 seconds to do a full server-restart cycle after source
change.
* it has a correct configuration of `sbt-native-packager` plugin, suited
for Liftweb. So, one can produce "*.deb" and "*.rpm" files. I switched
to manual scripts and jar-s anyway, they seemed much more simpler. But
if you want to experiment with "sbt-native-packager", you can.
* it uses two lint-er settings and "scalariform" to keep the project a
little better maintained. More precisely, I used "-lint:" scalac options
and the `wartremover` plugin.
* the project uses both "akka" and "liftweb" actors.
It's quite known thought that these actor systems work transparently by
the `!` method, and my project is not an exception to this. If you still
want to be even more convinced, here's the exact line. We're sending a
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/ru/ya/vn91/robotour/RegistrationCore.scala#L52
https://github.com/vn971/roboCup/blob/5c73ad2aaf0aed4571b892f05587618c59389058/src/main/scala/bootstrap/liftweb/Start.scala
The project goal and contents are probably much less interesting. It's
about a game that isn't exactly popular, and you cannot even play the
game on this server because it only integrates with another server (not
mine, not FOSS).
So, it's rather a collection of interesting & working solutions that can
be taken as an example.
Hope it may be interesting, have fun.:)
--
Vasya Novikov
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...