0
votes

We have an java web app (war) running on Ubuntu, which is time consuming to a) setup and b)install updates. We want to automate it, but we dont know where the line between what an rpm package can do, and what a config tool such as puppet/chef/salt etc. can/should do. We don't have the resources to try everything.

There are two servers to config once - one with mysql, the other with tomcat & java. Each requires config files to be edited (my.cnf, server.xml), as well as other stuff installed (such as sendmail), creating a user for our app, adding a config file in ~/.grails with environment specific settings. Presumably this could only be done through something like puppet, or by hand, not with an rpm script.

Secondly, our app has a number of steps to go through. we were about to try to learn & use rpm, but we are not sure if this is the correct approach.

This is what we do to install our app:

  1. wget liquibase and unpack in our system users home dir.
  2. copy our war and liquibase file tar.
  3. create a script to run liquibase against the mysql server, and replace the IP/DB name with whatever that environment uses.
  4. stop tomcat.
  5. run the script to update the DB schema.
  6. drop the war into the webapps dir.
  7. start tomcat.
  8. check the log files for errors.

The issue is we don't know how to get the rpm to know things like the mysql servers ip address, unless one should use environment variables? Or should we not use rmp at all, just use puppet to do everything?

The question is, what is the guideline for what should be done with RPM, and what should be done outside it, in terms of

a. the initial server configuration with things like mysl, tomcat and a system user, and

b. the installation of updates to our app (which is usually just a new war and a new liquibase changelog which has to be executed), but could occasionally require config file changes.

Both can move files around, and run scripts.

Our app has no source to compile, and it is independent of any architecture (just need java)

2
That's several questions - splitting it up would get more useful responses. - Thomas Dickey

2 Answers

2
votes

In RPM (or DEB) should go:

Everything else should be done by other tool (manually/chef/ansible/puppet). E.g:

  • starting and enabling of service
  • configuring of application (even upgrade of configs)
  • creating/upgrading db schema (it can reside on different machine)
  • checking log files for errors
1
votes

Given your situation, I don't believe doing everything through RPM is the way to go. Certainly you can deploy the application binaries with that (nowadays it's very easy to package things, have a look at FPM https://github.com/jordansissel/fpm if you don't know it). But on top of that you need a configuration management system which changes configuration in your files and optionally execute commands if the files are changed (like restarting a service or a custom command).

I am a puppet user, but I recognize that in a situation like yours it's a bit of an overkill to get the infrastructure up and running just for 2 servers (the same is true for chef and salt).

What you could have a look at is ansible ( http://docs.ansible.com ). It's an orchestration tool that can install packages, manage configuration files and execute commands. Best of all: it doesn't need any infrastructure, you can run it from your workstation/laptop over ssh. It's very powerful and easy to start with.