Since the last update, there is a now a new feature in the Univention App Center: “App Settings”. It allows simple configuration of an App from within the Univention Management Console. We developed this new feature so as to allow App Providers to improve the integration depth of an App in UCS and simplify the set-up of an App considerably with easy-to-use tools.
The focus of the App Center
Since it debuted in UCS 3.1 back in 2012, the App Center has evolved into a truly mighty tool, enabling software developers to present their solutions and place them with users. On the other side, users can try out new software solutions, put them into operation, and later maintain them up to date, all simply and securely.
Right from the very beginning, it was always important to us that Apps were installed and tested simply on the one hand and could be integrated deeply in the domain on the other. At the same time, it was also essential that they should not compromise the stability of the system as a whole. The improvements we have implemented in the App Center in recent years have always focused on this objective.
One particularly important milestone for UCS as an App Platform was the introduction of Docker support in UCS 4.1. Since the implementation of this technology, Apps have been delivered as containers, which results in more convenience for users and providers alike. This encapsulation of the Apps promises security on the one hand and simplicity on the other.
We promoted both aspects from the get-go: UCS-based containers, in which ad hoc packages from the software developers can be installed (a concept making them somewhat comparable to virtual machines) and “traditional” containers, which are developed by the manufacturer and delivered ready to use and with the full range of functions.
App Settings: What is this new feature for?
In “App Settings”, we have now introduced a new function in the Univention App Center which opens up further possibilities for software to interact with UCS and promises App Providers a genuine added value.
Via “App Settings” in the Univention Management Console, users can open a form with which they can configure the software during the installation or at a later point in time as they prefer.
Here is an example: The workflow for a certain software includes plans to send e-mails to users after certain events. However, to do so, it requires information on the mail configuration in the domain (the SMTP server and port as well as the user name and password) from the administrator.
Now, App Settings can be used to create a simple form which requests the necessary information and might look like the following:
Clicking on the “Apply Changes” button in the top right would send this information to the container and configure the App accordingly.
The Technology Behind It: Simple Text Files
From a technical perspective, the form is defined by an ini. file. A second file is run in the container, where it has access to the recently input data.
According to the above example, the settings file would look as follows:
[myapp/smtp/server] Description = SMTP Server [myapp/smtp/port] Type = Int Description = SMTP Port [myapp/smtp/user] Description = Username Description[de] = Benutzername [myapp/smtp/password] Type = PasswordFile Filename = /etc/myapp.smtp-secret
The names of the sections in the ini. file can be chosen at will and determine the internal name under which the values in the form are saved in the container.
Once a user has filled in the form, the values need to be processed. To do so, we require a second file – the configure script:
#!/bin/bash # if we were a UCS container, we could do "ucr get myapp/smtp/server" SMTP_SERVER=$(grep -e '^myapp/smtp/server: ' /etc/univention/base.conf | sed -e 's|^myapp/smtp/server: ||') SMTP_PORT=$(grep -e '^myapp/smtp/port: ' /etc/univention/base.conf | sed -e 's|^myapp/smtp/port: ||') SMTP_USER=$(grep -e '^myapp/smtp/user: ' /etc/univention/base.conf | sed -e 's|^myapp/smtp/user: ||') SMTP_PASSWORD=$(cat /etc/myapp.smtp-secret) # using the values needs deep understanding of the App of course. as this is just an easy example, we do: if [ -z "$SMTP_SERVER" -o -z "$SMTP_PORT" -o -z "$SMTP_USER" -o -z "$SMTP_PASSWORD" ]; then rm /opt/myapp/settings/smtp.settings exit 0 fi cat > /opt/myapp/settings/smtp.settings <<EOF server="$SMTP_SERVER" port="$SMTP_PORT" user="$SMTP_USER" password="$SMTP_PASSWORD" EOF chmod 0660 /opt/myapp/settings/smtp.settings /opt/myapp/bin/reload
App Settings and Start Parameters of Docker Containers
If the Docker App in the App Center is essentially a Docker container, as you would also find it in the Docker Hub, it often requires different start parameters, without which the container will not function. This is effected by entering the following in the command line:
docker run myapp:1.0 -e SITENAME="My Site"
In this example, the variable SITENAME could be used to write some initial data so that the user is presented with a “preconfigured” installation. “App Settings” can be used to provide this variable at the time the installation is started. The user is then asked before the installation which value the parameter should be assigned:
[SITENAME] Description = Name of the initial Site Description[de] = Name der initialen Site Show = Install Required = True
This simple measure means the App is now equipped with a kind of very simple “installer”.
All the files required for App Settings can be uploaded in the App Provider Portal. You can find further information and more advanced possibilities for the settings file in our documentation.
We hope that “App Settings” will present you with the opportunity to structure the configuration of Apps considerably more simply. For important settings which can only be adjusted in the App itself with considerable time and effort, it increases the convenience for the users, as they do not need to exit the Univention Management Console, plus it might be possible to simplify some steps via the configure script. However, it can also be used to allow a “graphic” installation of the App, which was not possible up until now, i.e., so as to provide an array of requisite parameters to the Docker container at the time installation is initiated.
Fun for more? These blog articles might also interest you:
- New in UCS 4.1: Docker Apps for the Univention App Center
- Introduction to the Univention App Catalog & UCS Appliances
For further questions, please visit our forum or comment below.
Use UCS Core Edition for Free!Download now
Open Source Software Engineer at Univention. Dirk is mainly engaged in the maintenance and further development of the Univention App Center.