64 Commits

Author SHA1 Message Date
Nana Janashia
dd21d95e93 Update Jenkinsfile 2021-12-04 15:54:42 +00:00
Nana Janashia
9492a348d0 Add frontend and java compatibility config 2021-07-12 12:27:29 +02:00
Nana Janashia
a87e8850de Remove target from source code 2021-07-12 12:13:41 +02:00
Nana Janashia
6123875bc8 add changes 2020-11-22 15:03:10 +01:00
Nana Janashia
1f54931484 add changes 2020-11-22 14:46:01 +01:00
Nana Janashia
18ecdca204 fix 2020-11-22 14:35:13 +01:00
Nana Janashia
e1dbd4d042 fix 2020-11-22 14:32:48 +01:00
Nana Janashia
36b85d75cc pass image name to shell script 2020-11-22 14:30:13 +01:00
Nana Janashia
c120554c74 tag replacement in docker-compose 2020-11-22 14:19:34 +01:00
Nana Janashia
3e1d99e8d0 rm env set 2020-11-22 14:10:05 +01:00
Nana Janashia
e71aab1655 add shell script for executing 2020-11-22 14:04:09 +01:00
Nana Janashia
762a6a9ffb add shell script for executing 2020-11-22 13:59:25 +01:00
Nana Janashia
e14b7b7012 fix env var setup 2020-11-22 13:43:08 +01:00
Nana Janashia
106a7e447e fix ports 2020-11-22 13:28:47 +01:00
Nana Janashia
b28d6ff9d9 add docker-compose config 2020-11-22 13:27:04 +01:00
Nana Janashia
4e33b70b24 Delete test.sh 2020-11-22 11:48:37 +00:00
Nana Janashia
d41bcec12b Update Jenkinsfile 2020-11-22 11:46:58 +00:00
Nana Janashia
9dadc24128 Update test.sh 2020-11-22 11:46:37 +00:00
Nana Janashia
12f88937ab Update Jenkinsfile 2020-11-22 11:38:52 +00:00
Nana Janashia
8b1aa75d8e Update test.sh 2020-11-22 11:38:44 +00:00
Nana Janashia
339109ec86 Update Jenkinsfile 2020-11-22 11:14:16 +00:00
Nana Janashia
63f6c3d5bb Update Jenkinsfile 2020-11-22 11:10:37 +00:00
Nana Janashia
ba9f0882ca Update freestyle-build.sh 2020-11-22 11:00:46 +00:00
Nana Janashia
0b043899f9 Update Jenkinsfile 2020-11-22 11:00:27 +00:00
Nana Janashia
f31394abe3 Update Jenkinsfile 2020-11-22 11:00:15 +00:00
Nana Janashia
e2633b0888 Update freestyle-build.sh 2020-11-22 10:56:56 +00:00
Nana Janashia
a1b5946b6d fixed building jar file 2020-11-22 11:32:38 +01:00
Nana Janashia
45817d153a fixed port 2020-11-22 10:13:21 +01:00
Nana Janashia
0576e0033b fixed env var usage 2020-11-22 10:08:59 +01:00
Nana Janashia
44cf4ac38c adjustments 2020-11-22 09:58:37 +01:00
Nana Janashia
04f35ad918 Update Jenkinsfile 2020-11-08 15:26:35 +00:00
Nana Janashia
686259038b add shebang 2020-11-08 15:39:58 +01:00
Nana Janashia
1978bd1fc9 Update Jenkinsfile 2020-11-08 12:57:32 +00:00
Nana Janashia
b262ce98c8 Update Jenkinsfile 2020-11-08 12:56:40 +00:00
Nana Janashia
24fdad6aaa Update Jenkinsfile 2020-11-08 09:46:22 +00:00
Nana Janashia
e41eb6433d Update Jenkinsfile 2020-11-08 09:45:28 +00:00
Nana Janashia
1ce128d916 Update Jenkinsfile 2020-11-08 08:10:52 +00:00
Nana Janashia
2c6295012f Update Jenkinsfile 2020-11-08 08:10:25 +00:00
Nana Janashia
48b35c0308 Update Jenkinsfile 2020-11-08 08:09:54 +00:00
Nana Janashia
80ed88f4be Update Jenkinsfile 2020-11-08 08:09:11 +00:00
Nana Janashia
f8698fee42 Update Jenkinsfile 2020-11-07 17:43:27 +00:00
Nana Janashia
eea2109d66 Update Jenkinsfile 2020-11-07 17:43:18 +00:00
Nana Janashia
a71dd16df8 Update Jenkinsfile 2020-11-07 17:18:06 +00:00
Nana Janashia
8e3382a0ef Update Jenkinsfile 2020-11-07 17:07:02 +00:00
Nana Janashia
1d4aac4b5a Update Jenkinsfile 2020-11-07 17:04:52 +00:00
Nana Janashia
f65d9eb00e Update Jenkinsfile 2020-11-07 16:59:22 +00:00
Nana Janashia
a026af6e2f Update Jenkinsfile 2020-11-07 16:56:56 +00:00
Nana Janashia
02aef32659 Update Jenkinsfile 2020-11-07 16:53:58 +00:00
Nana Janashia
e68743b02d Update Jenkinsfile 2020-11-07 16:52:56 +00:00
Nana Janashia
ce28529588 Update Jenkinsfile 2020-11-07 16:51:48 +00:00
Nana Janashia
a0deb05e4e Update Jenkinsfile 2020-11-07 16:50:48 +00:00
Nana Janashia
126336f79e Update Jenkinsfile 2020-11-07 16:44:13 +00:00
Nana Janashia
19eeb818ca Update Jenkinsfile 2020-11-07 16:41:18 +00:00
Nana Janashia
ff51c37f0a Update Jenkinsfile 2020-11-07 16:40:39 +00:00
Nana Janashia
948fbb8f12 Update Jenkinsfile 2020-11-07 16:39:30 +00:00
Nana Janashia
679d67b80a Update Jenkinsfile 2020-11-07 16:37:49 +00:00
Nana Janashia
661a008faa Update Jenkinsfile 2020-11-07 16:36:06 +00:00
Nana Janashia
9cc6d90fe8 Update Jenkinsfile 2020-11-07 16:32:06 +00:00
Nana Janashia
61821c6ef7 Update Jenkinsfile 2020-11-06 12:47:14 +00:00
Nana Janashia
1fa470771d Delete script.groovy 2020-11-06 12:27:54 +00:00
Nana Janashia
9c56ddc553 Update Jenkinsfile 2020-11-06 12:26:25 +00:00
Nana Janashia
056eca7cf6 Update script.groovy 2020-11-06 11:26:50 +00:00
Nana Janashia
e637047b84 Update Jenkinsfile 2020-11-06 11:26:28 +00:00
Nana Janashia
845783dbc6 Update Jenkinsfile 2020-11-06 11:17:00 +00:00
17 changed files with 104 additions and 83 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
.idea/* .idea/*
target

54
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env groovy
library identifier: 'jenkins-shared-library@master', retriever: modernSCM(
[$class: 'GitSCMSource',
remote: 'https://gitlab.com/nanuchi/jenkins-shared-library.git',
credentialsId: 'gitlab-credentials'
]
)
pipeline {
agent any
tools {
maven 'Maven'
}
environment {
IMAGE_NAME = 'nanajanashia/demo-app:java-maven-2.0'
}
stages {
stage('build app') {
steps {
script {
echo 'building application jar...'
buildJar()
}
}
}
stage('build image') {
steps {
script {
echo 'building docker image...'
buildImage(env.IMAGE_NAME)
dockerLogin()
dockerPush(env.IMAGE_NAME)
}
}
}
stage('deploy') {
steps {
script {
echo 'deploying docker image to EC2...'
def shellCmd = "bash ./server-cmds.sh ${IMAGE_NAME}"
def ec2Instance = "ec2-user@35.180.251.121"
sshagent(['ec2-server-key']) {
sh "scp -o StrictHostKeyChecking=no server-cmds.sh ${ec2Instance}:/home/ec2-user"
sh "scp -o StrictHostKeyChecking=no docker-compose.yaml ${ec2Instance}:/home/ec2-user"
sh "ssh -o StrictHostKeyChecking=no ${ec2Instance} ${shellCmd}"
}
}
}
}
}
}

12
docker-compose.yaml Normal file
View File

@@ -0,0 +1,12 @@
version: '3.8'
services:
java-maven-app:
image: ${IMAGE}
ports:
- 8080:8080
postgres:
image: postgres:13
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=my-pwd

View File

@@ -1,2 +0,0 @@
# npm --version
# docker --version

21
pom.xml
View File

@@ -8,6 +8,27 @@
<artifactId>java-maven-app</artifactId> <artifactId>java-maven-app</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

5
server-cmds.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
export IMAGE=$1
docker-compose -f docker-compose.yaml up --detach
echo "success"

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MyApp</title>
</head>
<body>
<h1>Welcome to Java Maven Application</h1>
<!-- add image here <img src="" width="" /> -->
</body>
</html>

View File

@@ -1,5 +0,0 @@
#Generated by Maven
#Thu Oct 29 12:55:55 CET 2020
version=1.0-SNAPSHOT
groupId=com.example
artifactId=java-maven-app

View File

@@ -1 +0,0 @@
com/example/Application.class

View File

@@ -1 +0,0 @@
/Users/nanajanashia/Demo-projects/Bootcamp/java-maven-app/src/main/java/com/example/Application.java

View File

@@ -1,4 +0,0 @@
-------------------------------------------------------------------------------
Test set: AppTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 sec

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="1" failures="0" name="AppTest" time="0.003" errors="0" skipped="0">
<properties>
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
<property name="sun.boot.library.path" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib"/>
<property name="java.vm.version" value="25.202-b08"/>
<property name="user.country.format" value="AT"/>
<property name="gopherProxySet" value="false"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="maven.multiModuleProjectDirectory" value="/Users/nanajanashia/Demo-projects/Bootcamp/java-maven-app"/>
<property name="java.vendor.url" value="http://java.oracle.com/"/>
<property name="path.separator" value=":"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
<property name="file.encoding.pkg" value="sun.io"/>
<property name="user.country" value="GB"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="/Users/nanajanashia/Demo-projects/Bootcamp/java-maven-app"/>
<property name="java.runtime.version" value="1.8.0_202-b08"/>
<property name="java.awt.graphicsenv" value="sun.awt.CGraphicsEnvironment"/>
<property name="java.endorsed.dirs" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/endorsed"/>
<property name="os.arch" value="x86_64"/>
<property name="java.io.tmpdir" value="/var/folders/y3/bvgmrxg950x0f1z4zt3pby3c0000gn/T/"/>
<property name="line.separator" value="
"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="os.name" value="Mac OS X"/>
<property name="classworlds.conf" value="/usr/local/Cellar/maven/3.6.0/libexec/bin/m2.conf"/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.library.path" value="/Users/nanajanashia/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:."/>
<property name="maven.conf" value="/usr/local/Cellar/maven/3.6.0/libexec/conf"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.class.version" value="52.0"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="10.14.6"/>
<property name="library.jansi.path" value="/usr/local/Cellar/maven/3.6.0/libexec/lib/jansi-native"/>
<property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
<property name="user.home" value="/Users/nanajanashia"/>
<property name="user.timezone" value="Europe/Vienna"/>
<property name="java.awt.printerjob" value="sun.lwawt.macosx.CPrinterJob"/>
<property name="java.specification.version" value="1.8"/>
<property name="file.encoding" value="UTF-8"/>
<property name="user.name" value="nanajanashia"/>
<property name="java.class.path" value="/usr/local/Cellar/maven/3.6.0/libexec/boot/plexus-classworlds-2.5.2.jar"/>
<property name="java.vm.specification.version" value="1.8"/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher test"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="user.language" value="en"/>
<property name="awt.toolkit" value="sun.lwawt.macosx.LWCToolkit"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="1.8.0_202"/>
<property name="java.ext.dirs" value="/Users/nanajanashia/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"/>
<property name="sun.boot.class.path" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/classes"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="maven.home" value="/usr/local/Cellar/maven/3.6.0/libexec"/>
<property name="file.separator" value="/"/>
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.io.unicode.encoding" value="UnicodeBig"/>
<property name="socksNonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
<property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
<property name="sun.cpu.isalist" value=""/>
</properties>
<testcase classname="AppTest" name="testApp" time="0.003"/>
</testsuite>

Binary file not shown.