Merge pull request #14 from compose-viz/dev-test
refactor: test structure
This commit is contained in:
commit
63caac3ce4
85 changed files with 289 additions and 3703 deletions
76
.github/workflows/ci.yml
vendored
76
.github/workflows/ci.yml
vendored
|
@ -20,77 +20,21 @@ jobs:
|
|||
sudo apt-get update
|
||||
sudo apt-get install -y graphviz
|
||||
|
||||
- name: Validate Test Files
|
||||
run: |
|
||||
docker compose -f tests/ymls/builds/docker-compose.yml config -q
|
||||
docker compose -f tests/ymls/depends_on/docker-compose.yml config -q
|
||||
docker compose -f tests/ymls/extends/docker-compose.yml config -q
|
||||
docker compose -f tests/ymls/links/docker-compose.yml config -q
|
||||
docker compose -f tests/ymls/networks/docker-compose.yml config -q
|
||||
docker compose -f tests/ymls/ports/docker-compose.yml config -q
|
||||
docker compose -f tests/ymls/volumes/docker-compose.yml config -q
|
||||
|
||||
- name: Setup Python 3.10.4
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10.4'
|
||||
|
||||
- name: Validate Test Files
|
||||
run: |
|
||||
docker-compose -f tests/in/000001.yaml config -q
|
||||
docker-compose -f tests/in/000010.yaml config -q
|
||||
docker-compose -f tests/in/000011.yaml config -q
|
||||
docker-compose -f tests/in/000100.yaml config -q
|
||||
docker-compose -f tests/in/000101.yaml config -q
|
||||
docker-compose -f tests/in/000110.yaml config -q
|
||||
docker-compose -f tests/in/000111.yaml config -q
|
||||
docker-compose -f tests/in/001000.yaml config -q
|
||||
docker-compose -f tests/in/001001.yaml config -q
|
||||
docker-compose -f tests/in/001010.yaml config -q
|
||||
docker-compose -f tests/in/001011.yaml config -q
|
||||
docker-compose -f tests/in/001100.yaml config -q
|
||||
docker-compose -f tests/in/001101.yaml config -q
|
||||
docker-compose -f tests/in/001110.yaml config -q
|
||||
docker-compose -f tests/in/001111.yaml config -q
|
||||
docker-compose -f tests/in/010000.yaml config -q
|
||||
docker-compose -f tests/in/010001.yaml config -q
|
||||
docker-compose -f tests/in/010010.yaml config -q
|
||||
docker-compose -f tests/in/010011.yaml config -q
|
||||
docker-compose -f tests/in/010100.yaml config -q
|
||||
docker-compose -f tests/in/010101.yaml config -q
|
||||
docker-compose -f tests/in/010110.yaml config -q
|
||||
docker-compose -f tests/in/010111.yaml config -q
|
||||
docker-compose -f tests/in/011000.yaml config -q
|
||||
docker-compose -f tests/in/011001.yaml config -q
|
||||
docker-compose -f tests/in/011010.yaml config -q
|
||||
docker-compose -f tests/in/011011.yaml config -q
|
||||
docker-compose -f tests/in/011100.yaml config -q
|
||||
docker-compose -f tests/in/011101.yaml config -q
|
||||
docker-compose -f tests/in/011110.yaml config -q
|
||||
docker-compose -f tests/in/011111.yaml config -q
|
||||
docker-compose -f tests/in/100000.yaml config -q
|
||||
docker-compose -f tests/in/100001.yaml config -q
|
||||
docker-compose -f tests/in/100010.yaml config -q
|
||||
docker-compose -f tests/in/100011.yaml config -q
|
||||
docker-compose -f tests/in/100100.yaml config -q
|
||||
docker-compose -f tests/in/100101.yaml config -q
|
||||
docker-compose -f tests/in/100110.yaml config -q
|
||||
docker-compose -f tests/in/100111.yaml config -q
|
||||
docker-compose -f tests/in/101000.yaml config -q
|
||||
docker-compose -f tests/in/101001.yaml config -q
|
||||
docker-compose -f tests/in/101010.yaml config -q
|
||||
docker-compose -f tests/in/101011.yaml config -q
|
||||
docker-compose -f tests/in/101100.yaml config -q
|
||||
docker-compose -f tests/in/101101.yaml config -q
|
||||
docker-compose -f tests/in/101110.yaml config -q
|
||||
docker-compose -f tests/in/101111.yaml config -q
|
||||
docker-compose -f tests/in/110000.yaml config -q
|
||||
docker-compose -f tests/in/110001.yaml config -q
|
||||
docker-compose -f tests/in/110010.yaml config -q
|
||||
docker-compose -f tests/in/110011.yaml config -q
|
||||
docker-compose -f tests/in/110100.yaml config -q
|
||||
docker-compose -f tests/in/110101.yaml config -q
|
||||
docker-compose -f tests/in/110110.yaml config -q
|
||||
docker-compose -f tests/in/110111.yaml config -q
|
||||
docker-compose -f tests/in/111000.yaml config -q
|
||||
docker-compose -f tests/in/111001.yaml config -q
|
||||
docker-compose -f tests/in/111010.yaml config -q
|
||||
docker-compose -f tests/in/111011.yaml config -q
|
||||
docker-compose -f tests/in/111100.yaml config -q
|
||||
docker-compose -f tests/in/111101.yaml config -q
|
||||
docker-compose -f tests/in/111110.yaml config -q
|
||||
docker-compose -f tests/in/111111.yaml config -q
|
||||
|
||||
- name: Setup Poetry
|
||||
uses: Gr1N/setup-poetry@v7
|
||||
with:
|
||||
|
|
|
@ -2,7 +2,7 @@ exclude: |
|
|||
(?x)^(
|
||||
README.md|
|
||||
LICENSE|
|
||||
tests/in/invalid.yaml
|
||||
tests/ymls/
|
||||
)
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
|
|
|
@ -6,7 +6,7 @@ from ruamel.yaml import YAML
|
|||
from compose_viz.compose import Compose, Service
|
||||
from compose_viz.extends import Extends
|
||||
from compose_viz.port import Port, Protocol
|
||||
from compose_viz.volume import AccessMode, Volume, VolumeType
|
||||
from compose_viz.volume import Volume, VolumeType
|
||||
|
||||
|
||||
class Parser:
|
||||
|
@ -40,10 +40,14 @@ class Parser:
|
|||
for service, service_name in zip(services_yaml_data.values(), services_yaml_data.keys()):
|
||||
|
||||
service_image: Optional[str] = None
|
||||
if service.get("image"):
|
||||
service_image = service["image"]
|
||||
elif service.get("build"):
|
||||
if service.get("build"):
|
||||
if type(service["build"]) is str:
|
||||
service_image = "build from " + service["build"]
|
||||
elif type(service["build"]) is dict:
|
||||
assert service["build"].get("context"), "Missing build context, aborting."
|
||||
service_image = "build from " + str(service["build"]["context"])
|
||||
elif service.get("image"):
|
||||
service_image = service["image"]
|
||||
|
||||
service_networks: List[str] = []
|
||||
if service.get("networks"):
|
||||
|
@ -54,8 +58,16 @@ class Parser:
|
|||
|
||||
service_extends: Optional[Extends] = None
|
||||
if service.get("extends"):
|
||||
if service["extends"].get("service"):
|
||||
service_extends = Extends(service_name=service["extends"]["service"])
|
||||
assert type(service["extends"]) is dict, "Invalid extends format, aborting."
|
||||
assert service["extends"]["service"], "Missing extends service, aborting."
|
||||
extend_service_name = str(service["extends"]["service"])
|
||||
|
||||
extend_from_file: Optional[str] = None
|
||||
if service["extends"].get("file"):
|
||||
assert service["extends"]["file"], "Missing extends file, aborting."
|
||||
extend_from_file = str(service["extends"]["file"])
|
||||
|
||||
service_extends = Extends(service_name=extend_service_name, from_file=extend_from_file)
|
||||
|
||||
service_ports: List[Port] = []
|
||||
if service.get("ports"):
|
||||
|
@ -69,7 +81,7 @@ class Parser:
|
|||
|
||||
container_port: str = str(port_data["target"])
|
||||
host_port: str = ""
|
||||
protocol: Protocol = Protocol.tcp
|
||||
protocol: Protocol = Protocol.any
|
||||
|
||||
if port_data.get("published"):
|
||||
host_port = str(port_data["published"])
|
||||
|
@ -79,6 +91,8 @@ class Parser:
|
|||
if port_data.get("host_ip"):
|
||||
host_ip = str(port_data["host_ip"])
|
||||
host_port = f"{host_ip}:{host_port}"
|
||||
else:
|
||||
host_port = f"0.0.0.0:{host_port}"
|
||||
|
||||
if port_data.get("protocol"):
|
||||
protocol = Protocol[str(port_data["protocol"])]
|
||||
|
@ -122,6 +136,8 @@ class Parser:
|
|||
|
||||
if host_ip:
|
||||
host_port = f"{host_ip}{host_port}"
|
||||
else:
|
||||
host_port = f"0.0.0.0:{host_port}"
|
||||
|
||||
assert host_port, "Error while parsing port, aborting."
|
||||
|
||||
|
@ -174,9 +190,7 @@ class Parser:
|
|||
service_volumes.append(Volume(source=spilt_data[0], target=spilt_data[1]))
|
||||
elif len(spilt_data) == 3:
|
||||
service_volumes.append(
|
||||
Volume(
|
||||
source=spilt_data[0], target=spilt_data[1], access_mode=AccessMode[spilt_data[2]]
|
||||
)
|
||||
Volume(source=spilt_data[0], target=spilt_data[1], access_mode=spilt_data[2])
|
||||
)
|
||||
|
||||
service_links: List[str] = []
|
||||
|
|
|
@ -4,10 +4,11 @@ from enum import Enum
|
|||
class Protocol(str, Enum):
|
||||
tcp = "tcp"
|
||||
udp = "udp"
|
||||
any = "any"
|
||||
|
||||
|
||||
class Port:
|
||||
def __init__(self, host_port: str, container_port: str, protocol: Protocol = Protocol.tcp):
|
||||
def __init__(self, host_port: str, container_port: str, protocol: Protocol = Protocol.any):
|
||||
self._host_port = host_port
|
||||
self._container_port = container_port
|
||||
self._protocol = protocol
|
||||
|
|
|
@ -18,13 +18,6 @@ class Service:
|
|||
extends: Optional[Extends] = None,
|
||||
) -> None:
|
||||
self._name = name
|
||||
|
||||
if image is None and extends is None:
|
||||
raise AttributeError(f"Both image and extends are not defined in service '{name}', aborting.")
|
||||
|
||||
if image is not None and extends is not None:
|
||||
raise AttributeError(f"Only one of image and extends can be defined in service '{name}', aborting.")
|
||||
|
||||
self._image = image
|
||||
self._ports = ports
|
||||
self._networks = networks
|
||||
|
|
|
@ -8,17 +8,8 @@ class VolumeType(str, Enum):
|
|||
npipe = "npipe"
|
||||
|
||||
|
||||
class AccessMode(str, Enum):
|
||||
rw = "rw"
|
||||
ro = "ro"
|
||||
z = "z"
|
||||
Z = "Z"
|
||||
|
||||
|
||||
class Volume:
|
||||
def __init__(
|
||||
self, source: str, target: str, type: VolumeType = VolumeType.volume, access_mode: AccessMode = AccessMode.rw
|
||||
):
|
||||
def __init__(self, source: str, target: str, type: VolumeType = VolumeType.volume, access_mode: str = "rw"):
|
||||
self._source = source
|
||||
self._target = target
|
||||
self._type = type
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
services:
|
||||
base:
|
||||
image: busybox
|
||||
user: root
|
||||
common:
|
||||
extends:
|
||||
service: base
|
||||
cli:
|
||||
extends:
|
||||
service: common
|
|
@ -1,28 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
networks:
|
||||
- admin
|
||||
extends:
|
||||
service: frontend
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
extends:
|
||||
service: frontend
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,8 +0,0 @@
|
|||
version: "3.9"
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "8080"
|
||||
redis:
|
||||
image: "redis:alpine"
|
|
@ -1,35 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
ports:
|
||||
- target: 80
|
||||
host_ip: 127.0.0.1
|
||||
published: 8080
|
||||
protocol: udp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
ports:
|
||||
- "127.0.0.1:8081:5001"
|
||||
networks:
|
||||
- admin
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
ports:
|
||||
- "8000:5010/udp"
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,15 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
ports:
|
||||
- target: 80
|
||||
|
||||
monitoring:
|
||||
extends:
|
||||
service: frontend
|
||||
|
||||
backend:
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5001"
|
|
@ -1,32 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
ports:
|
||||
- "8000:5000"
|
||||
|
||||
monitoring:
|
||||
networks:
|
||||
- admin
|
||||
extends:
|
||||
service: frontend
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5001"
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,12 +0,0 @@
|
|||
services:
|
||||
web:
|
||||
build: .
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
redis:
|
||||
image: redis
|
||||
db:
|
||||
image: postgres
|
|
@ -1,29 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
depends_on:
|
||||
- monitoring
|
||||
- backend
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,11 +0,0 @@
|
|||
services:
|
||||
web:
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
extends:
|
||||
service: redis
|
||||
redis:
|
||||
image: redis
|
||||
db:
|
||||
image: postgres
|
|
@ -1,30 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
depends_on:
|
||||
- monitoring
|
||||
- backend
|
||||
extends:
|
||||
service: backend
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,17 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
ports:
|
||||
- "8000:5000"
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
depends_on:
|
||||
- backend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
ports:
|
||||
- "8000:5001"
|
|
@ -1,30 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
depends_on:
|
||||
- backend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,19 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
ports:
|
||||
- "8000:5000"
|
||||
|
||||
monitoring:
|
||||
depends_on:
|
||||
- backend
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
|
||||
backend:
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5001"
|
|
@ -1,31 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
networks:
|
||||
- admin
|
||||
depends_on:
|
||||
- backend
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,11 +0,0 @@
|
|||
services:
|
||||
backend:
|
||||
image: awesome/backend
|
||||
volumes:
|
||||
- "db-data:/data"
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,37 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,13 +0,0 @@
|
|||
services:
|
||||
common:
|
||||
image: busybox
|
||||
volumes:
|
||||
- common-volume:/var/lib/backup/data:rw
|
||||
cli:
|
||||
extends:
|
||||
service: common
|
||||
volumes:
|
||||
- cli-volume:/var/lib/backup/data:ro
|
||||
volumes:
|
||||
common-volume:
|
||||
cli-volume:
|
|
@ -1,38 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
extends:
|
||||
service: monitoring
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,16 +0,0 @@
|
|||
services:
|
||||
backend:
|
||||
image: awesome/backend
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
ports:
|
||||
- "8000:5000"
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,39 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
ports:
|
||||
- "8000:5000"
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,23 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
backend:
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
extends:
|
||||
service: monitoring
|
||||
ports:
|
||||
- "8000:5000"
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,40 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
extends:
|
||||
service: monitoring
|
||||
ports:
|
||||
- "8000:5000"
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,22 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
depends_on:
|
||||
- backend
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,40 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,25 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,41 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,28 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
ports:
|
||||
- "8000:5000"
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
depends_on:
|
||||
- backend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
ports:
|
||||
- "8000:5001"
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,42 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
ports:
|
||||
- "8000:5010"
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,29 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
|
||||
backend:
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,43 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,31 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,15 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
extends:
|
||||
service: frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
|
@ -1,32 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
extends:
|
||||
service: frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,16 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
|
@ -1,33 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,17 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
|
@ -1,34 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,16 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
depends_on:
|
||||
- monitoring
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
|
@ -1,33 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
depends_on:
|
||||
- monitoring
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,17 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
depends_on:
|
||||
- monitoring
|
||||
links:
|
||||
- "db:database"
|
||||
extends:
|
||||
service: frontend
|
||||
db:
|
||||
image: postgres
|
|
@ -1,34 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,18 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
depends_on:
|
||||
- monitoring
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
|
@ -1,35 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
depends_on:
|
||||
- monitoring
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,20 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
|
||||
backend:
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
|
@ -1,36 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
|
@ -1,24 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
links:
|
||||
- "db:database"
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
db:
|
||||
image: postgres
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,42 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,27 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
extends:
|
||||
service: frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,43 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
extends:
|
||||
service: frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,28 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,44 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,29 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,45 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,26 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
depends_on:
|
||||
- backend
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
links:
|
||||
- "db:database"
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
db:
|
||||
image: postgres
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,44 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,29 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,45 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,30 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,46 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,30 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
|
||||
|
||||
backend:
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
volumes:
|
||||
db-data:
|
|
@ -1,47 +0,0 @@
|
|||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
||||
|
||||
monitoring:
|
||||
image: awesome/monitoring
|
||||
networks:
|
||||
- admin
|
||||
|
||||
|
||||
backend:
|
||||
networks:
|
||||
back-tier:
|
||||
aliases:
|
||||
- database
|
||||
admin:
|
||||
aliases:
|
||||
- mysql
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /data
|
||||
volume:
|
||||
nocopy: true
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
depends_on:
|
||||
- monitoring
|
||||
extends:
|
||||
service: frontend
|
||||
ports:
|
||||
- "8000:5010"
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
|
||||
networks:
|
||||
front-tier:
|
||||
back-tier:
|
||||
admin:
|
||||
volumes:
|
||||
db-data:
|
|
@ -9,76 +9,20 @@ runner = CliRunner()
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"file_number",
|
||||
"test_file_path",
|
||||
[
|
||||
"000001",
|
||||
"000010",
|
||||
"000011",
|
||||
"000100",
|
||||
"000101",
|
||||
"000110",
|
||||
"000111",
|
||||
"001000",
|
||||
"001001",
|
||||
"001010",
|
||||
"001011",
|
||||
"001100",
|
||||
"001101",
|
||||
"001110",
|
||||
"001111",
|
||||
"010000",
|
||||
"010001",
|
||||
"010010",
|
||||
"010011",
|
||||
"010100",
|
||||
"010101",
|
||||
"010110",
|
||||
"010111",
|
||||
"011000",
|
||||
"011001",
|
||||
"011010",
|
||||
"011011",
|
||||
"011100",
|
||||
"011101",
|
||||
"011110",
|
||||
"011111",
|
||||
"100000",
|
||||
"100001",
|
||||
"100010",
|
||||
"100011",
|
||||
"100100",
|
||||
"100101",
|
||||
"100110",
|
||||
"100111",
|
||||
"101000",
|
||||
"101001",
|
||||
"101010",
|
||||
"101011",
|
||||
"101100",
|
||||
"101101",
|
||||
"101110",
|
||||
"101111",
|
||||
"110000",
|
||||
"110001",
|
||||
"110010",
|
||||
"110011",
|
||||
"110100",
|
||||
"110101",
|
||||
"110110",
|
||||
"110111",
|
||||
"111000",
|
||||
"111001",
|
||||
"111010",
|
||||
"111011",
|
||||
"111100",
|
||||
"111101",
|
||||
"111110",
|
||||
"111111",
|
||||
"builds/docker-compose",
|
||||
"depends_on/docker-compose",
|
||||
"extends/docker-compose",
|
||||
"links/docker-compose",
|
||||
"networks/docker-compose",
|
||||
"ports/docker-compose",
|
||||
"volumes/docker-compose",
|
||||
],
|
||||
)
|
||||
def test_cli(file_number: str) -> None:
|
||||
input_path = f"tests/in/{file_number}.yaml"
|
||||
output_path = f"{file_number}.png"
|
||||
def test_cli(test_file_path: str) -> None:
|
||||
input_path = f"tests/ymls/{test_file_path}.yml"
|
||||
output_path = "compose-viz-test.png"
|
||||
result = runner.invoke(cli.app, ["-o", output_path, input_path])
|
||||
|
||||
assert result.exit_code == 0
|
||||
|
|
|
@ -5,10 +5,10 @@ from compose_viz.extends import Extends
|
|||
|
||||
def test_extend_init_normal() -> None:
|
||||
try:
|
||||
e = Extends(service_name="frontend", from_file="tests/in/000001.yaml")
|
||||
e = Extends(service_name="frontend", from_file="tests/ymls/others/empty.yaml")
|
||||
|
||||
assert e.service_name == "frontend"
|
||||
assert e.from_file == "tests/in/000001.yaml"
|
||||
assert e.from_file == "tests/ymls/others/empty.yaml"
|
||||
except Exception as e:
|
||||
assert False, e
|
||||
|
||||
|
@ -25,4 +25,4 @@ def test_extend_init_without_from_file() -> None:
|
|||
|
||||
def test_extend_init_without_service_name() -> None:
|
||||
with pytest.raises(TypeError):
|
||||
Extends(from_file="tests/in/000001.yaml") # type: ignore
|
||||
Extends(from_file="tests/ymls/others/empty.yaml") # type: ignore
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -4,15 +4,15 @@ from compose_viz.parser import Parser
|
|||
|
||||
|
||||
def test_parser_error_parsing_file() -> None:
|
||||
with pytest.raises(RuntimeError, match=r"Error parsing file 'tests/in/invalid.yaml'.*"):
|
||||
Parser().parse("tests/in/invalid.yaml")
|
||||
with pytest.raises(RuntimeError, match=r"Error parsing file 'tests/ymls/others/invalid.yml'.*"):
|
||||
Parser().parse("tests/ymls/others/invalid.yml")
|
||||
|
||||
|
||||
def test_parser_invalid_yaml() -> None:
|
||||
with pytest.raises(RuntimeError, match=r"Empty yaml file, aborting."):
|
||||
Parser().parse("tests/in/000000.yaml")
|
||||
Parser().parse("tests/ymls/others/empty.yml")
|
||||
|
||||
|
||||
def test_parser_no_services_found() -> None:
|
||||
with pytest.raises(RuntimeError, match=r"No services found, aborting."):
|
||||
Parser().parse("tests/in/no-services.yaml")
|
||||
Parser().parse("tests/ymls/others/no-services.yml")
|
||||
|
|
|
@ -7,7 +7,7 @@ def test_port_init_normal() -> None:
|
|||
|
||||
assert p.host_port == "8080"
|
||||
assert p.container_port == "80"
|
||||
assert p.protocol == Protocol.tcp
|
||||
assert p.protocol == Protocol.any
|
||||
except Exception as e:
|
||||
assert False, e
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import pytest
|
||||
|
||||
from compose_viz.extends import Extends
|
||||
from compose_viz.service import Service
|
||||
|
||||
|
||||
def test_service_init() -> None:
|
||||
with pytest.raises(
|
||||
AttributeError, match=r"Both image and extends are not defined in service 'frontend', aborting."
|
||||
):
|
||||
Service(name="frontend")
|
||||
|
||||
with pytest.raises(
|
||||
AttributeError, match=r"Only one of image and extends can be defined in service 'frontend', aborting."
|
||||
):
|
||||
Service(
|
||||
name="frontend", image="image", extends=Extends(service_name="frontend", from_file="tests/in/000001.yaml")
|
||||
)
|
|
@ -1,4 +1,4 @@
|
|||
from compose_viz.volume import AccessMode, Volume, VolumeType
|
||||
from compose_viz.volume import Volume, VolumeType
|
||||
|
||||
|
||||
def test_volume_init_normal() -> None:
|
||||
|
@ -8,7 +8,7 @@ def test_volume_init_normal() -> None:
|
|||
assert v.source == "./foo"
|
||||
assert v.target == "./bar"
|
||||
assert v.type == VolumeType.volume
|
||||
assert v.access_mode == AccessMode.rw
|
||||
assert v.access_mode == "rw"
|
||||
except Exception as e:
|
||||
assert False, e
|
||||
|
||||
|
@ -20,18 +20,18 @@ def test_volume_with_type() -> None:
|
|||
assert v.source == "./foo"
|
||||
assert v.target == "./bar"
|
||||
assert v.type == VolumeType.bind
|
||||
assert v.access_mode == AccessMode.rw
|
||||
assert v.access_mode == "rw"
|
||||
except Exception as e:
|
||||
assert False, e
|
||||
|
||||
|
||||
def test_volume_with_access_mode() -> None:
|
||||
try:
|
||||
v = Volume(source="./foo", target="./bar", access_mode=AccessMode.ro)
|
||||
v = Volume(source="./foo", target="./bar", access_mode="ro,z")
|
||||
|
||||
assert v.source == "./foo"
|
||||
assert v.target == "./bar"
|
||||
assert v.type == VolumeType.volume
|
||||
assert v.access_mode == AccessMode.ro
|
||||
assert v.access_mode == "ro,z"
|
||||
except Exception as e:
|
||||
assert False, e
|
||||
|
|
12
tests/ymls/builds/docker-compose.yml
Normal file
12
tests/ymls/builds/docker-compose.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
frontend:
|
||||
image: awesome/frontend
|
||||
build: ./frontend
|
||||
|
||||
backend:
|
||||
image: awesome/backend
|
||||
build:
|
||||
context: backend
|
||||
dockerfile: ../backend.Dockerfile
|
19
tests/ymls/depends_on/docker-compose.yml
Normal file
19
tests/ymls/depends_on/docker-compose.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
frontend:
|
||||
image: awesome/frontend
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
backend:
|
||||
image: awesome/backend
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
db:
|
||||
image: mysql
|
||||
redis:
|
||||
image: redis
|
14
tests/ymls/extends/docker-compose.yml
Normal file
14
tests/ymls/extends/docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
base:
|
||||
image: alpine:latest
|
||||
tty: true
|
||||
derive_from_base:
|
||||
image: alpine:edge
|
||||
extends:
|
||||
service: base
|
||||
derive_from_file:
|
||||
extends:
|
||||
file: web.yml
|
||||
service: web
|
5
tests/ymls/extends/web.yml
Normal file
5
tests/ymls/extends/web.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
web:
|
||||
image: awesome/web
|
|
@ -1,9 +1,9 @@
|
|||
version: "3.9"
|
||||
services:
|
||||
|
||||
web:
|
||||
build: .
|
||||
services:
|
||||
frontend:
|
||||
image: awesome/frontend
|
||||
links:
|
||||
- "db:database"
|
||||
db:
|
||||
image: postgres
|
||||
image: mysql
|
|
@ -1,6 +1,8 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
frontend:
|
||||
image: awesome/webapp
|
||||
image: awesome/frontend
|
||||
networks:
|
||||
- front-tier
|
||||
- back-tier
|
18
tests/ymls/ports/docker-compose.yml
Normal file
18
tests/ymls/ports/docker-compose.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
frontend:
|
||||
image: awesome/frontend
|
||||
ports:
|
||||
- "3000"
|
||||
- "3000-3005"
|
||||
- "9090-9091:8080-8081"
|
||||
- "49100:22"
|
||||
- "127.0.0.1:8001:8001"
|
||||
- "127.0.0.1:5000-5010:5000-5010"
|
||||
- "6060:6060/udp"
|
||||
- target: 80
|
||||
host_ip: 127.0.0.1
|
||||
published: 8080
|
||||
protocol: tcp
|
||||
- target: 443
|
23
tests/ymls/volumes/docker-compose.yml
Normal file
23
tests/ymls/volumes/docker-compose.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
backend:
|
||||
image: awesome/backend
|
||||
volumes:
|
||||
- "./data:/data"
|
||||
- type: bind
|
||||
source: /var/run/postgres/postgres.sock
|
||||
target: /var/run/postgres/postgres.sock
|
||||
common:
|
||||
image: busybox
|
||||
volumes:
|
||||
- common-volume:/var/lib/backup/data:rw,z
|
||||
cli:
|
||||
extends:
|
||||
service: common
|
||||
volumes:
|
||||
- cli-volume:/var/lib/backup/data:ro
|
||||
|
||||
volumes:
|
||||
common-volume:
|
||||
cli-volume:
|
Loading…
Reference in a new issue