MSS Code Factory 2.11: Mark Stephen Sobkow's Code Factory   

Prev Documentation Home Next

Installing a Manufactured Project

Installing a Windows 10 with WSL Ubuntu development environment

I may no longer have a Linux system, but Windows Services for Linux with Ubuntu 18.04 LTS is quite adequate for most of my needs, though debugging C++17 means resorting to good old command line gdb unless I want the overhead of a full X server/client on my system.

All platforms use OpenJDK 13 with OpenJFX 13 at this time (thought that is, admittedly, limited to Windows 10 Home amd 64 and WSL Ubuntu 18.04 LTS.

Installing Manufactured Database Schemas

All of the platforms can run the Java client applications through a "bash" shell, so I've only tested the unsuffixed/Windows scripts and the .bash Linux scripts in the various 2.12 projects delivered by MSS Code Factory 2.

You'll also need to install the OpenJDK 13 and OpenJFX 13, or a commercial equivalent, and make sure it is your default JDK.

In the case of the 2.12 installation packages, you just need to extract the zip file, and add its java/bin directory to your PATH. For Microsoft SQL Server you need to install the JDBC drivers to the appropriate java/bin directory. Some projects might not properly package the PostgreSQL drivers, so add those if need be as well.

DB/2 LUW

Debian Linux

After installing the DB/2 LUW database software, which creates a database administrator account (I'll call it db2admin for the sake of argument) and a default instance for the administrator data, you'll need to do an su -l db2admin. If you've previously installed the database instance, drop the old database, and create a new instance, db2inst2 for argument's sake:

db2 drop database db2inst2
db2 create database db2inst2 using codeset utf8 territory us pagesize 32 k

Exit from the administrator account, and go to your project's dbcreate/$projectname$/db2luw directory. Remove any existing *.log files.

Connect to the database instance you just created, as in:

db2 connect to db2inst2 user db2admin using $password$

Create the msidata1 tablespace:

db2 create tablespace msidata1 pagesize 32 k

Now source the crdb_$dbname$.bash script. You'll see a series of messages stream by as the database is created and its initial security data populated.

. ./crdb_$dbname$.bash

Disconnect from the database:

db2 connect reset

A log file of the database install process is produced to db2output.log, or you can scroll back through the window to look for errors (which is what I prefer to do as it's much less to review than the whole log file is.)

Install the IBM-supplied JDBC .jar files in your project's java/bin directory and build the source. Add the directory to your PATH variable. Create appropriate .bash scripts for running the manufactured projects applications. There are many examples in the 2.12 projects shipped by MSS Code Factory 2.

Windows 10

After installing the DB/2 LUW database software, which creates a database administrator account (normally db2admin) and a default instance for the administrator data, you'll need to do an su -l db2admin and create an instance, say db2inst2:

db2 create database db2inst2 using codeset utf8 territory us pagesize 32 k

Exit from the administrator account, and go to your project's dbcreate/$projectname$/db2luw directory. Remove any existing *.log files.

Connect to the database instance you just created, as in:

db2 connect to db2inst2 user db2admin using $password$

Now create an "msidata1" tablespace, optionally providing arguments as defined by the IBM documentation:

db2 create tablespace msidata1 pagesize 32 k

Now call the crdb_$dbname$.bat script. You'll see a series of messages stream by as the database is created and its initial security data populated.

call crdb_$dbname$.bat

Disconnect from the database:

db2 connect reset

A log file of the database install process is produced to db2output.log, or you can scroll back through the window to look for errors (which is what I prefer to do as it's much less to review than the whole log file is.)

Install the IBM-supplied JDBC .jar files in your project's java/bin directory and build the source. Add the directory to your PATH variable. Create appropriate .bash scripts for running the manufactured projects applications. There are many examples in the 2.12 projects shipped by MSS Code Factory 2.

Microsoft SQL Server

Debian Linux

Although there is no support for Debian Linux to run a Microsoft SQL Server, you can install client access software provided by Microsoft. Once you have installed the database instance on the server and extracted the Microsoft SQL Server JDBC drivers to the appropriate subdirectory of your project's java/bin directory, you should be able to run the manufactured Java applications from the command line by adding the project's java/bin directory to your PATH after performing a successful ant build.

Windows 10

Open a DOS window. Go to your project's dbcreate/%projectname%/mssql directory. Delete any existing *.log files. Invoke crdb_%dbname%.bat with the arguments for the name of the system running SQL Server with instance identifier, the database administrator's user name (normally "sa"), and the password for the database administrator account:

crdb_%dbname%.bat hostname sa %password%

or

crdb_%dbname%.bat localhost\MSSQLServer sa %password%

The script will take a significant amount of time to run, and will produce a crdb_%dbname%.log file of the results of the database creation. If you search the log file for "Server", you should be able to verify that the script ran successfully.

You will need to install the Microsoft-provided JDBC .jar files to the appropriate subdirectory of your project's java/bin directory before you can build the manufactured code and run it. Creation of the appropriate project's .bat files for running the Java applications is left an exercise for the development team. There are many examples in the manufactured CF* 2.12 projects delivered alongside the MSS Code Factory 2.11 downloads from SourceForge.net.

MySQL

Debian Linux

After installing the MySQL database software, make sure you can connect as the administrator (normally "root") to the database server via TCP (127.0.0.1 if you're a developer.)

Exit from the administrator account, and go to your project's dbcreate/$projectname$/mysql directory. Remove any existing *.log files.

Run the crdb_$dbname$.bash script. You'll see a few summary messages go by as the database is created and its initial security data populated.

./crdb_$dbname$.bash -U root -P $password$

A log file of the database install process is produced to crdb_$dbname$-YYYYMMDD_HHhMM.log. You can verify that the installation ran cleanly by looking for the string "ERROR", and deciding if they matter or not.

Install the MySQL-supplied JDBC .jar files in your project's java/bin directory and build the source. Add the directory to your PATH variable. Create appropriate .bash scripts for running the manufactured projects applications. There are many examples in the 2.12 projects shipped by MSS Code Factory 2.

Windows 10

After installing the MySQL database software, make sure you can connect as the administrator (normally "root") to the database server via TCP (127.0.0.1 if you're a developer.)

Exit from the administrator account, and go to your project's dbcreate/$projectname$/mysql directory. Remove any existing *.log files.

Run the crdb_$dbname$.bat script. You'll see a few summary messages go by as the database is created and its initial security data populated.

./crdb_$dbname$.bat root $password$

A log file of the database install process is produced to crdb_$dbname$.log. You can verify that the installation ran cleanly by looking for the string "ERROR", and deciding if they matter or not.

Install the MySQL-supplied JDBC .jar files in your project's java/bin directory and build the source. Add the directory to your PATH variable. Create appropriate .bash scripts for running the manufactured projects applications. There are many examples in the 2.12 projects shipped by MSS Code Factory 2.

Oracle

It is possible, but very painful to install an Oracle XE server on a Debian "Jessie" Linux amd64 box, but I got it to work. To be honest, I can't remember all of the steps involved and I don't know which ones actually were important, so I'm not going to even try to document the process. But it can be done -- take heart!

Dual Platform: Linux and Windows/Cygwin64

After installing the Oracle database software, make sure you can connect as the administrator (normally "system") to the database server via TCP (127.0.0.1 if you're a developer.)

If you have previously installed an instance of the database, remove it by doing a "drop user $dbname$ cascade;" while you're logged in through a SQL*Plus command line.

Exit from the administrator account, and go to your project's dbcreate/$projectname$/oracle directory. Remove any existing *.log files.

Run the crdb_$dbname$.bash script. You'll see a few summary messages go by as the database is created and its initial security data populated.

./crdb_$dbname$.bash -H 127.0.0.1 -U system -P $password$ -D /oracle/accessible/tablespace/directory

You only need to create the tablespaces once, so omit the -D and directory specification if you have already done so by a previous install of the database schema. You can also optionally specify the Oracle server port via "-p $port$" as well. There is also a "-S $servicename$" option, but I don't think I've ever had to use either option.

A log file of the database install process is produced to crdb_$dbname$-YYYYMMDD_HHhMM.log. You can verify that the installation ran cleanly by looking for the string "ERROR", and deciding if they matter or not.

Install the Oracle-supplied JDBC .jar files in your project's java/bin directory and build the source. Add the directory to your PATH variable. Create appropriate .bash scripts for running the manufactured projects applications. There are many examples in the 2.12 projects shipped by MSS Code Factory 2.

PostgreSQL

Debian Linux

After installing the PostgreSQL database software, make sure you can connect as the administrator (normally "postgres") to the database server via TCP (127.0.0.1 if you're a developer.)

Exit from the administrator account, and go to your project's dbcreate/$projectname$/pgsql directory. Remove any existing *.log files.

Run the crdb_$dbname$.bash script. You'll see a few summary messages go by as the database is created and its initial security data populated.

./crdb_$dbname$.bash -H 127.0.0.1 -U postgres -P $password$ -D /postgres/accessible/tablespace/directory

You only need to create the tablespaces once, so omit the -D and directory specification if you have already done so by a previous install of the database schema. You can also optionally specify the PostgreSQL server port via "-p $port$" as well.

A log file of the database install process is produced to crdb_$dbname$-YYYYMMDD_HHhMM.log. You can verify that the installation ran cleanly by looking for the string "ERROR", and deciding if they matter or not.

Install the PostgreSQL-supplied JDBC .jar files in your project's java/bin directory and build the source. Add the directory to your PATH variable. Create appropriate .bash scripts for running the manufactured projects applications. There are many examples in the 2.12 projects shipped by MSS Code Factory 2.

Windows 10

After installing the PostgreSQL database software, make sure you can connect as the administrator (normally "postgres") to the database server via TCP (127.0.0.1 if you're a developer) from the DOS command line.

Exit from the administrator account, and go to your project's dbcreate/$projectname$/pgsql directory. Remove any existing *.log files.

Run the crdb_$dbname$.bat script. You'll see a few summary messages go by as the database is created and its initial security data populated.

crdb_$dbname$.bat 127.0.0.1 postgres $password$ C:\postgres\accessible\tablespace\directory

You only need to create the tablespaces once, so omit the directory specification if you have already done so by a previous install of the database schema. The scripts do not allow for specifying a port under Windows.

A log file of the database install process is produced to crdb_$dbname$.log. You can verify that the installation ran cleanly by looking for the string "ERROR", and deciding if they matter or not.

Install the PostgreSQL-supplied JDBC .jar files in your project's java/bin directory and build the source. Add the directory to your PATH variable. Create appropriate .bash scripts for running the manufactured projects applications. There are many examples in the 2.12 projects shipped by MSS Code Factory 2.

Deploying and initializing your project

There are sample Tomcat 8 server.xml configuration files for the http XMsg server and the https SM server in the 2.12 java directories.

The SM (Security Manager) war is deployed with HTTPS enabled, while the XMsgSrv war is deployed over HTTP and implements its own encryption schema using AES256.

You'll need to use the Java keytool to create RSA 2048 bit key pairs for the XMsg server and for your client device.

keytool -genkeypair -keystore $keystoreFileName -storepass pw -keyalg RSA -keysize 2048 -alias $deviceName -validity 2000 -storetype jceks

You need to change all the references for CFDbTest212 to the name and version of your project, and it is particularly important to update the database PoolClass variable to specify the class name of the database connection pool for your project and the database you are using to run your server (the sample configurations are for Tomcat 8 with PostgreSQL.)

In order for users to be able to register new accounts via the Security Manager pages, the Java mail configurations have to be specified and valid. A confirmation email gets sent out when the user registers a new account, and unless they continue the registration process using the link provided by that email, they will not be allowed to log in to the system.

Launch the security manager web server and use a browser to navigate to the default index.html page for the services. You'll be redirected to initialize the server's password and cluster information, then redirected to the login web form. Note that I do not think you can run the HTTPS and HTTP servers at the same time in one web container instance, because the Security Manager and XMsgSrv would each try to initialize the global database connection pool and probably cause problems for each other as a result.

Now launch your Custom JavaFX HTTP GUI client. It will initialize it's configuration file, which you can then edit to point to your preferred JCEKS key store, and specify the name of the device/key alias of an RSA 2048 key pair. Once you've done so, relaunch the client application.

You'll be prompted by the client application for your keystore and key passwords, after which a window is displayed with the device name and export key text. Leave that window alone for the moment.

Log in to the Security Manager web interface as "system" using the password you configured, and add a device. Copy-paste the device name from the client application to the appropriate form field, and then copy-paste the key text to the appropriate form field. When you submit the device public key information, the server will verify that it can use the key for authentication, and save it as the default for the system account. Note that you can have as many device keys configured as you like.

Now you can launch the XMsgSrv war in it's web server.

Once the XMsgSrv war is started, you can log in to the client. If you launched the server in debug mode through Eclipse, a browser will have been started and redirected from index.html to the server's providing URL. Copy-paste that URL to the Server URL field of the login form.

The cluster has to be either "default" or "system". If it's "system", then the tenant also has to be "system". If it's "default", you'd normally be able to use any tenant name you've created under the default cluster.

You should get a connected dialog box, and then be able to navigate around the Swing GUI.

Don't forget to log out when you're done.