A Proof of Concept (PoC) for building and running Pro*COBOL programs in containers for deployment on Kubernetes.
This project demonstrates how to containerize and run a Pro*COBOL application with Oracle database connectivity in a modern Kubernetes environment. It leverages several open-source tools to create a fully containerized workflow.
- melange - For building packages
- apko - For building container images
- k3d - For running a local Kubernetes cluster
- kubectl - For interacting with Kubernetes
- maru - For running tasks
- Docker runtime
- Oracle Instant Client libraries (see below)
Due to Oracle licensing restrictions, you need to download the Oracle Instant Client files yourself. See the detailed instructions in src/libs/README.md for:
- Direct download links for the required packages
- Oracle account and license agreement requirements
- Specific version information and compatibility notes
- Proper placement of the downloaded files
The required files are:
- instantclient-basic-linux.x64-19.27.0.0.0dbru.zip
- instantclient-precomp-linux.x64-19.27.0.0.0dbru.zip
- src/cobolite.pco - The Pro*COBOL example application source code
- src/container.yaml - Configuration for building the container image
- src/package.yaml - Configuration for building the Wolfi package
- src/pipelines/procob.yaml - Pipeline for compiling Pro*COBOL code
- manifests/ - Kubernetes deployment manifests
- database.yaml - Oracle database deployment
- worker.yaml - COBOL application deployment
- The Pro*COBOL source code is pre-compiled and compiled using the Oracle Instant Client and GNU COBOL
- Melange builds a package with the compiled COBOL program and its dependencies
- Apko creates a minimal container image with the package
- K3d deploys a local Kubernetes cluster with:
- An Oracle database container
- A COBOL worker container that connects to the database
The full development workflow can be run with:
This command will:
- Check for required tools
- Generate necessary keys for Melange
- Build the COBOL package
- Build a container image
- Deploy to a local k3d Kubernetes cluster
- Run the COBOL application
The sample application (cobolite.pco) demonstrates:
- Connecting to an Oracle database using Pro*COBOL
- Retrieving environment variables for configuration
- Executing SQL queries
- Reading from and writing to files
- Processing command-line arguments
It can run in two modes:
- import - Reads data from a file and inserts it into the database
- export - Exports data from the database to a file (default mode in the demo)
To modify the application:
- Edit src/cobolite.pco
- Run maru run dev to rebuild and deploy
To change database connection details, modify the environment variables in manifests/worker.yaml.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.