forked from ravdy/DevOps
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit with maven, artifcatory and jenkins
- Loading branch information
Showing
10 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Setup Jfrog Artifactory | ||
|
||
## Pre-requisites: | ||
1. Setup an AWS T2.Small EC2 instance | ||
|
||
## Installation Steps | ||
|
||
1. Install Java | ||
```sh | ||
yum install java-1.8* -y | ||
``` | ||
1. Download Artifaction packages from | ||
|
||
```sh | ||
wget https://bintray.com/jfrog/artifactory-pro/download_file?file_path=org%2Fartifactory%2Fpro%2Fjfrog-artifactory-pro%2F6.19.1%2Fjfrog-artifactory-pro-6.19.1.zip | ||
``` | ||
|
||
1. extract artifactory zip file | ||
```sh | ||
unzip download_file?file_path=org%2Fartifactory%2Fpro%2Fjfrog-artifactory-pro%2F6.19.1%2Fjfrog-artifactory-pro-6.19.1.zip | ||
``` | ||
1. start artifactory services | ||
```sh | ||
cd artifactory-pro-6.19.1/bin | ||
./artifactory.sh start | ||
``` | ||
1. access artifactory from browser | ||
```sh | ||
http://<IP_Address>:8081 | ||
``` | ||
|
||
1. Provide credentials | ||
```sh | ||
username: admin | ||
password: passwrod | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
job('job_dsl_example') { | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
job('job_dsl_example') { | ||
|
||
description('This is my awesome Job') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
job('job_dsl_example') { | ||
|
||
description('This is my awesome Job') | ||
|
||
|
||
parameters { | ||
stringParam('Planet', defaultValue = 'world', description = 'This is the world') | ||
booleanParam('FLAG', true) | ||
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3']) | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
job('job_dsl_example') { | ||
|
||
description('This is my awesome Job') | ||
|
||
|
||
parameters { | ||
stringParam('Planet', defaultValue = 'world', description = 'This is the world') | ||
booleanParam('FLAG', true) | ||
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3']) | ||
} | ||
|
||
|
||
scm { | ||
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master') | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
job('job_dsl_example') { | ||
|
||
description('This is my awesome Job') | ||
|
||
|
||
parameters { | ||
stringParam('Planet', defaultValue = 'world', description = 'This is the world') | ||
booleanParam('FLAG', true) | ||
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3']) | ||
} | ||
|
||
scm { | ||
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master') | ||
} | ||
|
||
triggers { | ||
cron('H 5 * * 7') | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
job('job_dsl_example') { | ||
|
||
description('This is my awesome Job') | ||
|
||
|
||
parameters { | ||
stringParam('Planet', defaultValue = 'world', description = 'This is the world') | ||
booleanParam('FLAG', true) | ||
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3']) | ||
} | ||
|
||
scm { | ||
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master') | ||
} | ||
|
||
triggers { | ||
cron('H 5 * * 7') | ||
} | ||
|
||
steps { | ||
shell("echo 'Hello World'") | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
job('job_dsl_example') { | ||
|
||
description('This is my awesome Job') | ||
|
||
|
||
parameters { | ||
stringParam('Planet', defaultValue = 'world', description = 'This is the world') | ||
booleanParam('FLAG', true) | ||
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3']) | ||
} | ||
|
||
scm { | ||
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master') | ||
} | ||
|
||
triggers { | ||
cron('H 5 * * 7') | ||
} | ||
|
||
steps { | ||
shell("echo 'Hello World'") | ||
shell("echo 'Hello World2'") | ||
} | ||
|
||
publishers { | ||
mailer('[email protected]', true, true) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
job('maven_dsl') { | ||
|
||
description('Maven dsl project') | ||
|
||
scm { | ||
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master', {node -> node / 'extensions' << '' }) | ||
} | ||
|
||
steps { | ||
maven { | ||
mavenInstallation('maven') | ||
goals('-B -DskipTests clean package') | ||
} | ||
maven { | ||
mavenInstallation('maven') | ||
goals('test') | ||
} | ||
shell(''' | ||
echo ************RUNNING THE JAR************************ | ||
java -jar /var/lib/jenkins/workspace/maven_dsl/target/my-app-1.0-SNAPSHOT.jar | ||
''') | ||
} | ||
|
||
publishers { | ||
archiveArtifacts('target/*.jar') | ||
archiveJunit('target/surefire-reports/*.xml') | ||
mailer('[email protected]', true, true) | ||
} | ||
} | ||
|
50 changes: 50 additions & 0 deletions
50
maven/How_to_deploy_warfile_on_tomcat_server_using_maven.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# How to deploy on tomcat server using maven | ||
Pre-requisites | ||
1. Maven Server [Get help here] | ||
2. Tomcat Server [Get help here] | ||
|
||
Procedure | ||
|
||
1. download archetype maven-archetype-webapp | ||
```sh | ||
mvn archetype:generate -DgroupId=com.valaxy.webapp -DartifactId=helloworld-project -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false | ||
``` | ||
|
||
1. Update pom.xml code to add maven plugin to copy artifacts onto tomcat | ||
this should be under <build> | ||
```sh | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.tomcat.maven</groupId> | ||
<artifactId>tomcat8-maven-plugin</artifactId> | ||
<version>2.2</version> | ||
<configuration> | ||
<url>http://localhost:8080/manager/text</url> | ||
<server>TomcatServer</server> | ||
<path>/helloworld-webapp</path> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
``` | ||
|
||
1. create settings.xml for credentials | ||
```sh | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<settings ...> | ||
<servers> | ||
|
||
<server> | ||
<id>TomcatServer</id> | ||
<username>admin</username> | ||
<password>password</password> | ||
</server> | ||
|
||
</servers> | ||
</settings> | ||
``` | ||
|
||
|
||
1. Build and the project on tomcat | ||
```sh | ||
mvn tomcat7:deploy | ||
``` |