We have a java application hosted on JBoss with a Posgres DB, and we've traditionally been selling it as an appliance (full server with application installed). Now, we need to allow clients to be able to download and install it on their servers. What is the best way to approach this? Ideally, I'd like it to be a one packaged installation file that they can run and it checks for dependencies, deploys the war file, executes the postgres sql to setup the database and start up jboss.
JBoss and Postgres will be installed by the client prior to installation.
The simplest way is to use a bash script for Linux and possible bat/cmd files for Windows, though that is not ideal. Are there any libraries available to accomplish something like this?
install4j can be used to let users install applications. The installation package will contain everything needed (application, JBoss, postgres). Furthermore, it has ant and maven tasks, too, and you can even allow the users to do some basic configuration on-the-fly.
The latest version of JBoss is OSGi based. Have you consider to use this solution ?
If JBoss and Postgres are already preinstalled and configured by users as they wish then it would be very difficult to make a silver-bullet automatic installer that takes into account and correctly handles whatever incompatibilities it can face in real life.
Maybe a detailed install instruction would be enough. Especially for advanced users. For the others - bundle some diagnoctic scripts in case they face problem.
Also consider using liquibase to do automatic database initialization and migration on application's startup. This would greatly simplify the rest of install procedure: just check deps, make datasource and deploy app.
Related
The idea is to embed jboss AS7 to my project and add it to version control. Additionally to check the ability of start the server using mvn jboss:devserver (similar to how we run mvn appengine:devserver) So does it makes sense to write my own archtype ?
To my client this reduce lot of complexities so we can create our own jboss configuration to work with and the client's C# developers who will be going to work on java project development. find it easier to setup their local machines to run their changes locally. using similar command mentioned above.(mvn jboss:devserver) I wonder if anyone ever had this idea to work by?
I would probably look into using something like Puppet, instead of checking in all of JBoss.
Puppet uses a custom declarative language to define system configurations. Your puppet script would probably do the following:
Download JBoss from a public server, and unzip it to your desired location
Copy custom configuration files from your version control repo into JBoss
Copy your applications into JBoss
Puppet is a lot more powerful than the simple scenario that I have just described, but this scenario is a start.
With this solution, you would only end up checking in your puppet script and any custom JBoss configuration files you might need. In addition, I believe it would make your JBoss upgrade path a lot simpler, as you would only need to change the version of JBoss in your puppet script, and re-run puppet.
I think the ideal way to deal with situations like this is through packaging. If your client is deploying on some sort of unix server (i include Linux in that), then they are already using a package manager to manage system software on their servers. A package manager has the ability to install software, remove it, upgrade it, and, crucially for you, to install other packages on which some package depends.
You could therefore package JBoss, so that the package manager could install it, then package your application, specifying a dependency on JBoss. When the client installs your application package, JBoss will automatically be installed.
However, this plan only works if you client has a certain degree of infrastructure set up. They need to be using a system with a package manager. They need to have a way of managing package installation (a configuration management tool like Puppet, Chef, Ansible, or something vendor-proprietary is ideal for this). They need to be able to distribute custom packages inside their environment. They need to have either a way of accepting custom packages from you, or of accepting package build scripts and then building packages themselves.
In a server environment of any size, the sysadmins should and probably will have all this infrastructure anyway, because it's fundamental to managing a fleet of servers. But if your client doesn't have it, it may be too much effort to set up.
That said, the absolutely minimal version of this approach would be for you to send them the package files for the application and JBoss by email or SFTP or whatever, and then for the sysadmins to install them manually (eg with yum localinstall). This is not a lot better than having them install JBoss manually, but it's a step in the right direction.
I have written an application in Java and used MySQL as the database system. The user can insert or delete the rows in database tables. I have developed the application on Ubuntu 11.10 and it is working properly.
My question is how should I port this application to a Windows machine? Do I need to install MySQL server on that machine? If yes, how to pack all executables into a single .EXE. How do I make this application work on all platforms?
Java applications, unless you did some less ordinary things such as relying on line ending or did JNI, should generally work OOB in all the platforms java is supported. Test and fix the things that don't work.
MySQL installations are different per environment, and yes, you'd need the DB server on that environment too, if you plan to run it locally. Usually, you'd request the user to install MySQL and configure it to your application - I see a potential EULA/TOS issue with packaging MySQL binaries with your own application. If you'd do it anyway, you'd want to use an installer to create an install file for you that would include the files and perform steps that are needed.
Edit: see this thread for more convenient alternatives than using MySQL with your software and also for a note about the potential license agreement issue.
Recently I made an application in using Swing, AWT and JDBC that manages some database. I used PostgreSQL as the backend with JDBC drivers to connect to the database. What I want to do is create a setup/installer program so that the application can be installed and used on any pc. My problem is I dont know how to integrate the database along?
Any help would be appreciated.
Take a lesson from most commercial applications that have a database component. Usually they require that the database be installed/configured beforehand and provide db scripts for their supported vendors. There are a lot of reasons for this. Most of these are related to the fact that organization's like to manage their own databases. This is often because they have company restrictions regarding security, maintenance, etc. Also a single database process may be shared between many different programs(if you install two instances of your application do you want to have to two installations of the database?).
Most folks(especially network admins) wouldn't want an application that ran around installing rogue DMBS's on their machine.
I wouldn't spend a ton of time attempting to install the database during your install process. Why re-invent the wheel when the vendor has already created an installation process for you? Instead install the database ahead of time and focus your installer instead on running the necessary scripts such that your application can connect to it on the first start up. What it does means is having your installer have the necessary drivers, connection information, and credentials to communicate with the database to get it initialized. After the DB is initialized then you can have additional routines that configure your application install such that it points to the database you initialized during the install. Taking this approach will not only be easier, but it will allow your application to do more interesting things like connect to remote databases or skip database initialization all together and connect to an existing database.
Writing an installer that also manages DB installation is a project in and of itself. The big question is do you need to install PostgreSQL from scratch or will you tell the user to install it themselves first?
I have attempted to do something similar and what I eventually did was build an installer with NSIS that includes Postgres and a JRE in the install bundle along with my program. The installer copies everything to the user's install location and creates all the required config files.
The biggest issue I had was that I had a number of config options to present to the user that would have taken a lot of programming in NSIS. So, I modified the ANT build scripts I already had written to build the project. What NSIS does then is copy the JRE to a temp location and start a Java installer GUI I wrote instead that gathers up all the config info and launches ANT in the background.
If you don't have much to configure or what you need to configure doesn't have many options, then you can probably do everything in NSIS directly. But, keep in mind that you need to be security conscious too. How are you creating a new user to run Postgres? What about directory permissions for you install? Who can start and stop the DB, who can read the db files, etc?
Maybe you may try a pure java database, like hsql, or h2, or derby....
Currently we have a Java Restlet API with dependencies controlled via Maven. When we update the API we run maven assembly:assembly which does the unit tests etc and produces a single jar file. We then upload this to the production server and run it using nohup.
Is there a better or more automated way of doing this? Is this where something like Hudson would come in?
Thanks
My experience goes with webapp-deployment. But same should hold true here. Use Maven, Cargo, Nexus (or Artifactory), Hudson and probably, Jira in conjunction of product release.
Automated release process are more reliable because there is no human factor involved that may forget a step.
We also use Liquibase for database versioning. And, if you are dealing with database changes in your application deployment. You'll realize Liquibase boosts so much confidence while running alter scripts.
I would suggest to go through the following resources
Automated Deployment with Maven - going the whole nine yards If you can, literally follow this pattern.
Maven 2 Effective Implementation -- this book really helped us a lot.
There are several Maven plugins to help deployment. The most general of them is Cargo, but there are also app server specific plugins for some concrete servers like JBoss.
Most companies I have worked for (actually, all) have had some sort of custom in-house built deployment system; even if build was done using a standard framework (like Maven in use at my current company).
Part of this is because there are many aspects that tie closely to company-specific infrastructure, capacity management and monitoring systems; and so even though there are open-source systems, there is usually something that needs to be tweaked.
It sounds like you are running your app on its own--it isn't part of any application server. If you aren't using an application server, there are probably some ways to get cargo and maven to deploy it for you, but you may be better off just using some shell scripts to deploy and run the application.
However, as your application grows, you may find a need for an application server like Jetty, JBoss, Glassfish, Tomcat, etc. When this happens, take a look at the cargo plugin for Maven because it will allow you to do something like:
mvn cargo:redeploy
That will package up your application, send it to the server and restart the app. If you want Hudson to do this for you automatically you can add it as a target to build.
Cargo can save you a lot of time when you have to frequently update an application server.
I asked this on superuser as well, but with no answers (even no views). If it's wrong to mention it here, please let me know or just move it. Thanks.
We are using a shared server (six people with root access for each user), which is reinstalled and -configured soon. I agreed to install GlassFish for everyone to use. However, I am developer and do only know basiscs of Unix/Linux.
Now my question is, what do I have to consider if I want to meet these requirements:
Automatic startup on reboot (did not happen often in the past)
Easy integration with Apache
Usage of existing MySQL/PostgresSQL instance
Patterns/Tools for easy (shared) usage (installation of Java EE apps, administration)
Patterns/Tools for easy (shared) monitoring (resources (mem, db), applications)
Tools for easing remote development (EJB/WAR deployment, JRebel?)
Of course, there might be other topics I forgot which should be addressed.
Automatic start up under FreeBSD can simply be implemented using a start-up script which should just do 'asadmin start-domain' to start glassfish and 'asadmin stop-domain'. I'm sure there's a number of articles on start-up script creation for your version of FreeBSD (I would check FreeBSD Handbook first).
As to remote deployments - you just need a local copy of glassfish and should use it's asadmin utility - it has command line arguments that allow doing any administrative tasks with remote glassfish installations as long as you have admin password on them.
If you have experience with Windows only then I would strongly consider using a Windows box for this. The Glassfish distribution has functionality to register a given domain as a service, and I would suggest that you just create a domain for each developer.