Compare commits
30 Commits
feature/an
...
bugfix/jen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39cd2b4274 | ||
|
|
97716be9e5 | ||
|
|
e7c31d0701 | ||
|
|
2702970ffc | ||
|
|
3610ff3f17 | ||
|
|
51a1618bf9 | ||
|
|
2f4822a421 | ||
|
|
57b5004ec8 | ||
|
|
cdacbeeec4 | ||
|
|
1228821c74 | ||
|
|
650570153a | ||
|
|
e5f3bc546b | ||
|
|
99d992ee76 | ||
|
|
273c10f041 | ||
|
|
e0be3b5f9d | ||
|
|
c4cba3ddc6 | ||
|
|
8fb1d04fa8 | ||
|
|
48aa2427b3 | ||
|
|
ed870a0c6b | ||
|
|
28932727d1 | ||
|
|
2ef267a3fb | ||
|
|
05f3e19201 | ||
|
|
5d8d48709e | ||
|
|
fa5460fa44 | ||
|
|
ae9b87113d | ||
|
|
86350ca4e1 | ||
|
|
51edfc3d66 | ||
|
|
c8da404d8b | ||
|
|
18a24797ed | ||
|
|
710e1151f8 |
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM openjdk:8-jre-alpine
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
COPY ./target/java-maven-app-1.0-SNAPSHOT.jar /usr/app/
|
||||
WORKDIR /usr/app
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "java-maven-app-1.0-SNAPSHOT.jar"]
|
||||
40
Jenkinsfile
vendored
40
Jenkinsfile
vendored
@@ -1,40 +0,0 @@
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
ANSIBLE_SERVER = "167.99.136.157"
|
||||
}
|
||||
stages {
|
||||
stage("copy files to ansible server") {
|
||||
steps {
|
||||
script {
|
||||
echo "copying all neccessary files to ansible control node"
|
||||
sshagent(['ansible-server-key']) {
|
||||
sh "scp -o StrictHostKeyChecking=no ansible/* root@${ANSIBLE_SERVER}:/root"
|
||||
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'ec2-server-key', keyFileVariable: 'keyfile', usernameVariable: 'user')]) {
|
||||
sh 'scp $keyfile root@$ANSIBLE_SERVER:/root/ssh-key.pem'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("execute ansible playbook") {
|
||||
steps {
|
||||
script {
|
||||
echo "calling ansible playbook to configure ec2 instances"
|
||||
def remote = [:]
|
||||
remote.name = "ansible-server"
|
||||
remote.host = ANSIBLE_SERVER
|
||||
remote.allowAnyHosts = true
|
||||
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'ansible-server-key', keyFileVariable: 'keyfile', usernameVariable: 'user')]){
|
||||
remote.user = user
|
||||
remote.identityFile = keyfile
|
||||
sshScript remote: remote, script: "prepare-ansible-server.sh"
|
||||
sshCommand remote: remote, command: "ansible-playbook my-playbook.yaml"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
[defaults]
|
||||
host_key_checking = False
|
||||
inventory = inventory_aws_ec2.yaml
|
||||
|
||||
interpreter_python = /usr/bin/python3
|
||||
enable_plugins = aws_ec2
|
||||
|
||||
remote_user = ec2-user
|
||||
private_key_file = ~/ssh-key.pem
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
plugin: aws_ec2
|
||||
regions:
|
||||
- eu-west-3
|
||||
keyed_groups:
|
||||
- key: tags
|
||||
prefix: tag
|
||||
- key: instance_type
|
||||
prefix: instance_type
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
- name: Install python3, docker, docker-compose
|
||||
hosts: all
|
||||
become: yes
|
||||
gather_facts: False
|
||||
tasks:
|
||||
- name: Install python3 and docker
|
||||
vars:
|
||||
ansible_python_interpreter: /usr/bin/python
|
||||
yum:
|
||||
name:
|
||||
- python3
|
||||
- docker
|
||||
update_cache: yes
|
||||
state: present
|
||||
- name: Install Docker-compose
|
||||
get_url:
|
||||
url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-{{lookup('pipe', 'uname -m')}}
|
||||
dest: /usr/local/bin/docker-compose
|
||||
mode: +x
|
||||
- name: Start docker daemon
|
||||
systemd:
|
||||
name: docker
|
||||
state: started
|
||||
- name: Install docker python module
|
||||
pip:
|
||||
name:
|
||||
- docker
|
||||
- docker-compose
|
||||
2
freestyle-build.sh
Normal file
2
freestyle-build.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
# npm --version
|
||||
# docker --version
|
||||
30
pom.xml
30
pom.xml
@@ -6,35 +6,7 @@
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>java-maven-app</artifactId>
|
||||
<version>1.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>
|
||||
|
||||
<!-- to handle any Java version mismatch, add the following configuration for maven-compiler-plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
apt update
|
||||
apt install ansible -y
|
||||
apt install python3-pip -y
|
||||
pip3 install boto3 botocore
|
||||
@@ -1,19 +0,0 @@
|
||||
def buildJar() {
|
||||
echo "building the application..."
|
||||
sh 'mvn package'
|
||||
}
|
||||
|
||||
def buildImage() {
|
||||
echo "building the docker image..."
|
||||
withCredentials([usernamePassword(credentialsId: 'docker-hub-repo', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
|
||||
sh 'docker build -t nanajanashia/demo-app:jma-2.0 .'
|
||||
sh "echo $PASS | docker login -u $USER --password-stdin"
|
||||
sh 'docker push nanajanashia/demo-app:jma-2.0'
|
||||
}
|
||||
}
|
||||
|
||||
def deployApp() {
|
||||
echo 'deploying the application...'
|
||||
}
|
||||
|
||||
return this
|
||||
16
src/test/java/AppTest.java
Normal file
16
src/test/java/AppTest.java
Normal file
@@ -0,0 +1,16 @@
|
||||
import com.example.Application;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
public void testApp() {
|
||||
Application myApp = new Application();
|
||||
|
||||
String result = myApp.getStatus();
|
||||
|
||||
assertEquals("OK", result);
|
||||
}
|
||||
|
||||
}
|
||||
BIN
target/classes/com/example/Application.class
Normal file
BIN
target/classes/com/example/Application.class
Normal file
Binary file not shown.
BIN
target/java-maven-app-1.0-SNAPSHOT.jar
Normal file
BIN
target/java-maven-app-1.0-SNAPSHOT.jar
Normal file
Binary file not shown.
5
target/maven-archiver/pom.properties
Normal file
5
target/maven-archiver/pom.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Thu Oct 29 12:55:55 CET 2020
|
||||
version=1.0-SNAPSHOT
|
||||
groupId=com.example
|
||||
artifactId=java-maven-app
|
||||
@@ -0,0 +1 @@
|
||||
com/example/Application.class
|
||||
@@ -0,0 +1 @@
|
||||
/Users/nanajanashia/Demo-projects/Bootcamp/java-maven-app/src/main/java/com/example/Application.java
|
||||
@@ -0,0 +1 @@
|
||||
AppTest.class
|
||||
4
target/surefire-reports/AppTest.txt
Normal file
4
target/surefire-reports/AppTest.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Test set: AppTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 sec
|
||||
69
target/surefire-reports/TEST-AppTest.xml
Normal file
69
target/surefire-reports/TEST-AppTest.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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>
|
||||
BIN
target/test-classes/AppTest.class
Normal file
BIN
target/test-classes/AppTest.class
Normal file
Binary file not shown.
Reference in New Issue
Block a user