I am making a Restful API Web Application :-
BackEnd :- Spring Boot
FrontEnd :- Angular 2
Database :- MySQL
Is it possible to package the app as a standalone Installer or maybe a single Jar file which can be run on clients Windows Machine and it will install all the required platforms like jre,apache tomcat,mysql,etc and create an icon which will open the app in the browser ?
If it is not possible then what are the possible alternatives from which we can achieve similar behavior.
A web application running in a client's windows machine is not the best scenario; but since you are open to alternatives, here is a possible alternative solution:
Dockerize your web application
Install docker on the client's machine
Pull the docker image from a private docker registry or distribute your own image to the client
Shortcut a command to run in the format "docker run OPTIONS IMAGE"; do not forget to expose your ports
Open the browser and access the app.
I would never try this, please use a server instead...
Related
I was able to create a JAVA Rest API Web Service using SpringBoot. How do I deploy it so not only my localhost can access it but other computers in the private LAN as well.
I dont want to officialy publish it outside. Is Glassfish the tool for this?
I want to have an endpoint like
https://privatewebservice.net/api/
in the private network that other people can use.
Thanks.
Deploy the rest on your tomcat server on port 80 and in other PCs in the private LANs update host file for privatewebservice.net to point to your PC's IP in the LAN
It needs to run an a servlet container(aka web server). There are many; Jetty, Tomcat, Glassfish etc. That servlet container will start and host your application and make it available via it's port(s).
You can run this process on any physical or virtual machine that is visible on your LAN. You could even use your own machine for this if it's visible to your LAN (barring firewall/network rules blocking the traffic).
To make it available to your LAN from your machine, find your machines internal LAN IP address (run ifconfig on Linux or ipconfig on Windows) and try accessing the app via that IP from your browser. If other machines on your LAN can see your machine, they should be able to access it too via that IP address (likely you will also have an internal DNS name for your machine which would be cleaner to use in case your IP address changes).
Obviously that's only good for development and testing. Generally for internal hosted applications for your company you would have a machine running somewhere that you could deploy the app to to make it accessible by others on your LAN.
It's worth noting that Spring Boot by default comes with an embedded server/servlet container. By default this is Tomcat, but can be changed to say Jetty, via configuration and changing default dependencies in your maven POM file or Gradle build file. The default will be fine unless you have some specific reason to change it.
To use this embedded server, use one of either Maven or Gradle Spring Boot plugins which will provide a set of tasks that can be used to build an executable Java jar file for the application that will run the application on the embedded server, and the application within it. This can then be run with something like java -jar myapp.jar
Technically speaking this would probably be the easiest way to deploy the application. With the only major requirement on the machine you are deploying to being a compatible version of Java. Although I'd recommend wrapping that app in a Docker image that already has Java on it and use Docker to run the docker image as a container. This means your applications' dependencies(including Java and it's specific version) are housed within the docker image/container and also means the machine that will run the app could host many different applications resource efficiently(RAM, CPU etc), with each managing their own dependencies. The machine hosting the app would then just need Docker installed on it, and doesn't get polluted with any other applications dependencies.
follow this step :
1- generate a war file of your Spring-boot project API - see here how to do
2- deploy it on tomcat server see here how to do
3- replace your localhost with your #adress ip (where the server is on and where the project is deployed)
I have developed small spring-boot microservice application and dockerized the same. I have multiple spring-boot services and angular which are dockerized using docker-compose file. My app runs fine in my local. I just wanted to host my app on Heroku for free. please help me how to host my app and how to configure multiple ports with application. how to deploy using docker-compose.
First of all, you can not run your docker-compose in heroku.
Docker is not required
If you will choose heroku, docker is not required. Just ensure that your spring boot apis and angular app are standard. If you fulfill that, just create many applications as git repositories you have (I guess you have it like this).
Smart heroku engine will detect the technology of your git repository and will provide you an standard dyno for your app. After that heroku will run standard commands of open source languages.
For example, heroku will run npm install and npm run start in your angular/nodejs app. If you don't put the start script in your package.json, an error will be trowed. The same will happen with your spring boot rest api.
If you have any error with your current spring boot apis, try to compare it with my templates https://github.com/jrichardsz/spring-boot-templates/tree/master/000-hello-world.
I want docker
Anyway, if you want to use docker in heroku, just put the classic Dockerfile inside of any git repository and push them to heroku. Smart engine will detect it and deploy it.
1.You don't need docker as answered already. See this link for deployment to Heroku
You could also deploy using Travis CI for continuous integration via github.
I have a fully functional java application(with .jar extension) that can be hosted on a server.
I have a front end website(php) that needs to accesses that application and provide the resultant data that comes out of the application.
What is the best way to do that ? Or am I missing some logic in here?
as of now the app is built as a mac application with a GUI interface where the user has to get the application installed on their workstation. Thus, deciding to move the app to server and provide an unique website where the frontend can access the app hosted on the server
You need to turn your java application to rest service, if you want to get data from java application for your frontend application. If your app's architecture is well design it will not be a big deal.
If you already have a front-end site running PHP, you are likely either running apache or nginx.
Using either, you can configure a proxy for a specific URL, to be forwarded to the application, i.e.
curl http://example.com
> serve /www/example.com/index.php
curl http://example.com/api/abc
> serve http://127.0.0.1:8080/abc
In your apache config file, assuming that once started, your jar file binds to port 8080.
ProxyPass /api http://127.0.0.1:8080/
ProxyPassReverse /api http://127.0.0.1:8080/
Can I run or deploy java web application inside selenium, without having to first deploy it in any web container.
So, I want to deploy web app in selenium testing environment. Can it be done ?
Thanks.
You cant deploy application inside Selenium.
What you are expecting is CI/CD pipeline, this you can achieve using any tools like Jenkins/Cruise Control etc. In this you need to maintain a separate environment(where you have to host your application) in which you will be executing your selenium tests, and only if those tests gets passed you can promote that build to other environments like QA/UAT etc.
Selenium is for handling your browsers and not for hosting a website.. It's not a webserver software like Tomcat, Apache.
Selenium expects an web URL to launch the application, which means, you need to have a web application up and running either hosted locally or in remote web sever..
I have java code (that generates jasper reports) and I couldn't convert it to .net and I want to run it on a "Cloud Services" how can I run java code into cloud service ?
any help will be appreciated
#Dhana provided a link to a tutorial for pushing a Java app to Azure in Cloud Services (worker role). You could also push to a Web role but it makes less sense since IIS runs in a Web role, and you'll probably want Jetty, Tomcat, or JBoss for your web server.
If you're running a console app, that's fine too - just launch it from a startup script or the OnStart() in your workerrole.cs.
You'll need to install the tooling into Eclipse. At this point, you'll be able to build Azure deployment packages, in a similar way to Visual Studio (The Azure plugin for Eclipse only works on Windows though). Part of the packaging sets up links to the appropriate JVM and web server package, as well as your own jar files.
If, say, you have a console app that listens on a port, you'll just need to make sure you have an input endpoint set up for the port you want to expose.