I have a Linux (CentOS) based development system that is running Docker, and I have several other machines that will be used to develop client and server- side software that will be run in a Docker container. All software will be developed using Eclipse.
I have learned how to access and run remote docker containers from within Eclipse. What I would like to do is set up an environment where developers can write code (for example, server side code) in any language supported by Eclipse (particularly Java or Typescript), compile that code and run/debug it using Eclipse's debugger but within a remote docker container.
I have seen this capability in another IDE. VSCode has that capability for developers writing Python- based microservices. It allowed a team I was working with to write microservice code from within VSCode and actually run debugging sessions using VSCode debugger within a remote Docker container that was running on a shared, secure VM!
Is there a way to do this using Eclipse? If so, how can it be done?
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 made a small .NET Core REST API which I would like to be able to easily put on a Linux server running a Java app on Tomcat. Can one use Docker to ease the deployment of the .NET tool, and if so, how is it done? I was told by someone that Docker would (more or less) allow me to bundle the API as a single app/file without having to bother too much about deployment policies at the place I am working (which by default only allows for Java apps to Bd deployed).
You can use a docker image like e.g. microsoft/dotnet to run your app in a docker container. Please read the documentation on the linked page on how to run your app inside the container.
If you then map an exposed port (443, 80, 8080... depends on you app) using the -p option on container startup you can then access the REST endpoints from any software you like because it is basically behaving like an other REST server running on that host. Since you want to run tomcat in parallel you should avoid to map the port from the container to 8080 on you host, thought! Other than that this setup is totally independent from the application server running on the host itself.
I have a few Java applications, mostly with Spring Boot, in different servers (Droplets) from Digital Ocean. Previously I upload each new release manually and with some shell scripts created I am able to start/stop the applications. These scripts contains environment variables when it's necessary for test or production environments. To check if the application is running I have a cronjob launched every 5 minutes, this cronjob execute a shell script to start the application if it's not running.
However I switched to automatic deployments using Bitbucket pipelines and now I won't have shell scripts anymore because all the configuration will provided by the Bitbucket pipeline and will be executed over SSH.
For instance cat environment.sh start.sh | ssh xxx#yyy where environment.sh is created on the fly by the pipeline with right configuration in that moment for each environment.
How can I do something to start the application automatically if it's not running? Should I upload the script files in each automatic deployment and use a cronjob?
You should use a wrapper. YAJSW is popular, free and works (in my experience) well in production systems. The wrapper will restart your process if it crashes and can easily be installed as a service over many different OSes without much effort.
NOTE: I am not affiliated or related in any way to YAJSW.
I have created a java application in intellij ide. The application is working well. Now that my application is ready I want to transfer my java application from my machine to server and make it live. I have one server, domain and all the basic rights in the server. Can any one help me figuring out?
I am very new in this part. I dont know anything about hosting my own website and application.
The answer depends on what technology you use. If you use application that needs to be deploy into servlet container you can deploy it onto e.g. Tomcat.
Whatever technology you use you definiately should build your application - it also depends on what building system you use.
E.g.fFor gradle, you can use gradlew build.
For maven: mvn compile.
Tell us more details about technology you use to allow us to help you.
You have a java application (Dropwizard) and first need a server to run it on, which means that it must be a server with java installed or where you can install it yourself.
Then you need to transfer the application "fat" jar (typically you find this in the target directory, depending on how you built it) to this server and start it with java -jar my-application.jar.
Then you need to make sure that the port that the application runs on is available externally. This usually means that you need to have a web server installed (commonly nginx or httpd) which redirects from port 80 or 443 to the port of your application.
Only then is you app "live".
I'm new to Java and Java web applications. I'm trying to understand why I should use a Java application server like Tomcat instead of running it from command line.
Should I running Jenkins without a servlet container in production i.e using java -jar jenkins.war?
Is Tomcat more suitable for production environments?
Are there other advantages?
Please give me some idea why running the application in a servlet container is important.
Actually when you run Jenkins as "java -jar jenkins.war" it starts embedded servlet container anyway (Winstone or Jetty). Since main load on build server comes not from web users, but (surprise-surprise) from build jobs, I don't think servlet container type can affect performance. Moreover build jobs are started in separate JVM or even on slave machines.
Also all server/job/plugins configuration is stored in Jenkins home / config folder, so the way you started Jenkins does not affect server maintenance / backup tasks. Native installers also create user and start Jenkins as a service.
"Jenkins: The Definitive Guide" - "Running Jenkins as a stand-alone application may not be to everyone’s taste. For a production server, you might want to take advantage of the more sophisticated monitoring and administration features of a full blown Java application server such as JBoss, GlassFish, or WebSphere Application Server. And system administrators may be wary of the relatively little-known Winstone server, or may simply prefer Jenkins to fit into a known pattern of Java web application development. If this is the case, you may prefer to, or be obliged to, deploy Jenkins as a standard Java web application."