summaryrefslogtreecommitdiffstats
path: root/docker-compose/create-compose.py
blob: 1a63336180a66b3f03527fe8bdea7ad40911e458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
##############################################################################
# Copyright (c) 2017 Dell EMC and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

from builtins import input
import readline
readline.parse_and_bind("tab: complete")

content = '''##############################################################################
# Copyright (c) 2017 Dell EMC and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

version: '2'
services:
    storperf-master:
        container_name: "storperf-master"
        image: "opnfv/storperf-master:{storperf_tag}"
        env_file: {ENV_FILE}
        links:
            - storperf-graphite

    storperf-reporting:
        container_name: "storperf-reporting"
        image: "opnfv/storperf-reporting:{reporting_tag}"

    storperf-swaggerui:
        container_name: "storperf-swaggerui"
        image: "opnfv/storperf-swaggerui:{swaggerui_tag}"

    storperf-graphite:
        container_name: "storperf-graphite"
        image: "opnfv/storperf-graphite:{graphite_tag}"
        volumes:
            - {CARBON_DIR}:/opt/graphite/storage/whisper

    storperf-httpfrontend:
        container_name: "storperf-httpfrontend"
        image: "opnfv/storperf-httpfrontend:{frontend_tag}"
        ports:
            - "5000:5000"
        links:
            - storperf-master
            - storperf-reporting
            - storperf-swaggerui
            - storperf-graphite
'''
storeperf_tag = input("Enter image TAG for storperf-master: ") or 'latest'
assert isinstance(storeperf_tag, str)

reporting_tag = input("Enter image TAG for reporting: ") or 'latest'
assert isinstance(reporting_tag, str)

frontend_tag = input("Enter image TAG for frontend: ") or 'latest'
assert isinstance(frontend_tag, str)

graphite_tag = input("Enter image TAG for graphite: ") or 'latest'
assert isinstance(graphite_tag, str)

swaggerui_tag = input("Enter image TAG for swaggerui: ") or 'latest'
assert isinstance(swaggerui_tag, str)

env_file = input("Enter path to environment file: ")
assert isinstance(env_file, str)
if env_file == '':
    print("Did not specify environment file")
    exit(0)

carbon_dir = input("Enter path to Carbon: ")
assert isinstance(carbon_dir, str)
if carbon_dir == '':
    print("Did not specify Carbon Directory")
    exit(0)

f = open('docker-compose.yaml', 'w')
f.write(content.format(storperf_tag=storeperf_tag, reporting_tag=reporting_tag,
                       frontend_tag=frontend_tag, swaggerui_tag=swaggerui_tag,
                       graphite_tag=graphite_tag,
                       CARBON_DIR=carbon_dir, ENV_FILE=env_file))

f.close()