From 44d76c1072f7187cdc5f1e6caf2365ad51ad6a03 Mon Sep 17 00:00:00 2001 From: Sanjula Ganepola <32170854+SanjulaGanepola@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:27:57 -0500 Subject: [PATCH] Add service commander definition (#149) Signed-off-by: Sanjula Ganepola --- Makefile | 10 ++++- config/data.ini | 1 - config/dests.ini | 1 - docs/config/app.md | 2 +- docs/install.md | 78 ++++++++++++++++++++++++++++++-------- service-commander-def.yaml | 9 +++++ 6 files changed, 80 insertions(+), 21 deletions(-) create mode 100644 service-commander-def.yaml diff --git a/Makefile b/Makefile index 7d66626..6194bc8 100755 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ install: gmake -C config install BUILDLIB=${BUILDLIB} gmake -C ile BUILDLIB=${BUILDLIB} gmake -C camel install + install -m 555 -o qsys service-commander-def.yaml ${INSTALL_ROOT}/opt/manzan/lib/manzan.yaml uninstall: gmake -C ile uninstall BUILDLIB=${BUILDLIB} @@ -33,15 +34,20 @@ uninstall: /QOpenSys/pkgs/bin/yum install wget appinstall.jar: /QOpenSys/pkgs/bin/wget - /QOpenSys/pkgs/bin/wget -O appinstall.jar https://github.com/ThePrez/AppInstall-IBMi/releases/download/v0.0.3/appinstall-v0.0.3.jar + /QOpenSys/pkgs/bin/wget -O appinstall.jar https://github.com/ThePrez/AppInstall-IBMi/releases/download/v0.0.5/appinstall-v0.0.5.jar manzan-installer-v%.jar: /QOpenSys/pkgs/bin/zip appinstall.jar echo "Building version $*" system "dltlib ${BUILDLIB}" || echo "could not delete" system "crtlib ${BUILDLIB}" system "dltlib ${BUILDLIB}" + > config/app.ini > config/data.ini > config/dests.ini rm -fr /QOpenSys/etc/manzan + rm -fr /opt/manzan gmake -C config BUILDVERSION="$*" install BUILDLIB=${BUILDLIB} gmake -C ile BUILDVERSION="$*" BUILDLIB=${BUILDLIB} gmake -C camel BUILDVERSION="$*" clean install - /QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java -jar appinstall.jar --qsys manzan --dir /QOpenSys/etc/manzan --file /opt/manzan -o $@ + install -m 555 -o qsys service-commander-def.yaml ${INSTALL_ROOT}/opt/manzan/lib/manzan.yaml + echo "#!/QOpenSys/usr/bin/sh" > .postinstall + echo "ln -sf ${INSTALL_ROOT}/opt/manzan/lib/manzan.yaml /QOpenSys/etc/sc/services/manzan.yaml" >> .postinstall + /QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java -jar appinstall.jar -o $@ --qsys manzan --file /QOpenSys/etc/manzan --file /opt/manzan --post .postinstall diff --git a/config/data.ini b/config/data.ini index d90c5e1..6d247c8 100644 --- a/config/data.ini +++ b/config/data.ini @@ -1,4 +1,3 @@ - [sample] type=watch id=mznsample diff --git a/config/dests.ini b/config/dests.ini index 21c1a97..9811004 100644 --- a/config/dests.ini +++ b/config/dests.ini @@ -1,3 +1,2 @@ - [stdout] type=stdout \ No newline at end of file diff --git a/docs/config/app.md b/docs/config/app.md index 74945c5..4a4276e 100644 --- a/docs/config/app.md +++ b/docs/config/app.md @@ -1,5 +1,5 @@ -**Note: For almost all real-life deploutments of Manzan, this file can remain untouched!** +**Note: For almost all real-life deployments of Manzan, this file can remain untouched!** `app.ini` is made to hold two pieces of information: diff --git a/docs/install.md b/docs/install.md index 9989ce0..256a360 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,31 +1,77 @@ -This document will outline how to install Manzan on to IBM i. Manzan is install through a pase shell. We don't recommend using `qsh` or `qp2term`, and instead using SSH and a bash shell. +# Install -Building Manzan is easy for IBM i and we provide makefiles to simplify the entire process. +This document will outline how to install Manzan on to IBM i. Manzan is installed through a pase shell. We do not recommend using `qsh` or `qp2term`, and instead using SSH and a bash shell. -## Which Java to use -Use a Java version provided by IBM, which is at least version 8. When running the `java -version` command, the output -should contain the string `IBM`. Ex. `IBM Semeru Runtime Certified Edition`. Otherwise, Manzan may not function properly. +## Which Java to Use -## Install from GitHub release +Use a Java version provided by IBM, which is at least version 8. When running the `java -version` command, the output should contain the string `IBM`. Ex. `IBM Semeru Runtime Certified Edition`. Otherwise, Manzan may not function properly. -To install from a github release, simply perform the following steps: -1. Download the latest binary release from [the releases page](https://github.com/ThePrez/Manzan/releases) -2. If you didn't download to IBM i directly, transfer the `.jar` file to IBM i using technique of your choice -3. Run `java -jar ` +## Install from GitHub + +1. Make a "download" directory on IBM i by running the following from an SSH terminal: + + ```sh + mkdir -p /opt/download + ``` + +2. Download the latest binary release from the [GitHub releases](https://github.com/ThePrez/Manzan/releases) page (the file name will look like `manzan-installer-v#.jar`). + +3. If you did not download to IBM i directly, transfer the `.jar` file to IBM i using technique of your choice. + +4. Run the installer using: + + ```sh + java -jar + ``` For instance, to install version `0.0.6`, the steps from an IBM i (using open source `wget`) would look like: + ```bash +mkdir -p /opt/download +cd /opt/download wget https://github.com/ThePrez/Manzan/releases/download/v0.0.6/manzan-installer-v0.0.6.jar java -jar manzan-installer-v0.0.6.jar ``` -## Deployment basics +## Configuration + +Before starting Manzan, several configuration files (`.ini` extension) should be configured in `/QOpenSys/etc/manzan/`. For more details, refer to the [configuration](/config/index.md) page. + +## Startup + +### Option 1: Service Commander + +It is recommended to use [Service Commander](https://theprez.github.io/ServiceCommander-IBMi/#service-commander-for-ibm-i) to start/stop Manzan (or to have Manzan autostart). You can install it using: + +```sh +yum install service-commander +``` + +Once installed, you can use it to start, stop, and check the status of Manzan: + +```sh +## Start +sc start manzan + +## Check it's running +sc check manzan + +## Stop +sc stop manzan -* The configuration files (`.ini` extension) get created in `/QOpenSys/etc/manzan/` -* Manzan can be started with `/opt/manzan/bin/manzan` -* (optional) It is recommended to use [Service Commander](https://theprez.github.io/ServiceCommander-IBMi/#service-commander-for-ibm-i) to start/stop Manzan (or to have Manzan autostart at IBM) +## Check it's stopped +sc check manzan +``` + +### Option 2: Manual Startup + +Manzan can be manually started using: + +```sh +/opt/manzan/bin/manzan +``` -## Next steps +## Next Steps * Read more about the [configuration files](/config/index.md) -* Build your very first [handler](/examples/file.md) \ No newline at end of file +* Build your very first [handler](config/examples/file.md) \ No newline at end of file diff --git a/service-commander-def.yaml b/service-commander-def.yaml new file mode 100644 index 0000000..9c0df2c --- /dev/null +++ b/service-commander-def.yaml @@ -0,0 +1,9 @@ +name: Manzan +dir: . +start_cmd: ../bin/manzan +check_alive: manzan +batch_mode: 'true' +sbmjob_jobname: manzan +sbmjob_opts: JOBQ(QUSRNOMAX) +environment_vars: +- PATH=/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin \ No newline at end of file