diff --git a/compose_viz/__init__.py b/compose_viz/__init__.py index bce9bc5..467be58 100644 --- a/compose_viz/__init__.py +++ b/compose_viz/__init__.py @@ -1,2 +1,2 @@ __app_name__ = "compose_viz" -__version__ = "0.1.0" +__version__ = "0.1.1" diff --git a/compose_viz/graph.py b/compose_viz/graph.py index 15516ca..57e34f5 100644 --- a/compose_viz/graph.py +++ b/compose_viz/graph.py @@ -85,7 +85,11 @@ class Graph: self.add_vertex(port.host_port, "port", lable=port.host_port) self.add_edge(port.host_port, service.name, "ports", lable=port.container_port) for link in service.links: - self.add_edge(link.split(":")[0], service.name, "links", link.split(":")[1]) + if ":" in link: + service_name, alias = link.split(":", 1) + self.add_edge(service_name, service.name, "links", alias) + else: + self.add_edge(link, service.name, "links") for depends_on in service.depends_on: self.add_edge(service.name, depends_on, "depends_on") diff --git a/examples/full-stack-node-app/postgres.yml b/examples/full-stack-node-app/common-services.yml similarity index 67% rename from examples/full-stack-node-app/postgres.yml rename to examples/full-stack-node-app/common-services.yml index cb6c45e..2031249 100644 --- a/examples/full-stack-node-app/postgres.yml +++ b/examples/full-stack-node-app/common-services.yml @@ -3,3 +3,5 @@ version: "3.9" services: postgres: image: awesome/postgres + node: + image: awesome/node diff --git a/examples/full-stack-node-app/compose-viz.png b/examples/full-stack-node-app/compose-viz.png index 1b0976b..2ccd6ce 100644 Binary files a/examples/full-stack-node-app/compose-viz.png and b/examples/full-stack-node-app/compose-viz.png differ diff --git a/examples/full-stack-node-app/docker-compose.yml b/examples/full-stack-node-app/docker-compose.yml index b21887f..86915e2 100644 --- a/examples/full-stack-node-app/docker-compose.yml +++ b/examples/full-stack-node-app/docker-compose.yml @@ -1,15 +1,11 @@ version: "3.9" services: - node: - build: - context: . - dockerfile: Dockerfile.node - api: image: "awesome/api" extends: service: node + file: common-services.yml build: args: PACKAGE_PATH: api @@ -30,10 +26,10 @@ services: - front-tier - back-tier command: ["npm", "start"] - frontend: extends: service: node + file: common-services.yml build: args: PACKAGE_PATH: frontend @@ -49,12 +45,11 @@ services: networks: - front-tier command: ["npm", "start"] - db: image: "awesome/db" extends: service: postgres - file: postgres.yml + file: common-services.yml restart: always networks: - back-tier @@ -63,7 +58,6 @@ services: - type: bind source: /var/run/postgres/postgres.sock target: /var/run/postgres/postgres.sock - redis: image: "awesome/redis" restart: always @@ -71,13 +65,20 @@ services: - back-tier expose: - 6379 - adminer: image: "awesome/adminer" - networks: - - back-tier + links: + - db ports: - 8080:8080 + proxy: + image: "awesome/proxy" + build: + context: . + dockerfile: Dockerfile.proxy + networks: + - front-tier + volumes: db-data: diff --git a/pyproject.toml b/pyproject.toml index 5a686d1..43a2b36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "compose-viz" -version = "0.1.0" +version = "0.1.1" description = "A compose file visualization tool that supports compose-spec and allows you to gernerate graph in DOT format or PNG." authors = ["Xyphuz Wu "] readme = "README.md"