I have to set up a server to run a web application, which itself is composed of various "standard" software packages (Apache, PHP, MariaDB, several programming languages), and several web applications (including Moodle) and components installed from git repositories (as packaged versions are either too old or do not exist).

At present, we are using Debian for this, but (to better fit with other in-house servers) might be able to switch to Scientific Linux at some future point once the base packages catch up to being new enough for our use.

In common with many systems, the first version started off (after the minimal OS installation) as a quick and dirty shell script to install the packages and download from the git repos, etc, and no project time to try to investigate any sort of better installation solution.

The second iteration gradually built on this on and off over time and has now evolved into an 1100 line(!) interactive shell script, which downloads all of the necessary comppnents, configures the web and DB servers, sets up Moodle, and so on.

I'd like to think that this script is reasonably robust and non-hacky, but I am sure that it is not an ideal way to carry out this process. One thing that I have considered is breaking down the script into separate files for each of its functions (it has functions, at least), for ease of reading/editing/updating, and then concatenating these into the all-in-one install file.

Or have I created a monster, and there are better ways that I should manage this sort of software installation and configuration?

Other possibilities that I have considered include:

Would it be possible to convert my software installation procedure into some sort of Debian package, using dpkg-reconfigure (or something similar?) to query for the required settings from the administrator, but unfortunately I have no experience with this (and do not know whether this would be workable, given that some required "packages" necessarily have to be downloaded from git repos, rather than being able to be added as Debian package dependencies).

Whether there are perhaps other already existing software management or scripting systems that I should look into for this particular task, rather than relying on shell scripts?

  • 1
    There are numerous technologies that fit your description, e.g. container platforms such as docker, configuration management systems such as puppet, continuous automation platforms such as chef, or full-stack installers such as Omnibus. What is your deployment scenario? Are you after a way to package the different services and tools required to run your web application for users, so that they can install it without laborious configuration, or a way to automate in-house deployments? – Thomas Nyman Jun 21 '18 at 12:32