Would it be possible to deploy/run (for testing purposes) a standalone Java application on a remote server from intellij? I'm not trying to connect to an already running JVM, but to start a new JVM on the remote host from intellij just like it was running on my local machine?
There is no built-in support for it at the moment. You can deploy an application to an application server running on a remote machine, but if you have a standalone application, there is no built-in feature to deploy it.
That said, you can write an Ant script or a shell script to deploy your app, and use either the Ant integration or the external tool feature to run it from with in IntelliJ IDEA.
Related
I have a application developed in Java 8 with SpringBoot, that use jni4net for consuming a dll library.
It's posibble make a docker container in Ubuntu to run this application ?
Thanks
Spring Boot with Docker
This guide walks you through the process of building a Docker image for running a Spring Boot application.
What you’ll build
Docker is a Linux container management toolkit with a "social" aspect, allowing users to publish container images and consume those published by others. A Docker image is a recipe for running a containerized process, and in this guide we will build one for a simple Spring boot application.
What you’ll need
About 15 minutes
A favorite text editor or IDE
JDK 1.8 or later
Gradle 2.3+ or Maven 3.0+
You can also import the code straight into your IDE:
Spring Tool Suite (STS)
IntelliJ IDEA
If you are NOT using a Linux machine, you will need a virtualized server. By installing VirtualBox, other tools like the Mac’s boot2docker, can seamlessly manage it for you. Visit VirtualBox’s download site and pick the version for your machine. Download and install. Don’t worry about actually running it.
You will also need Docker, which only runs on 64-bit machines. See https://docs.docker.com/installation/#installation for details on setting Docker up for your machine. Before proceeding further, verify you can run docker commands from the shell. If you are using boot2docker you need to run that first.
I want to run my java code on a remote server for faster speed (The server is very powerful). What I want is to connect my Intellij to that remote server and run my code. But I want to still use the IntelliJ on my local machine (i.e. my laptop).
I found a config section in IntelliJ which is in Default Setting->Build-executation-deployment-> Deployment and there I can set the address of my remote server and username and password. But I don't know what to do next.
There is a step by step deployment guide for PhpStorm, but for IntelliJ IDEA it would be almost the same.
Here is the example configuration for deploying a .jar file from artifact subdirectory to the remote server via SFTP into /home/serge/artifact directory:
I'd configure the artifact to produce the executable jar. Then adjust the deployment configuration to deploy the jar to the remote server. Or you can use Maven/Gradle to do the same.
Next, you can configure Remote SSH external tool to run the jar on the server (via java -jar jarname.jar:
Running on the remote server via Tools | External Tools | hello:
To automate the process enable Include in project build for the artifact, enable Automatic upload in Tools | Deployment and enable uploading of external changes in Tools | Deployment | Options.
To debug the code use Remote Debug configuration. Copy the JVM options needed for debug and adjust the options in your remote SSH external tool so that the app is started in debug mode and can accept connections (make sure firewall rules are adjusted to permit the connections on the specified port).
remote debug configuration
debug external tool configuration
proof of working
If you need to debug your web application running on remote server you can do it this way:
Deploy your code to remote server. There are several ways to do it:
By intergration IDEA with you application server. Go into Settings > Build, Execution, Deployments > Application Servers and add your application server there. You could later use it as deployment target. See documentation.
By integration via you building tool, for example, maven have plugins for integration with many app servers. This works well when your build process is complicated.
Manually - simple copy build artifacts into target app server machine and deploy manually.
Connect to server in debug mode. To do this you need to create separate Run/ Debug configuration in IDEA. If you have Enterprise Edition you could choose configuration template for your server (e.q. Tomcat Server) and choose server from your Application Servers list. In Community Edition you have to use default Remote configuration instead.
When setup is done, your workflow should be the following:
Make changes into code;
Redeploy it into server (restart it if necessary);
Run your debug configuration;
Access your application on server (via browser for example) to trigger required code for execution;
Debug
I was wondering if IntelliJ has a built in Application Server (like Tomcat) that I can use without having to download Tomcat directly?
Right now when I go to Run | Edit Configurations, Defaults, Tomcat Server, Local, it asks me to specify the Tomcat home directory.
Previously I had used myEclipse and it came packaged with a Tomcat so I would be suprised if the ultimate version of IntelliJ does not have this.
Intellij does not include built in application server. It has simple web server they refer to as Webstorm. However it is not application server.
Here is excellent resource (official docs) for working with application servers in intellij which you may find to be useful including tips on integrating it IDE via plugins etc:
Working with Application Servers
You need to download an application server manually.
Or you could use a Maven/Gradle dependency to start Tomcat programmaticly from the Main method, or a plugin for starting it via command line e.g. mvn tomcat:run.
I have installed Heroku java plug-in and trying to set example application i.e. "Web & Asynchronous worker with Spring, CloudAMQP". This project is following maven and application gets deployed on heroku thru maven.
Would it be possible to run same application using local java container, rabbitmq and worker running in same and/or different JVM?
Yes, Foreman will start any project that has a Procfile. If there are multiple processes defined it will start them all.
https://devcenter.heroku.com/articles/procfile#developing-locally-with-foreman
You'll have to build the project locally with Maven first. You can either set the config info for your rabbitmq instance into environment variable or save them in a .env file which foreman will pick up. You can look at your Heroku app with 'heroku config' to see the variables that the app is expecting.
I have a Java web application that I have managed to successfully deploy and get running on Heroku using the 'git push heroku master' method, but I would like to automate deployment and have a full CI setup. I've had a go at using Atlassian Bamboo with the Heroku plugin but it's really only suitable for standalone .war files - I need to be able to specify additional config via the Procfile definition in my project.
What have other people used for CI/CD of Java web applications to Heroku?
Jenkins has a good Heroku Plugin, that allow you to deploy WARs and interact with Heroku in many ways, including setting variables, scaling your dynos and running one-off processes:
https://github.com/heroku/heroku-jenkins-plugin/blob/master/README.md
To change the Procfile on Heroku, you need to commit and push the new file. You can do that as a step on your CI build. Jenkins can run scripts as part of your build, where you could easily push a new Procfile if that is needed.