Automatic continuous compilation of webforms on linux/unix

6

Automatic continuous compilation of webforms on linux without X-terminal

In the webforms world you it is not uncommon to compile a webforms application on a linux/unix application server, after you’ve build a forms module on your Window development environment. Modules compiled on Windows typically will not run on another operating system, so the binaries must be deployed (i.e. by ftp) to the applicaiton server where they are compiled.

These tasks can be quite a burden if you imagine that every time a module is changed by a developer he/she has to ftp it to an application server, compile it and optionally copy the executable to a directory on the FORMS_PATH. Extra software must be installed on the desktop: an FTP client and optionally, X-terminal software to be able to compile the module in a grafical user interface. On the operating level the developer(s) should be known users on the application server. Finally, the developer(s) should be able to understand some unix/linux commands.

There is an easier way, however! Automatic, continous compilation. The goal is to maximize ease while minimizing the effort for both developers and administrators to deploy new/changed webforms modules to a linux based application server.This can be set up as described here.

The way we generally work at Amis is that all sources are maintained by a versioning system like CVS or subversion. The CVS or subversion client software is also installed on the application server. When a developer finishes developing on a forms module (or library module, menu module, etc), he/she checks-in the module into the versioning system.
And here ends the cycle for the developer (remember minimize ease)!

The application server picks up all changes from the version system via a shell-script scheduled in the crontab. It’s scheduled to run every 10 minutes, but the scheduling can be changed to any required value. The scheduled script is run as oracle-user because on our system the oracle-user is the only user privileged to run oracle software on the iAS. An example is show below.

#!/bin/bash
#
# Crontab job script for compilation webforms applications
# parameter 1: conn = Oracle connectstring (scott/tiger@orcl)
# parameter 2: os_user = username application owner (each application has os_user as owner)
#
. /etc/profile
cd /home/$os_user
svn update
/home/$os_user/bin/compile.sh $conn $os_user

The compile script that is called obviously compiles all new or changed modules in batch-mode using frmcmp_batch.sh. Then, finally the executables are moved to the FORMS_PATH path. The FORMS_PATH is set in the proper environment file on $MIDTIER_HOME/forms/server.
Using frmcmp_batch.sh over frmcmp.sh is crucial if you want to ommit X-terminal. By using crontab we are unable to use X-terminal applications.

An excerpt of the compile script is shown below.

#!/bin/bash
#
#  Compile recent (< 10 minuten) changes in application
#
echo Set Oracle environment
export FORMS_PATH=$PAGONI_HOME/build:$FORMS_PATH
export ORACLE_SID=midtier
export ORAENV_ASK=NO
. oraenv

export TERM=vt220
export ORACLE_TERM=$TERM
export NLS_LANG=AMERICAN_AMERICA.UTF8

# copy sources to build directory (code left out)

echo Compilation OFG-library modules ...
for i in `find $PAGONI_HOME/build/ofg*.pll -mmin -10`
do
  echo Compiling Library $i ....
  $ORACLE_HOME/bin/frmcmp_batch.sh userid=$conn module=$i module_type=LIBRARY compile_all=yes window_state=minimize
done

# repeat for other module types  (code left out)
# move executables to FORMS_PATH in environment file in $MIDTIER_HOME/forms/server.  (code left out)
echo Finished.
exit 0

Summary (pro’s-con’s):

The important pieces are to get it all working are setting ORACLE_TERM, NLS_LANG and FORMS_PATH and use frmcmp_batch.sh over frmcmp.sh. Further,

– On the application server no developer-user accounts are present.
– No other user-accounts than oracle needed to compile webforms application.
– Developers don’t have to install extra software (FTP-client, putty, X-terminal).
– Developers don’t have to learn linux/unix shell commands.
– Compilation is perfdormed automatically, via the cronjob.
– Compilation is done without the need of an X-terminal.
– Mandatory software on both developers desktop and on application server: versioning software (subversion or CVS).

Share.

About Author

6 Comments

  1. It give me
    FRM-91500: Unable to start/complete the build.
    when i run the frmcmp.sh in crontab

  2. The need to checkin before the form is compilated on the correct platform is not very attractive during development. I can imagine a developer does not want to wait x minute(s) before (unit)testing his/her progress on a linux/unix based environment.
    Does your develop-environment support alternative ways in this? I created a specific samba-share to the development AS. Every developer was able to put sources in that share and from there the compilation-process was started every 10 seconds or so. All it takes is an extra limited user for the samba-share.

  3. Harm Verschuren on

    Compilation is done with the application owner against the database the application is supposed to run. So, if the application is suppost to run against the testdatabase, it is conmpiled against the test database. This database schema is the same on both unix and windows.

    Compilation can fail in real life, so we generate some logging facilities. An email is sent to a designated user every time the compile job runs. This email contains also the forms compiler output. Sending an email is a standard feature of the crontab facility. Adding the form compiler output to the email is something we programmed by redirecting the compiler output to the email. There is no distinct in notification between succeesful compilation and errors. The desinated user always has to look through the email to see if there are errors.

  4. Harm,

    Though of course it is not supposed to happen, say that compilation on the Linux server fails, for example because a different database user is used for compilation than on the Windows client. Is there a way to find out about such compilation failures?

    Otherwise: great stuff and thanks a lot for sharing. (Not sure though about the ‘(remember minimize ease)!’ remark).