Skip to content

Commit

Permalink
Merge branch 'release/0.50.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Jun 10, 2016
2 parents 1e50e51 + 7574828 commit 2917475
Show file tree
Hide file tree
Showing 164 changed files with 508 additions and 429 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ This project adheres to [WebDevOps.io Dockerfile](https://github.com/webdevops/D

## [1.0.0] - upcoming

## [0.50.5] - 2016-06-10
### Added
- Added Magallanes deployer for samson-deployment
### Changed
- Improved documentation

## [0.50.4] - 2016-06-06
### Removed
- Removed superfluous environment variables for PHP inside nginx
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ rebuild:
push:
BUILD_MODE=push make all

graph:
python ./bin/diagram.py --dockerfile docker/ --filename documentation/docs/resources/images/docker-image-layout.gv

documentation:
docker run -t -i --rm -p 8080:8000 -v "$$(pwd)/documentation/docs/:/opt/docs" webdevops/sphinx sphinx-autobuild --poll -H 0.0.0.0 /opt/docs html

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Dockerfiles for various prebuilt docker containers

[![Docker layout](documentation/webdevops.gv.png)](documentation/webdevops.gv.png)
[![Docker layout](documentation/docs/resources/images/docker-image-layout.gv.png)](documentation/docs/resources/images/docker-image-layout.gv.png)

Dockerfile | Description | Depends on |
--------------------------------------------------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
Expand Down
212 changes: 106 additions & 106 deletions bin/diagram.py
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
#!/usr/bin/env/python

from datetime import datetime
import os
import argparse
import re
from graphviz import Digraph
import yaml

PATH = os.path.dirname(os.path.abspath(__file__))
FROM_REGEX = re.compile(ur'FROM\s+(?P<image>[^\s:]+)(:(?P<tag>.+))?', re.MULTILINE)
CONTAINERS = {}
SUBGRAPH = {}
EDGES = {}

def get_current_date():
import datetime
return datetime.date.today().strftime("%d.%m.%Y")

def processDockerfile(inputFile):
outputFile = os.path.splitext(inputFile)
outputFile = os.path.join(os.path.dirname(outputFile[0]),os.path.basename(outputFile[0]))

dockerImage = os.path.basename(os.path.dirname(os.path.dirname(outputFile)))
dockerTag = os.path.basename(os.path.dirname(outputFile))

with open(inputFile, 'r') as fileInput:
DockerfileContent = fileInput.read()
data = ([m.groupdict() for m in FROM_REGEX.finditer(DockerfileContent)])[0]
CONTAINERS["webdevops/%s"%dockerImage] = data.get('image')

def apply_styles(graph, styles):
graph.graph_attr.update(
('graph' in styles and styles['graph']) or {}
)
graph.node_attr.update(
('nodes' in styles and styles['nodes']) or {}
)
graph.edge_attr.update(
('edges' in styles and styles['edges']) or {}
)
return graph

def get_graph(conf,default_graph,name):

for group, group_attr in conf['diagram']['groups'].items():
if name in group_attr['docker']:
return SUBGRAPH[group]
return default_graph

def build_graph(args):
stream = open(os.path.dirname(__file__)+"/diagram.yml", "r")
conf_diagram = yaml.safe_load(stream)
dia = Digraph('webdevops', filename=args.filename, format=args.format, directory=args.path)
dia = apply_styles(dia,conf_diagram['diagram']['styles'])
dia.body.append(r'label = "\n\nWebdevops Containers\n at :%s"' % get_current_date() )

# Create subgraph
for group, group_attr in conf_diagram['diagram']['groups'].items():
SUBGRAPH[group] = Digraph("cluster_"+group);
SUBGRAPH[group].body.append(r'label = "%s"' % group_attr['name'] )
SUBGRAPH[group] = apply_styles(SUBGRAPH[group],group_attr['styles'] )
for image, base in CONTAINERS.items():
graph_image = get_graph(conf_diagram, dia, image)
graph_base = get_graph(conf_diagram, dia, base)
if "webdevops" in base:
if graph_image == graph_base:
graph_image.edge(base, image)
else:
graph_image.node(image)
EDGES[image] = base
else:
graph_image.node(image)


for name, subgraph in SUBGRAPH.items():
dia.subgraph(subgraph)

for image, base in EDGES.items():
dia.edge(base, image)
return dia

def main(args):
dockerfilePath = os.path.abspath(args.dockerfile)

# Parse Docker file
for root, dirs, files in os.walk(dockerfilePath):

for file in files:
if file.endswith("Dockerfile"):
processDockerfile(os.path.join(root, file))

dia = build_graph(args)
dia.render()


if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-d','--dockerfile' ,help='path to the folder containing dockerfile analyze',type=str)
parser.add_argument('-f','--filename' ,help='file output (default: webdevops.gv)',default='webdevops.gv',type=str)
parser.add_argument('-F','--format' ,help='output format (default: png)',default='png',choices=('png','jpg','pdf','svg'))
parser.add_argument('-p','--path' ,help='path output',default=os.path.dirname(__file__)+"/../",type=str)

args = parser.parse_args()

main(args)
#!/usr/bin/env/python

from datetime import datetime
import os
import argparse
import re
from graphviz import Digraph
import yaml

PATH = os.path.dirname(os.path.abspath(__file__))
FROM_REGEX = re.compile(ur'FROM\s+(?P<image>[^\s:]+)(:(?P<tag>.+))?', re.MULTILINE)
CONTAINERS = {}
SUBGRAPH = {}
EDGES = {}

def get_current_date():
import datetime
return datetime.date.today().strftime("%d.%m.%Y")

def processDockerfile(inputFile):
outputFile = os.path.splitext(inputFile)
outputFile = os.path.join(os.path.dirname(outputFile[0]),os.path.basename(outputFile[0]))

dockerImage = os.path.basename(os.path.dirname(os.path.dirname(outputFile)))
dockerTag = os.path.basename(os.path.dirname(outputFile))

with open(inputFile, 'r') as fileInput:
DockerfileContent = fileInput.read()
data = ([m.groupdict() for m in FROM_REGEX.finditer(DockerfileContent)])[0]
CONTAINERS["webdevops/%s"%dockerImage] = data.get('image')

def apply_styles(graph, styles):
graph.graph_attr.update(
('graph' in styles and styles['graph']) or {}
)
graph.node_attr.update(
('nodes' in styles and styles['nodes']) or {}
)
graph.edge_attr.update(
('edges' in styles and styles['edges']) or {}
)
return graph

def get_graph(conf,default_graph,name):

for group, group_attr in conf['diagram']['groups'].items():
if name in group_attr['docker']:
return SUBGRAPH[group]
return default_graph

def build_graph(args):
stream = open(os.path.dirname(__file__)+"/diagram.yml", "r")
conf_diagram = yaml.safe_load(stream)
dia = Digraph('webdevops', filename=args.filename, format=args.format, directory=args.path)
dia = apply_styles(dia,conf_diagram['diagram']['styles'])
dia.body.append(r'label = "\n\nWebdevops Images\n at :%s"' % get_current_date() )

# Create subgraph
for group, group_attr in conf_diagram['diagram']['groups'].items():
SUBGRAPH[group] = Digraph("cluster_"+group);
SUBGRAPH[group].body.append(r'label = "%s"' % group_attr['name'] )
SUBGRAPH[group] = apply_styles(SUBGRAPH[group],group_attr['styles'] )
for image, base in CONTAINERS.items():
graph_image = get_graph(conf_diagram, dia, image)
graph_base = get_graph(conf_diagram, dia, base)
if "webdevops" in base:
if graph_image == graph_base:
graph_image.edge(base, image)
else:
graph_image.node(image)
EDGES[image] = base
else:
graph_image.node(image)


for name, subgraph in SUBGRAPH.items():
dia.subgraph(subgraph)

for image, base in EDGES.items():
dia.edge(base, image)
return dia

def main(args):
dockerfilePath = os.path.abspath(args.dockerfile)

# Parse Docker file
for root, dirs, files in os.walk(dockerfilePath):

for file in files:
if file.endswith("Dockerfile"):
processDockerfile(os.path.join(root, file))

dia = build_graph(args)
dia.render()


if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-d','--dockerfile' ,help='path to the folder containing dockerfile analyze',type=str)
parser.add_argument('-f','--filename' ,help='file output (default: webdevops.gv)',default='webdevops.gv',type=str)
parser.add_argument('-F','--format' ,help='output format (default: png)',default='png',choices=('png','jpg','pdf','svg'))
parser.add_argument('-p','--path' ,help='path output',default=os.path.dirname(__file__)+"/../",type=str)

args = parser.parse_args()

main(args)
Loading

0 comments on commit 2917475

Please sign in to comment.