Skip to content

Commit

Permalink
Add RabbitMQ type
Browse files Browse the repository at this point in the history
  • Loading branch information
miwurster committed Mar 5, 2021
1 parent dca9056 commit 2730c88
Show file tree
Hide file tree
Showing 19 changed files with 186 additions and 16 deletions.
6 changes: 6 additions & 0 deletions admin/edmmmappings/EdmmMappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@
}, {
"edmmType" : "web_server",
"toscaType" : "{https://edmm.uni-stuttgart.de/nodetypes}SpringBoot"
}, {
"edmmType" : "rabbitmq",
"toscaType" : "{https://edmm.uni-stuttgart.de/nodetypes}RabbitMQ"
}, {
"edmmType" : "mom",
"toscaType" : "{https://edmm.uni-stuttgart.de/nodetypes}MOM"
} ],
"edmmTypeMapping" : [ {
"edmmType" : "web_application",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ apt -y update
apt -y install wget curl git unzip
# https://github.com/canha/golang-tools-install-script
wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash -s -- --version 1.7.6
source ~/.bashrc
source /root/.bashrc
export GOROOT=/root/.go
export PATH=$GOROOT/bin:$PATH
export GOPATH=/root/go
export PATH=$GOPATH/bin:$PATH
go get -v github.com/Masterminds/glide
go get -u github.com/FiloSottile/gvt
file_name=$(find . -type f -name '*.zip')
mkdir -d ~/go/src/${WORKDIR}
unzip $file_name -d ~/go/src/${WORKDIR}
cd ~/go/src/${WORKDIR}
mkdir -p /root/go/src/${WORKDIR}
unzip $file_name -d /root/go/src/${WORKDIR}
cd /root/go/src/${WORKDIR}
glide install
gvt restore
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app ${ENTRYPOINT}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" xmlns:selfservice="http://www.eclipse.org/winery/model/selfservice" xmlns:testwineryopentoscaorg="http://test.winery.opentosca.org" targetNamespace="https://edmm.uni-stuttgart.de/artifacttemplates" id="winery-defs-for_ateIgeneral1-RabbitMQ-Create">
<ArtifactTemplate xmlns:atyIgeneral="https://edmm.uni-stuttgart.de/artifacttypes" name="RabbitMQ-Create" type="atyIgeneral:Script" id="RabbitMQ-Create">
<ArtifactReferences>
<ArtifactReference reference="artifacttemplates/https%253A%252F%252Fedmm.uni-stuttgart.de%252Fartifacttemplates/RabbitMQ-Create/files/create.sh"/>
</ArtifactReferences>
</ArtifactTemplate>
</Definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

## If sudo is not available on the system,
## uncomment the line below to install it
# apt-get install -y sudo

sudo apt-get update -y

## Install prerequisites
sudo apt-get install curl gnupg -y

## Install RabbitMQ signing key
curl -fsSL https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | sudo apt-key add -

## Install apt HTTPS transport
sudo apt-get install apt-transport-https

## Add Bintray repositories that provision latest RabbitMQ and Erlang 23.x releases
sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list <<EOF
## Installs the latest Erlang 23.x release.
## Change component to "erlang-22.x" to install the latest 22.x version.
## "bionic" as distribution name should work for any later Ubuntu or Debian release.
## See the release to distribution mapping table in RabbitMQ doc guides to learn more.
deb https://dl.bintray.com/rabbitmq-erlang/debian bionic erlang
## Installs latest RabbitMQ release
deb https://dl.bintray.com/rabbitmq/debian bionic main
EOF

## Update package indices
sudo apt-get update -y

## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

## Install management plugin
sudo service rabbitmq-server stop
rabbitmq-plugins enable rabbitmq_management

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
text/x-sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" xmlns:selfservice="http://www.eclipse.org/winery/model/selfservice" xmlns:testwineryopentoscaorg="http://test.winery.opentosca.org" targetNamespace="https://edmm.uni-stuttgart.de/artifacttemplates" id="winery-defs-for_ateIgeneral1-RabbitMQ-Start">
<ArtifactTemplate xmlns:atyIgeneral="https://edmm.uni-stuttgart.de/artifacttypes" name="RabbitMQ-Start" type="atyIgeneral:Archive" id="RabbitMQ-Start">
<ArtifactReferences>
<ArtifactReference reference="artifacttemplates/https%253A%252F%252Fedmm.uni-stuttgart.de%252Fartifacttemplates/RabbitMQ-Start/files/start.sh"/>
</ArtifactReferences>
</ArtifactTemplate>
</Definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
sudo service rabbitmq-server start
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
text/x-sh
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
apt -y update
apt -y install openjdk-11-jre-headless
# apt -y install openjdk-11-jre-headless
apt -y install openjdk-8-jre-headless
file_name=$(find . -type f -name '*.jar')
cp $file_name ./app.jar
mv $file_name ./app.jar
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" xmlns:selfservice="http://www.eclipse.org/winery/model/selfservice" xmlns:testwineryopentoscaorg="http://test.winery.opentosca.org" targetNamespace="https://edmm.uni-stuttgart.de/nodetypeimplementations" id="winery-defs-for_ntyiIgeneral1-RabbitMQ-Impl">
<NodeTypeImplementation xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" targetNamespace="https://edmm.uni-stuttgart.de/nodetypeimplementations" name="RabbitMQ-Impl" abstract="no" final="no" nodeType="ntyIgeneral:RabbitMQ">
<ImplementationArtifacts>
<ImplementationArtifact xmlns:atyIgeneral="https://edmm.uni-stuttgart.de/artifacttypes" xmlns:ateIgeneral1="https://edmm.uni-stuttgart.de/artifacttemplates" name="create" interfaceName="http://opentosca.org/interfaces/lifecycle" operationName="create" artifactType="atyIgeneral:Script" artifactRef="ateIgeneral1:RabbitMQ-Create"/>
<ImplementationArtifact xmlns:atyIgeneral="https://edmm.uni-stuttgart.de/artifacttypes" xmlns:ateIgeneral1="https://edmm.uni-stuttgart.de/artifacttemplates" name="start" interfaceName="http://opentosca.org/interfaces/lifecycle" operationName="start" artifactType="atyIgeneral:Archive" artifactRef="ateIgeneral1:RabbitMQ-Start"/>
</ImplementationArtifacts>
</NodeTypeImplementation>
</Definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" xmlns:selfservice="http://www.eclipse.org/winery/model/selfservice" xmlns:testwineryopentoscaorg="http://test.winery.opentosca.org" targetNamespace="https://edmm.uni-stuttgart.de/nodetypes" id="winery-defs-for_ntyIgeneral-MOM">
<NodeType name="MOM" abstract="no" final="no" targetNamespace="https://edmm.uni-stuttgart.de/nodetypes">
<winery:PropertiesDefinition elementname="properties" namespace="https://edmm.uni-stuttgart.de/nodetypes/propertiesdefinition/winery">
<winery:properties>
<winery:key>port</winery:key>
<winery:type>xsd:integer</winery:type>
</winery:properties>
</winery:PropertiesDefinition>
<DerivedFrom xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" typeRef="ntyIgeneral:Software_Component"/>
</NodeType>
</Definitions>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image/png
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" xmlns:selfservice="http://www.eclipse.org/winery/model/selfservice" xmlns:testwineryopentoscaorg="http://test.winery.opentosca.org" targetNamespace="https://edmm.uni-stuttgart.de/nodetypes" id="winery-defs-for_ntyIgeneral-RabbitMQ">
<NodeType name="RabbitMQ" abstract="no" final="no" targetNamespace="https://edmm.uni-stuttgart.de/nodetypes">
<winery:PropertiesDefinition elementname="properties" namespace="https://edmm.uni-stuttgart.de/nodetypes/propertiesdefinition/winery">
<winery:properties>
<winery:key>management_port</winery:key>
<winery:type>xsd:integer</winery:type>
</winery:properties>
</winery:PropertiesDefinition>
<DerivedFrom xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" typeRef="ntyIgeneral:MOM"/>
<Interfaces>
<Interface name="http://opentosca.org/interfaces/lifecycle">
<Operation name="create"/>
<Operation name="start"/>
</Interface>
</Interfaces>
</NodeType>
</Definitions>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
image/png
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" xmlns:selfservice="http://www.eclipse.org/winery/model/selfservice" xmlns:testwineryopentoscaorg="http://test.winery.opentosca.org" targetNamespace="http://www.example.org/tosca/servicetemplates" id="winery-defs-for_steIgeneral-Test">
<ServiceTemplate name="Test" targetNamespace="http://www.example.org/tosca/servicetemplates" id="Test">
<TopologyTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="RabbitMQ" minInstances="1" maxInstances="1" type="ntyIgeneral:RabbitMQ" id="RabbitMQ_0" winery:x="669" winery:y="181">
<Properties>
<Properties xmlns="http://www.example.org">
<port>8888</port>
<management_port>9999</management_port>
</Properties>
</Properties>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="Compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_0" winery:x="654" winery:y="394">
<Properties>
<properties xmlns="https://edmm.uni-stuttgart.de/nodetypes/propertiesdefinition/winery">
<os_family>linux</os_family>
<machine_image>ubuntu</machine_image>
<instance_type>large</instance_type>
<key_name>empty</key_name>
<public_key>empty</public_key>
</properties>
</Properties>
</NodeTemplate>
<RelationshipTemplate xmlns:tyIgeneral="https://edmm.uni-stuttgart.de/relationtypes" name="HostedOn" type="tyIgeneral:HostedOn" id="con_HostedOn_0">
<SourceElement ref="RabbitMQ_0"/>
<TargetElement ref="Compute_0"/>
</RelationshipTemplate>
</TopologyTemplate>
</ServiceTemplate>
</Definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Definitions xmlns="http://docs.oasis-open.org/tosca/ns/2011/12" xmlns:winery="http://www.opentosca.org/winery/extensions/tosca/2013/02/12" xmlns:selfservice="http://www.eclipse.org/winery/model/selfservice" xmlns:testwineryopentoscaorg="http://test.winery.opentosca.org" targetNamespace="https://edmm.uni-stuttgart.de/servicetemplates" id="winery-defs-for_steIgeneral2-SockShop">
<ServiceTemplate name="SockShop" targetNamespace="https://edmm.uni-stuttgart.de/servicetemplates" id="SockShop">
<TopologyTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_0" winery:x="419" winery:y="475">
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_0" winery:x="322" winery:y="219">
<Properties>
<Properties xmlns="http://www.example.org">
<os_family>linux</os_family>
Expand All @@ -13,7 +13,7 @@
</Properties>
</Properties>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="front-end" minInstances="1" maxInstances="1" type="ntyIgeneral:NodeJS" id="NodeJS_0" winery:x="418" winery:y="114">
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="front-end" minInstances="1" maxInstances="1" type="ntyIgeneral:NodeJS" id="NodeJS_0" winery:x="322" winery:y="89">
<Properties>
<properties xmlns="https://edmm.uni-stuttgart.de/nodetypes/propertiesdefinition/winery">
<port>8080</port>
Expand All @@ -23,19 +23,19 @@
<DeploymentArtifact xmlns:atyIgeneral="https://edmm.uni-stuttgart.de/artifacttypes" xmlns:ateIgeneral1="https://edmm.uni-stuttgart.de/artifacttemplates" name="src" artifactType="atyIgeneral:Archive" artifactRef="ateIgeneral1:SockShop-Frontend"/>
</DeploymentArtifacts>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="payment" minInstances="1" maxInstances="1" type="ntyIgeneral:Go" id="Go_0" winery:x="847" winery:y="201">
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="payment" minInstances="1" maxInstances="1" type="ntyIgeneral:Go" id="Go_0" winery:x="912" winery:y="219">
<Properties>
<Properties xmlns="http://www.example.org">
<workdir>github.com/microservices-demo/payment</workdir>
<entrypoint>github.com/microservices-demo/payment/cmd/paymentsvc</entrypoint>
<port>8080</port>
<port>8081</port>
</Properties>
</Properties>
<DeploymentArtifacts>
<DeploymentArtifact xmlns:atyIgeneral="https://edmm.uni-stuttgart.de/artifacttypes" xmlns:ateIgeneral1="https://edmm.uni-stuttgart.de/artifacttemplates" name="src" artifactType="atyIgeneral:Archive" artifactRef="ateIgeneral1:SockShop-Payment"/>
</DeploymentArtifacts>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_1" winery:x="843" winery:y="471">
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_1" winery:x="912" winery:y="357">
<Properties>
<Properties xmlns="http://www.example.org">
<os_family>linux</os_family>
Expand All @@ -46,17 +46,37 @@
</Properties>
</Properties>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="shipping" minInstances="1" maxInstances="1" type="ntyIgeneral:SpringBoot" id="SpringBoot_0" winery:x="1182" winery:y="92">
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="shipping" minInstances="1" maxInstances="1" type="ntyIgeneral:SpringBoot" id="SpringBoot_0" winery:x="1183" winery:y="82">
<Properties>
<properties xmlns="https://edmm.uni-stuttgart.de/nodetypes/propertiesdefinition/winery">
<port>8080</port>
</properties>
<Properties xmlns="http://www.example.org">
<port>8082</port>
<rabbitmq_hostname>${RabbitMQ_0.public_address}</rabbitmq_hostname>
</Properties>
</Properties>
<DeploymentArtifacts>
<DeploymentArtifact xmlns:atyIgeneral="https://edmm.uni-stuttgart.de/artifacttypes" xmlns:ateIgeneral1="https://edmm.uni-stuttgart.de/artifacttemplates" name="jar" artifactType="atyIgeneral:JAR" artifactRef="ateIgeneral1:SockShop-Shipping"/>
</DeploymentArtifacts>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_2" winery:x="1174" winery:y="459">
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_2" winery:x="1181" winery:y="221">
<Properties>
<properties xmlns="https://edmm.uni-stuttgart.de/nodetypes/propertiesdefinition/winery">
<os_family>linux</os_family>
<machine_image>ubuntu</machine_image>
<instance_type>large</instance_type>
<key_name>empty</key_name>
<public_key>empty</public_key>
</properties>
</Properties>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="rabbitmq" minInstances="1" maxInstances="1" type="ntyIgeneral:RabbitMQ" id="RabbitMQ_0" winery:x="1579" winery:y="87">
<Properties>
<Properties xmlns="http://www.example.org">
<port>5672</port>
<management_port>15672</management_port>
</Properties>
</Properties>
</NodeTemplate>
<NodeTemplate xmlns:ntyIgeneral="https://edmm.uni-stuttgart.de/nodetypes" name="compute" minInstances="1" maxInstances="1" type="ntyIgeneral:Compute" id="Compute_3" winery:x="1577" winery:y="216">
<Properties>
<properties xmlns="https://edmm.uni-stuttgart.de/nodetypes/propertiesdefinition/winery">
<os_family>linux</os_family>
Expand Down Expand Up @@ -87,6 +107,14 @@
<SourceElement ref="SpringBoot_0"/>
<TargetElement ref="Compute_2"/>
</RelationshipTemplate>
<RelationshipTemplate xmlns:tyIgeneral="https://edmm.uni-stuttgart.de/relationtypes" name="HostedOn" type="tyIgeneral:HostedOn" id="con_HostedOn_3">
<SourceElement ref="RabbitMQ_0"/>
<TargetElement ref="Compute_3"/>
</RelationshipTemplate>
<RelationshipTemplate xmlns:tyIgeneral="https://edmm.uni-stuttgart.de/relationtypes" name="ConnectsTo" type="tyIgeneral:ConnectsTo" id="con_ConnectsTo_2">
<SourceElement ref="SpringBoot_0"/>
<TargetElement ref="RabbitMQ_0"/>
</RelationshipTemplate>
</TopologyTemplate>
</ServiceTemplate>
</Definitions>

0 comments on commit 2730c88

Please sign in to comment.