Is it possible to bundle a Play! application into a single executable? - scala

I'm building an application using Scala + Play!. This is not a normal web application. Instead, it's just a software that will do something on localhost. In other words it will be distributed to multiple clients' machines. As a result, I want it to be really portable and light-weight. I don't want the clients to have to manually install Scala, Play, and JVM before they can run the program.
So my question is, is there a way to bundle a Play! application into a single executable? It doesn't really have to be just a single file, i.e. it just have to be really easy for a client with little technical knowledge to run this application easily.
Hope I'm being clear...
Thank you!

Or maybe you are just looking for a way to easily dist your application? :) have a look here: http://www.playframework.com/documentation/2.1.0/ProductionDist
This will produce a self-contained .zip file in your project's brand new dist sub directory. The only thing missing in that archive would be the JVM

You could use things like sbt-native-packager and sbt-assembly.

Related

perl lib issue - not finding lib dir

For years I have been using the following at the top of my scripts:
use lib '/var/www/vhosts/example.com/demo.example.com/cgi-bin/library';
That works fine when the lib is within the same domain space as the calling script.
However, I want to call in from a centralised library so I will have just one place to set db credentials.
So, if I adjust that line to call in from another account on the same server, it cannot find the library.
use lib '/var/www/vhosts/example2.com/demo.example2.com/cgi-bin/library';
Running on plesk, if that may make a difference. Used to run on cPanel and I had no issue.
I would appreciate a pointer, having already read some docs and I am confused.
Only someone with access to the configuration of your web server can answer this for sure, but I'd guess that each of your vhosts is running as a different user and the users can only read files from their own web space.
This approach won't work. If you want to to have a centralised module library then either install the modules that you want in the system module library (i.e. where cpan will install them by default) or create your own new centralised library somewhere that isn't under one of the vhost directories (perhaps under /opt).
However, it's worth noting that best practices for deployment of applications are moving in completely the opposite direction. It's generally considered a good idea for each application to have its own set of dependencies installed in its own module library. Using a cpanfile to record the exact versions of the dependencies that you're using makes this simple.

Why self-contained Application?

I am beginner in apache spark-scala, and I have been created a project with SBT (self-contained application).
I searched on Internet and I asked many people, why we create the self-contained application on scala with SBT ? Why we need for self-contained application ? What is the interest of the self-contained application ?
I arrived to these results:
- we create the self-contained application in scala with sbt to create an arborescence of project and we can run a full program.
- In the running of program we genere a file jar.
I run my program like this:
spark-submit --class "name_file" --master local[*] target/scala-2.11/"name_project"_2.11-1.0.jar
With the self-contained application we can give my file jar to another person and he can running my program without install spark or scala in another machine (like the files .dll in C++).
And finally, may be my question is not normaly, but I told, that I can ask my question in StackoverFlow and I am sure that I'll find the best answer.
Thank you!
Name itself states that it have no external dependencies while running (not developing) it in production environments.
A self-contained application consists of a single, installable bundle
that contains your application and a copy of the JRE or any Runtime
environment needed to run the application. When the application is
installed, it behaves the in the same way as any native application.
Read more from here
And in you case a simple self contained application is here

packing a tcl program for deployment in linux

We are getting ready to deploy a Tcl application, but i'm having trouble figuring out how to do it. Currently, I'm experimenting with tclkit and sdx.kit. I can pack a single tcl file and run it, but the structure of the whole application contains folders and images and c files that work together with tcl. i have two folders and inside a bunch of c files and tcl files and other stuff. How would i go and wrap the whole thing. What tool do you guys recommend other than tclkit and why?
The main way that you're recommended to distribute applications is as a tclkit. There are a few alternatives (e.g., TOBE, ActiveState's commercial tooling) but they're pretty similar as they all build on top of Tcl's virtual filesystem layer. (NB. This isn't the same as the Linux VFS stuff; this is a VFS in a single application.) Indeed, the ActiveState tooling actually is a rebadged tclkit (plus some other stuff like code obfuscation). I believe that TOBE uses ZIP archives instead of metakit databases.
The advantage of using a VFS-based solution is that it means that lots of things work inside, particularly including both source (for getting another .tcl file in) and load (for getting a binary library). In fact, you can put your application, the packages it depends on, and the resources (images, etc.) inside the VFS and be fairly sure that things will work. About the only things that we know run into real problems are where you want to exec something in the archive (the VFS mount is process-local; you have to copy the subsidiary file out if you want it to be seen in subprocesses) and if you're wanting to load certificates of private keys with the tls package (because the underlying OpenSSL library doesn't delegate to Tcl to handle that part of its I/O for some reason, AIUI).
When you're building these things, effectively you make a directory (and its subdirectories) that have everything laid out right. Then you run the packager (sdx for tclkits) and it builds the overall application for you. Attach the result to a runtime (the standard tclkit) and you're ready to test and deploy.
We don't generally do tool recommendations here on Stack Overflow, but the ActiveState Tcl Dev Kit is actually rather widely used. Many other people use sdx/tclkit. TOBE is quite a lot rarer. (There are other packaging techniques, but I wouldn't recommend them these days; a packaged VFS works very well indeed.)

Patching a perl cgi web application

I've written a web cgi application in perl and before I start to distribute it to clients, I'd like to provide an option for future updates.
I would like to know what are the standard approaches for that using free Linux tools.
It is OK for the server to be stopped during updating.
Thank you,
Spasski
If you have separated code from configuration and data, then the easiest way is to tar/zip the new files and unpack them onto the existing installation. If you need to update the data files, then you could include a script that makes the necessary changes.
Take a look at th bugzilla upgrade guide. I've used this process many times without a hitch.
http://www.bugzilla.org/docs/tip/en/html/upgrade.html

How do you do beautiful reports when testing with Selenium under Perl?

Selenium has some nice additional libraries, as long you are using Java to write your tests, e.g. LoggingSelenium. However, these are not usable if you are writing in Perl. How do you normally do proper reporting, possibly with screenshots after every significant step etc.?
Not an ideal answer but have you looked at the Java module on CPAN? You could then use the original Java Selenium libraries such as LoggingSelenium to do your reporting. You'll need to run a Java server with the jar provided by the CPAN Java module (but if you're already using Selenium...)
You could also try Java::Import which might avoid the need to run a server.
TAP::Formatter::HTML produces nice-looking html reports. It does not do screenshots, though.