Skip to content
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

Jenkins file #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
__pycache__/
*.py[cod]
*$py.class
migrations/
migrations/
.env
1 change: 1 addition & 0 deletions Sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
KEY=
124 changes: 124 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# docker-compose.deploy.yml
version: '3.8'

volumes:
userdb_vol:
productdb_vol:
orderdb_vol:

networks:
micro_network:
# external:
name: micro_network

services:
user-api:
container_name: cuser-service
build:
context: user-service
ports:
- "5001:5001"
depends_on:
- user-db
# entrypoint: flask db init
networks:
- micro_network
restart: always

user-db:
container_name: cuser_dbase
image: mysql:8
ports:
- "32000:3306"
environment:
MYSQL_ROOT_PASSWORD: pfm_dc_2020
MYSQL_DATABASE: user
MYSQL_USER: cloudacademy
MYSQL_PASSWORD: pfm_2020
networks:
- micro_network
volumes:
- userdb_vol:/var/lib/mysql

product-api:
container_name: cproduct-service
build:
context: product-service
ports:
- "5002:5002"
depends_on:
- product-db
# entrypoint: flask db init
# command: "flask db init && flask db migrate && flask db upgrade"
networks:
- micro_network
restart: always

product-db:
container_name: cproduct_dbase
image: mysql:8
ports:
- "32001:3306"
environment:
MYSQL_ROOT_PASSWORD: pfm_dc_2020
MYSQL_DATABASE: product
MYSQL_USER: cloudacademy
MYSQL_PASSWORD: pfm_2020
networks:
- micro_network
volumes:
- productdb_vol:/var/lib/mysql

order-api:
container_name: corder-service
build:
context: order-service
ports:
- "5003:5003"
# entrypoint: flask db init
# command: "flask db init && flask db migrate && flask db upgrade"
depends_on:
- order-db
networks:
- micro_network
restart: always

order-db:
container_name: corder_dbase
image: mysql:8
ports:
- "32002:3306"
environment:
MYSQL_ROOT_PASSWORD: pfm_dc_2020
MYSQL_DATABASE: order
MYSQL_USER: cloudacademy
MYSQL_PASSWORD: pfm_2020
networks:
- micro_network
volumes:
- orderdb_vol:/var/lib/mysql

frontend-app:
container_name: cfrontend-app
build:
context: frontend
ports:
- "5000:5000"
networks:
- micro_network
restart: always

datadog:
container_name: datadog-agent
image: datadog/agent:latest
links:
- demo-server
environment:
- DD_API_KEY=${KEY}
# - DD_SITE="datadoghq.com"
networks:
- micro_network
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /proc/:/host/proc/:ro
- /sys/fs/cgroup:/host/sys/fs/cgroup:ro
54 changes: 54 additions & 0 deletions frontend/JenkinsFile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
pipeline {
agent any
environment {
//once you sign up for Docker hub, use that user_id here
registry = "ajitha1234/frontend"
//- update your credentials ID after creating credentials for connecting to Docker Hub
registryCredential = 'd425a730-28cb-4552-8505-9ed3beb008d5'
dockerImage = ''
}

stages {
stage('build') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/JenkinsFile']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/vinay-sj/python-flask-microservices.git']]])

}
}

// Building Docker images
stage('Building image') {
steps {
echo "Working"

}
}

// Uploading Docker images into Docker Hub
stage('Upload Image') {
steps {
echo "Working"

}
}

// Stopping Docker containers for cleaner Docker run
stage('docker stop container') {
steps {
echo "Working"

}
}


// Running Docker container, make sure port 8096 is opened in
stage('Docker Run') {
steps {
echo "Working"

}
}

}

}
3 changes: 1 addition & 2 deletions frontend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ version: '3.8'

networks:
micro_network:
external:
name: micro_network
name: micro_network

services:
frontend-app:
Expand Down