Hi guys : I notice that the Solr installation directory has an executable jar file embedded in the "examples" folder. This is somewhat odd (normally, executables have their own directories - and specific examples would be implemented by having subdirectories with directives, configurations, etc.. )...
For example, we might consider the tomcat, hadoop, or other such server-side programs , which have a single executable that can be launched with a variety of configurations.
1) Im wondering .. do solr deployments compile their own start.jar files from scratch ? If not ... Then why is their no executable in the root solr installation directories.........
2) What is the "execution" model for Solr - do we compile our own versions with our own source code repositories ? How would we typically manage deployment and administration of solr instances?
The start.jar file in the example folder is just a quick start way of running Solr with Jetty after you have downloaded it as it needs a servlet container to run in. To answer your questions:
There is no executable in the Solr root because it needs to run in a servlet container being that it is a set of REST-like HTTP/XML and JSON APIs.
The best answer for this is to check out the SolrInstall page on the Solr Wiki, select a servlet container and follow those specific setup instructions.
The start.jar is an included version of Jetty, a servlet container. If you execute it, it starts a server at port 8983 with the .war file.
The jetty, example schema.xml, example solrconfig.xml are meant for tutorial purposes.
For a production environment, I would deploy the .war file in Tomcat . Tomcat would run fine as a service on bootup. (Even Jetty can be deployed in production).
http://wiki.apache.org/solr/SolrTomcat
Setting a Tomcat site: "my_search":
http://localhost:8080/my_search
manage deployment and administration of solr instances
There are solr cores. A simplistic analogy: if a Solr index can be called a big DB table, a Solr core would be a database.
http://wiki.apache.org/solr/CoreAdmin
Your can set up two cores like:
http://localhost:8080/my_search/my_classifieds_site
http://localhost:8080/my_search/my_doc_search
You can load/unload a core, swap a running core with a dormant one, swap two running cores without interrupting requests. And they are done with REST operations.
http://localhost:8080/my_search/admin/cores?action=CREATE&name=coreX&instanceDir=path_to_instance_directory
Related
I'm new to deployment, I've jar file as a package how should I go ahead for deployment in my prod server?
My prod server is basically an EC2 machine running on AWS
Shall I just run java - jar "jar file"? is this the practiced way for prod servers?
Shall I package .jar file to ear/war and deploy in tomcat/jboss server?
Help appreciated!
Both of the approaches you described are valid.
For small web APIs that include their own application server (e.g. Spark, Javalin, Spring Boot) on Linux servers, I start a screen session and run java -jar. This allows me to exit the SSH session (disconnect from the server) without terminating the program.
For other Spring applications that don't include an application server, I package the code into a WAR and copy it to an application server's deployment directory. For Tomcat, that's webapps. The application server can then read the WAR and spin up a running instance (assuming hot-deploy is enabled).
Tomcat in particular also has a web page where you can upload your WAR file to deploy it.
If you would that the program is still held run after disconnecting from SSH or closing the terminal in Linux. You can use this command:
nohup java -jar file.jar &
This is basically up to your preference and usual standard at your place. We have services in Docker that basically have exec java -jar param param... at the end of entry-point.sh script. You can run whole Tomcat, etc.
If you're using Spring Boot (which is a good idea), then java -jar is perfectly fine - you can use embedded Tomcat and skip installing dedicated application server (or, to be precise, servlet container).
Second approach is preferred over first in Jboss servers as things can be easily done through console.
You can control the deployment of the application on the servers.
If say you don't want to deploy the jar on all the servers part of cluster ,that can be taken care.
There's alot of questions on different forums [1] [2] [3] about this topic but none seem to provide a definitive answer. I've tried different combinations suggested in the various posts but I have yet to succeed.
My goal is to make compiled source code in a standalone tomcat (8) reloadable - just like the embedded tomcat reloads newly complied sources in e.g. spring-boot or Grails. There are a few constraints that I need to comply with:
No Grails or Spring-boot is available
No Maven or Gradle is available
The tomcat should read the exploded war file from an external location
To keep things simple I use a very simple JEE app with Spring MVC as POC for this before I move on to the real deal. The setup is as follows (for now):
Exploded war builds into directory target/exploded
Tomcat is setup with default settings except from Context.xmlwhere the two lines regarding WatchedResource are removed. Context is not set to reloadable="true".
The Tomcat server is run from within IntelliJ Idea (2016.3) like this:
where the "exploded" folder points to the target described above. And the "Server" tab like this:
The server starts up and the app is running fine. I then try to change some code, save it, and build a new exploded war file. I can see the class files change - but nothing is reloaded in tomcat.
Can anybody please elaborate? Is this approach even possible - in contrary to what many posts suggest? How is it possible in the embedded tomcat in e.g. Grails?
I've been using tomcat run configuration without any problems - it does a excellent job. However I kind of don't like the fact that it is not documented anywhere (or is it?) how this magic actually happens.
I suppose it somehow makes tomcat reference app created from artifact within target directory (if using maven). I also noticed that when using manager-gui app there are no other applications deployed so it must not use tomcat/webapps dir.
What I am curious is:
How does it start tomcat to point at the application outside tomcat home?
Does it deploy my app using {project_dir}/target/{appName}?
Where is the manager-gui app?
Where are the logs and conf files?
I'm using IntelliJ IDEA 15.0.3, Tomcat 8.0.15 and JDK 1.8.0_31
This is an excerpt from C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\bin\idea.properties:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.system.path=${user.home}/.IntelliJIdea/system
idea.system.path=D:/dev/IntelliJ-Settings/system
In File --> Settings... --> Build, Execution, Deployment --> Application Servers I've defined this: (look at Tomcat base directory)
D:\catalina-base-idea contains the global Tomcat configuration for IntelliJ.
When I deploy my webapp using IntelliJ run configuration, the web app will be deployed to D:\dev\IntelliJ-Settings\system\tomcat (see idea.properties).
The above explains question 1.
Question 2: afaik, target is only used for building, not for deploying.
Question 3: there is no manager app within D:\dev\IntelliJ-Settings\system\tomcat\webapps
Question 4: logs are within D:\dev\IntelliJ-Settings\system\tomcat\webapps\yourApp . The global Tomcat config is located in D:\catalina-base-idea.
You can configure the Tomcat for IntelliJ so that it uses a port other than 8080. So you can start your standard Tomcat and IntelliJ Tomact at the same time.
I read some comments about the build of dropwizard applications: [1] "Dropwizard is designed to run as a JAR, not as a WAR file." and [2]"You can't do this. Dropwizard embeds Jetty. You should look into just using Jersey as a standard web application.", so, my questions are:
1 - How to deploy a jar file in a production environment?
2 - How will I manage the service? for example, is there a way to monitor the healthy of the application? if the application falls down how can I restart it again automatically?
[1] How to create a war from dropwizard app?
[2] Dropwizard in tomcat container
You can use tools like runit or systemd to manage your dropwizard app on Linux. They can do things like make sure it starts when the system starts up, and can help with detecting failures. There is a bit of scripting involved.
You can point a monitoring tool at the healthcheck URL of your app to send alerts when it's down.
For deployment, I prefer to package apps using the system packaging format, .deb (Debian-based systems, including Ubuntu), or .rpm (RedHat based systems). Use the fpm package builder to create it, and include your runit files (or whatever), and scripts to copy the jar file somewhere on the target system. If you have a private package repository, you can put builds of your app into it, and installation becomes a matter of "apt-get install myapp" or "yum install myapp". Otherwise, drop the package onto your target server and run "rpm -i myapp.rpm" or similar.
After running mvn package of your source directory, the said jar file is created in the target directory by maven.
Just upload this jar file to a directory of your liking on the server, say /opt/myapplication/.
The jar file can be executed on the server with java -jar JARFILE, make sure you have java installed there. That's it, basically.
Now when you run this in production, you want to have the process supervised (and restarted if it fails) and started automatically on bootup. For this, look into your servers startup-system (systemd was mentioned before for those linux distributions that support it, but on current debian/ubuntu versions you have ATM still other boot mechanisms, you probably need to write a start script for /etc/init.d/myapplication).
Health checks are - as mentioned before - integrated in the dropwizard app, you simply request the health check url on a regular base. In professional environments, you should have a tool like nagios that you could point to the URL.
If your server is unix, you can build fpm packages to install your service on server. Just build fpm, copy to server and install it.
Or use fabric (http://www.fabfile.org/).
I am new to TorqueBox. I have created one RESTEasy app which is currently running on tomcat. Now I want to deploy it in TorqueBox.
For that I have created on yml file in apps folder of torquebox. The content of file is
---
application:
root: C:/torqueApp/java/RESTEasyTorque
env: development
web:
context: /hellojava
My problem is when i start server it doesn't deploy my app. What should i do?
Bob answered this on the mailing list, but I'll paste it here as well:
You can deploy pure Java applications on TorqueBox, but you don't use
a torquebox.yml (or *-knob.yml).
To deploy a Java application in TorqueBox, just drop your .war file
into the apps/ directory directly (I'm assuming TorqueBox 1.x)
fwiw, if deploying a Ruby application, you can put a torquebox.yml
inside your application, but the files in app/ would be a *-knob.yml
file, or an archived version of your application with the extension of
.knob.
When we refer to "knobs", we mean either the *-knob.yml, or the *.knob
archives, which are used in the apps/ folder. torquebox.yml is
primarily used within your application's own directory tree.
For Java applications, ignore everything TorqueBox-related, and you
can pretend that our distribution is just like JBoss AS6 (for
TorqueBox 1.x) or just like JBoss AS7 (for TorqueBox 2.x). Our
changes are purely additive, building on top of the JavaEE container
from JBoss.
from: http://markmail.org/message/zhjwhbgxarjsvdz7
For torquebox-2.3.x and above, you need to have jboss-clent.jar is available in your java app's library folder is automatically searches for running JBOSS instance and get deployed to it. However if you need to use Torquebox queues you to bind JBOSS to an IP using runtime JVM options e.g.
JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=192.168.100.101 -Djboss.bind.address.management=192.168.100.101 -Djboss.bind.address.unsecure=192.168.100.101
Then using JMS API you can use Torquebox queues