diff --git a/build_util/build_in_docker b/build_util/build_in_docker new file mode 100755 index 0000000..72d8b76 --- /dev/null +++ b/build_util/build_in_docker @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +docker build --rm -t local/c7-buildhost docker + +docker run -it -v `pwd`:/root/build local/c7-buildhost /root/build/build_util/build_rpm diff --git a/build_util/build_rpm b/build_util/build_rpm new file mode 100755 index 0000000..e756c4f --- /dev/null +++ b/build_util/build_rpm @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +cd /root +cp -Rv build build2 +cd build2 + +SPEC=$(ls *.spec) +VER=$(grep Version $SPEC | awk '{print $2}') +tar cvf $HOME/rpmbuild/SOURCES/DataMigrator-${VER}.tar.gz --show-transformed --transform="s/^\./PPL_DataMigrationTools-${VER}/" . +rpmbuild -ba $SPEC +cp /root/rpmbuild/RPMS/x86_64/PPL_DataMigrationTools-* /root/build/ diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..88f2eac --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,28 @@ +# General build RPM environment for CentOS 6.x +# +# VERSION 0.0.1 + +FROM centos:centos7 +MAINTAINER Derry Hamilton + +# Install up-to-date epel rpm repository +RUN yum -y install epel-release + +# Install various packages to get compile environment +RUN yum -y groupinstall 'Development Tools' + +# Install git command to access GitHub repository +RUN yum -y install git + +# Install rpm-build to use rpmrebuild command +RUN yum -y install rpm-build + +# Install yum-utils to use yumdownloader command +RUN yum -y install yum-utils + +# Install rpmdevtools to use rpmdev-setuptree command +RUN yum -y install rpmdevtools + +# Install rpmdevtools to use rpmdev-setuptree command +RUN yum -y install maven +RUN mkdir -p /root/rpmbuild/SOURCES diff --git a/install_extra/copying_defaults_log4j.properties b/install_extra/copying_defaults_log4j.properties new file mode 100644 index 0000000..f83dfb2 --- /dev/null +++ b/install_extra/copying_defaults_log4j.properties @@ -0,0 +1,28 @@ +log4j.rootLogger=info, stdout, R, SYSLOG + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Threshold=info +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +#log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %d - %m%n +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2} %x - %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=/tmp/DefaultCopyingApp.log + +log4j.appender.R.MaxFileSize=100KB +# Keep one backup file +log4j.appender.R.MaxBackupIndex=1 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%p %t %c %d - %m%n + + +log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender +log4j.appender.SYSLOG.Threshold=info +log4j.appender.SYSLOG.syslogHost=localhost +log4j.appender.SYSLOG.Facility=LOCAL4 +log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout +log4j.appender.SYSLOG.layout.conversionPattern=%d{ISO8601} %-5p [%t] %c{2} %x - %m%n + diff --git a/install_extra/run_copying_job b/install_extra/run_copying_job new file mode 100755 index 0000000..2bb58ab --- /dev/null +++ b/install_extra/run_copying_job @@ -0,0 +1,38 @@ +#!/bin/bash + +JOBNAME=${1:-undef} +if [ -z "${JOBNAME}" ] +then + echo "Job name not specified" + exit 1 +fi +if [ ! -e "/etc/ujetl/${JOBNAME}_config_live.xml" ] +then + echo "Could not find config file for $JOBNAME" + exit 2 +fi + +LOG_PROPS=/etc/ujetl/copying_defaults_log4j.properties +if [ -e "/etc/ujetl/${JOBNAME}_log4j.properties" ] +then + echo Using log config "/etc/ujetl/${JOBNAME}_log4j.properties" + LOG_PROPS="/etc/ujetl/${JOBNAME}_log4j.properties" +else + echo Using default logging. +fi + +#LOCKFILE=/tmp/"${JOBNAME}"_copying.lock + +#/usr/bin/lockfile -r ${RETRIES:-"1"} $LOCKFILE || exit 1 + +#trap "rm -f $LOCKFILE; exit" INT TERM EXIT + +/usr/bin/java \ + -Xms1g \ + -Xmx2g \ + -cp /usr/share/ujetl/lib/CopyingApp.jar \ + com.ujetl.data.CopyingApp \ + --log4j "$LOG_PROPS" \ + --config "/etc/ujetl/${JOBNAME}_config_live.xml" + +#rm -f $LOCKFILE diff --git a/run_copying_job b/run_copying_job deleted file mode 100755 index d0d0313..0000000 --- a/run_copying_job +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -set -e - -JOBNAME=${1:-undef} -if [ -z "${JOBNAME}" ] -then - echo "Job name not specified" - exit 1 -fi -if [ ! -e "/etc/ujetl/${JOBNAME}_config_live.xml" ] -then - echo "Could not find config file for $JOBNAME" - exit 2 -fi - -LOG_PROPS=/etc/ujetl/copying_defaults_log4j.xml -if [ -e "/etc/ujetl/${JOBNAME}_log4j.xml" ] -then - echo Using log config "/etc/ujetl/${JOBNAME}_log4j.xml" - LOG_PROPS="/etc/ujetl/${JOBNAME}_log4j.xml" -else - echo Using default logging. -fi -test -e "$LOG_PROPS" - - -LOCKFILE=/tmp/"${JOBNAME}"_copying.lock - -/usr/bin/lockfile -r ${RETRIES:-"1"} $LOCKFILE || exit 1 - -trap "rm -f $LOCKFILE; exit" INT TERM EXIT - -/usr/bin/java \ - -Xms1g \ - -Xmx2g \ - -jar target/CopyingApp-2.0.0-jar-with-dependencies.jar \ - --log4j "$LOG_PROPS" \ - --config "/etc/ujetl/${JOBNAME}_config_live.xml" - -if [ -e "/etc/ujetl/${JOBNAME}_post.sql" ] -then - psql -f "/etc/ujetl/${JOBNAME}_post.sql" data_hub -fi - -rm -f $LOCKFILE diff --git a/uJETL.spec b/uJETL.spec new file mode 100644 index 0000000..a885963 --- /dev/null +++ b/uJETL.spec @@ -0,0 +1,33 @@ +Summary: Java app to facilitate moving data between databases. +Name: uJETL +Version: 2.0.0 +Release: 1 +Group: Applications/Database +License: All rights reserved. +Source: uJETL-%{version}.tar.gz +URL: https://github.com/rasilon/ujetl.git +Distribution: derryh +Vendor: derryh +Packager: Derry Hamilton +#BuildRoot: . + +%description +A very small ETL app + +%prep +%setup + +%build +#mvn -Dmaven.test.skip=true clean package +true + +%install +mkdir -p $RPM_BUILD_ROOT/usr/share/ujetl/lib $RPM_BUILD_ROOT/etc/ujetl $RPM_BUILD_ROOT/usr/bin +cp target/CopyingApp-*-jar-with-dependencies.jar $RPM_BUILD_ROOT/usr/share/ujetl/lib/CopyingApp.jar +cp install_extra/run_copying_job $RPM_BUILD_ROOT/usr/bin +cp install_extra/copying_defaults_log4j.properties $RPM_BUILD_ROOT/etc/ujetl + +%files +/usr/share/ujetl/lib/CopyingApp.jar +/usr/bin/run_copying_job +/etc/ujetl/copying_defaults_log4j.properties