Skip to content

Development #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ada495f
testing
augustkyei Mar 25, 2023
b3d20e0
jenkinsfile added
augustkyei Mar 25, 2023
1012e6b
docker changes
augustkyei Apr 15, 2023
a3a702b
permission issue fixed
augustkyei Apr 15, 2023
cc8fd3b
testing
augustkyei Apr 15, 2023
3f9f7a1
push
augustkyei Apr 15, 2023
30218e0
testing
augustkyei Apr 15, 2023
8d30b38
testing
augustkyei Apr 16, 2023
a6f3944
clean up stage added
augustkyei Apr 16, 2023
7a77626
credentials added
augustkyei Apr 16, 2023
31c55d4
new file
augustkyei Apr 16, 2023
4ce4278
git stage added
augustkyei Apr 16, 2023
0ba3c14
stages added
augustkyei Apr 16, 2023
b8be6bc
docker added
augustkyei Apr 16, 2023
56ef7ed
build number added
augustkyei Apr 16, 2023
bb81539
tag added
augustkyei Apr 16, 2023
b8c9993
Update Dockerfile
awsdevopsclass2022 Apr 19, 2023
33e9d4d
Update Dockerfile
awsdevopsclass2022 Apr 20, 2023
729aa69
Update README.md
awsdevopsclass2022 May 12, 2023
7c227e6
Update file.txt
awsdevopsclass2022 May 12, 2023
8fa438e
Update file.txt
awsdevopsclass2022 May 12, 2023
a2b1853
Create java-app-target.yaml
awsdevopsclass2022 May 14, 2023
f4c8f50
Update java-app-target.yaml
awsdevopsclass2022 May 14, 2023
6904d4c
Update java-app-target.yaml
awsdevopsclass2022 May 14, 2023
d4045e2
Update java-app-target.yaml
awsdevopsclass2022 May 14, 2023
bd4bae9
Update file.txt
awsdevopsclass2022 May 14, 2023
38a2331
Update java-app-target.yaml
awsdevopsclass2022 May 17, 2023
5b265d3
Update java-app-target.yaml
awsdevopsclass2022 May 17, 2023
9e256b0
Update java-app-target.yaml
awsdevopsclass2022 May 17, 2023
68531d8
Update java-app-target.yaml
awsdevopsclass2022 May 17, 2023
92c6b91
test
augustkyei May 20, 2023
fcdc79a
test
augustkyei May 20, 2023
d7b063e
baby baby added
augustkyei May 20, 2023
f891484
test
augustkyei May 20, 2023
8fae8bb
test
augustkyei May 20, 2023
f3dcf92
test
augustkyei May 20, 2023
ad5e5cd
test
augustkyei May 20, 2023
99da759
test
augustkyei May 20, 2023
285ce9f
test
augustkyei May 20, 2023
7e1d34e
Update jenkinsfile-ansible
awsdevopsclass2022 May 20, 2023
ab15026
Update jenkinsfile-ansible
awsdevopsclass2022 May 20, 2023
2aec811
test
augustkyei May 20, 2023
de1686a
test
augustkyei May 20, 2023
9ae4d63
Update README.md
awsdevopsclass2022 May 20, 2023
2d32a1d
test
augustkyei May 21, 2023
a867498
dev
augustkyei May 21, 2023
2242666
test
augustkyei May 21, 2023
8eed474
test
augustkyei May 21, 2023
c5551ef
Merge pull request #1 from awsdevopsclass2022/master
awsdevopsclass2022 May 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tomcat
ADD target/addressbook.war /usr/local/tomcat/webapps
FROM tomcat:8.5
ADD target/addressbook.war /usr/local/tomcat/webapps/addressbook.war
EXPOSE 8080
CMD /usr/local/tomcat/bin/catalina.sh run
CMD ["catalina.sh", "run"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Addressbook Tutorial V2.9


hello

This tutorial teaches you some of the basic concepts in [Vaadin Framework](https://vaadin.com). It is meant to be
a fast read for learning how to get started - not an example on how application should be
Expand Down Expand Up @@ -34,6 +34,7 @@ To get the project up and running in IDEA, do:

You should now have a Jetty server running on localhost:8080. Navigate to http://localhost:8080 to play with the application


Importing in NetBeans 8
--------------------
These instructions were tested on NetBeans 8.0.2. You can get it from https://www.netbeans.org
Expand Down
22 changes: 22 additions & 0 deletions ansible-deploy-playbook-QA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
- name: Check and deploy Docker container
hosts: QA
become: true

tasks:
- name: Check if container is running
command: docker ps -q --filter "name=addressbook"
register: container_check
failed_when: false
changed_when: false

- name: Stop and remove container if running
command: docker rm -f addressbook
when: container_check.stdout != ""

- name: Remove image if exists
command: docker pull devopsclass2022/address-app
ignore_errors: true

- name: Deploy new container
command: docker run -itd -p 7000:8080 --name addressbook devopsclass2022/address-app
22 changes: 22 additions & 0 deletions ansible-deploy-playbook-Staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
- name: Check and deploy Docker container
hosts: staging
become: true

tasks:
- name: Check if container is running
command: docker ps -q --filter "name=addressbook"
register: container_check
failed_when: false
changed_when: false

- name: Stop and remove container if running
command: docker rm -f addressbook
when: container_check.stdout != ""

- name: Remove image if exists
command: docker pull devopsclass2022/address-app
ignore_errors: true

- name: Deploy new container
command: docker run -itd -p 7000:8080 --name addressbook devopsclass2022/address-app
22 changes: 22 additions & 0 deletions ansible-docker-deploy-playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
- name: Check and deploy Docker container
hosts: QA
become: true

tasks:
- name: Check if container is running
command: docker ps -q --filter "name=addressbook"
register: container_check
failed_when: false
changed_when: false

- name: Stop and remove container if running
command: docker rm -f addressbook
when: container_check.stdout != ""

- name: Remove image if exists
command: docker pull devopsclass2022/address-app
ignore_errors: true

- name: Deploy new container
command: docker run -itd -p 7000:8080 --name addressbook devopsclass2022/address-app
Empty file added ansible-inv
Empty file.
17 changes: 17 additions & 0 deletions java-app-target.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- hosts: all
# become: yes
tasks:
#### copy a file
- name: copy file
copy:
src: /var/lib/jenkins/workspace/ansible-jenkins-int/target/addressbook.war
dest: /tmp
- name: Run Docker container
become: true
docker_container:
name: my_container
image: my_image:latest
state: started
ports:
- "9000:80"
66 changes: 66 additions & 0 deletions jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
pipeline {
agent any

environment {

DOCKERHUB_CREDENTIALS= credentials('docker-hub-credentials')

}

stages {
stage('compile') {
steps {
echo 'Compiling Stage'
git 'https://github.com/awsdevopsclass2022/DevOpsClassCodes-aug.git'
sh 'mvn compile'
}
}
stage('test') {
steps {
echo 'Testing Stage'
sh 'mvn test'
}
}
stage('package') {
steps {
echo 'Package Stage'
sh 'mvn package'
}
}
stage('Docker Build') {
steps {
echo 'Docker docker build stage'
sh 'docker build -t devopsclass2022/address-app:${JOB_NAME}-${BUILD_NUMBER} .'
//sh 'docker login -u devopsclass2022 -p Done24Money@'
// sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'

}
}


stage('Docker Login') {
steps {

//sh 'docker login -u devopsclass2022 -p Done24Money@'
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'

}
}



stage('Push Image to Dockerhub') {
steps {
echo 'Docker Registry'
sh 'docker push devopsclass2022/address-app:${JOB_NAME}-${BUILD_NUMBER}'
}
}

stage('Clean Up Docker Image') {
steps {
sh 'docker rmi devopsclass2022/address-app:${JOB_NAME}-${BUILD_NUMBER}'
}
}
}

}
50 changes: 50 additions & 0 deletions jenkinsfile-16th-april
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
pipeline {
agent any

stages {
stage('checkout') {
steps {
echo 'I am doing a git clone'
git 'https://github.com/awsdevopsclass2022/DevOpsClassCodes-aug.git'
}
}

stage('compile') {
steps {
sh 'mvn compile'
}
}

stage('test') {
steps {
sh 'mvn test'
}
}

stage('package') {
steps {
sh 'mvn package'
}
}

stage('docker build') {
steps {
sh 'docker build -t devopsclass2022/address-book:${JOB_NAME}-${BUILD_NUMBER} .'
}
}

stage('docker login') {
steps {
sh 'docker login -u devopsclass2022 -p Done24Money@ '
}
}

stage('docker push') {
steps {
sh 'docker push devopsclass2022/address-book:${JOB_NAME}-${BUILD_NUMBER} '
}
}


}
}
90 changes: 90 additions & 0 deletions jenkinsfile-ansible
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
pipeline {
agent any

// environment {

// //DOCKERHUB_CREDENTIALS= credentials('docker-hub-credentials')

// }

stages {
stage('compile') {
steps {
echo 'Compiling Stage'
git url: 'https://github.com/awsdevopsclass2022/DevOpsClassCodes-aug.git'
sh 'mvn compile'
}
}
stage('test') {
steps {
echo 'Testing Stage'
sh 'mvn test'
}
}
stage('package') {
steps {
echo 'Package Stage'
sh 'mvn package'
}
}
stage('Docker Build') {
steps {
echo 'Docker docker build stage'
sh 'docker build -t devopsclass2022/address-app .'
//sh 'docker login -u devopsclass2022 -p Done24Money@'
// sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'

}
}


stage('Docker Login') {
steps {

sh 'docker login -u devopsclass2022 -p Done24Money@'
// sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'

}
}


stage('Push Image to Dockerhub') {
steps {
echo 'Docker Registry'
sh 'docker push devopsclass2022/address-app'
}
}

stage('Clean Up Docker Image') {
steps {
sh 'docker rmi devopsclass2022/address-app'
}
}

stage('Deployment to QA (Ansible)') {

// when {
// expression { env.BRANCH_NAME == 'orig/development' }
// }
steps {
//sh 'ansible-playbook ansible-docker-deploy-playbook.yaml'
sh "echo 'today@1234' | su -c 'ansible-playbook ansible-deploy-playbook-QA.yaml' devops"
}
}

stage('Deployment to Staging') {

// when {
// expression { env.BRANCH_NAME == 'master' }
// }

steps {
//sh 'ansible-playbook ansible-docker-deploy-playbook.yaml'
sh "echo 'today@1234' | su -c 'ansible-playbook ansible-deploy-playbook-Staging.yaml' devops"
}
}


}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class AddressbookUI extends UI {
TextField filter = new TextField();
Grid contactList = new Grid();
Button newContact = new Button("New contact");
// Button finalContact = new Button("New contact")

// ContactForm is an example of a custom component class
ContactForm contactForm = new ContactForm();
Expand Down Expand Up @@ -76,10 +77,10 @@ private void configureComponents() {

contactList
.setContainerDataSource(new BeanItemContainer<>(Contact.class));
contactList.setColumnOrder("firstName", "lastName", "email");
contactList.removeColumn("id");
contactList.setColumnOrder("firstName", "lastName", "email", "phone");
contactList.removeColumn("id");
contactList.removeColumn("birthDate");
contactList.removeColumn("phone");
// contactList.removeColumn("phone");
contactList.setSelectionMode(Grid.SelectionMode.SINGLE);
contactList.addSelectionListener(
e -> contactForm.edit((Contact) contactList.getSelectedRow()));
Expand All @@ -100,6 +101,7 @@ private void configureComponents() {
private void buildLayout() {
HorizontalLayout actions = new HorizontalLayout(filter, newContact);
actions.setWidth("100%");

filter.setWidth("100%");
actions.setExpandRatio(filter, 1);

Expand Down