diff --git a/.env b/.env index d415161..fa45cee 100644 --- a/.env +++ b/.env @@ -27,11 +27,24 @@ TOMCAT_BASE_IMAGE=tomcat:9.0.31-jdk11-openjdk JASPERREPORTS_SERVER_VERSION=7.5.1 JASPERREPORTS_SERVER_IMAGE_TAG=7.5.1 -# Amazon Corretto works +# 7.8.0 - Docker Hub. Debian based +JAVA_BASE_IMAGE=openjdk:11.0 +TOMCAT_BASE_IMAGE=tomcat:9.0.37-jdk11-openjdk +JASPERREPORTS_SERVER_VERSION=7.8.0 +JASPERREPORTS_SERVER_IMAGE_TAG=7.8.0 + +# Amazon Corretto 7.5.0 #JAVA_BASE_IMAGE=amazoncorretto:11 #TOMCAT_BASE_IMAGE=tomcat:9.0-jdk11-corretto +#JASPERREPORTS_SERVER_VERSION=7.5.0 #JASPERREPORTS_SERVER_IMAGE_TAG=7.5.0-correto11 +# Amazon Corretto 7.8.0 +#JAVA_BASE_IMAGE=amazoncorretto:11 +#TOMCAT_BASE_IMAGE=tomcat:9.0-jdk11-corretto +#JASPERREPORTS_SERVER_VERSION=7.8.0 +#JASPERREPORTS_SERVER_IMAGE_TAG=7.8.0-corretto11 + #Jaspersoft CI #JASPERREPORTS_SERVER_APP_IMAGE_NAME=jrs-openjdk #JASPERREPORTS_SERVER_CMDLINE_IMAGE_NAME=jrs-openjdk-cmdline @@ -44,20 +57,22 @@ IMAGE_REPOSITORY= JASPERREPORTS_SERVER_APP_IMAGE_NAME=jasperserver-pro JASPERREPORTS_SERVER_CMDLINE_IMAGE_NAME=jasperserver-pro-cmdline +JAVASCRIPT_RENDERING_ENGINE=chromium + ### Runtime args # default database type -#DB_TYPE=postgresql +# DB_TYPE=postgresql # localhost on Windows and Mac -DB_HOST=host.docker.internal +# DB_HOST=host.docker.internal -#DB_HOST=localhost +# DB_HOST=localhost # defaults for PostgreSQL -#DB_PORT=5432 -#DB_USER=postgres -#DB_PASSWORD=postgres +# DB_PORT=5432 +# DB_USER=postgres +# DB_PASSWORD=postgres # default database name # DB_NAME=jasperserver diff --git a/Dockerfile b/Dockerfile index b9cfe65..1f4bf85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,10 @@ # Certified version of Tomcat for JasperReports Server 7.5.0 commercial editions # ARG TOMCAT_BASE_IMAGE=tomcat:9.0-jdk11-corretto -ARG TOMCAT_BASE_IMAGE=tomcat:9.0.27-jdk11-openjdk +# Certified version of Tomcat for JasperReports Server 7.8.0 commercial editions +# ARG TOMCAT_BASE_IMAGE=tomcat:9.0.37-jdk11-corretto + +ARG TOMCAT_BASE_IMAGE=tomcat:9.0.37-jdk11-openjdk FROM ${TOMCAT_BASE_IMAGE} ARG DN_HOSTNAME @@ -20,27 +23,29 @@ ARG KS_PASSWORD ARG JRS_HTTPS_ONLY ARG HTTP_PORT ARG HTTPS_PORT +ARG JAVASCRIPT_RENDERING_ENGINE ARG POSTGRES_JDBC_DRIVER_VERSION ARG JASPERREPORTS_SERVER_VERSION ARG EXPLODED_INSTALLER_DIRECTORY -ENV PHANTOMJS_VERSION ${PHANTOMJS_VERSION:-2.1.1} ENV DN_HOSTNAME ${DN_HOSTNAME:-localhost.localdomain} ENV KS_PASSWORD ${KS_PASSWORD:-changeit} -ENV JRS_HTTPS_ONLY ${JRS_HTTPS_ONLY:-false} -ENV HTTP_PORT ${HTTP_PORT:-8080} -ENV HTTPS_PORT ${HTTPS_PORT:-8443} +ENV JRS_HTTPS_ONLY ${JRS_HTTPS_ONLY:-false} +ENV HTTP_PORT ${HTTP_PORT:-8080} +ENV HTTPS_PORT ${HTTPS_PORT:-8443} +ENV JAVASCRIPT_RENDERING_ENGINE ${JAVASCRIPT_RENDERING_ENGINE:-chromium} + ENV POSTGRES_JDBC_DRIVER_VERSION ${POSTGRES_JDBC_DRIVER_VERSION:-42.2.5} -ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.5.1} +ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.8.0} ENV EXPLODED_INSTALLER_DIRECTORY ${EXPLODED_INSTALLER_DIRECTORY:-resources/jasperreports-server-pro-$JASPERREPORTS_SERVER_VERSION-bin} -# This Dockerfile requires an exploded JasperReports Server WAR file installer file +# This Dockerfile requires an exploded JasperReports Server WAR file installer file # EXPLODED_INSTALLER_DIRECTORY (default jasperreports-server-bin/) directory below the Dockerfile. -RUN mkdir -p /usr/src/jasperreports-server - -# get the WAR and license +# deploy the WAR to Tomcat COPY ${EXPLODED_INSTALLER_DIRECTORY}/jasperserver-pro $CATALINA_HOME/webapps/jasperserver-pro/ + +#copy copyright notices COPY ${EXPLODED_INSTALLER_DIRECTORY}/TIB* /usr/src/jasperreports-server/ # Ant @@ -55,42 +60,24 @@ COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/bin/groovy /usr/src/jasperrepor # supporting resources COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/conf_source /usr/src/jasperreports-server/buildomatic/conf_source/ -COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/target /usr/src/jasperreports-server/buildomatic/target/ +COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/lib /usr/src/jasperreports-server/buildomatic/lib/ -COPY scripts / +# js-docker specific scripts and resources +COPY scripts /usr/src/jasperreports-server/scripts/ -RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ - chmod +x /*.sh && \ - /installPackagesForJasperserver-pro.sh > /dev/null && \ - echo "finished installing packages" && \ +RUN chmod +x /usr/src/jasperreports-server/scripts/*.sh && \ + /usr/src/jasperreports-server/scripts/installPackagesForJasperserver-pro.sh && \ rm -rf $CATALINA_HOME/webapps/ROOT && \ rm -rf $CATALINA_HOME/webapps/docs && \ rm -rf $CATALINA_HOME/webapps/examples && \ rm -rf $CATALINA_HOME/webapps/host-manager && \ rm -rf $CATALINA_HOME/webapps/manager && \ # - cp -R /buildomatic /usr/src/jasperreports-server/buildomatic && \ - rm /installPackagesForJasperserver*.sh && rm -rf /buildomatic && \ + cp -R /usr/src/jasperreports-server/scripts/buildomatic /usr/src/jasperreports-server/buildomatic && \ chmod +x /usr/src/jasperreports-server/buildomatic/js-* && \ chmod +x /usr/src/jasperreports-server/apache-ant/bin/* && \ java -version && \ -# Extract phantomjs, move to /usr/local/share/phantomjs, link to /usr/local/bin. -# Comment out if phantomjs not required. - wget "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2" \ - -O /tmp/phantomjs.tar.bz2 --no-verbose && \ - tar -xjf /tmp/phantomjs.tar.bz2 -C /tmp && \ - rm -f /tmp/phantomjs.tar.bz2 && \ - mv /tmp/phantomjs*linux-x86_64 /usr/local/share/phantomjs && \ - ln -sf /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin && \ -# In case you wish to download from a different location you can manually -# download the archive and copy from resources/ at build time. Note that you -# also # need to comment out the preceding RUN command -#COPY resources/phantomjs*bz2 /tmp/phantomjs.tar.bz2 -#RUN tar -xjf /tmp/phantomjs.tar.bz2 -C /tmp && \ -# rm -f /tmp/phantomjs.tar.bz2 && \ -# mv /tmp/phantomjs*linux-x86_64 /usr/local/share/phantomjs && \ -# ln -sf /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin && \ - rm -rf /tmp/* && \ + #rm -rf /tmp/* && \ # wget "https://jdbc.postgresql.org/download/postgresql-${POSTGRES_JDBC_DRIVER_VERSION}.jar" \ -P /usr/src/jasperreports-server/buildomatic/conf_source/db/postgresql/jdbc --no-verbose && \ @@ -102,12 +89,12 @@ RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ -storetype PKCS12 \ -storepass "${KS_PASSWORD}" \ -keypass "${KS_PASSWORD}" \ - -keystore /root/.keystore.p12 && \ - keytool -list -keystore /root/.keystore.p12 -storepass "${KS_PASSWORD}" -storetype PKCS12 && \ - xmlstarlet ed --inplace --subnode "/Server/Service" --type elem \ + -keystore $CATALINA_HOME/conf/.keystore.p12 && \ + keytool -list -keystore $CATALINA_HOME/conf/.keystore.p12 -storepass "${KS_PASSWORD}" -storetype PKCS12 && \ + xmlstarlet ed --inplace --subnode "/Server/Service" --type elem \ -n Connector -v "" --var connector-ssl '$prev' \ --insert '$connector-ssl' --type attr -n port -v "${HTTPS_PORT}" \ - --insert '$connector-ssl' --type attr -n protocol -v \ + --insert '$connector-ssl' --type attr -n protocol -v \ "org.apache.coyote.http11.Http11NioProtocol" \ --insert '$connector-ssl' --type attr -n maxThreads -v "150" \ --insert '$connector-ssl' --type attr -n SSLEnabled -v "true" \ @@ -118,7 +105,7 @@ RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ --insert '$connector-ssl' --type attr -n keystorePass \ -v "${KS_PASSWORD}"\ --insert '$connector-ssl' --type attr -n keystoreFile \ - -v "/root/.keystore.p12" \ + -v "$CATALINA_HOME/conf/.keystore.p12" \ ${CATALINA_HOME}/conf/server.xml # Expose ports. Note that you must do one of the following: @@ -126,7 +113,7 @@ RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ # or use dynamic ports. EXPOSE ${HTTP_PORT} ${HTTPS_PORT} -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/usr/src/jasperreports-server/scripts/entrypoint.sh"] # Default action executed by entrypoint script. CMD ["run"] diff --git a/Dockerfile-cmdline b/Dockerfile-cmdline index 5e7bbd5..7c9bb13 100644 --- a/Dockerfile-cmdline +++ b/Dockerfile-cmdline @@ -5,10 +5,10 @@ # set certified JRE image version for the # JasperReports Server command line tools -# for JasperReports Server 7.5 +# for JasperReports Server 7.5.0 and 7.8.0 # ARG JAVA_BASE_IMAGE=amazoncorretto:11 -ARG JAVA_BASE_IMAGE=openjdk:11.0-slim +ARG JAVA_BASE_IMAGE=openjdk:11.0 FROM ${JAVA_BASE_IMAGE} @@ -17,7 +17,7 @@ ARG JASPERREPORTS_SERVER_VERSION ARG EXPLODED_INSTALLER_DIRECTORY ENV POSTGRES_JDBC_DRIVER_VERSION ${POSTGRES_JDBC_DRIVER_VERSION:-42.2.5} -ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.5.1} +ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.8.0} ENV EXPLODED_INSTALLER_DIRECTORY ${EXPLODED_INSTALLER_DIRECTORY:-resources/jasperreports-server-pro-$JASPERREPORTS_SERVER_VERSION-bin} # This Dockerfile requires an exploded JasperReports Server WAR file installer file @@ -26,8 +26,6 @@ ENV EXPLODED_INSTALLER_DIRECTORY ${EXPLODED_INSTALLER_DIRECTORY:-resources/jaspe # COPY the buildomatic, command line scripts and supporting resources # from the JasperReports Server WAR file installer into the image -RUN mkdir -p /usr/src/jasperreports-server - # Ant COPY ${EXPLODED_INSTALLER_DIRECTORY}/apache-ant /usr/src/jasperreports-server/apache-ant/ @@ -45,17 +43,16 @@ COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/bin/groovy /usr/src/jasperrepor COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/jdbc-dep /usr/src/jasperreports-server/buildomatic/bin/jdbc-dep/ COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/install_resources /usr/src/jasperreports-server/buildomatic/install_resources/ COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/conf_source /usr/src/jasperreports-server/buildomatic/conf_source/ -COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/target /usr/src/jasperreports-server/buildomatic/target/ +COPY ${EXPLODED_INSTALLER_DIRECTORY}/buildomatic/lib /usr/src/jasperreports-server/buildomatic/lib/ -COPY scripts / +# js-docker specific scripts and resources +COPY scripts /usr/src/jasperreports-server/scripts/ -RUN echo "apt-get" && \ - echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ - chmod +x /*.sh && \ - /installPackagesForJasperserver-pro-cmdline.sh && \ +RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ + chmod +x /usr/src/jasperreports-server/scripts/*.sh && \ + /usr/src/jasperreports-server/scripts/installPackagesForJasperserver-pro-cmdline.sh && \ echo "finished installing packages" && \ - cp -R /buildomatic /usr/src/jasperreports-server/buildomatic && \ - rm /installPackagesForJasperserver*.sh && rm -rf /buildomatic && \ + cp -R /usr/src/jasperreports-server/scripts/buildomatic /usr/src/jasperreports-server/buildomatic && \ chmod +x /usr/src/jasperreports-server/buildomatic/js-* && \ chmod +x /usr/src/jasperreports-server/buildomatic/bin/*.sh && \ chmod +x /usr/src/jasperreports-server/apache-ant/bin/* && \ @@ -63,7 +60,7 @@ RUN echo "apt-get" && \ wget "https://jdbc.postgresql.org/download/postgresql-${POSTGRES_JDBC_DRIVER_VERSION}.jar" \ -P /usr/src/jasperreports-server/buildomatic/conf_source/db/postgresql/jdbc --no-verbose -ENTRYPOINT ["/entrypoint-cmdline.sh"] +ENTRYPOINT ["/usr/src/jasperreports-server/scripts/entrypoint-cmdline.sh"] # Default action executed by entrypoint script. CMD ["init"] diff --git a/README.md b/README.md index ac4043a..be187d1 100644 --- a/README.md +++ b/README.md @@ -150,31 +150,32 @@ For the JasperReports Server Web app (WAR): | Environment Variable Name | Notes | | ------------ | ------------- | -| `TOMCAT_BASE_IMAGE` | Tomcat Docker image certified for the version of JasperReports Server being deployed. Linux images using apt-get (Debian) or yum (CentOS, Redhat, Corretto/Amazon Linux 2) package managers. Default for 7.5.1: "tomcat:9.0.31-jdk11-openjdk". | -| `JASPERREPORTS_SERVER_VERSION` | Version number used in file names. Default for JasperReports Server: 7.5.1 | +| `TOMCAT_BASE_IMAGE` | Tomcat Docker image certified for the version of JasperReports Server being deployed. Linux images using apt-get (Debian) or yum (CentOS, Redhat, Corretto/Amazon Linux 2) package managers. Default for 7.8.0: "tomcat:9.0.37-jdk11-openjdk" and for Amazon Linux "tomcat:9.0.37-jdk11-corretto". | +| `JASPERREPORTS_SERVER_VERSION` | Version number used in file names. Default for JasperReports Server: 7.8.0 | | `EXPLODED_INSTALLER_DIRECTORY` | Directory below the Dockerfiles where the WAR file installer has been prepared as above. Default: resources/jasperreports-server-pro-$JASPERREPORTS_SERVER_VERSION-bin -| `HTTP_PORT` | HTTP port Tomcat runs on and .env file should be updated wih correct port number if any non default port is used. Default: "8080" | -| `HTTPS_PORT` | HTTPS port Tomcat runs on and .env file should be updated wih correct port number if any non default port is used. Default: "8443" | +| `HTTP_PORT` | HTTP port Tomcat runs on and .env file should be updated wih right port number if any non default port is used. Default: "8080" | +| `HTTPS_PORT` | HTTPS port Tomcat runs on and .env file should be updated wih right port number if any non default port is used. Default: "8443" | | `JRS_HTTPS_ONLY` | Enables HTTPS-only mode. Default: false. | | | A self signed SSL certificate is defined for Tomcat. | -|`DN_HOSTNAME` | Self signed certificate host name. Default: "localhost.localdomain" | -|`KS_PASSWORD` | SSL Keystore password. Default: "changeit" | -|`POSTGRES_JDBC_DRIVER_VERSION` | Default: 42.2.5. If you change this, the new version will be downloaded from https://jdbc.postgresql.org/download.html | +| `DN_HOSTNAME` | Self signed certificate host name. Default: "localhost.localdomain" | +| `KS_PASSWORD` | SSL Keystore password. Default: "changeit" | +| `POSTGRES_JDBC_DRIVER_VERSION` | Default: 42.2.5. If you change this, the new version will be downloaded from https://jdbc.postgresql.org/download.html | +| `JAVASCRIPT_RENDERING_ENGINE` | Default: chromium. if not chromium, phantomjs will be installed. | For the cmdline: | Environment Variable Name | Notes | | ------------ | ------------- | -| `JAVA_BASE_IMAGE` | Java Docker image certified for the version of JasperReports Server being deployed. Linux images using apt-get (Debian) or yum (CentOS, Redhat, Corretto/Amazon Linux 2) package managers. JDK 8 or 11 from https://github.com/docker-library/docs/blob/master/openjdk/README.md#supported-tags-and-respective-dockerfile-links Default openjdk:11.0-slim | -| `JASPERREPORTS_SERVER_VERSION` | Version number used in file names. Default: 7.5.1 | +| `JAVA_BASE_IMAGE` | Java Docker image certified for the version of JasperReports Server being deployed. Linux images using apt-get (Debian) or yum (CentOS, Redhat, Corretto/Amazon Linux 2) package managers. JDK 8 or 11 from https://github.com/docker-library/docs/blob/master/openjdk/README.md#supported-tags-and-respective-dockerfile-links Default openjdk:11-jdk and for Amazon Linux amazoncorretto:11| +| `JASPERREPORTS_SERVER_VERSION` | Version number used in file names. Default: 7.8.0 | | `EXPLODED_INSTALLER_DIRECTORY` | Directory below the Dockerfiles where the WAR file installer has been prepared as above. Default: resources/jasperreports-server-pro-$JASPERREPORTS_SERVER_VERSION-bin |`POSTGRES_JDBC_DRIVER_VERSION` | Default: 42.2.5. If you change this, the new version will be downloaded from https://jdbc.postgresql.org/download.html | ### Build the images -`docker build -t jasperserver-pro:7.5.1 .` +`docker build -t jasperserver-pro:7.8.0 .` -`docker build -t jasperserver-pro-cmdline:7.5.1 -f Dockerfile-cmdline .` +`docker build -t jasperserver-pro-cmdline:7.8.0 -f Dockerfile-cmdline .` # docker run time environment variables @@ -192,8 +193,8 @@ This image does not create the repository and keystore files. See cmdline below. | `DB_USER` | database username. Default: postgres | | `DB_PASSWORD` | database password. Default: postgres | | `DB_NAME` | JasperReports Server repository schema name in the database. Default: "jasperserver" | -| `HTTP_PORT` | HTTP port Tomcat runs on and .env file should be updated wih correct port number if any non default port is used. Default: HTTP_PORT in image | -| `HTTPS_PORT` | HTTPS port Tomcat runs on and .env file should be updated wih correct port number if any non default port is used. Default: HTTPS_PORT in image | +| `HTTP_PORT` | HTTP port Tomcat runs on. Default: HTTP_PORT in image | +| `HTTPS_PORT` | HTTPS port Tomcat runs on. Default: HTTPS_PORT in image | | `JAVA_OPTS` | Command line options passed to Java. Optional. The Java heap size of JasperReports Server is automatically managed to conform to the container size. | | `JAVA_MIN_RAM_PERCENTAGE` | Java heap minimum percentage in the container. Default: 33.3% | | `JAVA_MAX_RAM_PERCENTAGE` | Java heap maximum percentage in the container. Default: 80.0% | @@ -243,7 +244,7 @@ For the JasperReports Server Web app (WAR): | Description | Path to override in container | Notes | | ------------ | ------------- | ------------ | | License | `/usr/local/share/jasperserver-pro/license` | REQUIRED. Path to contain `jasperserver.license` file to use. | -| Encryption keystore files | `/usr/local/share/jasperserver-pro/keystore` | REQUIRED. .jrsks and .jrsksp files used to encrypt sensitive values. This volume is required for use with JRS 7.5.1, which will create these files on this volume if they do not exist when initializing the repository database. | +| Encryption keystore files | `/usr/local/share/jasperserver-pro/keystore` | REQUIRED. .jrsks and .jrsksp files used to encrypt sensitive values. This volume is required for use with JRS 7.8.0, which will create these files on this volume if they do not exist when initializing the repository database. | | JasperReports Server customizations | `/usr/local/share/jasperserver-pro/customization` | Zip files. If a zip file contains `install.sh`, it will be unzipped and executed - useful for hotfixes or config changes in the image. Zip files that do not contain `install.sh` will be unzipped into `${CATALINA_HOME}/webapps/jasperserver-pro`. Files are processed in alphabetical order, so duplicate file names within zips can be overridden. | | Tomcat level customizations | `/usr/local/share/jasperserver-pro/tomcat-customization` | Zip files that are unzipped into `${CATALINA_HOME}`. Files are processed in alphabetical order, so duplicate file names within zips can be overridden. | | SSL keystore file | `/usr/local/share/jasperserver-pro/ssl-certificate` | .keystore file containing the certificate in this volume will be loaded into /root and Tomcat updated to use it. The keystore password must be set as the KS_PASSWORD environment variable. | @@ -251,13 +252,12 @@ For the JasperReports Server Web app (WAR): | JDBC driver for the repository database | /usr/src/jasperreports-server/buildomatic/conf_source/db/dbType/jdbc | Override JDBC drivers within the image for the repository. Valid dbTypes are: postgresql, mysql, sqlserver, oracle, db2. Need to set the `JDBC_DRIVER_VERSION` environment variable to the version number of the driver. | Note: Tomcat and JasperReports server customizations are applied after deploying the JasperReports Server Application in tomcat. - For the cmdline: | Description | Path to override in container | Notes | | ------------ | ------------- | ------------ | | License | `/usr/local/share/jasperserver-pro/license` | REQUIRED. Path to contain `jasperserver.license` file to use. | -| Encryption keystore files | `/usr/local/share/jasperserver-pro/keystore` | REQUIRED. .jrsks and .jrsksp files used to encrypt sensitive values. This volume is required for use with JRS 7.5.1, which will create these files on this volume if they do not exist when initializing the database. | +| Encryption keystore files | `/usr/local/share/jasperserver-pro/keystore` | REQUIRED. .jrsks and .jrsksp files used to encrypt sensitive values. This volume is required for use with JRS 7.8.0, which will create these files on this volume if they do not exist when initializing the database. | | Additional default_master installation properties | `/usr/local/share/jasperserver-pro/deploy-customization` | `default_master_additional.properties` file contents appended to default_master.properties. See "To install the WAR file using js-install scripts" in JasperReports Server Installation Guide | | JDBC driver for the repository database | /usr/src/jasperreports-server/buildomatic/conf_source/db//jdbc | Override JDBC drivers within the image for the repository. Valid dbTypes are: postgresql, mysql, sqlserver, oracle, db2. Need to set the `JDBC_DRIVER_VERSION` environment variable to the version number of the driver. | | Buildomatic customizations | `/usr/local/share/jasperserver-pro/buildomatic_customization` | Zip files. If a zip file contains `install.sh`, it will be unzipped and executed - useful for hotfixes or config changes in the image. Zip files that do not contain `install.sh` will be unzipped into `${BUILDOMATIC_HOME}`. Files are processed in alphabetical order, so duplicate file names within zips can be overridden. | @@ -579,7 +579,7 @@ To volumize the JasperReports Server container log, you can create a container f ```console -$ docker volume create --name some-jasperserver-lo +$ docker volume create --name some-jasperserver-log $ docker run --name some-jasperserver -v @@ -594,7 +594,7 @@ some-jasperserver-log:/usr/local/tomcat/webapps/jasperserver-pro/WEB-INF/logs Where: - `some-jasperserver-log` is the name of the new data volume for log storage -- `some-jasperserver` is the name of the new JasperReports Server containe +- `some-jasperserver` is the name of the new JasperReports Server container - `jasperserver-pro:X.X.X` is the image name and version tag for your build. This image will be used to create containers - Database settings should be modified for your setup @@ -608,11 +608,11 @@ Note that docker containers do not have separate logs. All information is logged After the JasperReports Server container is up, log into it via URL The URL depends upon your installation. The default configuration uses: ```console -http://:8080/jasperserver-pr +http://:8080/jasperserver-pro or if running on port 80: -http:///jasperserver-pr +http:///jasperserver-pro ``` @@ -627,8 +627,8 @@ If you used a different port when installing your application server, specify it JasperReports Server ships with the following default credentials -- superuser/superuser - System-wide administrato -- jasperadmin/jasperadmin - Administrator for the default organizatio +- superuser/superuser - System-wide administrator +- jasperadmin/jasperadmin - Administrator for the default organization # Troubleshooting diff --git a/docker-compose-mysql.yml b/docker-compose-mysql.yml index fb9bddc..a6db98c 100644 --- a/docker-compose-mysql.yml +++ b/docker-compose-mysql.yml @@ -35,7 +35,7 @@ services: volumes: # where jasperserver.license file is. Otherwise uses temporary license - - /C/Users/swood/Documents/License:/usr/local/share/jasperserver-pro/license + - ./license:/usr/local/share/jasperserver-pro/license # zip files in alphabetical order exploded into webapps/jasperserver-pro #- jrs_customization:/usr/local/share/jasperserver-pro/customization @@ -50,7 +50,7 @@ services: # As of JasperReports Server 7.5, this volume : # - saves .jrsks and .jrsksp files if they are created # - provides access to pre-existing keystore related files - - /C/Users/swood/Documents/Docker/keystore-container-deployment:/usr/local/share/jasperserver-pro/keystore + - ./keystore:/usr/local/share/jasperserver-pro/keystore # include a new version of a JDBC driver for repository databases supported by # JasperReports Server. @@ -59,7 +59,7 @@ services: # set environment property: # maven.jdbc.version= # have a look at buildomatic/conf_source/db/ for db.properties for a dbType - - /C/Users/swood/Documents/Docker/mysql:/usr/src/jasperreports-server/buildomatic/conf_source/db/mysql/jdbc + # - ./mysql:/usr/src/jasperreports-server/buildomatic/conf_source/db/mysql/jdbc # for Mac OS you may want to define local path for volume mounts. # Note that defining path for a named volume is not supported @@ -98,7 +98,7 @@ services: volumes: # where jasperserver.license file is. Otherwise uses temporary license - - /C/Users/swood/Documents/License:/usr/local/share/jasperserver-pro/license + - ./license:/usr/local/share/jasperserver-pro/license # zip files in alphabetical order exploded into webapps/jasperserver-pro #- jrs_customization:/usr/local/share/jasperserver-pro/customization @@ -113,7 +113,7 @@ services: # As of JasperReports Server 7.5, this volume : # - saves .jrsks and .jrsksp files if they are created # - provides access to pre-existing keystore related files - - /C/Users/swood/Documents/Docker/keystore-container-deployment:/usr/local/share/jasperserver-pro/keystore + - ./keystore:/usr/local/share/jasperserver-pro/keystore # default_master_additional.properties file added to default_master.properties # see "To install the WAR file using js-install scripts" in JasperReports Server Installation Guide @@ -126,7 +126,7 @@ services: # set environment property: # maven.jdbc.version= # have a look at buildomatic/conf_source/db/ for db.properties for a dbType - - /C/Users/swood/Documents/Docker/mysql:/usr/src/jasperreports-server/buildomatic/conf_source/db/mysql/jdbc + # - ./mysql:/usr/src/jasperreports-server/buildomatic/conf_source/db/mysql/jdbc # for Mac OS you may want to define local path for volume mounts. # Note that defining path for a named volume is not supported @@ -139,7 +139,7 @@ services: # - /C/Users/aUser/Documents/License:/usr/local/share/jasperserver-pro/license # for import/export - - /C/Users/swood/Documents/Docker/jrs-import:/usr/local/share/jasperserver-pro/import + #- ./jrs-import:/usr/local/share/jasperserver-pro/import mem_limit: 3g mem_reservation: 1g diff --git a/docker-compose.yml b/docker-compose.yml index 6c77683..8f8a5de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,8 @@ services: args: - "TOMCAT_BASE_IMAGE=${TOMCAT_BASE_IMAGE}" - "JASPERREPORTS_SERVER_VERSION=${JASPERREPORTS_SERVER_VERSION}" - + - "JAVASCRIPT_RENDERING_ENGINE=${JAVASCRIPT_RENDERING_ENGINE}" + # expose port on the host ports: - 8080:8080 @@ -38,13 +39,13 @@ services: volumes: # Required. Where jasperserver.license file is. #- /path/to/license:/usr/local/share/jasperserver-pro/license - - /C/Users/swood/Documents/License:/usr/local/share/jasperserver-pro/license + - ./license:/usr/local/share/jasperserver-pro/license # As of JasperReports Server 7.5, this volume is required: # - saves .jrsks and .jrsksp files if they are created # - provides access to pre-existing keystore related files #- /path/to/keystore:/usr/local/share/jasperserver-pro/keystore - - /C/Users/swood/Documents/Docker/keystore-container-deployment:/usr/local/share/jasperserver-pro/keystore + - ./keystore:/usr/local/share/jasperserver-pro/keystore # zip files in alphabetical order exploded into webapps/jasperserver-pro or running embedded install.sh #- /path/to/customization:/usr/local/share/jasperserver-pro/customization @@ -109,13 +110,13 @@ services: volumes: # where jasperserver.license file is. Otherwise uses temporary license #- /path/to/license:/usr/local/share/jasperserver-pro/license - - /C/Users/swood/Documents/License:/usr/local/share/jasperserver-pro/license + - ./license:/usr/local/share/jasperserver-pro/license # As of JasperReports Server 7.5, this volume is required: # - saves .jrsks and .jrsksp files if they are created # - provides access to pre-existing keystore related files #- /path/to/keystore:/usr/local/share/jasperserver-pro/keystore - - /C/Users/swood/Documents/Docker/keystore-container-deployment:/usr/local/share/jasperserver-pro/keystore + - ./keystore:/usr/local/share/jasperserver-pro/keystore # zip files in alphabetical order exploded into buildomatic or running embedded install.sh #- /path/to/buildomatic_customization:/usr/local/share/jasperserver-pro/buildomatic_customization diff --git a/keystore/README.md b/keystore/README.md new file mode 100644 index 0000000..debf9eb --- /dev/null +++ b/keystore/README.md @@ -0,0 +1 @@ +Place your existing .jrsks and .jrsksp files here, or they will be generated if this is a new instance. diff --git a/kubernetes/Dockerfile-cmdline-k8s b/kubernetes/Dockerfile-cmdline-k8s index 61d176a..04d8294 100644 --- a/kubernetes/Dockerfile-cmdline-k8s +++ b/kubernetes/Dockerfile-cmdline-k8s @@ -3,23 +3,22 @@ # JasperReports Server command line image, saving keystore changes to a secret. # Leverages base JRS image of same version -ARG JASPERREPORTS_SERVER_IMAGE_TAG=7.5.0 +ARG JASPERREPORTS_SERVER_IMAGE_TAG=7.8.0 FROM jasperserver-pro-cmdline:${JASPERREPORTS_SERVER_IMAGE_TAG} -ARG JASPERREPORTS_SERVER_VERSION=7.5.0 +ARG JASPERREPORTS_SERVER_VERSION=7.8.0 ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION} -COPY scripts / +COPY scripts /usr/src/jasperreports-server/scripts/ # load kubectl -RUN chmod +x /*.sh && \ - /installPackagesForJasperserver-pro.sh > /dev/null && \ - echo "finished installing packages" && \ - rm /installPackagesForJasperserver-pro.sh +RUN chmod +x /usr/src/jasperreports-server/scripts/*.sh && \ + /usr/src/jasperreports-server/scripts/installPackagesForJasperserver-pro-cmdline-k8s.sh > /dev/null && \ + echo "finished installing packages" -ENTRYPOINT ["/entrypoint-cmdline-k8s.sh"] +ENTRYPOINT ["/usr/src/jasperreports-server/scripts/entrypoint-cmdline-k8s.sh"] # Default action executed by entrypoint script. CMD ["init"] diff --git a/kubernetes/README.md b/kubernetes/README.md index 1641f3a..629ff03 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -51,7 +51,7 @@ The following software is required or recommended: - (*Recommended*) for development - they include Kubernetes: - [Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/install/) - [Docker Desktop for Mac](https://docs.docker.com/docker-for-mac/install/) -- (*optional*)[kubernetes](https://kubernetes.io/) version 1.10 or higher +- (*optional*)[kubernetes](https://kubernetes.io/) version 1.19 or higher - (*optional*) Preconfigured PostgreSQL 9, 10 or 11 database. If you do not currently have a PostgreSQL instance, you can create a PostgreSQL container at run time. # Build the Kubernetes specific command line image @@ -64,8 +64,8 @@ In this directory, run: | Environment Variable Name | Notes | | ------------ | ------------- | -| `JASPERREPORTS_SERVER_IMAGE_TAG` | Tag of jasperserver-pro-cmdline image to base this image on. `jasperserver-pro-cmdline:` Default: `7.5.0` | -| `JASPERREPORTS_SERVER_VERSION` | Version number used in file names. Default: `7.5.0` | +| `JASPERREPORTS_SERVER_IMAGE_TAG` | Tag of jasperserver-pro-cmdline image to base this image on. `jasperserver-pro-cmdline:` Default: `7.8.0` | +| `JASPERREPORTS_SERVER_VERSION` | Version number used in file names. Default: `7.8.0` | # Configure the JasperReports Server service @@ -83,7 +83,7 @@ The init-container in the Service, which runs a cmdline image, ensures that the Your JasperReports Server license is in a secret. -`kubectl create secret generic jasperserver-pro-license --from-file=jasperserver.license=./jasperserver.license` +`kubectl create secret generic jasperserver-pro-license --from-file=jasperserver.license=./jasperserver.license -n jaspersoft` Use the secret as a volume in both the init and main containers. @@ -138,7 +138,7 @@ And then use the secret with the containers. For the init container, use the cmd ``` initContainers: - name: init - image: jasperserver-pro-cmdline:k8s-7.5.0 + image: jasperserver-pro-cmdline:k8s-7.8.0 env: #- name: KEYSTORE_SECRET_NAME # value: "jasperserver-pro-jrsks" @@ -164,7 +164,7 @@ And for the JasperReports Server web application container: ``` containers: - name: jasperserver-pro - image: jasperserver-pro:7.5.0 + image: jasperserver-pro:7.8.0 env: volumeMounts: @@ -202,7 +202,7 @@ And then use the persistent volume with the containers. For the init container, ``` initContainers: - name: init - image: jasperserver-pro-cmdline:7.5.0 + image: jasperserver-pro-cmdline:7.8.0 env: volumeMounts: - name: jasperserver-pro-volume @@ -215,7 +215,7 @@ for the web application: ``` containers: - name: jasperserver-pro - image: jasperserver-pro:7.5.0 + image: jasperserver-pro:7.8.0 env: ports: volumeMounts: @@ -261,7 +261,7 @@ Or run the PostgreSQL repository inside k8s, which is the default approach taken - edit `repository-database.yaml` to suit your environment. - This creates a persistent volume and the `postgresql` service in k8s - set volume name, username, password, use secrets etc according to your requirements -- use kubectl to create the postgresql service: `kubectl apply -f postgres-k8s.yaml` +- use kubectl to create the postgresql service: `kubectl apply -f repository-database.yaml` See the main README for details on how to use other databases for the repository apart from PostgreSQL. @@ -277,6 +277,8 @@ For keystores in secrets: `kubectl apply -f jasperreports-server-service-deploym - ConfigMap for Deployment. - Service: ClusterIP, NodePort, LoadBalancer. +Note: If Service is not an external loadbalancer like aws or azure loadbalancer or using **NodePort** as Service then **Service ports , Liveness and Readiness ports** should be updated to 8080 and 8443. + Otherwise launch via volumes only: `kubectl apply -f jasperreports-server-k8s-volume.yaml` # Troubleshooting diff --git a/kubernetes/jasperreports-server-k8s-volume.yaml b/kubernetes/jasperreports-server-k8s-volume.yaml index 18242eb..d1fc3af 100644 --- a/kubernetes/jasperreports-server-k8s-volume.yaml +++ b/kubernetes/jasperreports-server-k8s-volume.yaml @@ -17,70 +17,108 @@ data: apiVersion: v1 kind: Service metadata: - name: jasperserver-pro labels: app: jasperserver-pro + name: jasperserver-pro + namespace: jaspersoft spec: ports: - - port: 80 - targetPort: 80 - name: jasperserver-pro + - name: http + port: 80 + protocol: TCP + - name: https + port: 443 + protocol: TCP selector: app: jasperserver-pro type: LoadBalancer --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: - name: jasperserver-pro labels: app: jasperserver-pro + name: jasperserver-pro + namespace: jaspersoft spec: strategy: type: Recreate + selector: + matchLabels: + app: jasperserver-pro template: metadata: labels: app: jasperserver-pro + namespace: jaspersoft spec: + replicas: 1 containers: - - name: jasperserver-pro - image: jasperserver-pro:7.5.0 - imagePullPolicy: Always - - envFrom: - - configMapRef: - name: jasper-config - ports: - - name: http - containerPort: 80 - protocol: TCP - - name: https - containerPort: 443 - protocol: TCP - volumeMounts: - - name: license - mountPath: "/usr/local/share/jasperserver-pro/license" - readOnly: true - - name: jasperserver-pro-volume - mountPath: "/usr/local/share/jasperserver-pro" - readOnly: true + - envFrom: + - configMapRef: + name: jasper-config + image: jasperserver-pro:7.8.0 + name: jasperserver-pro + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + name: http + protocol: TCP + - containerPort: 8443 + name: https + protocol: TCP + resources: + limits: + #cpu: 200m + memory: 6Gi + requests: + #cpu: 100m + memory: 2Gi + volumeMounts: + - name: license + mountPath: "/usr/local/share/jasperserver-pro/license" + readOnly: true + - name: jasperserver-pro-volume + mountPath: "/usr/local/share/jasperserver-pro" + readOnly: true + livenessProbe: + tcpSocket: + port: 80 + failureThreshold: 20 + periodSeconds: 10 + initialDelaySeconds: 300 + readinessProbe: + tcpSocket: + port: 80 + failureThreshold: 10 + periodSeconds: 10 + initialDelaySeconds: 90 initContainers: - - name: init - image: jasperserver-pro-cmdline:7.5.0 - - envFrom: - - configMapRef: - name: jasper-config - volumeMounts: + - envFrom: + - configMapRef: + name: jasper-config + image: jasperserver-pro-cmdline:k8s-7.8.0 + name: init + imagePullPolicy: IfNotPresent + resources: + limits: + #cpu: 200m + memory: 3Gi + requests: + #cpu: 100m + memory: 1Gi + volumeMounts: + - name: license + mountPath: "/usr/local/share/jasperserver-pro/license" + readOnly: true + - name: jasperserver-pro-volume + mountPath: "/usr/local/share/jasperserver-pro" + readOnly: false + serviceAccountName: jasper-robot + volumes: - name: license - mountPath: "/usr/local/share/jasperserver-pro/license" - readOnly: true + secret: + secretName: jasperserver-pro-license - name: jasperserver-pro-volume - mountPath: "/usr/local/share/jasperserver-pro" - readOnly: false - volumes: - - name: license - secret: - secretName: jasperserver-pro-license - - name: jasperserver-pro-volume - persistentVolumeClaim: - claimName: jasperreports-server-pv-claim + persistentVolumeClaim: + claimName: jasperreports-server-pv-claim diff --git a/kubernetes/jasperreports-server-service-deployment.yaml b/kubernetes/jasperreports-server-service-deployment.yaml index 6031ef6..a325ece 100644 --- a/kubernetes/jasperreports-server-service-deployment.yaml +++ b/kubernetes/jasperreports-server-service-deployment.yaml @@ -21,17 +21,17 @@ metadata: namespace: jaspersoft spec: ports: - - name: http - port: 8080 - targetPort: 8080 - - name: https - port: 8443 - targetPort: 8443 + - name: http + port: 80 + protocol: TCP + - name: https + port: 443 + protocol: TCP selector: app: jasperserver-pro type: LoadBalancer --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: labels: @@ -39,8 +39,12 @@ metadata: name: jasperserver-pro namespace: jaspersoft spec: + replicas: 1 strategy: type: Recreate + selector: + matchLabels: + app: jasperserver-pro template: metadata: labels: @@ -48,81 +52,94 @@ spec: namespace: jaspersoft spec: containers: - - envFrom: - - configMapRef: - name: jasper-config - image: jasperserver-pro:7.5.0 - name: jasperserver-pro - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8080 - name: http - protocol: TCP - - containerPort: 8443 - name: https - protocol: TCP - resources: - limits: - #cpu: 200m - memory: 6Gi - requests: - #cpu: 100m - memory: 2Gi - volumeMounts: - - mountPath: /usr/local/share/jasperserver-pro/license - name: license - readOnly: true - - mountPath: /usr/local/share/jasperserver-pro/keystore - name: keystore-files-secret - readOnly: true -# Add if additional default_master.propeties in a Secret -# - mountPath: /usr/local/share/jasperserver-pro/deploy-customization -# name: jasperserver-pro-additional-master-secret -# readOnly: true - - mountPath: /usr/local/share/jasperserver-pro - name: jasperserver-pro-volume - readOnly: true + - envFrom: + - configMapRef: + name: jasper-config + image: jasperserver-pro:7.8.0 + name: jasperserver-pro + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + name: http + protocol: TCP + - containerPort: 8443 + name: https + protocol: TCP + resources: + limits: + #cpu: 200m + memory: 6Gi + requests: + #cpu: 100m + memory: 2Gi + volumeMounts: + - mountPath: /usr/local/share/jasperserver-pro/license + name: license + readOnly: true + - mountPath: /usr/local/share/jasperserver-pro/keystore + name: jasperserver-pro-keystore-files-secret + readOnly: true + # Add if additional default_master.propeties in a Secret + # - mountPath: /usr/local/share/jasperserver-pro/deploy-customization + # name: jasperserver-pro-additional-master-secret + # readOnly: true + - mountPath: /usr/local/share/jasperserver-pro + name: jasperserver-pro-volume + readOnly: true + livenessProbe: + tcpSocket: + port: 80 + failureThreshold: 20 + periodSeconds: 10 + initialDelaySeconds: 300 + readinessProbe: + tcpSocket: + port: 80 + failureThreshold: 15 + periodSeconds: 10 + initialDelaySeconds: 90 initContainers: - - envFrom: - - configMapRef: - name: jasper-config - image: jasperserver-pro-cmdline:k8s-7.5.0 - name: init - imagePullPolicy: IfNotPresent - resources: - limits: - #cpu: 200m - memory: 3Gi - requests: - #cpu: 100m - memory: 1Gi - volumeMounts: - - mountPath: /usr/local/share/jasperserver-pro/license - name: license - readOnly: true - - mountPath: /usr/local/share/jasperserver-pro-secrets/jasperserver-pro-jrsks - name: jasperserver-pro-keystore-files-secret - readOnly: true -# Add if buildmatic additional default_master.propeties are in a Secret -# - mountPath: /usr/local/share/jasperserver-pro/buildomatic-customization -# name: jasperserver-pro-buildmatic-additional-master-secret -# readOnly: true - - mountPath: /usr/local/share/jasperserver-pro - name: jasperserver-pro-volume - readOnly: false + - envFrom: + - configMapRef: + name: jasper-config + image: jasperserver-pro-cmdline:k8s-7.8.0 + name: init + imagePullPolicy: IfNotPresent + resources: + limits: + #cpu: 200m + memory: 3Gi + requests: + #cpu: 100m + memory: 1Gi + volumeMounts: + - mountPath: /usr/local/share/jasperserver-pro/license + name: license + readOnly: true + - mountPath: /usr/local/share/jasperserver-pro-secrets/jasperserver-pro-jrsks + name: jasperserver-pro-keystore-files-secret + readOnly: true + # Add if buildmatic additional default_master.propeties are in a Secret + # - mountPath: /usr/local/share/jasperserver-pro/buildomatic-customization + # name: jasperserver-pro-buildmatic-additional-master-secret + # readOnly: true + - mountPath: /usr/local/share/jasperserver-pro + name: jasperserver-pro-volume + readOnly: false serviceAccountName: jasper-robot volumes: - - name: license - secret: - secretName: jasperserver-pro-license - - name: jasperserver-pro-keystore-files-secret - secret: - secretName: jasperserver-pro-jrsks -# - name: jasperserver-pro-additional-master-secret -# secret: -# secretName: jasperserver-pro-additional-master -# - name: jasperserver-pro-additional-master-secret -# secret: -# secretName: jasperserver-pro-buildomatic-additional-master - - name: jasperserver-pro-volume - emptyDir: {} + - name: license + secret: + secretName: jasperserver-pro-license + - name: jasperserver-pro-keystore-files-secret + secret: + secretName: jasperserver-pro-jrsks + # - name: jasperserver-pro-additional-master-secret + # secret: + # secretName: jasperserver-pro-additional-master + # - name: jasperserver-pro-additional-master-secret + # secret: + # secretName: jasperserver-pro-buildomatic-additional-master + - name: jasperserver-pro-volume + hostPath: + path: /mnt/jasperser-pro-customization diff --git a/kubernetes/namespace-rbac.yaml b/kubernetes/namespace-rbac.yaml index 4ce6f8c..bea927f 100644 --- a/kubernetes/namespace-rbac.yaml +++ b/kubernetes/namespace-rbac.yaml @@ -9,7 +9,7 @@ metadata: name: jasper-robot namespace: jaspersoft --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: use-secrets @@ -18,9 +18,9 @@ rules: - apiGroups: [""] resources: ["secrets"] resourceNames: [ "jasperserver-pro-jrsks" ] - verbs: ["get", "update", "patch"] + verbs: ["get", "create", "update", "patch"] --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: use-secrets-binding diff --git a/kubernetes/repository-database.yaml b/kubernetes/repository-database.yaml index 84100cb..c4b9c47 100644 --- a/kubernetes/repository-database.yaml +++ b/kubernetes/repository-database.yaml @@ -23,7 +23,7 @@ spec: app: jasperreports-server-repository tier: postgreSQL --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: labels: @@ -33,6 +33,9 @@ metadata: spec: strategy: type: Recreate + selector: + matchLabels: + app: jasperreports-server-repository template: metadata: labels: diff --git a/kubernetes/scripts/common-environment-k8s.sh b/kubernetes/scripts/common-environment-k8s.sh index 1fe563c..13dd53f 100644 --- a/kubernetes/scripts/common-environment-k8s.sh +++ b/kubernetes/scripts/common-environment-k8s.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2019. TIBCO Software Inc. +# Copyright (c) 2020. TIBCO Software Inc. # This file is subject to the license terms contained # in the license file that is distributed with this file. diff --git a/kubernetes/scripts/entrypoint-cmdline-k8s.sh b/kubernetes/scripts/entrypoint-cmdline-k8s.sh index e889fc9..7c98119 100644 --- a/kubernetes/scripts/entrypoint-cmdline-k8s.sh +++ b/kubernetes/scripts/entrypoint-cmdline-k8s.sh @@ -7,12 +7,14 @@ # Wraps the jasperserver-pro-cmdline entrypoint.sh to # manage keystore files in a secret -. ./common-environment-k8s.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -BASE_ENTRYPOINT=${BASE_ENTRYPOINT:-/entrypoint-cmdline.sh} +. $DIR/common-environment-k8s.sh + +BASE_ENTRYPOINT_PATH=${DIR}/${BASE_ENTRYPOINT:-/entrypoint-cmdline.sh} initialize_keystore_files_from_secret -( ${BASE_ENTRYPOINT} "$@" ) +( ${BASE_ENTRYPOINT_PATH} "$@" ) save_jrsks_to_secret diff --git a/kubernetes/scripts/installPackagesForJasperserver-pro.sh b/kubernetes/scripts/installPackagesForJasperserver-pro-cmdline-k8s.sh similarity index 93% rename from kubernetes/scripts/installPackagesForJasperserver-pro.sh rename to kubernetes/scripts/installPackagesForJasperserver-pro-cmdline-k8s.sh index d08a007..da0469b 100644 --- a/kubernetes/scripts/installPackagesForJasperserver-pro.sh +++ b/kubernetes/scripts/installPackagesForJasperserver-pro-cmdline-k8s.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2019. TIBCO Software Inc. +# Copyright (c) 2020. TIBCO Software Inc. # This file is subject to the license terms contained # in the license file that is distributed with this file. @@ -34,5 +34,5 @@ else echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list apt-get update apt-get install -y kubectl - rm -rf /var/lib/apt/lists/* + #rm -rf /var/lib/apt/lists/* fi diff --git a/license/README.md b/license/README.md new file mode 100644 index 0000000..c13ea63 --- /dev/null +++ b/license/README.md @@ -0,0 +1 @@ +Place your license file here diff --git a/platforms/aws/Dockerfile-cmdline-s3 b/platforms/aws/Dockerfile-cmdline-s3 index 844c84f..a9c7989 100644 --- a/platforms/aws/Dockerfile-cmdline-s3 +++ b/platforms/aws/Dockerfile-cmdline-s3 @@ -3,18 +3,18 @@ # JasperReports Server command line image, loading resources from S3. # Leverages base JRS image of same version -ARG JASPERREPORTS_SERVER_VERSION=7.5.1 +ARG JASPERREPORTS_SERVER_VERSION=7.8.0 FROM jasperserver-pro-cmdline:${JASPERREPORTS_SERVER_VERSION} -ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.5.1} +ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.8.0} -COPY scripts / +COPY scripts /usr/src/jasperreports-server/scripts/ -RUN chmod +x /*.sh && \ - /installPackagesForJasperserver-pro-s3.sh +RUN chmod +x /usr/src/jasperreports-server/scripts/*.sh && \ + /usr/src/jasperreports-server/scripts/installPackagesForJasperserver-pro-s3.sh -ENTRYPOINT ["/entrypoint-aws-cmdline.sh"] +ENTRYPOINT ["/usr/src/jasperreports-server/scripts/entrypoint-aws-cmdline.sh"] # Default action executed by entrypoint script. CMD ["init"] diff --git a/platforms/aws/Dockerfile-s3 b/platforms/aws/Dockerfile-s3 index 549f3e7..366d788 100644 --- a/platforms/aws/Dockerfile-s3 +++ b/platforms/aws/Dockerfile-s3 @@ -2,18 +2,18 @@ # JasperReports Server image loading resources from S3. # Leverages base JRS image of same version -ARG JASPERREPORTS_SERVER_VERSION=7.5.1 +ARG JASPERREPORTS_SERVER_VERSION=7.8.0 FROM jasperserver-pro:${JASPERREPORTS_SERVER_VERSION} -ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.5.1} +ENV JASPERREPORTS_SERVER_VERSION ${JASPERREPORTS_SERVER_VERSION:-7.8.0} -COPY scripts / +COPY scripts /usr/src/jasperreports-server/scripts/ -RUN chmod +x /*.sh && \ - /installPackagesForJasperserver-pro-s3.sh +RUN chmod +x /usr/src/jasperreports-server/scripts/*.sh && \ + /usr/src/jasperreports-server/scripts/installPackagesForJasperserver-pro-s3.sh -ENTRYPOINT ["/entrypoint-aws.sh"] +ENTRYPOINT ["/usr/src/jasperreports-server/scripts/entrypoint-aws.sh"] # Default action executed by entrypoint script. CMD ["run"] diff --git a/platforms/aws/README.md b/platforms/aws/README.md index 5e1b43d..9690673 100644 --- a/platforms/aws/README.md +++ b/platforms/aws/README.md @@ -43,7 +43,7 @@ The following software is required or recommended: - EKS - run CloudFormation templates - subscribe to AWS Marketplace listings -- [kubernetes](https://kubernetes.io/) version 1.10 or higher +- [kubernetes](https://kubernetes.io/) version 1.17 or higher - Bastion EC2 instance to run kubectl commands - (*optional*) Preconfigured PostgreSQL database in RDS @@ -53,36 +53,36 @@ The CloudFormation templates attached here: - jasperreports-server-7.2.0-ecr.template - jasperreports-server-7.5.0-ecr.template - jasperreports-server-7.5.1-ecr.template +- jasperreports-server-7.8.0-ecr.template create the JasperReports Server images: - jasperserver-pro: - jasperserver-pro-cmdline: - jasperserver-pro-cmdline:-k8s +- jasperserver-pro:s3- +- jasperserver-pro-cmdline:s3- -To create these stacks, you need to go to the AWS Marketplace and subscribe to TIBCO Jaspersoft Reporting and Analytics (BYOL). -- Find via the listings via: https://aws.amazon.com/marketplace/search/results?x=0&y=0&searchTerms=jaspersoft+byol -- Login to your AWS account as a user with the ability to subscribe to Marketplace listings. -- Continue to Subscribe -- Accept terms and conditions -- Do not launch instances - -Create a stack for the desired version of JasperReports Server, based on the templates here. These templates: -- Launch a JasperReports Server BYOL instance -- Install Docker -- Download the master branch of https://github.com/TIBCOSoftware/js-docker -- Build - - jasperserver-pro: - - jasperserver-pro-cmdline: - - jasperserver-pro-cmdline:-k8s - - note that the JasperReports Server image is confiured to run on port 80 in the template -- Create ECR repositories for the current AWS account and region if they do not exist +To create these images , take the ECR template as per the required version of Jasper reports server +- Login to your AWS account +- Upload the jasperreports-server--ecr.template template +- Provide the correct github branch url for JaspersoftForDockerURL +- fill all other parameters as per the requirement +- click create stack + +Once stack creation completed , it will generate docker images in ECR repository in your account + +Repository Names: +- jasperserver-pro +- jasperserver-pro-cmdline + +Create ECR repositories for the current AWS account and region if they do not exist - aws ecr create-repository --region ${AWS::Region} --repository-name jasperserver-pro - aws ecr create-repository --region ${AWS::Region} --repository-name jasperserver-pro-cmdline - Tag and push the versions of the images to the ECR repositories # Deployment to EKS -General deployment into EKS is documented here: https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html +General setup of EKS cluster documented in [aws/eks in js-docker](https://github.com/TIBCOSoftware/js-docker/tree/master/platforms/aws/eks) JasperReports Server deploys into EKS as per the instructions for Kubernetes [js-docker for Kubernetes](https://github.com/TIBCOSoftware/js-docker/tree/master/kubernetes) diff --git a/platforms/aws/eks/README.md b/platforms/aws/eks/README.md new file mode 100644 index 0000000..d893720 --- /dev/null +++ b/platforms/aws/eks/README.md @@ -0,0 +1,89 @@ +# TIBCO JasperReports® Server with Amazon EKS + +# Table of contents +1. [Introduction](#introduction) +1. [Prerequisites](#prerequisites) +1. [EKS Cluster setup](#eks-cluster-setup) +1. [EFS Configuration for applying the customization](#efs-setup-for-customization) +# Introduction + These EKS configuration files help to create a EKS cluster setup. + +# Prerequisites +The following software's are required +- AWS Account +- AWS administrative access. To manage: + - EKS + - Run CloudFormation templates +- Instsall required software's and tools , see here for [eksctl ,kubectl and aws cli setup and configuration](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html) + +# EKS Cluster setup + To Setup a EKS cluster run below command . + + `eksctl create cluster -f eksclustersetup.yaml`. Modify the **eksclustersetup.yaml** file as per the need. + It will take 15 to 20 minutes to setup a cluster along with the managed node groups. + + By default it will create a cluster with single Node with two private and two public subnets in a separate VPC. + +To verify the cluste setup run `kubectl get svc` and it will list the ClusterIP and it will confirm that the cluster is ready. + + Once Cluster is ready and see the [Js-Docker/Kubernets](https://github.com/TIBCOSoftware/js-docker/tree/master/kubernetes) for JRS deployment in EKS. + + Note: It is a basic cluster setup and for advanced security features and some other configuration , refer the [Official AWS Docs](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html) + +# EFS Configuration for applying the customization + For large amount of files for customizations in kubernetes deployment , kubernetes secrets may not work. To avoid such type of issues , +we can use AWS EFS CSI driver for mounting the larger amount of data and same data can be deployed in Jaspersoft. +To Setup EFS Storage for EKS cluster follow below steps. + +- To install EFS CSI driver in EKS cluster and creating EFS in aws follow this [AWS-CSI-DRIVER](https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html) +Make sure EFS should be created in same VPC where EKS cluster is created and allow NFS port for EKS cluster CIDR range +- Once everything setup run `aws efs describe-file-systems --query "FileSystems[*].FileSystemId" --output text` to get the EFS file system ID or get the ID from aws console +- modify the `eks-efs-setup.yaml` and replace the volumeHandle with EFS file system ID + ```` + csi: + driver: efs.csi.aws.com + volumeHandle: fs-xxxxx` +```` +- Create jaspersoft name space in kubernetes cluster by running `kubectl apply -f namespace-rbac.yaml` , find the namespace-rbac-yaml file [js-docker/kubernetes](https://github.com/TIBCOSoftware/js-docker/tree/master/kubernetes) +- Create Kubernets storage , persistent volume and persistent volume claim in EKS cluster by running `kubectl apply -f eks-efs-setup.yaml` +- Remove the jasperserver-pro-volume in [Kubernetes-deployment-yaml-file](https://github.com/TIBCOSoftware/js-docker/blob/master/kubernetes/jasperreports-server-service-deployment.yaml) in volumes sections . +```` + volumes: + - name: license + secret: + secretName: jasperserver-pro-license + - name: jasperserver-pro-keystore-files-secret + secret: + secretName: jasperserver-pro-jrsks + - name: jasperserver-pro-volume + hostPath: + path: /mnt/jasperser-pro-customization +```` +Add jasperserver-pro-volume with below code + +```` +- name: jasperserver-pro-volume + persistentVolumeClaim: + claimName: jaspersoft-efs-claim +```` +- To mount the data from on-premises to EFS , first create ec2 instance on same VPC where eks cluster is created and allow SSH port to copy the data +- Connect to ec2 instance , switch to root user and create efs directory `mkdir efs` +- Mount EFS on ec2 machine bu running EFS mount point similar to like this `sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-XXXX.efs.us-east-1.amazonaws.com:/ efs`. +- To get the EFS mount point , click in EFS which is created and click on attach button and then will see EFS mounting options, copy the EFS mount point from `Using the NFS client:` and run it on ec2 machine. +- For more information see [Mount EFS on EC2 machine](https://docs.aws.amazon.com/efs/latest/ug/wt1-test.html) +- Copy all your customizations in proper volumes , see [JS-Docker-volumes](https://github.com/TIBCOSoftware/js-docker#jasperreports-server-volumes) + + Once Everything is setup then see the [Js-Docker/Kubernets](https://github.com/TIBCOSoftware/js-docker/tree/master/kubernetes) for JRS deployment in EKS. + +# Copyright +Copyright © 2020. TIBCO Software Inc. +This file is subject to the license terms contained +in the license file that is distributed with this file. +___ + +TIBCO, Jaspersoft, and JasperReports are trademarks or +registered trademarks of TIBCO Software Inc. +in the United States and/or other countries. + +Docker is a trademark or registered trademark of Docker, Inc. +in the United States and/or other countries. \ No newline at end of file diff --git a/platforms/aws/eks/eks-efs-setup.yaml b/platforms/aws/eks/eks-efs-setup.yaml new file mode 100644 index 0000000..4d3632f --- /dev/null +++ b/platforms/aws/eks/eks-efs-setup.yaml @@ -0,0 +1,39 @@ +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: efs-sc + namespace: jaspersoft +provisioner: efs.csi.aws.com + +--- + +apiVersion: v1 +kind: PersistentVolume +metadata: + name: jaspersfor-efs-pv + namespace: jaspersoft +spec: + capacity: + storage: 5Gi + volumeMode: Filesystem + accessModes: + - ReadWriteMany + persistentVolumeReclaimPolicy: Retain + storageClassName: efs-sc + csi: + driver: efs.csi.aws.com + volumeHandle: fs-xxxxx +--- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: jaspersoft-efs-claim + namespace: jaspersoft +spec: + accessModes: + - ReadWriteMany + storageClassName: efs-sc + resources: + requests: + storage: 5Gi \ No newline at end of file diff --git a/platforms/aws/eks/eksclustersetup.yaml b/platforms/aws/eks/eksclustersetup.yaml new file mode 100644 index 0000000..f0c1157 --- /dev/null +++ b/platforms/aws/eks/eksclustersetup.yaml @@ -0,0 +1,29 @@ +apiVersion: eksctl.io/v1alpha5 +kind: ClusterConfig + +metadata: + name: jrs-eks-cluster + region: us-east-1 + version: "1.18" +availabilityZones: ["us-east-1a" ,"us-east-1b"] +managedNodeGroups: + - name: jrs-node-group + instanceType: m5.large + minSize: 1 + desiredCapacity: 1 + maxSize: 2 + availabilityZones: ["us-east-1a", "us-east-1b"] + volumeSize: 20 + ssh: + allow: true + publicKeyPath: ~/.ssh/ec2_id_rsa.pub # provide a aws public key name + +# To enable all of the control plane logs +cloudWatch: + clusterLogging: + enableTypes: ["*"] +# all supported types: "api", "audit", "authenticator", "controllerManager", "scheduler" + +# to add encryption keys uncomment below +# secretsEncryption: +# keyARN: ${MASTER_ARN} diff --git a/platforms/aws/jasperreports-server-7.8.0-ecr.template b/platforms/aws/jasperreports-server-7.8.0-ecr.template new file mode 100644 index 0000000..180ff3f --- /dev/null +++ b/platforms/aws/jasperreports-server-7.8.0-ecr.template @@ -0,0 +1,279 @@ +Description: > + TIBCO JasperReports Server BYOL 7.8.0 for Docker. + + This template launches a base TIBCO JasperReports Server BYOL docker image, creates ECR repos 'jasperserver-pro' and 'jasperserver-pro-cmdline'and pushes base docker images into the ECR repo. + + If you update this template for another JasperReports Server version, change the AWSRegionToAMI mapping below. + Copyright 2019-2020, TIBCO Software Inc. All Rights Reserved. + +Parameters: + + JaspersoftForDockerURL: + Description: URL to a zip file containing TIBCOSoftware/js-docker + Type: String + MaxLength: 100 + Default: "https://github.com/TIBCOSoftware/js-docker/zipball/master" + ConstraintDescription: Can be a release ZIP, or point to a branch zipball, like the default. + + JasperReportsServerVersion: + Description: In the AMI you are using. Update AMI and this version number. + Type: String + MinLength: 1 + MaxLength: 63 + Default: '7.8.0' + ConstraintDescription: A JasperReports Server version number. + + ImageTagPrefix: + Description: "Optional. Included in image tag: jasperserver-pro:" + Type: String + MaxLength: 63 + Default: '' + + JavaBaseImage: + Description: "Java base image tag for JasperReports Server cmdline image. JDK 8 or 11 from https://github.com/docker-library/docs/blob/master/openjdk/README.md#supported-tags-and-respective-dockerfile-links" + Type: String + MinLength: 1 + MaxLength: 63 + Default: 'amazoncorretto:11' + ConstraintDescription: Valid Java 11 Java image tag. + + TomcatBaseImage: + Description: "Java base image tag for JasperReports Server web application image. JDK 8 or 11 from https://hub.docker.com/_/tomcat" + Type: String + MinLength: 1 + MaxLength: 63 + Default: 'tomcat:9.0.37-jdk11-corretto' + ConstraintDescription: Valid Java 11 + Tomcat 9.0 image tag. + + VPCID: + Type: 'AWS::EC2::VPC::Id' + Description: Existing VPC to run JasperReports Server instance. + + PrivateSubnet: + Type: 'AWS::EC2::Subnet::Id' + Description: Subnet within VPC to run JasperReports Server instance. + + KeyName: + Description: An existing key pair. Used to SSH into EC2 instances. + Type: AWS::EC2::KeyPair::KeyName + MinLength: 1 + MaxLength: 64 + AllowedPattern: '[-_ a-zA-Z0-9]*' + ConstraintDescription: Must be the name of an existing key pair. It can contain only alphanumeric characters, spaces, dashes and underscores. + +Metadata: + AWS::CloudFormation::Interface: + ParameterGroups: + - + Label: + default: "Container properties" + Parameters: + - JasperReportsServerVersion + - ImageTagPrefix + - JavaBaseImage + - TomcatBaseImage + - JaspersoftForDockerURL + - + Label: + default: "JasperReports Server EC2 Instance" + Parameters: + - KeyName + - VPCID + - PrivateSubnet + +Conditions: + HasKeyName: + !Not [!Equals [!Ref KeyName, ""]] + +Mappings: + + AWSRegionAMI: + us-east-1: + "64": ami-06ed3fd089c8e62f5 + us-east-2: + "64": ami-0355f6d73d5fae73a + us-west-1: + "64": ami-0001470d19f9a6405 + us-west-2: + "64": ami-060f780bf2d6d376a + ca-central-1 : + "64": ami-09a9f2133758f756e + eu-central-1 : + "64": ami-04b28d05825ee91bb + eu-west-1: + "64": ami-0fd13a289d081dc3d + eu-west-2: + "64": ami-03c3c1fde3b77b77a + eu-west-3: + "64": ami-01a516917af8fa78f + eu-north-1: + "64": ami-0adb3b3512c53ea84 + ap-southeast-1: + "64": ami-0ad88e26054d6c830 + ap-southeast-2: + "64": ami-0f4986d48d5541b72 + ap-south-1: + "64": ami-09f1c9c9ea7ad7467 + ap-northeast-1: + "64": ami-0a97c312878973887 + ap-northeast-2: + "64": ami-01cf7a60a1037b9e2 + ap-northeeast-3: + "64": ami-058a3ca662374270c + sa-east-1: + "64": ami-0cce5bd1e6ba2a8c3 + us-gov-east-1 : + "64": ami-0d95a1d045c867695 + us-gov-west-1 : + "64": ami-094b49d82d41681c9 + +Resources: + +#################### EC2 Instance for pushing JasperReports Server base images to ECR #################### + + FirstEC2Instance: + Type: AWS::EC2::Instance + Properties: + ImageId: !FindInMap + - AWSRegionAMI + - !Ref 'AWS::Region' + - '64' + InstanceType: m5.large + KeyName: !If [HasKeyName, !Ref KeyName, !Ref "AWS::NoValue"] + BlockDeviceMappings: + - DeviceName: "/dev/xvda" + Ebs: + VolumeSize: "50" + IamInstanceProfile: !Ref ECRInstanceProfile + InstanceInitiatedShutdownBehavior: stop + SubnetId: !Ref PrivateSubnet + UserData: + Fn::Base64: !Sub | + #!/bin/bash + echo 'JasperReports Server-Containers-AWS: Start of EC2 Instance UserData execution...' + echo "Install Docker..." + sudo yum update + sudo yum -y install docker unzip + sudo service docker start + #sudo usermod -aG docker $USER + + echo 'Installing JasperReports Server images for version ${JasperReportsServerVersion}' + cd /usr/share/jrs_dist/ + + echo 'Get js-docker from TIBCOSoftware Github' + wget "${JaspersoftForDockerURL}" -O js-dockerrepo.zip --no-verbose + unzip -q js-dockerrepo.zip + mv $(ls -d TIBCOSoftware-js-docker*/)/* . + + echo 'unzip WAR from jasperreports-server-bin' + cd jasperreports-server-bin + mkdir jasperserver-pro + unzip -q jasperserver-pro.war -d jasperserver-pro + + cd .. + + docker build -f Dockerfile --build-arg HTTP_PORT=80 --build-arg HTTPS_PORT=443 --build-arg EXPLODED_INSTALLER_DIRECTORY=jasperreports-server-bin --build-arg TOMCAT_BASE_IMAGE=${TomcatBaseImage} -t jasperserver-pro:${ImageTagPrefix}${JasperReportsServerVersion} . + docker build -f Dockerfile-cmdline --build-arg EXPLODED_INSTALLER_DIRECTORY=jasperreports-server-bin --build-arg JAVA_BASE_IMAGE=${JavaBaseImage} -t jasperserver-pro-cmdline:${ImageTagPrefix}${JasperReportsServerVersion} . + + cd kubernetes + docker build -f Dockerfile-cmdline-k8s --build-arg JASPERREPORTS_SERVER_IMAGE_TAG=${ImageTagPrefix}${JasperReportsServerVersion} -t jasperserver-pro-cmdline:${ImageTagPrefix}k8s-${JasperReportsServerVersion} . + + cd ../platforms/aws + docker build -f Dockerfile-s3 --build-arg JASPERREPORTS_SERVER_VERSION=${ImageTagPrefix}${JasperReportsServerVersion} -t jasperserver-pro:${ImageTagPrefix}s3-${JasperReportsServerVersion} . + docker build -f Dockerfile-cmdline-s3 --build-arg JASPERREPORTS_SERVER_VERSION=${ImageTagPrefix}${JasperReportsServerVersion} -t jasperserver-pro-cmdline:${ImageTagPrefix}s3-${JasperReportsServerVersion} . + + echo 'ECR login...' + $(aws ecr get-login --region ${AWS::Region} --no-include-email) + echo 'Create image repositories ...' + if aws ecr describe-repositories --region ${AWS::Region} --repository-names jasperserver-pro | grep repositoryUri; then + echo 'jasperserver-pro ECR Repository already exists, skipping repository creation...' + else + echo 'jasperserver-pro ECR Repository does not exist, creating...' + aws ecr create-repository --region ${AWS::Region} --repository-name jasperserver-pro + fi + if aws ecr describe-repositories --region ${AWS::Region} --repository-names jasperserver-pro-cmdline | grep repositoryUri; then + echo 'jasperserver-pro-cmdline ECR Repository already exists, skipping repository creation...' + else + echo 'jasperserver-pro-cmdline ECR Repository does not exist, creating...' + aws ecr create-repository --region ${AWS::Region} --repository-name jasperserver-pro-cmdline + fi + + echo 'Tagging and pushing to ECR...' + + docker tag jasperserver-pro:${ImageTagPrefix}${JasperReportsServerVersion} ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro:${ImageTagPrefix}${JasperReportsServerVersion} + docker tag jasperserver-pro-cmdline:${ImageTagPrefix}${JasperReportsServerVersion} ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro-cmdline:${ImageTagPrefix}${JasperReportsServerVersion} + + docker tag jasperserver-pro-cmdline:${ImageTagPrefix}k8s-${JasperReportsServerVersion} ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro-cmdline:${ImageTagPrefix}k8s-${JasperReportsServerVersion} + + docker tag jasperserver-pro:${ImageTagPrefix}s3-${JasperReportsServerVersion} ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro:${ImageTagPrefix}s3-${JasperReportsServerVersion} + docker tag jasperserver-pro-cmdline:${ImageTagPrefix}s3-${JasperReportsServerVersion} ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro-cmdline:${ImageTagPrefix}s3-${JasperReportsServerVersion} + + docker push ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro:${ImageTagPrefix}${JasperReportsServerVersion} + docker push ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro-cmdline:${ImageTagPrefix}${JasperReportsServerVersion} + + docker push ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro-cmdline:${ImageTagPrefix}k8s-${JasperReportsServerVersion} + + docker push ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro:${ImageTagPrefix}s3-${JasperReportsServerVersion} + docker push ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/jasperserver-pro-cmdline:${ImageTagPrefix}s3-${JasperReportsServerVersion} + + echo 'JasperReports Server-Containers-AWS: End of EC2 Instance UserData execution, shutting down...' + sudo poweroff + + ECRRole: + Type: AWS::IAM::Role + Properties: + Path: / + RoleName: !Sub ${AWS::StackName}-ECRRole-${AWS::Region} + AssumeRolePolicyDocument: | + { + "Statement": [{ + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + } + }] + } + Policies: + - PolicyName: jrs-image-init-service + PolicyDocument: | + { + "Statement": [{ + "Effect": "Allow", + "Action": [ + "ecr:*", + "s3:*", + "logs:*" + ], + "Resource": "*" + }] + } + + ECRInstanceProfile: + Type: AWS::IAM::InstanceProfile + Properties: + Path: / + Roles: + - !Ref ECRRole + + +#################### Output Section #################### +Outputs: + + jasperserverProECR: + Description: Amazon ECR (Amazon EC2 Container Registry) for JasperReports Server images. + Value: !Join + - '' + - + - 'https://console.aws.amazon.com/ecr/home?region=' + - !Ref 'AWS::Region' + - '#/repositories/jasperserver-pro#images' + + jasperserverProCmdlineECR: + Description: Amazon ECR (Amazon EC2 Container Registry)) for JasperReports Server command line images. + Value: !Join + - '' + - + - 'https://console.aws.amazon.com/ecr/home?region=' + - !Ref 'AWS::Region' + - '#/repositories/jasperserver-pro-cmdline#images' diff --git a/platforms/aws/scripts/entrypoint-aws.sh b/platforms/aws/scripts/entrypoint-aws.sh index a09dc96..dc86f40 100644 --- a/platforms/aws/scripts/entrypoint-aws.sh +++ b/platforms/aws/scripts/entrypoint-aws.sh @@ -8,14 +8,18 @@ # other config files from a given S3 bucket #. ./common-environment-aws.sh - fixed the ./ -> / -. /common-environment-aws.sh +#. /common-environment-aws.sh + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +. $DIR/common-environment-aws.sh initialize_from_S3 -BASE_ENTRYPOINT=${BASE_ENTRYPOINT:-/entrypoint.sh} +BASE_ENTRYPOINT_PATH=${DIR}/${BASE_ENTRYPOINT:-/entrypoint.sh} case "$1" in run) - ( ${BASE_ENTRYPOINT} "$@" ) + ( ${BASE_ENTRYPOINT_PATH} "$@" ) ;; *) diff --git a/platforms/aws/scripts/entrypoint-cmdline-aws.sh b/platforms/aws/scripts/entrypoint-cmdline-aws.sh index 89ae1fc..18d657d 100644 --- a/platforms/aws/scripts/entrypoint-cmdline-aws.sh +++ b/platforms/aws/scripts/entrypoint-cmdline-aws.sh @@ -7,9 +7,11 @@ # Wraps the jasperserver-pro entrypoint.sh to load license and # other config files from a given S3 bucket -. /common-environment-aws.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -BASE_ENTRYPOINT=${BASE_ENTRYPOINT:-/entrypoint-cmdline.sh} +. $DIR/common-environment-aws.sh + +BASE_ENTRYPOINT_PATH=${DIR}/${BASE_ENTRYPOINT:-/entrypoint-cmdline.sh} case "$1" in @@ -24,7 +26,7 @@ case "$1" in initialize_from_S3 - ( ${BASE_ENTRYPOINT} "$@" ) + ( ${BASE_ENTRYPOINT_PATH} "$@" ) ;; import) @@ -49,7 +51,7 @@ case "$1" in aws s3 cp s3://${bucketAndFolder} /tmp/${bucketAndFolder} --recursive #ls /tmp/${bucketAndFolder} - ( ${BASE_ENTRYPOINT} import "/tmp/${bucketAndFolder}/${importFileName}" ) + ( ${BASE_ENTRYPOINT_PATH} import "/tmp/${bucketAndFolder}/${importFileName}" ) # copy results back into s3 ${bucketAndFolder} aws s3 cp /tmp/${bucketAndFolder} s3://${bucketAndFolder}/ --recursive @@ -64,7 +66,7 @@ case "$1" in ;; mnt) shift 1 - ( ${BASE_ENTRYPOINT} import "$@" ) + ( ${BASE_ENTRYPOINT_PATH} import "$@" ) ;; esac ;; @@ -90,7 +92,7 @@ case "$1" in echo "Exporting to s3: ${bucketAndFolder}" mkdir -p /tmp/${bucketAndFolder} aws s3 cp s3://${bucketAndFolder}/${exportFileName} /tmp/${bucketAndFolder} - ( ${BASE_ENTRYPOINT} export "/tmp/${bucketAndFolder}/${exportFileName}" ) + ( ${BASE_ENTRYPOINT_PATH} export "/tmp/${bucketAndFolder}/${exportFileName}" ) # copy export results into ${bucketAndFolder} aws s3 cp /tmp/${bucketAndFolder} s3://${bucketAndFolder} --recursive aws s3 rm s3://${bucketAndFolder}/${exportFileName} @@ -102,7 +104,7 @@ case "$1" in ;; mnt) shift 1 - ( ${BASE_ENTRYPOINT} export "$@" ) + ( ${BASE_ENTRYPOINT_PATH} export "$@" ) ;; esac ;; diff --git a/platforms/aws/scripts/installPackagesForJasperserver-pro-s3.sh b/platforms/aws/scripts/installPackagesForJasperserver-pro-s3.sh index 1cd27ca..0d2a669 100644 --- a/platforms/aws/scripts/installPackagesForJasperserver-pro-s3.sh +++ b/platforms/aws/scripts/installPackagesForJasperserver-pro-s3.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2020. TIBCO Software Inc. +# Copyright (c) 2019. TIBCO Software Inc. # This file is subject to the license terms contained # in the license file that is distributed with this file. @@ -24,4 +24,5 @@ else rm -rf /var/lib/apt/lists/* fi -pip3 install awscli --upgrade \ No newline at end of file +pip3 install awscli --upgrade + diff --git a/scripts/buildomatic/js-ant b/scripts/buildomatic/js-ant index 05dd6c2..15c3fe0 100644 --- a/scripts/buildomatic/js-ant +++ b/scripts/buildomatic/js-ant @@ -1,7 +1,7 @@ #!/bin/sh -export ANT_OPTS="$ANT_OPTS -Djava.net.preferIPv4Stack=true -noverify" -echo "ANT_OPTS=$ANT_OPTS" +ANT_OPTS="-Xms128m -Xmx512m -Djava.net.preferIPv4Stack=true -noverify" + # # setup to use bundled of ant # @@ -30,6 +30,7 @@ then fi export BUILDOMATIC_MODE=${BUILDOMATIC_MODE:-interactive} +#export ANT_OPTS="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y" # # Collect the command line args @@ -37,5 +38,4 @@ export BUILDOMATIC_MODE=${BUILDOMATIC_MODE:-interactive} CMD_LINE_ARGS=$* -$ANT_RUN --noconfig -nouserlib -f build.xml $CMD_LINE_ARGS - +$ANT_RUN --noconfig -nouserlib -lib . -lib lib -f build.xml $CMD_LINE_ARGS \ No newline at end of file diff --git a/scripts/chromium-setup.sh b/scripts/chromium-setup.sh new file mode 100644 index 0000000..a05504c --- /dev/null +++ b/scripts/chromium-setup.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Copyright (c) 2020. TIBCO Software Inc. +# This file is subject to the license terms contained +# in the license file that is distributed with this file. +# This script is used to set up the chromium at the time of container starting. + +if hash yum 2>/dev/null; then + PACKAGE_MGR="yum" +elif hash zypper 2>/dev/null; then + PACKAGE_MGR="zypper" +elif hash rpm 2>/dev/null; then + PACKAGE_MGR="rpm" +else + PACKAGE_MGR="apt_get" +fi +echo "Installing packages with $PACKAGE_MGR" +case "$PACKAGE_MGR" in +"yum") + yum -y install chromium + ;; +"zypper") + zypper -n install chromium + ;; +"rpm") + echo "Installed nothing via rpm" + exit 1 + ;; +"apt_get") + apt-get install -y --no-install-recommends chromium + ;; +esac + +if hash chrome 2>/dev/null; then + echo Using chrome + chrome -version +elif hash chromium 2>/dev/null; then + echo Using chromium + chromium -version +elif hash chromium-browser 2>/dev/null; then + echo Using chromium-browser + chromium-browser -version +else + echo Chromium not installed. Exiting + exit 1 +fi +# if chromium is installed, update JasperReports Server config. +if hash chrome 2>/dev/null; then + CHROMIUM_CMD=chrome +elif hash chromium 2>/dev/null; then + CHROMIUM_CMD=chromium +elif hash chromium-browser 2>/dev/null; then + CHROMIUM_CMD=chromium-browser +else + CHROMIUM_CMD=Not +fi + +if [ "$CHROMIUM_CMD" != "Not" ]; then + echo "$CHROMIUM_CMD available. Configuring JasperReports Server to use it" + sed -i -r "s/^chrome.path=(.*)/chrome.path=$CHROMIUM_CMD/" \ + $CATALINA_HOME/webapps/jasperserver-pro/WEB-INF/js.config.properties + cat $CATALINA_HOME/webapps/jasperserver-pro/WEB-INF/js.config.properties | grep chrome.path= + echo 'net.sf.jasperreports.chrome.argument.no-sandbox=true' >>$CATALINA_HOME/webapps/jasperserver-pro//WEB-INF/classes/jasperreports.properties +else + echo "Chromium not available. Headless browser functionality will fail." +fi diff --git a/scripts/common-environment.sh b/scripts/common-environment.sh index 400096b..0a3b367 100644 --- a/scripts/common-environment.sh +++ b/scripts/common-environment.sh @@ -15,6 +15,8 @@ # Sets script to fail if any command fails. set -e +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + BUILDOMATIC_HOME=${BUILDOMATIC_HOME:-/usr/src/jasperreports-server/buildomatic} MOUNTS_HOME=${MOUNTS_HOME:-/usr/local/share/jasperserver-pro} @@ -43,10 +45,10 @@ export JAVA_MAX_RAM_PCT=${JAVA_MAX_RAM_PERCENTAGE:-80.0} # Add Java options to suppress Groovy related warning message for Jaspersoft running Java 11 -export JAVA_OPTS="$JAVA_OPTS -XX:-UseContainerSupport -XX:MinRAMPercentage=$JAVA_MIN_RAM_PCT -XX:MaxRAMPercentage=$JAVA_MAX_RAM_PCT @/java11.opts" +export JAVA_OPTS="$JAVA_OPTS -XX:-UseContainerSupport -XX:MinRAMPercentage=$JAVA_MIN_RAM_PCT -XX:MaxRAMPercentage=$JAVA_MAX_RAM_PCT @$DIR/java11.opts" # additional options for Ant used by buildomatic -export ANT_OPTS="$ANT_OPTS @/java11.opts" +export ANT_OPTS="$ANT_OPTS @$DIR/java11.opts" initialize_deploy_properties() { # license could fail diff --git a/scripts/entrypoint-cmdline.sh b/scripts/entrypoint-cmdline.sh index a8cdd77..e09811e 100644 --- a/scripts/entrypoint-cmdline.sh +++ b/scripts/entrypoint-cmdline.sh @@ -13,7 +13,9 @@ # Sets script to fail if any command fails. set -e -. /common-environment.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +. $DIR/common-environment.sh apply_customizations() { # unpack zips (if exist) from path diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index eb72523..ada2aef 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -11,13 +11,14 @@ # Sets script to fail if any command fails. set -e -. /common-environment.sh +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -run_jasperserver() { +. $DIR/common-environment.sh +run_jasperserver() { test_database_connection - + # Because default_master.properties could change on any launch, # always do deploy-webapp-pro. @@ -26,8 +27,8 @@ run_jasperserver() { # Apply customization zips if present apply_customizations - # setup phantomjs - config_phantomjs + # set Chromium as the JavaScript rendering engine + config_chromium # If JRS_HTTPS_ONLY is set, sets JasperReports Server to # run only in HTTPS. Update keystore and password if given @@ -37,26 +38,9 @@ run_jasperserver() { exec env JAVA_OPTS="$JAVA_OPTS" catalina.sh run } - - -config_phantomjs() { - # if phantomjs binary is present, update JasperReports Server config. - if [[ -x "/usr/local/bin/phantomjs" ]]; then - PATH_PHANTOM='\/usr\/local\/bin\/phantomjs' - PATTERN1='com.jaspersoft.jasperreports' - PATTERN2='phantomjs.executable.path' - cd $CATALINA_HOME/webapps/jasperserver-pro/WEB-INF - sed -i -r "s/(.*)($PATTERN1.highcharts.$PATTERN2=)(.*)/\2$PATH_PHANTOM/" \ - classes/jasperreports.properties - sed -i -r "s/(.*)($PATTERN1.fusion.$PATTERN2=)(.*)/\2$PATH_PHANTOM/" \ - classes/jasperreports.properties - sed -i -r "s/(.*)(phantomjs.binary=)(.*)/\2$PATH_PHANTOM/" \ - js.config.properties - elif [[ "$(ls -A /usr/local/share/phantomjs)" ]]; then - echo "Warning: /usr/local/bin/phantomjs is not executable, \ -but /usr/local/share/phantomjs exists. PhantomJS \ -is not correctly configured." - fi +config_chromium() { + ## Install chromium at the time of starting of container + . $DIR/chromium-setup.sh } config_ports_and_ssl() { @@ -70,12 +54,12 @@ config_ports_and_ssl() { # in JasperReports Server. JRS_HTTPS_ONLY=${JRS_HTTPS_ONLY:-false} - if "$JRS_HTTPS_ONLY" = "true" ; then + if "$JRS_HTTPS_ONLY" = "true"; then echo "Setting HTTPS only within JasperReports Server" cd $CATALINA_HOME/webapps/jasperserver-pro/WEB-INF xmlstarlet ed --inplace \ -N x="http://java.sun.com/xml/ns/j2ee" -u \ - "//x:security-constraint/x:user-data-constraint/x:transport-guarantee"\ + "//x:security-constraint/x:user-data-constraint/x:transport-guarantee" \ -v "CONFIDENTIAL" web.xml sed -i "s/=http:\/\//=https:\/\//g" js.quartz.properties sed -i "s/8080/${HTTPS_PORT:-8443}/g" js.quartz.properties @@ -86,42 +70,41 @@ config_ports_and_ssl() { SSL_CERT_PATH=${SSL_CERT_PATH:-${MOUNTS_HOME}/ssl-certificate} if [ -d "$SSL_CERT_PATH" ]; then - CERT_PATH_FILES=`find $SSL_CERT_PATH -iname ".keystore*" \ - -exec readlink -f {} \;` - - # update the keystore and password if there - if [[ ${#CERT_PATH_FILES} -ne 0 ]]; then - # will only be one, if at all - for keystore in $CERT_PATH_FILES; do - if [[ -f "$keystore" ]]; then - echo "Deploying SSL Keystore $keystore" - cp "${keystore}" /root - xmlstarlet ed --inplace --subnode "/Server/Service/Connector[@port='${HTTPS_PORT:-8443}']" --type elem \ - --var connector-ssl '$prev' \ - --update '$connector-ssl' --type attr -n port -v "${HTTPS_PORT:-8443}" \ - --update '$connector-ssl' --type attr -n keystoreFile -v "/root/${keystore}" \ - --update '$connector-ssl' --type attr -n keystorePass -v "${KS_PASSWORD:-changeit}" \ - ${CATALINA_HOME}/conf/server.xml - echo "Deployed SSL ${keystore} keystore" - fi - done - else - # update existing server.xml. could have been overwritten by customization - # xmlstarlet ed --inplace --subnode "/Server/Service/Connector[@port='${HTTPS_PORT:-8443}']" --type elem \ - # --var connector-ssl '$prev' \ - # --update '$connector-ssl' --type attr -n port -v "${HTTPS_PORT:-8443}" \ - # --update '$connector-ssl' --type attr -n keystorePass -v "${KS_PASSWORD}" \ - # --update '$connector-ssl' --type attr -n keystoreFile -v "/root/.keystore.p12" \ - # ${CATALINA_HOME}/conf/server.xml - echo "No .keystore files. Did not update SSL" - fi + CERT_PATH_FILES=$(find $SSL_CERT_PATH -iname ".keystore*" \ + -exec readlink -f {} \;) + + # update the keystore and password if there + if [[ ${#CERT_PATH_FILES} -ne 0 ]]; then + # will only be one, if at all + for keystore in $CERT_PATH_FILES; do + if [[ -f "$keystore" ]]; then + echo "Deploying SSL Keystore $keystore" + cp "${keystore}" $CATALINA_HOME/conf + xmlstarlet ed --inplace --subnode "/Server/Service/Connector[@port='${HTTPS_PORT:-8443}']" --type elem \ + --var connector-ssl '$prev' \ + --update '$connector-ssl' --type attr -n port -v "${HTTPS_PORT:-8443}" \ + --update '$connector-ssl' --type attr -n keystoreFile -v "$CATALINA_HOME/conf/${keystore}" \ + --update '$connector-ssl' --type attr -n keystorePass -v "${KS_PASSWORD:-changeit}" \ + ${CATALINA_HOME}/conf/server.xml + echo "Deployed SSL ${keystore} keystore" + fi + done + else + # update existing server.xml. could have been overwritten by customization + # xmlstarlet ed --inplace --subnode "/Server/Service/Connector[@port='${HTTPS_PORT:-8443}']" --type elem \ + # --var connector-ssl '$prev' \ + # --update '$connector-ssl' --type attr -n port -v "${HTTPS_PORT:-8443}" \ + # --update '$connector-ssl' --type attr -n keystorePass -v "${KS_PASSWORD}" \ + # --update '$connector-ssl' --type attr -n keystoreFile -v "/root/.keystore.p12" \ + # ${CATALINA_HOME}/conf/server.xml + echo "No .keystore files. Did not update SSL" + fi # end if $SSL_CERT_PATH exists. fi } - apply_customizations() { # unpack zips (if exist) from path # ${MOUNTS_HOME}/customization @@ -130,55 +113,54 @@ apply_customizations() { # file sorted with natural sort JRS_CUSTOMIZATION=${JRS_CUSTOMIZATION:-${MOUNTS_HOME}/customization} if [ -d "$JRS_CUSTOMIZATION" ]; then - echo "Deploying Customizations from $JRS_CUSTOMIZATION" - - JRS_CUSTOMIZATION_FILES=`find $JRS_CUSTOMIZATION -iname "*zip" \ - -exec readlink -f {} \; | sort -V` - # find . -path ./lower -prune -o -name "*txt" - for customization in $JRS_CUSTOMIZATION_FILES; do - if [[ -f "$customization" ]]; then - if unzip -l $customization | grep install.sh ; then - echo "Installing ${customization##*/}" - mkdir -p "/tmp/jrs-installs/${customization##*/}" - unzip -o -q "$customization" -d "/tmp/jrs-installs/${customization##*/}" - cd "/tmp/jrs-installs/${customization##*/}" - chmod +x -R *.sh - ./install.sh - cd .. - rm -rf "${customization##*/}" - else - echo "Unzipping $customization into JasperReports Server webapp" - unzip -o -q "$customization" \ - -d $CATALINA_HOME/webapps/jasperserver-pro/ - fi - fi - done + echo "Deploying Customizations from $JRS_CUSTOMIZATION" + + JRS_CUSTOMIZATION_FILES=$(find $JRS_CUSTOMIZATION -iname "*zip" \ + -exec readlink -f {} \; | sort -V) + # find . -path ./lower -prune -o -name "*txt" + for customization in $JRS_CUSTOMIZATION_FILES; do + if [[ -f "$customization" ]]; then + if unzip -l $customization | grep install.sh; then + echo "Installing ${customization##*/}" + mkdir -p "/tmp/jrs-installs/${customization##*/}" + unzip -o "$customization" -d "/tmp/jrs-installs/${customization##*/}" + cd "/tmp/jrs-installs/${customization##*/}" + chmod +x -R *.sh + ./install.sh + cd .. + rm -rf "${customization##*/}" + else + echo "Unzipping $customization into JasperReports Server webapp $CATALINA_HOME/webapps/jasperserver-pro" + unzip -o "$customization" \ + -d $CATALINA_HOME/webapps/jasperserver-pro/ + fi + fi + done fi - + TOMCAT_CUSTOMIZATION=${TOMCAT_CUSTOMIZATION:-${MOUNTS_HOME}/tomcat-customization} if [ -d "$TOMCAT_CUSTOMIZATION" ]; then - echo "Deploying Tomcat Customizations from $TOMCAT_CUSTOMIZATION" - TOMCAT_CUSTOMIZATION_FILES=`find $TOMCAT_CUSTOMIZATION -iname "*zip" \ - -exec readlink -f {} \; | sort -V` - for customization in $TOMCAT_CUSTOMIZATION_FILES; do - if [[ -f "$customization" ]]; then - echo "Unzipping $customization into Tomcat" - unzip -o -q "$customization" \ - -d $CATALINA_HOME - fi - done - fi + echo "Deploying Tomcat Customizations from $TOMCAT_CUSTOMIZATION" + TOMCAT_CUSTOMIZATION_FILES=$(find $TOMCAT_CUSTOMIZATION -iname "*zip" \ + -exec readlink -f {} \; | sort -V) + for customization in $TOMCAT_CUSTOMIZATION_FILES; do + if [[ -f "$customization" ]]; then + echo "Unzipping $customization into Tomcat" + unzip -o -q "$customization" \ + -d $CATALINA_HOME + fi + done + fi } - initialize_deploy_properties case "$1" in - run) - shift 1 - run_jasperserver "$@" - ;; - *) - exec "$@" +run) + shift 1 + run_jasperserver "$@" + ;; +*) + exec "$@" + ;; esac - diff --git a/scripts/installPackagesForJasperserver-pro-cmdline.sh b/scripts/installPackagesForJasperserver-pro-cmdline.sh index 457639e..6a54a5f 100644 --- a/scripts/installPackagesForJasperserver-pro-cmdline.sh +++ b/scripts/installPackagesForJasperserver-pro-cmdline.sh @@ -23,14 +23,14 @@ case "$PACKAGE_MGR" in yum -y update yum -y install yum-utils wget unzip ;; - "rpm" ) - echo "Installed nothing via rpm" - ;; "zypper" ) zypper refresh && \ zypper -n install wget unzip && \ zypper clean -a ;; + "rpm" ) + echo "Installed nothing via rpm" + ;; "apt_get" ) apt-get update apt-get install -y --no-install-recommends apt-utils unzip wget diff --git a/scripts/installPackagesForJasperserver-pro.sh b/scripts/installPackagesForJasperserver-pro.sh index 19cde7d..1061479 100644 --- a/scripts/installPackagesForJasperserver-pro.sh +++ b/scripts/installPackagesForJasperserver-pro.sh @@ -4,6 +4,7 @@ # This file is subject to the license terms contained # in the license file that is distributed with this file. + if hash yum 2>/dev/null; then #echo "yum found" PACKAGE_MGR="yum" @@ -17,8 +18,6 @@ else fi echo "Installing packages with $PACKAGE_MGR" -# installing JasperReports Server web app - case "$PACKAGE_MGR" in "yum" ) yum -y update @@ -28,22 +27,21 @@ case "$PACKAGE_MGR" in yum -y install /tmp/epel-release-latest-7.noarch.rpm yum -y install xmlstarlet ;; - "rpm" ) - echo "Installed nothing via rpm" - ;; "zypper" ) - zypper refresh && \ - zypper -n install wget unzip tar bzip2 && \ + zypper refresh + zypper -n install wget unzip tar bzip2 wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ -O /tmp/epel-release-latest-7.noarch.rpm --no-verbose zypper -n install /tmp/epel-release-latest-7.noarch.rpm zypper -n install xmlstarlet - zypper clean -a + ;; + "rpm" ) + echo "Installed nothing via rpm" + exit 1 ;; "apt_get" ) apt-get update apt-get install -y --no-install-recommends apt-utils unzip xmlstarlet - #apt-get install -y unzip xmlstarlet - rm -rf /var/lib/apt/lists/* ;; esac +