diff --git a/.gitignore b/.gitignore
index 9c9642b1d..a4381843c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@ target/*
.idea
*.iml
/target
+packer_cache/
+builds/
diff --git a/Jenkinsfile b/Jenkinsfile
index 85b61203e..b0a913c3e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,226 +1,29 @@
#!/bin/env groovy
-
-@Library('ldop-shared-library@fd16602cad0f97ca1b04090f93a0540ddc871b45') _
-
pipeline {
agent none
- environment {
- IMAGE = "liatrio/petclinic-tomcat"
- }
-
stages {
- stage('Build') {
- agent {
- docker {
- image 'maven:3.5.0'
- args '-e INITIAL_ADMIN_USER -e INITIAL_ADMIN_PASSWORD --network=${LDOP_NETWORK_NAME}'
- }
- }
- steps {
- configFileProvider([configFile(fileId: 'nexus', variable: 'MAVEN_SETTINGS')]) {
- sh 'mvn -s $MAVEN_SETTINGS clean deploy -DskipTests=true -B'
- }
- }
- }
- stage('Sonar') {
+ stage('Deploy to Artifactory') {
agent {
- docker {
- image 'sebp/sonar-runner'
- args '-e SONAR_ACCOUNT_LOGIN -e SONAR_ACCOUNT_PASSWORD -e SONAR_DB_URL -e SONAR_DB_LOGIN -e SONAR_DB_PASSWORD --network=${LDOP_NETWORK_NAME}'
+ node {
+ label 'tester'
}
}
steps {
- sh '/opt/sonar-runner-2.4/bin/sonar-runner -e -D sonar.login=${SONAR_ACCOUNT_LOGIN} -D sonar.password=${SONAR_ACCOUNT_PASSWORD} -D sonar.jdbc.url=${SONAR_DB_URL} -D sonar.jdbc.username=${SONAR_DB_LOGIN} -D sonar.jdbc.password=${SONAR_DB_PASSWORD}'
+ sh 'mvn deploy'
}
}
- stage('Get Artifact') {
+ stage('Deploy to Dev') {
agent {
- docker {
- image 'maven:3.5.0'
- args '-e INITIAL_ADMIN_USER -e INITIAL_ADMIN_PASSWORD --network=${LDOP_NETWORK_NAME}'
+ node {
+ label 'tester'
}
}
steps {
- sh 'mvn clean'
- script {
- pom = readMavenPom file: 'pom.xml'
- getArtifact(pom.groupId, pom.artifactId, pom.version, 'petclinic')
- }
- }
- }
-
- stage('Build container') {
- agent any
- steps {
- script {
- if ( env.BRANCH_NAME == 'master' ) {
- pom = readMavenPom file: 'pom.xml'
- TAG = pom.version
- } else {
- TAG = env.BRANCH_NAME
- }
- sh "docker build -t ${env.IMAGE}:${TAG} ."
- }
- }
- }
-
- stage('Run local container') {
- agent any
- steps {
- sh 'docker rm -f petclinic-tomcat-temp || true'
- sh "docker run -d --network=${LDOP_NETWORK_NAME} --name petclinic-tomcat-temp ${env.IMAGE}:${TAG}"
- }
- }
-
- stage('Smoke-Test & OWASP Security Scan') {
- agent {
- docker {
- image 'maven:3.5.0'
- args '--network=${LDOP_NETWORK_NAME}'
- }
- }
- steps {
- sh "cd regression-suite && mvn clean -B test -DPETCLINIC_URL=http://petclinic-tomcat-temp:8080/petclinic/"
- }
- }
- stage('Stop local container') {
- agent any
- steps {
- sh 'docker rm -f petclinic-tomcat-temp || true'
- }
- }
-
- stage('Push to dockerhub') {
- agent any
- steps {
- withCredentials([usernamePassword(credentialsId: 'dockerhub', passwordVariable: 'dockerPassword', usernameVariable: 'dockerUsername')]){
- script {
- sh "docker login -u ${env.dockerUsername} -p ${env.dockerPassword}"
- sh "docker push ${env.IMAGE}:${TAG}"
- }
- }
- }
- }
-
- stage('Deploy to dev') {
- when {
- branch 'master'
- }
- agent any
- steps {
- script {
- deployToEnvironment("ec2-user", "dev.petclinic.liatr.io", "petclinic-deploy-key", env.IMAGE, TAG, "spring-petclinic", "dev.petclinic.liatr.io")
- }
- }
- }
-
- stage('Smoke test dev') {
- when {
- branch 'master'
- }
- agent {
- docker {
- image 'maven:3.5.0'
- args '--network=${LDOP_NETWORK_NAME}'
- }
- }
- steps {
- sh "cd regression-suite && mvn clean -B test -DPETCLINIC_URL=https://dev.petclinic.liatr.io/petclinic"
- echo "Should be accessible at https://dev.petclinic.liatr.io/petclinic"
- }
- }
-
- stage('Deploy to qa') {
- when {
- branch 'master'
- }
- agent any
- steps {
- deployToEnvironment("ec2-user", "qa.petclinic.liatr.io", "petclinic-deploy-key", env.IMAGE, TAG, "spring-petclinic", "qa.petclinic.liatr.io")
- }
- }
-
- stage('Smoke test qa') {
- when {
- branch 'master'
- }
- agent {
- docker {
- image 'maven:3.5.0'
- args '--network=${LDOP_NETWORK_NAME}'
- }
- }
- steps {
- sh "cd regression-suite && mvn clean -B test -DPETCLINIC_URL=https://qa.petclinic.liatr.io/petclinic"
- echo "Should be accessible at https://qa.petclinic.liatr.io/petclinic"
- input 'Deploy to Prod?'
- }
- }
-
- stage('Blue/Green Prod Deploy') {
- when {
- branch 'master'
- }
- agent {
- dockerfile {
- filename "blue-green/Dockerfile"
- }
- }
- steps {
- withCredentials([
- usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
- file(credentialsId: 'petclinic-deploy-key', variable: 'DEPLOY_KEY_PATH')
- ]) {
- script {
- sh "TAG=${TAG} blue-green/blue-green deploy"
- }
- }
- }
- }
-
- stage('Blue/Green Prod Regression Test') {
- when {
- branch 'master'
- }
- agent {
- dockerfile {
- filename "blue-green/Dockerfile"
- }
- }
- steps {
- withCredentials([
- usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
- file(credentialsId: 'petclinic-deploy-key', variable: 'DEPLOY_KEY_PATH')
- ]) {
- script {
- sh "TAG=${TAG} blue-green/blue-green test"
- }
- }
- }
- }
-
- stage('Blue/Green Prod Toggle Load Balancer') {
- when {
- branch 'master'
- }
- agent {
- dockerfile {
- filename "blue-green/Dockerfile"
- }
- }
- steps {
- input "Toggle Prod Load Balancer?"
- withCredentials([
- usernamePassword(credentialsId: 'aws', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
- file(credentialsId: 'petclinic-deploy-key', variable: 'DEPLOY_KEY_PATH')
- ]) {
- script {
- sh "TAG=${TAG} blue-green/blue-green toggle"
- }
- }
+ sh 'scp -P 2225 -r script.sh admin@192.168.0.20:/home/admin/.'
+ sh 'ssh -p 2225 admin@192.168.0.20 < script.sh'
}
}
}
diff --git a/pom.xml b/pom.xml
index 31725653e..290fb2938 100644
--- a/pom.xml
+++ b/pom.xml
@@ -420,14 +420,11 @@
-
- snapshots
- http://nexus:8081/nexus/content/repositories/snapshots
-
-
- releases
- http://nexus:8081/nexus/content/repositories/releases
-
+
+ snapshots
+ localhost.localdomain-snapshots
+ http://192.168.0.20:8081/artifactory/libs-snapshot-local
+
demopetclinic
diff --git a/script.sh b/script.sh
new file mode 100644
index 000000000..4464695e8
--- /dev/null
+++ b/script.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+wget http://192.168.0.20:8081/artifactory/libs-snapshot-local/org/springframework/samples/spring-petclinic/maven-metadata.xml
+VERSION=$(cat maven-metadata.xml | grep -m 1 -oP '(?<=).*(?=)')
+rm -f maven-metadata.xml
+wget http://192.168.0.20:8081/artifactory/libs-snapshot-local/org/springframework/samples/spring-petclinic/$VERSION/maven-metadata.xml
+
+AID=$(cat maven-metadata.xml | grep -m 1 -oP '(?<=).*(?=)')
+VALUE=$(cat maven-metadata.xml | grep -m 1 -oP '(?<=).*(?=)')
+echo $AID-$VALUE.war > version
+#echo "curl \"http://192.168.0.56:8081/repository/maven-snapshots/org/springframework/samples/spring-petclinic/$VERSION/" > command
+
+echo "curl \"http://192.168.0.20:8081/artifactory/libs-snapshot-local/org/springframework/samples/spring-petclinic/$VERSION/" > command
+
+paste -d '' command version > firsthalf
+echo "\" -o /usr/share/tomcat/webapps/petclinic.war" > secondhalf
+paste -d '' firsthalf secondhalf > fullcmd
+sudo chmod 755 fullcmd
+sudo ./fullcmd
+sudo service tomcat restart
+#rm -f command firsthalf fullcmd maven-metadata.xml secondhalf version
+rm -f command firsthalf maven-metadata.xml secondhalf version
diff --git a/test.sh b/test.sh
new file mode 100644
index 000000000..1cd42a7bf
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo 'TESTING JF' >> jfile.txt
diff --git a/vm-images/jenkins/jenkins_build.json b/vm-images/jenkins/jenkins_build.json
new file mode 100644
index 000000000..980979727
--- /dev/null
+++ b/vm-images/jenkins/jenkins_build.json
@@ -0,0 +1,51 @@
+{
+ "variables": {
+ "file": "http://mirrors.ocf.berkeley.edu/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso",
+ "checksum": "bd43d41e01c2a46b3cb23eb9139dce4b",
+ "type": "md5",
+ "non_gui": "false"
+ },
+ "builders": [
+ {
+ "type": "virtualbox-iso",
+ "iso_url": "{{ user `file` }}",
+ "iso_checksum": "{{ user `checksum` }}",
+ "iso_checksum_type": "md5",
+ "headless": "{{ user `non_gui` }}",
+ "output_directory": "builds",
+ "vm_name": "jenkins_centos",
+ "guest_os_type": "RedHat_64",
+ "disk_size": "10240",
+ "vboxmanage": [
+ ["modifyvm", "{{.Name}}", "--memory", "2048"],
+ ["modifyvm", "{{.Name}}", "--cpus", "2"],
+ ["modifyvm", "{{.Name}}", "--audio", "none"],
+ ["modifyvm", "{{.Name}}", "--usb", "off"]
+ ],
+ "http_directory": "src",
+ "boot_wait": "5s",
+ "boot_command": [
+ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg"
+ ],
+ "ssh_username": "admin",
+ "ssh_password": "admin",
+ "ssh_port": 22,
+ "ssh_wait_timeout": "10000s",
+ "guest_additions_path": "disable",
+ "shutdown_command": "echo 'admin' | sudo -S /sbin/halt -h -p"
+ }
+ ],
+ "provisioners": [{
+ "type": "shell",
+ "inline": [
+ "sleep 30",
+ "sudo yum upgrade",
+ "sudo yum install git -y",
+ "sudo yum install wget -y",
+ "sudo yum install java-1.8.0-openjdk-devel -y",
+ "sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo",
+ "sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key",
+ "sudo yum install jenkins -y"
+ ]
+ }]
+}
diff --git a/vm-images/jenkins/src/ks.cfg b/vm-images/jenkins/src/ks.cfg
new file mode 100644
index 000000000..e659d3c6c
--- /dev/null
+++ b/vm-images/jenkins/src/ks.cfg
@@ -0,0 +1,87 @@
+install
+cdrom
+
+lang en_US.UTF-8
+keyboard us
+timezone UTC
+
+network --bootproto=dhcp
+firewall --disabled
+
+rootpw --plaintext packer
+user --name=admin --password=admin
+auth --enableshadow --passalgo=sha512 --kickstart
+selinux --permissive
+
+text
+skipx
+
+clearpart --all --initlabel
+zerombr
+autopart
+bootloader --location=mbr
+
+firstboot --disable
+reboot
+
+%packages --instLangs=en_US.utf8 --nobase --ignoremissing --excludedocs
+@^minimal
+@core
+
+-aic94xx-firmware
+-atmel-firmware
+-b43-openfwwf
+-bfa-firmware
+-ipw2100-firmware
+-ipw2200-firmware
+-ivtv-firmware
+-iwl100-firmware
+-iwl105-firmware
+-iwl135-firmware
+-iwl1000-firmware
+-iwl2000-firmware
+-iwl2030-firmware
+-iwl3160-firmware
+-iwl3945-firmware
+-iwl4965-firmware
+-iwl5000-firmware
+-iwl5150-firmware
+-iwl6000-firmware
+-iwl6000g2a-firmware
+-iwl6000g2b-firmware
+-iwl6050-firmware
+-iwl7260-firmware
+-libertas-usb8388-firmware
+-ql2100-firmware
+-ql2200-firmware
+-ql23xx-firmware
+-ql2400-firmware
+-ql2500-firmware
+-rt61pci-firmware
+-rt73usb-firmware
+-xorg-x11-drv-ati-firmware
+-zd1211-firmware
+%end
+
+%post --log=/root/ks.log
+SEE NEXT PICTURE!!!! The security settings of my provider does not allow this content!
+%end
+
+%post
+echo "admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/admin
+echo "Defaults:admin !requiretty" >> /etc/sudoers.d/admin
+chmod 0440 /etc/sudoers.d/admin
+mkdir -pm 700 /home/admin/.ssh
+cat </home/admin/.ssh/authorized_keys
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8Y\
+Vr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdO\
+KLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7Pt\
+ixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmC\
+P3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW\
+yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== admin insecure public key
+EOK
+chmod 0600 /home/admin/.ssh/authorized_keys
+chown -R admin.admin /home/admin/.ssh
+yum -y update
+yum -y remove linux-firmware
+%end
diff --git a/vm-images/test_env/config/tomcat-users.xml b/vm-images/test_env/config/tomcat-users.xml
new file mode 100644
index 000000000..61d2b4889
--- /dev/null
+++ b/vm-images/test_env/config/tomcat-users.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vm-images/test_env/config/tomcat.conf b/vm-images/test_env/config/tomcat.conf
new file mode 100644
index 000000000..bdfeb770a
--- /dev/null
+++ b/vm-images/test_env/config/tomcat.conf
@@ -0,0 +1,51 @@
+# System-wide configuration file for tomcat services
+# This will be loaded by systemd as an environment file,
+# so please keep the syntax. For shell expansion support
+# place your custom files as /etc/tomcat/conf.d/*.conf
+#
+# There are 2 "classes" of startup behavior in this package.
+# The old one, the default service named tomcat.service.
+# The new named instances are called tomcat@instance.service.
+#
+# Use this file to change default values for all services.
+# Change the service specific ones to affect only one service.
+# For tomcat.service it's /etc/sysconfig/tomcat, for
+# tomcat@instance it's /etc/sysconfig/tomcat@instance.
+
+# This variable is used to figure out if config is loaded or not.
+TOMCAT_CFG_LOADED="1"
+
+# In new-style instances, if CATALINA_BASE isn't specified, it will
+# be constructed by joining TOMCATS_BASE and NAME.
+TOMCATS_BASE="/var/lib/tomcats/"
+
+# Where your java installation lives
+JAVA_HOME="/usr/lib/jvm/jre"
+
+# Where your tomcat installation lives
+CATALINA_HOME="/usr/share/tomcat"
+
+# System-wide tmp
+CATALINA_TMPDIR="/var/cache/tomcat/temp"
+
+# You can pass some parameters to java here if you wish to
+#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"
+
+# Use JAVA_OPTS to set java.library.path for libtcnative.so
+#JAVA_OPTS="-Djava.library.path=/usr/lib"
+
+# You can change your tomcat locale here
+#LANG="en_US"
+
+# Run tomcat under the Java Security Manager
+SECURITY_MANAGER="false"
+
+# Time to wait in seconds, before killing process
+# TODO(stingray): does nothing, fix.
+# SHUTDOWN_WAIT="30"
+
+# If you wish to further customize your tomcat environment,
+# put your own definitions here
+# (i.e. LD_LIBRARY_PATH for some jdbc drivers)
+JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"
+
diff --git a/vm-images/test_env/src/ks.cfg b/vm-images/test_env/src/ks.cfg
new file mode 100644
index 000000000..e659d3c6c
--- /dev/null
+++ b/vm-images/test_env/src/ks.cfg
@@ -0,0 +1,87 @@
+install
+cdrom
+
+lang en_US.UTF-8
+keyboard us
+timezone UTC
+
+network --bootproto=dhcp
+firewall --disabled
+
+rootpw --plaintext packer
+user --name=admin --password=admin
+auth --enableshadow --passalgo=sha512 --kickstart
+selinux --permissive
+
+text
+skipx
+
+clearpart --all --initlabel
+zerombr
+autopart
+bootloader --location=mbr
+
+firstboot --disable
+reboot
+
+%packages --instLangs=en_US.utf8 --nobase --ignoremissing --excludedocs
+@^minimal
+@core
+
+-aic94xx-firmware
+-atmel-firmware
+-b43-openfwwf
+-bfa-firmware
+-ipw2100-firmware
+-ipw2200-firmware
+-ivtv-firmware
+-iwl100-firmware
+-iwl105-firmware
+-iwl135-firmware
+-iwl1000-firmware
+-iwl2000-firmware
+-iwl2030-firmware
+-iwl3160-firmware
+-iwl3945-firmware
+-iwl4965-firmware
+-iwl5000-firmware
+-iwl5150-firmware
+-iwl6000-firmware
+-iwl6000g2a-firmware
+-iwl6000g2b-firmware
+-iwl6050-firmware
+-iwl7260-firmware
+-libertas-usb8388-firmware
+-ql2100-firmware
+-ql2200-firmware
+-ql23xx-firmware
+-ql2400-firmware
+-ql2500-firmware
+-rt61pci-firmware
+-rt73usb-firmware
+-xorg-x11-drv-ati-firmware
+-zd1211-firmware
+%end
+
+%post --log=/root/ks.log
+SEE NEXT PICTURE!!!! The security settings of my provider does not allow this content!
+%end
+
+%post
+echo "admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/admin
+echo "Defaults:admin !requiretty" >> /etc/sudoers.d/admin
+chmod 0440 /etc/sudoers.d/admin
+mkdir -pm 700 /home/admin/.ssh
+cat </home/admin/.ssh/authorized_keys
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8Y\
+Vr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdO\
+KLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7Pt\
+ixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmC\
+P3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW\
+yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== admin insecure public key
+EOK
+chmod 0600 /home/admin/.ssh/authorized_keys
+chown -R admin.admin /home/admin/.ssh
+yum -y update
+yum -y remove linux-firmware
+%end
diff --git a/vm-images/test_env/test_env.sh b/vm-images/test_env/test_env.sh
new file mode 100644
index 000000000..a31864160
--- /dev/null
+++ b/vm-images/test_env/test_env.sh
@@ -0,0 +1,12 @@
+# Provision tomcat
+sudo yum install tomcat -y
+sudo yum install tomcat-webapps tomcat-admin-webapps -y
+sudo mv tomcat-users.xml /usr/share/tomcat/conf/tomcat-users.xml
+sudo mv tomcat.conf /usr/share/tomcat/conf/tomcat.conf
+sudo systemctl enable tomcat
+
+# Provision jenkins
+sudo yum install maven -y
+
+# Install git
+sudo yum install git -y
diff --git a/vm-images/test_env/test_env_build.json b/vm-images/test_env/test_env_build.json
new file mode 100644
index 000000000..977740c65
--- /dev/null
+++ b/vm-images/test_env/test_env_build.json
@@ -0,0 +1,56 @@
+{
+ "variables": {
+ "file": "http://mirrors.ocf.berkeley.edu/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso",
+ "checksum": "bd43d41e01c2a46b3cb23eb9139dce4b",
+ "type": "md5",
+ "non_gui": "false"
+ },
+ "builders": [
+ {
+ "type": "virtualbox-iso",
+ "iso_url": "{{ user `file` }}",
+ "iso_checksum": "{{ user `checksum` }}",
+ "iso_checksum_type": "md5",
+ "headless": "{{ user `non_gui` }}",
+ "output_directory": "builds",
+ "vm_name": "Test-env-CentOS7",
+ "guest_os_type": "RedHat_64",
+ "disk_size": "10240",
+ "vboxmanage": [
+ ["modifyvm", "{{.Name}}", "--memory", "2048"],
+ ["modifyvm", "{{.Name}}", "--cpus", "2"],
+ ["modifyvm", "{{.Name}}", "--audio", "none"],
+ ["modifyvm", "{{.Name}}", "--usb", "off"]
+ ],
+ "http_directory": "src",
+ "boot_wait": "5s",
+ "boot_command": [
+ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg"
+ ],
+ "ssh_username": "admin",
+ "ssh_password": "admin",
+ "ssh_port": 22,
+ "ssh_wait_timeout": "10000s",
+ "guest_additions_path": "disable",
+ "shutdown_command": "echo 'admin' | sudo -S /sbin/halt -h -p"
+ }
+ ],
+ "provisioners": [
+ {
+ "type": "file",
+ "source": "config/tomcat-users.xml",
+ "destination": "~/tomcat-users.xml"
+ },
+ {
+ "type": "file",
+ "source": "config/tomcat.conf",
+ "destination": "~/tomcat.conf"
+ },
+ {
+ "type": "shell",
+ "scripts": [
+ "test_env.sh"
+ ]
+ }
+ ]
+}
diff --git a/vm-images/tomcat/config/tomcat-users.xml b/vm-images/tomcat/config/tomcat-users.xml
new file mode 100644
index 000000000..61d2b4889
--- /dev/null
+++ b/vm-images/tomcat/config/tomcat-users.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vm-images/tomcat/config/tomcat.conf b/vm-images/tomcat/config/tomcat.conf
new file mode 100644
index 000000000..bdfeb770a
--- /dev/null
+++ b/vm-images/tomcat/config/tomcat.conf
@@ -0,0 +1,51 @@
+# System-wide configuration file for tomcat services
+# This will be loaded by systemd as an environment file,
+# so please keep the syntax. For shell expansion support
+# place your custom files as /etc/tomcat/conf.d/*.conf
+#
+# There are 2 "classes" of startup behavior in this package.
+# The old one, the default service named tomcat.service.
+# The new named instances are called tomcat@instance.service.
+#
+# Use this file to change default values for all services.
+# Change the service specific ones to affect only one service.
+# For tomcat.service it's /etc/sysconfig/tomcat, for
+# tomcat@instance it's /etc/sysconfig/tomcat@instance.
+
+# This variable is used to figure out if config is loaded or not.
+TOMCAT_CFG_LOADED="1"
+
+# In new-style instances, if CATALINA_BASE isn't specified, it will
+# be constructed by joining TOMCATS_BASE and NAME.
+TOMCATS_BASE="/var/lib/tomcats/"
+
+# Where your java installation lives
+JAVA_HOME="/usr/lib/jvm/jre"
+
+# Where your tomcat installation lives
+CATALINA_HOME="/usr/share/tomcat"
+
+# System-wide tmp
+CATALINA_TMPDIR="/var/cache/tomcat/temp"
+
+# You can pass some parameters to java here if you wish to
+#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"
+
+# Use JAVA_OPTS to set java.library.path for libtcnative.so
+#JAVA_OPTS="-Djava.library.path=/usr/lib"
+
+# You can change your tomcat locale here
+#LANG="en_US"
+
+# Run tomcat under the Java Security Manager
+SECURITY_MANAGER="false"
+
+# Time to wait in seconds, before killing process
+# TODO(stingray): does nothing, fix.
+# SHUTDOWN_WAIT="30"
+
+# If you wish to further customize your tomcat environment,
+# put your own definitions here
+# (i.e. LD_LIBRARY_PATH for some jdbc drivers)
+JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"
+
diff --git a/vm-images/tomcat/src/ks.cfg b/vm-images/tomcat/src/ks.cfg
new file mode 100644
index 000000000..e659d3c6c
--- /dev/null
+++ b/vm-images/tomcat/src/ks.cfg
@@ -0,0 +1,87 @@
+install
+cdrom
+
+lang en_US.UTF-8
+keyboard us
+timezone UTC
+
+network --bootproto=dhcp
+firewall --disabled
+
+rootpw --plaintext packer
+user --name=admin --password=admin
+auth --enableshadow --passalgo=sha512 --kickstart
+selinux --permissive
+
+text
+skipx
+
+clearpart --all --initlabel
+zerombr
+autopart
+bootloader --location=mbr
+
+firstboot --disable
+reboot
+
+%packages --instLangs=en_US.utf8 --nobase --ignoremissing --excludedocs
+@^minimal
+@core
+
+-aic94xx-firmware
+-atmel-firmware
+-b43-openfwwf
+-bfa-firmware
+-ipw2100-firmware
+-ipw2200-firmware
+-ivtv-firmware
+-iwl100-firmware
+-iwl105-firmware
+-iwl135-firmware
+-iwl1000-firmware
+-iwl2000-firmware
+-iwl2030-firmware
+-iwl3160-firmware
+-iwl3945-firmware
+-iwl4965-firmware
+-iwl5000-firmware
+-iwl5150-firmware
+-iwl6000-firmware
+-iwl6000g2a-firmware
+-iwl6000g2b-firmware
+-iwl6050-firmware
+-iwl7260-firmware
+-libertas-usb8388-firmware
+-ql2100-firmware
+-ql2200-firmware
+-ql23xx-firmware
+-ql2400-firmware
+-ql2500-firmware
+-rt61pci-firmware
+-rt73usb-firmware
+-xorg-x11-drv-ati-firmware
+-zd1211-firmware
+%end
+
+%post --log=/root/ks.log
+SEE NEXT PICTURE!!!! The security settings of my provider does not allow this content!
+%end
+
+%post
+echo "admin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/admin
+echo "Defaults:admin !requiretty" >> /etc/sudoers.d/admin
+chmod 0440 /etc/sudoers.d/admin
+mkdir -pm 700 /home/admin/.ssh
+cat </home/admin/.ssh/authorized_keys
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8Y\
+Vr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdO\
+KLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7Pt\
+ixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmC\
+P3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW\
+yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== admin insecure public key
+EOK
+chmod 0600 /home/admin/.ssh/authorized_keys
+chown -R admin.admin /home/admin/.ssh
+yum -y update
+yum -y remove linux-firmware
+%end
diff --git a/vm-images/tomcat/tomcat.sh b/vm-images/tomcat/tomcat.sh
new file mode 100644
index 000000000..82910deb9
--- /dev/null
+++ b/vm-images/tomcat/tomcat.sh
@@ -0,0 +1,6 @@
+sudo yum install tomcat -y
+sudo yum install tomcat-webapps tomcat-admin-webapps -y
+sudo mv tomcat-users.xml /usr/share/tomcat/conf/tomcat-users.xml
+sudo mv tomcat.conf /usr/share/tomcat/conf/tomcat.conf
+sudo systemctl enable tomcat
+
diff --git a/vm-images/tomcat/tomcat_build.json b/vm-images/tomcat/tomcat_build.json
new file mode 100644
index 000000000..018a19a5b
--- /dev/null
+++ b/vm-images/tomcat/tomcat_build.json
@@ -0,0 +1,56 @@
+{
+ "variables": {
+ "file": "http://mirrors.ocf.berkeley.edu/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso",
+ "checksum": "bd43d41e01c2a46b3cb23eb9139dce4b",
+ "type": "md5",
+ "non_gui": "false"
+ },
+ "builders": [
+ {
+ "type": "virtualbox-iso",
+ "iso_url": "{{ user `file` }}",
+ "iso_checksum": "{{ user `checksum` }}",
+ "iso_checksum_type": "md5",
+ "headless": "{{ user `non_gui` }}",
+ "output_directory": "builds",
+ "vm_name": "Tomcat-CentOS7",
+ "guest_os_type": "RedHat_64",
+ "disk_size": "10240",
+ "vboxmanage": [
+ ["modifyvm", "{{.Name}}", "--memory", "2048"],
+ ["modifyvm", "{{.Name}}", "--cpus", "2"],
+ ["modifyvm", "{{.Name}}", "--audio", "none"],
+ ["modifyvm", "{{.Name}}", "--usb", "off"]
+ ],
+ "http_directory": "src",
+ "boot_wait": "5s",
+ "boot_command": [
+ " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg"
+ ],
+ "ssh_username": "admin",
+ "ssh_password": "admin",
+ "ssh_port": 22,
+ "ssh_wait_timeout": "10000s",
+ "guest_additions_path": "disable",
+ "shutdown_command": "echo 'admin' | sudo -S /sbin/halt -h -p"
+ }
+ ],
+ "provisioners": [
+ {
+ "type": "file",
+ "source": "config/tomcat-users.xml",
+ "destination": "~/tomcat-users.xml"
+ },
+ {
+ "type": "file",
+ "source": "config/tomcat.conf",
+ "destination": "~/tomcat.conf"
+ },
+ {
+ "type": "shell",
+ "scripts": [
+ "tomcat.sh"
+ ]
+ }
+ ]
+}