Commit 6a784739 authored by Spiros Koulouzis's avatar Spiros Koulouzis

Adding docker login

parent c9be5596
version: "2"
version: "3.2"
services:
kamailio:
#build: ./kamailio
......@@ -104,8 +104,8 @@ services:
- "10048:10048/udp"
- "10049:10049/udp"
expose:
- "7711"
#expose:
#- "7711"
# volumes:
# - ./rtpproxy/docker-entrypoint-init:/docker-entrypoint-init
dns:
......@@ -136,5 +136,5 @@ networks:
driver: default
config:
- subnet: 192.168.2.0/24
ip_range: 192.168.2.0/24
gateway: 192.168.2.1
#ip_range: 192.168.2.0/24
#gateway: 192.168.2.1
......@@ -134,8 +134,6 @@ services:
- REDIS_PORT=${REDIS_PORT:-6379}
- REDIS_PASSWORD=${REDIS_PASSWORD:-changeme}
- DEFAULT_SIP=${DEFAULT_SIP:-${SIP_PEERNAME}}
- MONITORING_SERVER = monitoring_server
- MONITORING_ADAPTER = monitoring_adapter
ports:
- "8001:80/tcp"
......@@ -165,4 +163,4 @@ networks:
volumes:
graphite_data:
grafana_data:
redis_data:
redis_data:
\ No newline at end of file
topology_template:
node_templates:
Alerter:
artifacts: null
requirements:
- dependency:
- Graphana
- NotifyService
type: "Switch.nodes.Application.Container.Docker.LOKSORR_Alerter"
properties:
Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
STATSD_HOST: monitoring_adapter
NOTIFICATION_SERVICE: notify
VIRTUAL_HOST: "alerter.beia.switch"
ports_mapping:
scaling_mode: single
Redis:
artifacts: null
requirements:
- dependency: null
type: "Switch.nodes.Application.Container.Docker.LOKSORR_Redis"
properties:
Environment_variables:
var: var
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
ports_mapping:
scaling_mode: single
Graphana:
artifacts: null
requirements:
- dependency:
- Graphite2
- Data_Collector
type: "Switch.nodes.Application.Container.Docker.LOKSORR_Graphana"
properties:
Environment_variables:
GF_SECURITY_ADMIN_PASSWORD: "${GRAFANA_PASSWORD:-secret}"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
VIRTUAL_HOST: "grafana.beia.switch"
ports_mapping:
scaling_mode: single
Asterisk:
artifacts: null
requirements:
- dependency: null
type: "Switch.nodes.Application.Container.Docker.LOKSORR_Asterisk"
properties:
Environment_variables:
SIP_PEERNAME: sipserver
ARI_SECRET: ari_secret
SIP_HOST: "${SIP_HOST}"
SIP_USERNAME: "${SIP_USERNAME}"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
SIP_SECRET: "${SIP_SECRET}"
SIP_EXTENSION: "${SIP_EXTENSION}"
SIP_PORT: "${SIP_PORT:-26999}"
ports_mapping:
scaling_mode: single
"Monitoring Proxy":
artifacts:
inputdistributor_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "beia/monitoring_adapter"
requirements:
- dependency:
- monitoring_server
- Graphite2
type: "Switch.nodes.Application.Container.Docker.LOKSORR_Monitoring_Adapter"
properties:
Environment_variables:
MONITORING_PREFIX: "eu.beia.switch"
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
monitoring_server: monitoring_server
GRAPHITE_SERVER: Graphite
ports_mapping:
scaling_mode: single
Graphite2:
artifacts:
graphite2_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "vladwing/graphite"
requirements:
- dependency:
- "Monitoring Proxy"
type: "Switch.nodes.Application.Container.Docker.LOKSORR_Graphite2"
properties:
Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
VIRTUAL_HOST: "graphite.beia.switch"
MONITORING_PROXY: "Monitoring Proxy"
ports_mapping:
scaling_mode: single
NotifyService:
artifacts: null
requirements:
- dependency:
- "Monitoring Proxy"
- Graphite2
- Asterisk
- Redis
type: "Switch.nodes.Application.Container.Docker.LOKSORR_NotifyService"
properties:
Environment_variables:
MONITORING_ADAPTER: monitoring_adapter
REDIS_HOST: notify_redis
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
REDIS_PORT: 6379
DEFAULT_SIP: sipserver
ARI_PASSWORD: ari_secret
ARI_URL: "http://notify_asterisk:8088"
ARI_USERNAME: ari_user
ports_mapping:
scaling_mode: single
Data_Collector:
artifacts: null
requirements:
- dependency:
- "Monitoring Proxy"
type: "Switch.nodes.Application.Container.Docker.LOKSORR_DataCollecotr"
properties:
Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
STATSD_HOST: monitoring_adapter
ports_mapping:
scaling_mode: single
WebUI2:
artifacts: null
requirements:
- dependency:
- Graphana
type: "Switch.nodes.Application.Container.Docker.LOKSORR_WebUI"
properties:
Environment_variables:
var: var
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
ports_mapping:
scaling_mode: single
monitoring_server:
artifacts:
monitoring_server_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "salmant/salman_monitoring_server_container_image"
requirements:
- dependency: null
type: "Switch.nodes.Application.Container.Docker.MonitoringServer"
properties:
Environment_variables:
VIRTUAL_PORT: 8080
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/248/tosca"
MONITORING_SERVER: monitoring_server
VIRTUAL_HOST: "jcatascopia.beia.switch"
ports_mapping:
port_mapping_1:
host_port: 4242
container_port: 4242
port_mapping_0:
host_port: 8080
container_port: 8080
port_mapping_3:
host_port: 7199
container_port: 7199
port_mapping_2:
host_port: 4245
container_port: 4245
port_mapping_5:
host_port: 7001
container_port: 7001
port_mapping_4:
host_port: 7000
container_port: 7000
port_mapping_7:
host_port: 9042
container_port: 9042
port_mapping_6:
host_port: 9160
container_port: 9160
port_mapping_9:
host_port: 61621
container_port: 61621
port_mapping_8:
host_port: 8012
container_port: 8012
scaling_mode: single
artifact_types:
"tosca.artifacts.Deployment.Image.Container.Docker":
derived_from: "tosca.artifacts.Deployment.Image"
description: "BEIA Usecase created at BEIA"
node_types:
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_ProxyTranscoder":
properties:
multicastAddrPort:
default: 3000
type: "Switch.datatypes.port"
multicastAddrIP:
default: "225.2.2.0"
type: "Switch.datatypes.Network.Multicast"
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.VLAD_THE_IMPALER_RTUSensorDataAcquisition":
properties:
name:
required: false
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_InputDistributor":
properties:
inPort:
default: 2000
type: "Switch.datatypes.port"
derived_from: "Switch.nodes.Application.Container.Docker"
"tosca.groups.Root":
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_InputDistributor.Cardiff":
properties:
multicastAddrPort:
default: 3000
type: "Switch.datatypes.port"
multicastAddrIP:
default: "225.2.2.0"
type: "Switch.datatypes.Network.Multicast"
inPort:
default: 2000
type: "Switch.datatypes.port"
waitingTime:
default: 5
type: integer
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_Graphana":
properties:
GF_SECURITY_ADMIN_PASSWORD:
default: "${GRAFANA_PASSWORD:-secret}"
type: string
VIRTUAL_HOST:
default: "grafana.beia.switch"
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_Gateway":
properties:
Name:
default: BEIA_Gateway
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_Acquisition":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_Switcher.Cardiff":
properties:
waitingTime:
default: 5
type: integer
multicastAddrIP:
default: "225.2.2.0"
type: "Switch.datatypes.Network.Multicast"
switcherREST:
default: switcherREST
type: "Switch.datatypes.port"
switcherOutAddrPort:
default: 6000
type: "Switch.datatypes.port"
multicastAddrIP2:
default: "225.2.2.2"
type: "Switch.datatypes.Network.Multicast"
switcherOutAddrIP:
default: "226.2.2.2"
type: "Switch.datatypes.Network.Multicast"
multicastAddrPort:
default: 3000
type: "Switch.datatypes.port"
videoWidth:
default: 176
type: integer
multicastAddrPort2:
default: 3002
type: "Switch.datatypes.port"
videoHeight:
default: 100
type: integer
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_Monitoring_Adapter":
properties:
monitoring_server:
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker":
properties:
in_ports:
entry_schema:
type: "Switch.datatypes.port"
required: false
type: map
dockers:
required: false
type: string
QoS:
required: false
type: "Switch.datatypes.QoS.AppComponent"
name:
required: false
type: string
out_ports:
entry_schema:
type: "Switch.datatypes.port"
required: false
type: map
ports_mapping:
entry_schema:
type: "Switch.datatypes.port_mapping"
type: map
scaling_mode:
required: false
type: string
ethernet_port:
entry_schema:
type: "Switch.datatypes.ethernet_port"
required: false
type: list
derived_from: "tosca.nodes.Container.Application"
"Switch.nodes.Application.Container.Docker.BEIA_RTUSensorDataAcquisition":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Compute":
artifacts:
gateway_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "/???"
derived_from: "tosca.nodes.Compute"
"Switch.nodes.Application.Container.Docker.BEIA_V1_NotificationServer":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_OutputTranscoder":
properties:
metrics:
default: true
type: string
OutIP:
type: string
multicastAddrIP:
type: string
multicastAddrPortmulticastAddrIP:
type: string
statsdPort:
type: string
OutPort:
type: string
videoWidth:
type: string
videoHeight:
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_ProxyTranscoder2":
artifacts:
monitoring_adapter_v2_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "beia/monitoring_adapter"
properties:
metrics:
type: string
machineip:
type: string
multicastAddrIP:
type: string
statsdPort:
type: string
multicastAddrPort:
type: string
videoWidth:
type: string
videoHeight:
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Network":
derived_from: "tosca.nodes.network.Network"
"Switch.nodes.EventListener":
derived_from: "tosca.nodes.Root"
"Switch.nodes.Application.Container.Docker.LOKSORR_VideoSwitcher":
properties:
waitingTime:
type: string
switcherREST:
type: string
switcherOutAddrPort:
type: string
buffer:
type: string
switcherOutAddrIP:
type: string
camnumber:
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_V1_DatabaseServer":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.VirtualNetwork":
artifacts:
"switcher.cardiff_image":
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: null
properties:
subnet:
default: "192.168.10.0"
type: string
netmask:
default: "255.255.255.0"
type: string
name:
type: string
derived_from: "tosca.nodes.Root"
"Switch.nodes.Application.Container.Docker.LOKSORR_Redis":
properties:
var:
default: var
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_RTUSensorDataManagement":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.MonitoringAgent":
properties:
agent_id:
default: null
type: string
probes:
entry_schema:
type: "Switch.datatypes.monitoring.probe"
type: map
derived_from: "tosca.nodes.Root"
"Switch.nodes.AdaptationPolicy":
derived_from: "tosca.nodes.Root"
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_Input":
properties:
port2:
default: 24
type: integer
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_V1_Monitoring":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_Alerter":
properties:
STATSD_HOST:
default: monitoring_adapter
type: string
NOTIFICATION_SERVICE:
default: notify
type: string
VIRTUAL_HOST:
default: "alerter.beia.switch"
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS.MOG_Input_Distributor":
properties:
Input_RTP_TS_Port:
default: 2000
type: string
Waiting_Time:
default: 5
type: string
Output_Uncompressed_Video_Multicast_Address:
default: "225.2.2.0"
type: string
Output_Uncompressed_Video_Multicast_Port:
default: "3000 waiting time Waiting time (in seconds) for Input Distributor to receive TS stream 5 switcherOutAddrIP Multicast IP address where Video Switcher"
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Component":
derived_from: "tosca.nodes.Root"
"Switch.nodes.Constraint":
requirements:
- monitor_server_endpoint:
node: "Switch.nodes.Application.Container.Docker.MonitoringServer"
capability: "tosca.capabilities.Node"
relationship: "tosca.relationships.DependsOn"
properties:
QoS:
type: "Switch.datatypes.QoS.AppComponent"
derived_from: "tosca.nodes.Root"
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS.MOG_Switcher":
properties:
Input_A_Uncompressed_Video_Multicast_Address:
default: "225.2.2.0"
type: string
Input_Video_Width:
default: 176
type: string
Input_B_Uncompressed_Video_Multicast_Port:
default: 3002
type: string
Input_B_Uncompressed_Video_Multicast_Address:
default: "225.2.2.1"
type: string
port:
default: 23
type: integer
Output_Uncompressed_Video_Multicast_Address:
default: "226.2.2.2"
type: string
Output_REST_PORT:
default: 8008
type: string
Output_Uncompressed_Video_Multicast_Port:
default: 6000
type: string
Input_Video_Height:
default: 100
type: string
Input_A_Uncompressed_Video_Multicast_Port:
default: 3000
type: string
Waiting_Time:
default: 5
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_V1_RTUSensorDataAcquisitions":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_RTUSensorData":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_OutputTranscoder.Cardiff":
properties:
OutIP:
default: "192.168.1.194"
type: "Switch.datatypes.Network.Multicast"
videoWidth:
default: 176
type: integer
OutPort:
default: 4000
type: "Switch.datatypes.port"
videoHeight:
default: 100
type: integer
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.MOG_InputDistributor":
artifacts:
inputdistributor2_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "mogpsantos/inputpipe"
properties:
metrics:
default: true
type: boolean
waitingTime:
default: 5
type: integer
machineip:
default: InputDistributor
type: string
multicastAddrIP:
type: string
statsdPort:
default: 8125
type: "Switch.datatypes.port"
multicastAddrPort:
default: 3000
type: "Switch.datatypes.port"
videoWidth:
default: 720
type: integer
inPort:
default: 2000
type: "Switch.datatypes.port"
videoHeight:
default: 406
type: integer
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Connection":
properties:
source:
type: "Switch.datatypes.Application.Connection.EndPoint"
bandwidth:
type: integer
multicast:
type: "Switch.datatypes.Network.Multicast"
jitter:
required: false
type: integer
target:
type: "Switch.datatypes.Application.Connection.EndPoint"
latency:
required: false
type: integer
QoS:
type: "Switch.datatypes.QoS.AppComponent"
derived_from: "tosca.nodes.Root"
"Switch.nodes.Requirement":
properties:
host:
type: "Switch.datatypes.hw.host"
os:
type: "Switch.datatypes.hw.os"
derived_from: "tosca.nodes.Root"
"Switch.nodes.ExternalComponent":
derived_from: "tosca.nodes.Root"
"Switch.nodes.DST":
properties:
dave:
type: string
derived_from: "tosca.nodes.Root"
"Switch.nodes.Application.Container.Docker.LOKSORR_WebUI":
properties:
var:
default: var
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_Bb":
properties:
bb:
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_NotificationServer":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_V1_RTUSensorDataAcquisition":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.MonitoringServer":
properties:
ports_mapping:
entry_schema:
type: "Switch.datatypes.port_mapping"
type: map
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.UL_JitsiMeet_docker":
properties:
ips:
type: string
deploy:
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_SomethingStupid":
artifacts:
somethingstupid_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "something/stupid"
properties:
stupidvalue:
default: "You are stupid"
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_DataCollecotr":
properties:
STATSD_HOST:
default: monitoring_adapter
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_Graphite2":
artifacts:
redis_image:
type: "tosca.artifacts.Deployment.Image.Container.Docker"
repository: SWITCH_docker_hub
file: "redis:alpine"
properties:
VIRTUAL_HOST:
default: "graphite.beia.switch"
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_Asterisk":
properties:
SIP_PORT:
default: "${SIP_PORT:-26999}"
type: string
ARI_SECRET:
default: ari_secret
type: string
SIP_HOST:
default: "${SIP_HOST}"
type: string
SIP_USERNAME:
default: "${SIP_USERNAME}"
type: string
SIP_SECRET:
default: "${SIP_SECRET}"
type: string
SIP_EXTENSION:
default: "${SIP_EXTENSION}"
type: string
SIP_PEERNAME:
default: sipserver
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_NotifyService":
properties:
REDIS_HOST:
default: notify_redis
type: string
MONITORING_ADAPTER:
default: monitoring_adapter
type: string
REDIS_PORT:
default: 6379
type: string
DEFAULT_SIP:
default: sipserver
type: string
ARI_PASSWORD:
default: ari_secret
type: string
ARI_URL:
default: "http://notify_asterisk:8088"
type: string
ARI_USERNAME:
default: ari_user
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.LOKSORR_MOGFrontend":
properties:
ipPT1:
type: string
ipPT2:
type: string
ipPT3:
type: string
ipPT4:
type: string
ipVS:
type: string
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.Application.Container.Docker.BEIA_V1_TelemetryGateway":
derived_from: "Switch.nodes.Application.Container.Docker"
"Switch.nodes.MessagePasser":
derived_from: "tosca.nodes.Root"
"Switch.nodes.Application.Container.Docker.BEIA_DB":
derived_from: "Switch.nodes.Application.Container.Docker"
repositories:
SWITCH_docker_hub:
url: "https://github.com/switch-project"
credential:
token_type: "X-Auth-Token"
token: 604bbe45ac7143a79e14f3158df67091
protocol: xauth
description: "switch repository in GitHub"
data_types:
"Switch.datatypes.monitoring.metric.threshold":
properties:
operator:
type: string
value:
type: integer
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.port":
properties:
type:
type: string
port:
type: string
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.Application.Connection.EndPoint":
properties:
netmask:
type: string
component_name:
type: string
port_name:
type: string
address:
type: string
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.monitoring.probe":
properties:
active:
type: boolean
path:
required: false
type: string
static:
type: boolean
name:
type: string
metrics:
entry_schema:
type: "Switch.datatypes.monitoring.metric"
type: map
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.hw.host":
properties:
cpu_frequency:
type: float
mem_size:
type: integer
num_cpus:
type: integer
disk_size:
type: integer
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.ethernet_port":
properties:
subnet_name:
type: string
name:
type: string
address:
type: string
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.hw.os":
properties:
os_version:
type: string
distribution:
type: string
type:
type: string
architecture:
type: string
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.QoS.AppComponent":
properties:
response_time:
type: integer
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.Application.Connection.Multicast":
properties:
multicastAddrPort:
type: string
multicastAddrIP:
type: string
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.Network.Multicast":
properties:
multicastAddrPort:
type: string
multicastAddrIP:
type: string
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.port_mapping":
properties:
host_port:
type: integer
container_port:
type: integer
derived_from: "tosca.datatypes.Root"
"Switch.datatypes.monitoring.metric":
properties:
thresholds:
entry_schema:
type: "Switch.datatypes.monitoring.metric.threshold"
required: false
type: map
type:
type: string
name:
type: string
unit:
required: false
type: string
derived_from: "tosca.datatypes.Root"
tosca_definitions_version: tosca_simple_yaml_1_0
\ No newline at end of file
---
topology_template:
node_templates:
"Graphite":
artifacts:
graphite_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: vladwing/graphite
requirements: []
type: 'Switch.nodes.Application.Container.Docker.VLAD_Graphite'
properties:
Environment_variables:
Environment:
string_2: SET_ITS_VALUE
string_0: SET_ITS_VALUE
string_1: SET_ITS_VALUE
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca"
MONITORING_PROXY: "Monitoring Proxy"
scaling_mode: single
"SIPNotifier":
artifacts:
sipnotifier_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/sip_notifier
requirements:
- Graphite
type: 'Switch.nodes.Application.Container.Docker.VLAD_SIPNotifier'
properties:
Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca"
MONITORING_PROXY: "Monitoring Proxy"
scaling_mode: single
"AlertChecker":
artifacts:
alertchecker_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/alerter
requirements:
- Graphite
type: 'Switch.nodes.Application.Container.Docker.VLAD_AlertChecker'
properties:
Environment_variables:
TOSCA: "http://i213.cscloud.cf.ac.uk:7001/api/switchapps/258/tosca"
MONITORING_PROXY: "Monitoring Proxy"
scaling_mode: single
artifact_types:
tosca.artifacts.Deployment.Image.Container.Docker:
derived_from: tosca.artifacts.Deployment.Image
description: Version 3
node_types:
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_ProxyTranscoder:
properties:
multicastAddrPort:
default: 3000
type: Switch.datatypes.port
multicastAddrIP:
default: 225.2.2.0
type: Switch.datatypes.Network.Multicast
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_THE_IMPALER_RTUSensorDataAcquisition:
properties:
name:
required: 'false'
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_InputDistributor:
properties:
inPort:
default: 2000
type: Switch.datatypes.port
derived_from: Switch.nodes.Application.Container.Docker
tosca.groups.Root: {}
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_InputDistributor.Cardiff:
properties:
multicastAddrPort:
default: 3000
type: Switch.datatypes.port
multicastAddrIP:
default: 225.2.2.0
type: Switch.datatypes.Network.Multicast
inPort:
default: 2000
type: Switch.datatypes.port
waitingTime:
default: 5
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.LOKSORR_SomethingStrange:
artifacts:
somethingstrange_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: matej/somethingStrange
properties:
das:
default: das
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_Gateway:
properties:
Name:
default: BEIA_Gateway
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_Acquisition:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_Switcher.Cardiff:
properties:
waitingTime:
default: 5
type: integer
multicastAddrIP:
default: 225.2.2.0
type: Switch.datatypes.Network.Multicast
switcherREST:
default: switcherREST
type: Switch.datatypes.port
switcherOutAddrPort:
default: 6000
type: Switch.datatypes.port
multicastAddrIP2:
default: 225.2.2.2
type: Switch.datatypes.Network.Multicast
switcherOutAddrIP:
default: 226.2.2.2
type: Switch.datatypes.Network.Multicast
multicastAddrPort:
default: 3000
type: Switch.datatypes.port
videoWidth:
default: 176
type: integer
multicastAddrPort2:
default: 3002
type: Switch.datatypes.port
videoHeight:
default: 100
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker:
properties:
in_ports:
entry_schema:
type: Switch.datatypes.port
required: 'false'
type: map
dockers:
required: 'false'
type: string
QoS:
required: 'false'
type: Switch.datatypes.QoS.AppComponent
name:
required: 'false'
type: string
out_ports:
entry_schema:
type: Switch.datatypes.port
required: 'false'
type: map
ports_mapping:
entry_schema:
type: Switch.datatypes.port_mapping
type: map
scaling_mode:
required: 'false'
type: string
ethernet_port:
entry_schema:
type: Switch.datatypes.ethernet_port
required: 'false'
type: list
derived_from: tosca.nodes.Container.Application
Switch.nodes.Application.Container.Docker.BEIA_RTUSensorDataAcquisition:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Compute:
artifacts:
gateway_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: /???
derived_from: tosca.nodes.Compute
Switch.nodes.Application.Container.Docker.BEIA_V1_NotificationServer:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_AlertChecker:
artifacts:
sipnotifier_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/sip_notifier
derived_from: Switch.nodes.Application.Container.Docker
switch.Component.Component.Docker:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Network:
derived_from: tosca.nodes.network.Network
Switch.nodes.EventListener:
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.LOKSORR_A:
artifacts:
a_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: sad
properties:
dass:
entry_schema:
type: string
type: map
das:
default: dsasd
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_DatabaseServer:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.VirtualNetwork:
artifacts:
switcher.cardiff_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file:
properties:
subnet:
default: 192.168.10.0
type: string
netmask:
default: 255.255.255.0
type: string
name:
type: string
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.VLAD_BEIAComponent:
artifacts:
beiacomponent_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/hang
properties:
Environment:
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_RTUSensorDataManagement:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.MonitoringAgent:
properties:
agent_id:
default:
type: string
probes:
entry_schema:
type: Switch.datatypes.monitoring.probe
type: map
derived_from: tosca.nodes.Root
Switch.nodes.AdaptationPolicy:
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.VLAD_Alterter:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_Graphite:
artifacts:
webui_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/nginx
properties:
Environment:
entry_schema:
type: string
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_Input:
properties:
port2:
default: 24
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_Alerter:
properties:
Environment:
entry_schema:
type: string
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_Monitoring:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS.MOG_Input_Distributor:
properties:
Input_RTP_TS_Port:
default: 2000
type: string
Waiting_Time:
default: 5
type: string
Output_Uncompressed_Video_Multicast_Address:
default: 225.2.2.0
type: string
Output_Uncompressed_Video_Multicast_Port:
default: 3000 waiting time Waiting time (in seconds) for Input Distributor
to receive TS stream 5 switcherOutAddrIP Multicast IP address where Video
Switcher
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Component:
derived_from: tosca.nodes.Root
Switch.nodes.Constraint:
requirements:
- monitor_server_endpoint:
node: Switch.nodes.Application.Container.Docker.MonitoringServer
capability: tosca.capabilities.Node
relationship: tosca.relationships.DependsOn
properties:
QoS:
type: Switch.datatypes.QoS.AppComponent
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS.MOG_Switcher:
properties:
Input_A_Uncompressed_Video_Multicast_Address:
default: 225.2.2.0
type: string
Input_Video_Width:
default: 176
type: string
Input_B_Uncompressed_Video_Multicast_Port:
default: 3002
type: string
Input_B_Uncompressed_Video_Multicast_Address:
default: 225.2.2.1
type: string
port:
default: 23
type: integer
Output_Uncompressed_Video_Multicast_Address:
default: 226.2.2.2
type: string
Output_REST_PORT:
default: 8008
type: string
Output_Uncompressed_Video_Multicast_Port:
default: 6000
type: string
Input_Video_Height:
default: 100
type: string
Input_A_Uncompressed_Video_Multicast_Port:
default: 3000
type: string
Waiting_Time:
default: 5
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_RTUSensorDataAcquisitions:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.LOKSORR_Blabla:
artifacts:
blabla_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: matej/biba
properties:
da:
default: sda
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_SIPNotifier:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_RTUSensorData:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.PEDRO.SANTOS_OutputTranscoder.Cardiff:
properties:
OutIP:
default: 192.168.1.194
type: Switch.datatypes.Network.Multicast
videoWidth:
default: 176
type: integer
OutPort:
default: 4000
type: Switch.datatypes.port
videoHeight:
default: 100
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.MOG_InputDistributor:
properties:
waitingTime:
default: 5
type: integer
multicastAddrIP:
default: 255.2.2.0
type: string
multicastAddrPort:
default: 3000
type: integer
videoWidth:
default: 170
type: integer
inPort:
default: 2000
type: integer
videoHeight:
default: 100
type: integer
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Connection:
properties:
source:
type: Switch.datatypes.Application.Connection.EndPoint
bandwidth:
type: integer
multicast:
type: Switch.datatypes.Network.Multicast
jitter:
required: 'false'
type: integer
target:
type: Switch.datatypes.Application.Connection.EndPoint
latency:
required: 'false'
type: integer
QoS:
type: Switch.datatypes.QoS.AppComponent
derived_from: tosca.nodes.Root
Switch.nodes.Requirement:
properties:
host:
type: Switch.datatypes.hw.host
os:
type: Switch.datatypes.hw.os
derived_from: tosca.nodes.Root
Switch.nodes.ExternalComponent:
derived_from: tosca.nodes.Root
Switch.nodes.DST:
properties:
dave:
type: string
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.LOKSORR_Bb:
properties:
bb:
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_NotificationServer:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_RTUSensorDataAcquisition:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.MonitoringServer:
properties:
ports_mapping:
entry_schema:
type: Switch.datatypes.port_mapping
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.UL_JitsiMeet_docker:
properties:
ips:
type: string
deploy:
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.LOKSORR_MatejsMagic:
artifacts:
matejsmagic_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: matej/magic
properties:
das:
default: das
required: 'false'
type: string
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_DataCollector:
artifacts:
data_collector_image:
type: tosca.artifacts.Deployment.Image.Container.Docker
repository: SWITCH_docker_hub
file: beia/data_collector
properties:
Environment:
entry_schema:
type: string
type: map
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_BEIAGUI:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_WebUI:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.BEIA_V1_TelemetryGateway:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.Application.Container.Docker.VLAD_Dashboard:
derived_from: Switch.nodes.Application.Container.Docker
Switch.nodes.MessagePasser:
derived_from: tosca.nodes.Root
Switch.nodes.Application.Container.Docker.BEIA_DB:
derived_from: Switch.nodes.Application.Container.Docker
repositories:
SWITCH_docker_hub:
url: https://github.com/switch-project
credential:
token_type: X-Auth-Token
token: 604bbe45ac7143a79e14f3158df67091
protocol: xauth
description: switch repository in GitHub
data_types:
Switch.datatypes.monitoring.metric.threshold:
properties:
operator:
type: string
value:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.port:
properties:
type:
type: string
port:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.Application.Connection.EndPoint:
properties:
netmask:
type: string
component_name:
type: string
port_name:
type: string
address:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.monitoring.probe:
properties:
active:
type: boolean
path:
required: 'false'
type: string
static:
type: boolean
name:
type: string
metrics:
entry_schema:
type: Switch.datatypes.monitoring.metric
type: map
derived_from: tosca.datatypes.Root
Switch.datatypes.hw.host:
properties:
cpu_frequency:
type: float
mem_size:
type: integer
num_cpus:
type: integer
disk_size:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.ethernet_port:
properties:
subnet_name:
type: string
name:
type: string
address:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.hw.os:
properties:
os_version:
type: string
distribution:
type: string
type:
type: string
architecture:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.QoS.AppComponent:
properties:
response_time:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.Application.Connection.Multicast:
properties:
multicastAddrPort:
type: string
multicastAddrIP:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.Network.Multicast:
properties:
multicastAddrPort:
type: string
multicastAddrIP:
type: string
derived_from: tosca.datatypes.Root
Switch.datatypes.port_mapping:
properties:
host_port:
type: integer
container_port:
type: integer
derived_from: tosca.datatypes.Root
Switch.datatypes.monitoring.metric:
properties:
thresholds:
entry_schema:
type: Switch.datatypes.monitoring.metric.threshold
required: 'false'
type: map
type:
type: string
name:
type: string
unit:
required: 'false'
type: string
derived_from: tosca.datatypes.Root
tosca_definitions_version: tosca_simple_yaml_1_0
......@@ -54,7 +54,9 @@ import nl.uva.sne.drip.commons.utils.Converter;
import nl.uva.sne.drip.commons.utils.DRIPLogHandler;
import nl.uva.sne.drip.drip.commons.data.v1.external.ConfigurationRepresentation;
import nl.uva.sne.drip.drip.commons.data.v1.external.KeyPair;
import nl.uva.sne.drip.drip.commons.data.v1.external.PlanResponse;
import nl.uva.sne.drip.drip.commons.data.v1.external.ScaleRequest;
import nl.uva.sne.drip.drip.commons.data.v1.external.ToscaRepresentation;
import nl.uva.sne.drip.drip.commons.data.v1.external.ansible.AnsibleOutput;
import nl.uva.sne.drip.drip.commons.data.v1.external.ansible.AnsibleResult;
import nl.uva.sne.drip.drip.commons.data.v1.external.ansible.BenchmarkResult;
......@@ -93,6 +95,12 @@ public class DeployService {
@Autowired
private BenchmarkResultService benchmarkResultService;
@Autowired
private ToscaService toscaService;
@Autowired
private PlannerService plannerService;
private static final String[] CLOUD_SITE_NAMES = new String[]{"domain", "VMResourceID"};
private static final String[] PUBLIC_ADRESS_NAMES = new String[]{"public_address", "publicAddress"};
private final Logger logger;
......@@ -138,9 +146,7 @@ public class DeployService {
public DeployResponse deploySoftware(DeployRequest deployInfo) throws Exception {
try (DRIPCaller deployer = new DeployerCaller(messageBrokerHost);) {
Message deployerInvokationMessage = buildDeployerMessages(
deployInfo.getProvisionID(),
deployInfo.getManagerType().toLowerCase(),
deployInfo.getConfigurationID(),
deployInfo,
null,
null).get(0);
;
......@@ -167,10 +173,9 @@ public class DeployService {
}
public Map<String, Object> getSwarmInfo(DeployResponse deployResp) throws JSONException, IOException, TimeoutException, InterruptedException {
deployResp.setManagerType("swarm_info");
Message deployerInvokationMessage = buildDeployerMessages(
deployResp.getProvisionID(),
"swarm_info",
deployResp.getConfigurationID(),
deployResp,
null,
null).get(0);
Map<String, Object> info;
......@@ -185,12 +190,20 @@ public class DeployService {
return info;
}
private List<Message> buildDeployerMessages(String provisionID, String managerType, String configurationID, String serviceName, Integer numOfCont) throws JSONException {
private List<Message> buildDeployerMessages(
DeployRequest deployInfo,
String serviceName,
Integer numOfContainers) throws JSONException {
String provisionID = deployInfo.getProvisionID();
String managerType = deployInfo.getManagerType();
String configurationID = deployInfo.getConfigurationID();
ProvisionResponse pro = provisionService.findOne(provisionID);
if (pro == null) {
throw new NotFoundException();
}
List<String> loginKeysIDs = pro.getDeployerKeyPairIDs();
List<Message> messages = new ArrayList<>();
// if (loginKeysIDs == null || loginKeysIDs.isEmpty()) {
// List<String> cloudConfIDs = pro.getCloudCredentialsIDs();
......@@ -220,12 +233,14 @@ public class DeployService {
}
if (managerType.toLowerCase().equals("swarm") && configurationID != null) {
MessageParameter composerParameter = createComposerParameter(configurationID);
Map<String, String> dockerLogin = getDockerLogin(pro);
MessageParameter composerParameter = createComposerParameter(configurationID, dockerLogin);
parameters.add(composerParameter);
}
if (managerType.toLowerCase().equals("scale") && configurationID != null) {
MessageParameter scaleParameter = createScaleParameter(configurationID, serviceName, numOfCont);
MessageParameter scaleParameter = createScaleParameter(configurationID, serviceName, numOfContainers);
parameters.add(scaleParameter);
}
if (managerType.toLowerCase().equals("swarm_info") && configurationID != null) {
......@@ -278,10 +293,13 @@ public class DeployService {
return createConfigurationParameter(configurationID, "ansible");
}
private MessageParameter createComposerParameter(String configurationID) throws JSONException {
private MessageParameter createComposerParameter(String configurationID, Map<String, String> dockerLogin) throws JSONException {
MessageParameter configurationParameter = createConfigurationParameter(configurationID, "composer");
Map<String, String> attributes = new HashMap<>();
attributes.put("name", configurationID);
attributes.put("docker_login_username", dockerLogin.get("username"));
attributes.put("docker_login_password", dockerLogin.get("password"));
attributes.put("docker_login_registry", dockerLogin.get("registry"));
configurationParameter.setAttributes(attributes);
return configurationParameter;
}
......@@ -335,8 +353,11 @@ public class DeployService {
throw new BadRequestException("Service name does not exist in this deployment");
}
Message message = buildDeployerMessages(deployment.getProvisionID(), "scale",
confID, scaleReq.getScaleTargetName(), scaleReq.getNumOfInstances()).get(0);
deployment.setManagerType("scale");
Message message = buildDeployerMessages(deployment,
scaleReq.getScaleTargetName(),
scaleReq.getNumOfInstances()).get(0);
message.setOwner(((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUsername());
try (DRIPCaller deployer = new DeployerCaller(messageBrokerHost);) {
logger.info("Calling deployer");
......@@ -673,4 +694,15 @@ public class DeployService {
return resp;
}
private Map<String, String> getDockerLogin(ProvisionResponse pro) {
String planID = pro.getPlanID();
PlanResponse plan = plannerService.findOne(planID);
ToscaRepresentation tosca = toscaService.findOne(plan.getToscaID());
Map<String, Object> map = tosca.getKeyValue();
map.get("repositories");
HashMap dockerLogin = new HashMap();
return dockerLogin;
}
}
......@@ -35,7 +35,7 @@ if not getattr(logger, 'handler_set', None):
retry=0
def deploy_compose(vm, compose_file, compose_name):
def deploy_compose(vm, compose_file, compose_name,docker_login):
try:
logger.info("Starting docker compose deployment on: "+vm.ip)
paramiko.util.log_to_file("deployment.log")
......@@ -46,7 +46,10 @@ def deploy_compose(vm, compose_file, compose_name):
sftp.chdir('/tmp/')
sftp.put(compose_file, "docker-compose.yml")
stdin, stdout, stderr = ssh.exec_command("sudo docker stack deploy --compose-file /tmp/docker-compose.yml %s" % (compose_name))
if(docker_login):
stdin, stdout, stderr = ssh.exec_command("docker login -u "+docker_login['username']+" -p "+docker_login['password']+" "+docker_login['registry']+" && sudo sudo docker stack deploy --compose-file /tmp/docker-compose.yml %s" % (compose_name))
else:
stdin, stdout, stderr = ssh.exec_command("sudo docker stack deploy --compose-file /tmp/docker-compose.yml %s" % (compose_name))
stdout.read()
logger.info("Finished docker compose deployment on: "+vm.ip)
except Exception as e:
......@@ -64,12 +67,12 @@ def deploy_compose(vm, compose_file, compose_name):
def run(vm_list, compose_file, compose_name,rabbitmq_host,owner):
def run(vm_list, compose_file, compose_name,rabbitmq_host,owner,docker_login):
rabbit = DRIPLoggingHandler(host=rabbitmq_host, port=5672,user=owner)
logger.addHandler(rabbit)
for i in vm_list:
if i.role == "master":
ret = deploy_compose(i, compose_file, compose_name)
ret = deploy_compose(i, compose_file, compose_name,docker_login)
if "ERROR" in ret:
return ret
else:
......
......@@ -95,6 +95,12 @@ def handleDelivery(message):
compose_file = path + "docker-compose.yml"
if not param["attributes"] == None and not param["attributes"]["name"] == None :
compose_name = param["attributes"]["name"]
if 'docker_login' in param["attributes"]:
docker_login = {}
docker_login['username'] = param["attributes"]["docker_login_username"]
docker_login['password'] = param["attributes"]["docker_login_password"]
docker_login['registry'] = param["attributes"]["docker_login_registry"]
docker_login = param["attributes"]["docker_login"]
else:
current_milli_time = lambda: int(round(time.time() * 1000))
compose_name = "service_"+str(current_milli_time())
......@@ -117,7 +123,7 @@ def handleDelivery(message):
if "ERROR" in ret: return ret
ret = docker_swarm.run(vm_list,rabbitmq_host,owner)
if "ERROR" in ret: return ret
ret = docker_compose.run(vm_list, compose_file, compose_name,rabbitmq_host,owner)
ret = docker_compose.run(vm_list, compose_file, compose_name,rabbitmq_host,owner,docker_login)
return ret
elif manager_type == "ansible":
ret = ansible_playbook.run(vm_list,playbook,rabbitmq_host,owner)
......
......@@ -82,8 +82,9 @@ def handle_delivery(message):
def test_local():
home = expanduser("~")
transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/MOG/mog_tosca_v1.yml")
compose = transformer.getnerate_compose()
transformer = DockerComposeTransformer(home+"/workspace/DRIP/docs/input_tosca_files/BEIA/BEIAv3.yml")
vresion = '2';
compose = transformer.getnerate_compose(vresion)
print yaml.dump(compose)
with open(home+'/Downloads/docker-compose.yml', 'w') as outfile:
......
......@@ -29,11 +29,11 @@ class DockerComposeTransformer:
self.DOCKER_TYPE = 'Switch.nodes.Application.Container.Docker'
def getnerate_compose(self):
def getnerate_compose(self,version):
# if self.tt:
# return self.analize_tosca()
# else:
return self.analyze_yaml()
return self.analyze_yaml(version)
def get_node_types(self):
return self.yaml_dict_tpl['node_types']
......@@ -157,11 +157,11 @@ class DockerComposeTransformer:
volumes.append(vol)
return volumes
def analyze_yaml(self):
def analyze_yaml(self,version):
docker_types = self.get_docker_types()
node_templates = self.get_node_templates()
services = {}
services['version'] = '2'
services['version'] = version
services['services'] = {}
all_volumes = []
for node_template_key in node_templates:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment