Sample application to use in koding.
This is a HelloWorld javaspark sample application. to demonstrate running a simple Java application on Koding.com VMs. In the low resource environment like the VMs in koding(1GB Ram, 1Core, 3GB Disk), being light is so important so instead of running a full feature web containers/framework like Tomcat or Spring. going with spark and guice make the life and of course your application easier.
Spark is a simple and lightweight Java web framework built for rapid development.(Note: Spark is not Apache Spark)
-
You should have an account in koding.com. If you don't, go here and make one for yourself.
-
stop the default apache server on your VM.
$sudo service apache stop -
remove the apache if you like (you don't need it any more). if you like to keep apache on your Vm. change the port of Spark to somthing other tan 80.
$sudo apt-get purge apache -
Install java 8 on you vm.
$ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer $ sudo apt-get install oracle-java8-set-default -
Install maven.
$sudo apt-get install maven -
clone this sample.
$git clone https://github.com/mortezaadi/koding-spark.git -
go to the cloned directory and run the app.
$sudo mvn clean install
$sudo mvn exec:java
opening port under 1024 in koding.com requires administrative privileges.