diff --git a/README.md b/README.md index 34b90a4..e9e3214 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,70 @@ -# TIBCO JasperReports® Server for Containers -This project intends to build, configure, and deploy TIBCO JasperReports® Server and Scalable Query Engine on Docker and Kubernetes. \ No newline at end of file +# TIBCO JasperReports® Server for minikube +This repository is a fork of the [TIBCOSoftware/js-docker](https://github.com/TIBCOSoftware/js-docker) repository. + +This project intends to build and deploy a minimal TIBCO JasperReports® Server Professional Edition installation to a local Kubernetes cluster using [minikube](https://github.com/kubernetes/minikube). + +JasperReports Server minikube cluster + +This project contains a bash script that aims to codify the steps found in the base repo docs here: +- [Use Case: Deploying TIBCO JasperReports® Server Using PostgreSQL Container in K8s Cluster](./jaspersoft-containers/K8s/jrs/README.md#use-case-deploying-tibco-jasperreports-server-using-postgresql-container-in-k8s-cluster) + +
+ +# Prerequisites + +1. [Docker-engine (19.x+)](https://docs.docker.com/engine/install/) +1. [minikube](https://minikube.sigs.k8s.io/docs/start/) +1. [Docker Compose (3.9+)](https://docs.docker.com/compose/install/) +1. [Helm 3.5](https://helm.sh/docs/intro/) +1. [kubectl commandline tool](https://kubernetes.io/docs/tasks/tools/) +1. TIBCO JasperReports® Server +1. Minimal Knowledge of Docker and K8s + +# Setup +Clone the project +``` +git clone git@github.com:pdeters/js-docker-mk.git +cd js-docker-mk +``` +Download a commercial edition of TIBCO JasperReports® Server WAR File installer zip into the current directory. +- _Currently this works for exactly_ `TIB_js-jrs_8.1.0_bin.zip` + + +Obtain a JRS license file and place it in the current directory as `jasperserver.license` + +# Run +**Run the default setup script:** +``` + sh minikube/setup.sh +``` + +This script will delete and recreate minikube, create and customize necessary files in the base repository and unzipped installer directories, then build and deploy the Docker images to minikube using Docker Compose and Helm. + +
+ +**Run the default setup script, accepting all prompts:** + +The default setup script will prompt you before doing anything destructive (such as running `minikube delete`), but you can skip these prompots using the `-f` flag: +``` + sh minikube/setup.sh -f +``` + +
+ +**Run the setup script, with a custom k8s namespace:** + +By default this script will install all k8s resources in the `jasper-reports` namespace, but you may also provide your own using the `-n` flag: +``` + sh minikube/setup.sh -n custom-namespace +``` + +
+ +**Run the cleanup script:** + +By design this script aims to not modify any of the asset files in the base repository, so once the script has completed you should expect to see several modified and untracked files (aside from the zip and license files you initially [setup](#Setup)). + +It's not reccomened to commit these changes, so after the setup script completes, you can run it again to cleanup using the `-c` flag: +``` + sh minikube/setup.sh -c +``` diff --git a/jrs-cluster.png b/jrs-cluster.png new file mode 100644 index 0000000..1f2fc5c Binary files /dev/null and b/jrs-cluster.png differ diff --git a/minikube/conf/.gitignore b/minikube/conf/.gitignore new file mode 100644 index 0000000..acf4ee6 --- /dev/null +++ b/minikube/conf/.gitignore @@ -0,0 +1 @@ +jasperserver.license diff --git a/minikube/conf/docker.default_master.properties b/minikube/conf/docker.default_master.properties new file mode 100644 index 0000000..8ab54f1 --- /dev/null +++ b/minikube/conf/docker.default_master.properties @@ -0,0 +1,33 @@ +################################################################################ +# This is a custom version of: +# ../jasper-containers/Docker/jrs/resources/default-properties/ +# default_master.properties +################################################################################ + +# application server +appServerType = tomcat +appServerDir = /usr/local/tomcat + +# database host +dbType=postgresql +# Docker Compose +#dbHost=repository +# For docker for desktop windows and mac +# host.docker.internal +## for k8s +## repository-postgresql.default.svc.cluster.local + +# CUSTOM: THe '.K8S_NAMESPACE.' segment will be replaced with the correct namespace +dbHost=repository-postgresql.K8S_NAMESPACE.svc.cluster.local +js.dbName=jasperserver +dbUsername=postgres +dbPassword=postgres + +#############SCALABLE QUERY ENGINE PROPERTIES########### +scalableQueryEngine.enabled=false +scalableQueryEngine.url=http://localhost:8081 + +chrome.path=/usr/bin/chromium + +# misc +preserve_master_properties_footer_comments_when_encrypting_buildomatic=true diff --git a/minikube/conf/docker.env b/minikube/conf/docker.env new file mode 100644 index 0000000..8ef9745 --- /dev/null +++ b/minikube/conf/docker.env @@ -0,0 +1,28 @@ +################################################################################ +# This is a custom version of: +# ../jasper-containers/Docker/jrs/.env +################################################################################ + +INSTALL_CHROMIUM=false +JASPERREPORTS_SERVER_APP_IMAGE_NAME=jasperserver-webapp +JASPERREPORTS_SERVER_BUILDOMATIC_IMAGE_NAME=jasperserver-buildomatic +JASPERREPORTS_SERVER_VERSION=8.1.0 +JASPERREPORTS_SERVER_APP_IMAGE_TAG=8.1.0 +JASPERREPORTS_SERVER_BUILDOMATIC_IMAGE_TAG=8.1.0 +TOMCAT_BASE_IMAGE=tomcat:9.0.54-jdk11-openjdk +JDK_BASE_IMAGE=openjdk:11-jdk +RELEASE_DATE=May 13,2022 + +# JS_INSTALL_TARGETS=gen-config pre-install-test-pro prepare-all-pro-dbs-normal + +# CUSTOM: Used the "for minimal setup" suggested targets +JS_INSTALL_TARGETS=set-minimal-mode gen-config pre-install-test-pro prepare-js-pro-db-minimal + +## For including samples gen-config pre-install-test-pro prepare-all-pro-dbs-normal +## For minimal setup set-minimal-mode gen-config pre-install-test-pro prepare-js-pro-db-minimal + +# To connect the Scalable Adhoc worker +# docker for desktop , it should be host.docker.internal +# for linux , use the complete DNS or host IP +SCALABLE_QUERY_ENGINE_ENABLED=false +SCALABLE_QUERY_ENGINE_URL=http://host.docker.internal:8081 diff --git a/minikube/conf/keystore.postgres.default_master.properties b/minikube/conf/keystore.postgres.default_master.properties new file mode 100755 index 0000000..8cb675c --- /dev/null +++ b/minikube/conf/keystore.postgres.default_master.properties @@ -0,0 +1,294 @@ +# +# Copyright (C) 2005 - 2022 TIBCO Software Inc. All rights reserved. +# http://www.jaspersoft.com. +# +# Unless you have purchased a commercial license agreement from Jaspersoft, +# the following license terms apply: +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +################################################################################ +# This is a custom version of: +# ..//buildomatic/sample_conf/postgresql_master.properties +################################################################################ + +################################################################################ +# # +# Master Properties File # +# # +# Standard usage is to rename this file to default_master.properties. # +# It should be placed in the root of the buildomatic directory, like: # +# # +# /buildomatic/default_master.properties # +# # +# There is one sample property file for each database type. Sample property # +# files are found in: # +# # +# /buildomatic/sample_conf # +# # +################################################################################ + +################################################################################ +# # +# Installation Settings # +# # +# Set values for: # +# # +# 1) Application server type # +# # +# 2) Path to application server home directory # +# # +# 3) Database location and connection settings # +# # +################################################################################ + +# Application Server Settings +# Type tomcat supports installation on Apache Tomcat 8.5 and 9 +# Type jboss-eap supports installation on JBoss EAP 7.x version +# Type wildfly supports installation on Wildfly 11.x - 14.x +# Type glassfish supports installation on glassfish 4.1.x +# See Platform Support document, Release Notes and Installation guide for more details. + +# appServerType = tomcat +# appServerType = jboss-eap-7 +# appServerType = wildfly +# appServerType = glassfish +appServerType = skipAppServerCheck + +# Tomcat app server root dir +appServerDir = C:\\Program Files\\Apache Software Foundation\\Tomcat 9.0 +# appServerDir = /home/devuser/apache-tomcat-9.0 +# if linux package managed tomcat instance, set two properties below +# CATALINA_HOME = /usr/share/tomcat9 +# CATALINA_BASE = /var/lib/tomcat9 + +# JBoss app server root dir +# appServerDir = C:\\wildfly-14.0.1.Final +# appServerDir = /home/devuser/wildfly-14.0.1.Final + +# jboss.profile = default + +# Glassfish app server root dir +# appServerDir = C:\\glassfish-4.1.2 +# appServerDir = /home/devuser/glassfish-4.1.2 + +# database type +dbType=postgresql + +# database location and connection settings + +dbHost=localhost +dbUsername=postgres +dbPassword=postgres + +# additional database parameters +# (uncomment these if you want non-default settings) + +# dbPort=5432 + +# JasperServer db name, sample db names +# js.dbName=jasperserver +# sugarcrm.dbName=sugarcrm +# foodmart.dbName=foodmart + +# Uncomment below settings ONLY for split installation +#installType=split +#audit.dbHost=localhost +#audit.dbUsername=postgres +#audit.dbPassword=postgres +#audit.dbPort=5432 +#audit.dbName=jsaudit + + +# web app name +# (set one of these to deploy to a non-default war file name) +# webAppNameCE = jasperserver +# webAppNamePro = jasperserver-pro + + +################################################################################ +# # +# Additional Settings # +# # +# Set values for: # +# # +# 1) Setup Alternate JDBC Driver # +# # +# 2) Skip JDBC Driver Deploy # +# # +# 3) Modify Diagnostic JMX Configurations # +# # +# 4) AWS Data Source Settings # +# # +# 5) Glassfish Application Server Settings # +# # +# 6) Report Scheduler Email Properties # +# # +# 7) Encryption Settings # +# # +# 8) Override PostgreSQL default Locale on DB Creation # +# # +# 9) External Authentication Data Sources # +# # +################################################################################ + +# 1) Setup Alternate JDBC Driver +# +# Uncomment and modify the value in order to change the default +# Driver will be found here: /buildomatic/conf_source/db/postgresql/jdbc +# +# maven.jdbc.groupId=org.postgresql +# maven.jdbc.artifactId=postgresql +# maven.jdbc.version=42.3.5 + + +# 2) Skip JDBC Driver Deploy +# +# Uncomment and modify the value in order to change the default +# Flag used to skip JDBC driver deploying during deployment process +# +# deployJDBCDriver=false + + +# 3) Modify Diagnostic JMX Configurations +# +# Current default settings are shown as the property values below +# Uncomment and modify the value in order to change the default +# +# Diagnostic server: false uses Jaspersoft built in server, true to supply your own +# diagnostic.jmx.usePlatformServer = false +# +# change this value if you have more than one app server on same machine running JRS +# diagnostic.jmx.port = 10990 +# +# change this if you have more than one instance of JRS on the same app server +# diagnostic.jmx.name = jasperserver +# +# change this to your RMI registry host name or IP, if you use a separate one +# diagnostic.jmx.rmiHost = localhost + + +# 4) AWS Data Source Settings +# +# Current default settings are shown as the property values below +# Uncomment and modify the value in order to change the default +# +# Change this value if you want to disable the AWS Data Source security group creation +# This group will allow your instace have access to target AWS data source instance +# aws.db.security.group.changes.enabled=true +# +# Db Security Group Name. Need to be overridden if server (where instance is running) +# is out of scope Amazon to have unique group name for this server. +# aws.db.security.group.name=JRSSecurityGroup +# +# Change this value to have a specific description +# aws.db.security.group.description=Jasper Report Server Security Group +# +# Provide the server IP address if your server is outside Amazon +# This is the Ingress Public IP address of server that will be added in the +# DB Security Group to have access to target AWS data source instance +# aws.db.security.group.ingressPublicIp= + + +# 5) Glassfish Application Server Settings +# +# Current default settings are shown as the property values below +# Uncomment and modify the value in order to change the default +# +# Glassfish domain name (default is domain1) +# glassfishDomain=domain1 +# +# Glassfish domain port (default is 4848), user (default is admin) and password. +# glassfishPort=4848 +# glassfishUser=admin +# AS_ADMIN_PASSWORD=adminadmin + + +# 6) Report Scheduler Email Properties +# +# Current default settings are shown as the property values below +# Uncomment and modify the value in order to change the default +# +# These properties control the configuration of the Report Scheduler functionality. +# The standard default application server http ports are the following: tomcat 8080, +# jboss 8080, glassfish 4848, weblogic 7001, websphere 9080 +# These values will show up in the file WEB-INF/js.quartz.properties +# +# quartz.mail.sender.host=mail.example.com +# quartz.mail.sender.port=25 +# quartz.mail.sender.protocol=smtp +# quartz.mail.sender.username=admin +# quartz.mail.sender.password=password +# quartz.mail.sender.from=admin@example.com +# quartz.web.deployment.uri=http://localhost:8080/jasperserver-pro + + +# 7) Encryption Settings +# +# For encryption of buildomatic passwords: only encrypt=true is required. The rest of the +# properties are going to be set to defaults below. One could also choose to modify those +# properties but only for the first encrypt=true build pass. +# +# Note: JNDI password decryption in context.xml only works for Tomcat (and tcServer). Other +# servers should handle their own container encryption. For eg., for jboss, after encrypt=true +# install run, js-jdbc-ds.xml gets the encrypted password values. If the intention was to encrypt +# buildomatic only, the admin must reset the password to plain text ones in JBoss or use internal +# JBoss encryption. Also, see the JasperReports Server Admin Guide for a full description. +# +# encrypt=true +# build.key.algo=AES +# build.key.size=128 +# enc.transformation=AES/CBC/PKCS5Padding +# enc.block.size=16 +# propsToEncrypt=dbPassword + + +# 8) Override PostgreSQL default Locale on DB Creation +# +# When the 'jasperserver' repository database is created under Linux, the default +# locale is used from PostgreSQL. PostgreSQL sets this locale when it is installed +# and initialized. If the PostgreSQL locale does not support UTF-8 encoding then +# JasperServer will have trouble with the database creation. The 'jasperserver' +# database should have UTF-8 encoding in order to fully support language +# internationalization. The PostgreSQL default locale can be overridden by using +# the properties below in order to specify a locale that supports UTF-8 encoding. +# +# Uncomment the properties below to specify a particular Locale +# +# db.set.lc_collate=en_US.utf8 +# db.set.lc_ctype=en_US.utf8 + +# 9) External Authentication Data Sources +# +# Configure external LDAP context source or external database datasource here in order to be able +# to encrypt the passwords. +# +# external.jdbcDriverClass=com.mysql.jdbc.Driver +# external.jdbcUrl=jdbc:mysql://localhost:3306/EXTERNAL_DB +# external.dbUsername=externalUsername +# external.dbPassword=password +# +# external.ldapUrl=ldap://localhost:389/o=External_LDAP_Org +# external.ldapDn=cn=Manager,o=External_LDAP_Org +# external.ldapPassword=secret + +# TODO: KEEP THIS PROPERTY LAST +# dummy property to temporarily fix bug 33916. +# Without this property, the last comments in master property file are removed, +# when buildomatic is encrypted (encrypt=true). +# The permanent fix will be to upgrade buildomatic/target to commons-configuration 2.0. +# http://commons.apache.org/proper/commons-configuration/download_configuration.cgi +# Original Apache bug https://issues.apache.org/jira/browse/CONFIGURATION-525 +preserve_master_properties_footer_comments_when_encrypting_buildomatic=true diff --git a/minikube/setup.sh b/minikube/setup.sh new file mode 100755 index 0000000..5f1ae60 --- /dev/null +++ b/minikube/setup.sh @@ -0,0 +1,279 @@ +#!/bin/bash + +set -u + +FORCE=true + +PROJ_ROOT_PATH=$(cd "${0%/*}" && echo "$PWD") +PROJ_CONF_PATH=$(cd "$PROJ_ROOT_PATH/conf" && echo "$PWD") +REPO_ROOT_PATH=$(cd "$PROJ_ROOT_PATH/../" && echo "$PWD") +DOCKER_PATH="$REPO_ROOT_PATH/jaspersoft-containers/Docker" +K8S_PATH="$REPO_ROOT_PATH/jaspersoft-containers/K8s" + +INSTALLER_ZIP="TIB_js-jrs_8.1.0_bin.zip" +INSTALLER_PATH="$REPO_ROOT_PATH/jasperreports-server-pro-8.1.0-bin" + +K8S_NAMESPACE="jasper-reports" +K8S_POSTGRES_POD_NAME="pod/repository-postgresql-0" + +msg() { + printf "\n🦄 %s\n\n" "$1" +} + +msg_ol() { + printf "\n🦄 %s\n" "$1" +} + +delete_quietly() { + [ -e "$1" ] && rm "$1" +} + +# +# Clean +# + +clean() { + msg "Cleaning generated and modified files" + + # Delete existing keystore files in user home + delete_quietly ~/.jrsks + delete_quietly ~/.jrsksp + # Delete existing keystore files in Docker keystore directory + delete_quietly "$DOCKER_PATH/jrs/resources/keystore/.jrsks" + delete_quietly "$DOCKER_PATH/jrs/resources/keystore/.jrsksp" + # Checkout existing Docker Componse environment file + git checkout "$DOCKER_PATH/jrs/.env" + # Checkout original Docker default master peroperties file + git checkout "$DOCKER_PATH/jrs/resources/default-properties/default_master.properties" + # Delete existing keystore files in Helm keystore directory + delete_quietly "$K8S_PATH/jrs/helm/secrets/keystore/.jrsks" + delete_quietly "$K8S_PATH/jrs/helm/secrets/keystore/.jrsksp" + # Delete existing Buildomatic default master properties file + delete_quietly "$INSTALLER_PATH/buildomatic/default_master.properties" + # Delete existing license file in Helm license directory + delete_quietly "$K8S_PATH/jrs/helm/secrets/license/jasperserver.license" + # Checkout original Helm chart lock file + git checkout jaspersoft-containers/K8s/jrs/helm/Chart.lock >&1 +} + +while getopts ":cfn:" opt; do + case $opt in + c) + clean + echo + exit + ;; + f) + FORCE=true + ;; + n) + K8S_NAMESPACE=$OPTARG + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac +done + +msg "Running with the following parameters" + +echo " FORCE=${FORCE}" +echo " REPO_ROOT_PATH=${REPO_ROOT_PATH}" +echo " PROJ_ROOT_PATH=${PROJ_ROOT_PATH}" +echo " PROJ_CONF_PATH=${PROJ_CONF_PATH}" +echo " DOCKER_PATH=${DOCKER_PATH}" +echo " K8S_PATH=${K8S_PATH}" +echo " INSTALLER_ZIP=${INSTALLER_ZIP}" +echo " INSTALLER_PATH=${INSTALLER_PATH}" +echo " K8S_NAMESPACE=${K8S_NAMESPACE}" +echo " K8S_POSTGRES_POD_NAME=${K8S_POSTGRES_POD_NAME}" + +clean + +# +# Installer +# + +msg_ol "Unzipping JasperReports Server installation archive to repository root" + +# Unzip JasperReports Server installer archive +# -o Overwrite without prompting +# -q Quietly +# -d To repo root directory +unzip -o -q "$INSTALLER_ZIP" -d "$REPO_ROOT_PATH" + +# +# Minikube +# + +# Confirm minikube delete +if ! $FORCE; then + read -p $'\n'"💀 Warning! This will run minikube delete, continue? " -r prompt + if [[ $prompt != "y" && $prompt != "Y" && $prompt != "yes" && $prompt != "Yes" ]]; then + exit 1 + fi +fi + +msg "Deleting minikube cluster" +minikube delete + +msg "Starting minikube cluster" +minikube start + +msg "Creating K8S namespace '$K8S_NAMESPACE' in minikube" +kubectl config use-context minikube +kubectl create namespace "$K8S_NAMESPACE" +kubectl config set-context --current --namespace="$K8S_NAMESPACE" + +msg "Current K8S contexts:" +kubectl config get-contexts + +# Connect Docker CLI to minikube Docker daemon +msg_ol "Connecting Docker CLI to minikube Docker daemon" +eval "$(minikube -p minikube docker-env)" + +# +# Docker Images +# + +msg "Building JasperReports Server Docker images using Docker Compose" + +# Update Docker Compose environment file with customized version +cp "$PROJ_CONF_PATH/docker.env" "$DOCKER_PATH/jrs/.env" + +# Update Docker default master properties file with customized version +cp "$PROJ_CONF_PATH/docker.default_master.properties" "$DOCKER_PATH/jrs/resources/default-properties/default_master.properties" +sed -i '' "s/K8S_NAMESPACE/$K8S_NAMESPACE/g" "$DOCKER_PATH/jrs/resources/default-properties/default_master.properties" + +# Build Docker images using Docker Compose +# TODO: Remove --no-cache flag +docker-compose -f "$DOCKER_PATH/jrs/docker-compose.yml" build --no-cache + +# +# Keystore +# + +msg "Generating keystore files" + +# Update Buildomatic keystore creation default master properties file with customized PostgreSQL version +cp "$PROJ_CONF_PATH/keystore.postgres.default_master.properties" "$INSTALLER_PATH/buildomatic/default_master.properties" + +# Generate keystore files +cd "$INSTALLER_PATH/buildomatic" || exit +# shellcheck disable=SC1091 +source ./js-ant gen-config <<<$'y' + +msg_ol "Copying generated keystore files to Docker keystore directory" + +# Copy the generated keystore files to the Docker keystore directory with 644 permissions +cp ~/.jrsks "$DOCKER_PATH/jrs/resources/keystore" +cp ~/.jrsksp "$DOCKER_PATH/jrs/resources/keystore" +chmod 644 "$DOCKER_PATH/jrs/resources/keystore/.jrsks" +chmod 644 "$DOCKER_PATH/jrs/resources/keystore/.jrsksp" + +# +# Helm +# + +msg_ol "Copying JasperReports Server license file to Helm license directory" + +# Copy license file to Helm license directory +cp "$PROJ_CONF_PATH/jasperserver.license" "$K8S_PATH/jrs/helm/secrets/license" + +msg_ol "Copying generated keystore files to Helm keystore directory" + +# Copy the generated keystore files to the Helm keystore directory with 644 permissions +cp ~/.jrsks "$K8S_PATH/jrs/helm/secrets/keystore" +cp ~/.jrsksp "$K8S_PATH/jrs/helm/secrets/keystore" +chmod 644 "$K8S_PATH/jrs/helm/secrets/keystore/.jrsks" +chmod 644 "$K8S_PATH/jrs/helm/secrets/keystore/.jrsksp" + +msg "Adding and updating Helm chart dependencies" + +# Add Helm dependency chart repositories and update Helm dependencies +cd "$K8S_PATH" || exit +helm repo add bitnami https://charts.bitnami.com/bitnami +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo add haproxytech https://haproxytech.github.io/helm-charts +helm repo add elastic https://helm.elastic.co +helm dependencies update jrs/helm + +# Install PostgreSQL chart into the correct namespace +helm install repository bitnami/postgresql --set auth.postgresPassword=postgres --namespace $K8S_NAMESPACE + +# Wait for the PostgreSQL pod to be ready +printf "\n🦄 Giving the PostgreSQL pod a few seconds to warm up ... (5s) " +for i in {5..1}; +do + printf "\b\b\b\b%ss) " "$i" + sleep 1 +done +printf "\b\b\b\b🔥) \n" + +msg "A single PostgreSQL pod named '$K8S_POSTGRES_POD_NAME' should be coming up in the '$K8S_NAMESPACE' namespace" + +kubectl get pods -n "$K8S_NAMESPACE" + +printf "\n🦄 Waiting for the PostgreSQL pod to have the Running status ... (/) " + +# shellcheck disable=SC1003 +while [[ $(kubectl get $K8S_POSTGRES_POD_NAME -n $K8S_NAMESPACE -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; +do for X in '-' '\' '|' '/'; do printf "\b\b\b%s) " "$X"; sleep 0.1; done; done +printf "\b\b\b\b(👍) \n" + +msg "Current K8s pods in the '$K8S_NAMESPACE' namespace" + +kubectl get pods -n "$K8S_NAMESPACE" + +msg "Installing JasperReports Server Helm charts" + +# shellcheck disable=SC2028 +echo "------------------------------------------------ + +Verification: + + A pod named 'pod/jasperserver-buildomatic-' will start in the '$K8S_NAMESPACE' namespace with the + purpose of setting up the JRS repository DB. + + To connect to the repository DB at any time the '$K8S_POSTGRES_POD_NAME' is running: + + $ kubectl port-forward --namespace $K8S_NAMESPACE svc/repository-postgresql 5432:5432 + + Once completed successfully the buildomatic pod will be destroyed. + + Three additional pods will start in the '$K8S_NAMESPACE' namespace with the names: + + pod/jasperserver-cache- + pod/jrs-jasperserver-ingress- + pod/jrs-jasperserver-pro- + + To watch the JRS webapp logs during startup: + + $ kubectl logs --follow pod/jrs-jasperserver-pro- + + Once the pod named 'pod/jrs-jasperserver-ingress-' is in the Ready state, you'll need to forward + http traffic from your localhost to the JRS service to be able to view the JRS UI in a browser. + + $ kubectl port-forward --namespace $K8S_NAMESPACE service/jrs-jasperserver-ingress 8080:80 + + Open http://127.0.0.1:8080/jasperserver-pro/login.html in a browser to verify the server is up and running. + +Troubleshooting: + + It's important that the pod named 'pod/jasperserver-cache-' is Ready before the webapp pod comes up, + however often it doesn't. When the cache pod is not ready for the webapp, you'll see errors in the webapp + logs similar to: + + Could not connect to broker URL: tcp://jasperserver-cache-service.$K8S_NAMESPACE.svc.cluster.local:61616 + + When this occurs: Delete the webapp pod and let the deployment recreate it OR just be patient and the + webapp pod will be restarted and should come up without error. + +You may kill this terminal once the K8S deployments have been created. + +(╯°□°)╯︵ puƎ ǝɥꓕ +------------------------------------------------ +" + +# Install JasperReports Server charts into specified namespace +helm install jrs jrs/helm --namespace "$K8S_NAMESPACE" --wait --timeout 6m0s --set buildomatic.includeSamples=false