Hi,
I've moved to a VPS server, and am confused about the setup, especially in terms of folder structure.
As a test for deployment, say I created an application called b4jwebsocketstest, embedded in a b4jwebsocketstest.jar.
The domain e.g. is b4jwebsocketstest.com
My questions are regarding deployment. I have a VPS server, and have installed Java 8.
The development folders on my local PC, and some of the files, are as follows:
../B4J/b4jwebsocketstest
../B4J/b4jwebsocketstest/objects/ b4jwebsocketstest.jar
../B4J/b4jwebsocketstest/objects/www
../B4J/b4jwebsocketstest/objects/www/index.html
../B4J/b4jwebsocketstest/objects/www/b4j_ws.js
, etc.
, and I use this in the code, to map to the test form
srvr.AddWebSocket( "/ws", "frm_b4jwebsocketstest" )
I’ve opened up a port for the app on the server, incoming and outgoing. Same as the server port, referenced in the application.
Everything works fine in localhost.
The root folder for my app is, e.g. /home/myapp, so we have
/home/myapp
/home/myapp/logs
/home/myapp/public_html
/home/myapp/public_ftp
/home/myapp/etc
/home/myapp/tmp,
etc.
Command line that I’m using (unsuccessfully, so far), for running the app:
nohup /usr/java8/jre1.8.0_121/bin/java -jar b4jwebsocketstest.jar > nohup.out &
These are the questions:
1. I’m not sure where to put the jar. Erel, you mentioned to put it in any folder, but not to put it in /home/ myapp /public_html, because then it would be visible, along with any subfolders. That’s fine, but the index.html has to go in /home/ myapp /public_html, because I want the app to be visible at www.b4jwebsocketstest.com. But if we do that, then the b4jwebsocketstest.jar, is no longer in the same relative position with the main index.html, as in Dev (../objects/ b4jwebsocketstest.jar, and ../objects/www/index.html).
1a. If I put b4jwebsocketstest.jar in some random folder, e.g. /home/myapp/jettyapp in a different relative position from index.html than the development projects, then it won’t be able to locate index.html and other files (I think).
1b. Instead of explaining, can you list a sample folder structure for the .jar and associated js, css, and html files?
2. Do we need to install jetty on the server? Or is the entire jetty code, embedded in the B4J app, so Jetty doesn't need to be installed on the server? It was mentioned in https://www.b4x.com/android/forum/threads/server-run-a-server-on-a-vps.60378/#content, that the developer installed Jetty, along with Java.
3. If I have to install Jetty on the server, where is the link for Jetty? Should it be downloaded from here: http://www.eclipse.org/jetty/download.html?
I've moved to a VPS server, and am confused about the setup, especially in terms of folder structure.
As a test for deployment, say I created an application called b4jwebsocketstest, embedded in a b4jwebsocketstest.jar.
The domain e.g. is b4jwebsocketstest.com
My questions are regarding deployment. I have a VPS server, and have installed Java 8.
The development folders on my local PC, and some of the files, are as follows:
../B4J/b4jwebsocketstest
../B4J/b4jwebsocketstest/objects/ b4jwebsocketstest.jar
../B4J/b4jwebsocketstest/objects/www
../B4J/b4jwebsocketstest/objects/www/index.html
../B4J/b4jwebsocketstest/objects/www/b4j_ws.js
, etc.
, and I use this in the code, to map to the test form
srvr.AddWebSocket( "/ws", "frm_b4jwebsocketstest" )
I’ve opened up a port for the app on the server, incoming and outgoing. Same as the server port, referenced in the application.
Everything works fine in localhost.
The root folder for my app is, e.g. /home/myapp, so we have
/home/myapp
/home/myapp/logs
/home/myapp/public_html
/home/myapp/public_ftp
/home/myapp/etc
/home/myapp/tmp,
etc.
Command line that I’m using (unsuccessfully, so far), for running the app:
nohup /usr/java8/jre1.8.0_121/bin/java -jar b4jwebsocketstest.jar > nohup.out &
These are the questions:
1. I’m not sure where to put the jar. Erel, you mentioned to put it in any folder, but not to put it in /home/ myapp /public_html, because then it would be visible, along with any subfolders. That’s fine, but the index.html has to go in /home/ myapp /public_html, because I want the app to be visible at www.b4jwebsocketstest.com. But if we do that, then the b4jwebsocketstest.jar, is no longer in the same relative position with the main index.html, as in Dev (../objects/ b4jwebsocketstest.jar, and ../objects/www/index.html).
1a. If I put b4jwebsocketstest.jar in some random folder, e.g. /home/myapp/jettyapp in a different relative position from index.html than the development projects, then it won’t be able to locate index.html and other files (I think).
1b. Instead of explaining, can you list a sample folder structure for the .jar and associated js, css, and html files?
2. Do we need to install jetty on the server? Or is the entire jetty code, embedded in the B4J app, so Jetty doesn't need to be installed on the server? It was mentioned in https://www.b4x.com/android/forum/threads/server-run-a-server-on-a-vps.60378/#content, that the developer installed Jetty, along with Java.
3. If I have to install Jetty on the server, where is the link for Jetty? Should it be downloaded from here: http://www.eclipse.org/jetty/download.html?