Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
0bb072e4
Commit
0bb072e4
authored
Feb 07, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added thread to keep connection alive
parent
757553a2
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
73 additions
and
41 deletions
+73
-41
drip-deployer.iml
deployer/.idea/drip-deployer.iml
+3
-1
Dockerfile
deployer/Dockerfile
+3
-5
__main__.py
deployer/__main__.py
+8
-5
requirements.txt
deployer/requirements.txt
+5
-1
docker-compose.yml
docker-compose.yml
+9
-15
dockerize.sh
dockerize.sh
+7
-1
misc.xml
planner/.idea/misc.xml
+1
-1
planner.iml
planner/.idea/planner.iml
+1
-1
Dockerfile
planner/Dockerfile
+1
-1
__main__.py
planner/__main__.py
+29
-4
__init__.cpython-38.pyc
planner/planner/__pycache__/__init__.cpython-38.pyc
+0
-0
planner.cpython-38.pyc
planner/planner/__pycache__/planner.cpython-38.pyc
+0
-0
__init__.cpython-38.pyc
planner/service/__pycache__/__init__.cpython-38.pyc
+0
-0
simple_spec_alayzer.cpython-38.pyc
...er/service/__pycache__/simple_spec_alayzer.cpython-38.pyc
+0
-0
spec_service.cpython-38.pyc
planner/service/__pycache__/spec_service.cpython-38.pyc
+0
-0
specification_analyzer.cpython-38.pyc
...service/__pycache__/specification_analyzer.cpython-38.pyc
+0
-0
__init__.cpython-38.pyc
planner/util/__pycache__/__init__.cpython-38.pyc
+0
-0
tosca_helper.cpython-38.pyc
planner/util/__pycache__/tosca_helper.cpython-38.pyc
+0
-0
Dockerfile
provisioner/Dockerfile
+3
-0
misc.xml
sure_tosca-flask-server/.idea/misc.xml
+1
-1
sure_tosca-flask-server.iml
sure_tosca-flask-server/.idea/sure_tosca-flask-server.iml
+1
-4
default_controller.py
...flask-server/sure_tosca/controllers/default_controller.py
+1
-1
No files found.
deployer/.idea/drip-deployer.iml
View file @
0bb072e4
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
</content>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.8 (deployer)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.8 (deployer)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</component>
...
...
deployer/Dockerfile
View file @
0bb072e4
FROM
python:3.
7
-buster
FROM
python:3.
8
-buster
RUN
apt
-get
install
ansible
RUN
apt
update
-y
&&
apt-get
install
ansible
-y
RUN
mkdir
-p
/usr/src/app
RUN
mkdir
-p
/usr/src/app
WORKDIR
/usr/src/app
WORKDIR
/usr/src/app
...
@@ -11,6 +11,4 @@ RUN pip3 install --no-cache-dir -r requirements.txt
...
@@ -11,6 +11,4 @@ RUN pip3 install --no-cache-dir -r requirements.txt
COPY
. /usr/src/app
COPY
. /usr/src/app
EXPOSE
8081
CMD
python3 __main__.py $RABBITMQ_HOST deployer
ENTRYPOINT
["python3 __main__.py $RABBITMQ_HOST deployer_queue"]
deployer/__main__.py
View file @
0bb072e4
...
@@ -41,10 +41,13 @@ def init_chanel(args):
...
@@ -41,10 +41,13 @@ def init_chanel(args):
def
start
(
this_channel
):
def
start
(
this_channel
):
try
:
this_channel
.
basic_qos
(
prefetch_count
=
1
)
this_channel
.
basic_qos
(
prefetch_count
=
1
)
this_channel
.
basic_consume
(
queue
=
queue_name
,
on_message_callback
=
on_request
)
this_channel
.
basic_consume
(
queue
=
queue_name
,
on_message_callback
=
on_request
)
logger
.
info
(
" [x] Awaiting RPC requests"
)
logger
.
info
(
" [x] Awaiting RPC requests"
)
this_channel
.
start_consuming
()
this_channel
.
start_consuming
()
except
:
exit
(
-
1
)
def
on_request
(
ch
,
method
,
props
,
body
):
def
on_request
(
ch
,
method
,
props
,
body
):
...
@@ -93,7 +96,7 @@ def handle_delivery(message):
...
@@ -93,7 +96,7 @@ def handle_delivery(message):
tosca_template_dict
=
tosca
.
add_tokens
(
tokens
,
tosca_template_dict
)
tosca_template_dict
=
tosca
.
add_tokens
(
tokens
,
tosca_template_dict
)
tosca_template_dict
=
tosca
.
add_dashboard_url
(
k8s_service
.
get_dashboard_url
(
vms
),
tosca_template_dict
)
tosca_template_dict
=
tosca
.
add_dashboard_url
(
k8s_service
.
get_dashboard_url
(
vms
),
tosca_template_dict
)
response
=
{
'toscaTemplate'
:
tosca_template_dict
}
response
=
{
'toscaTemplate'
:
tosca_template_dict
}
output_current_milli_time
=
int
(
round
(
time
.
time
()
*
1000
))
output_current_milli_time
=
int
(
round
(
time
.
time
()
*
1000
))
...
...
deployer/requirements.txt
View file @
0bb072e4
...
@@ -2,4 +2,8 @@ pika==1.1.0
...
@@ -2,4 +2,8 @@ pika==1.1.0
names==0.3.0
names==0.3.0
networkx==2.4
networkx==2.4
requests==2.22.0
requests==2.22.0
ansible==2.9.2
wheel==0.34.1
\ No newline at end of file
pyyaml==5.3
tosca-parser ==1.7.0
matplotlib==3.1.2
ansible==2.9.4
docker-compose.yml
View file @
0bb072e4
version
:
'
3'
version
:
'
3
.7
'
services
:
services
:
mongo
:
mongo
:
...
@@ -14,7 +14,6 @@ services:
...
@@ -14,7 +14,6 @@ services:
-
"
4369:4369"
-
"
4369:4369"
-
"
15671:15671"
-
"
15671:15671"
planner
:
planner
:
depends_on
:
depends_on
:
-
rabbit
-
rabbit
...
@@ -67,8 +66,3 @@ services:
...
@@ -67,8 +66,3 @@ services:
environment
:
environment
:
publish
:
"
127.0.0.1:30002:80"
publish
:
"
127.0.0.1:30002:80"
image
:
gliderlabs/logspout:latest
image
:
gliderlabs/logspout:latest
#docker-compose build
#docker-compose up -d
dockerize.sh
View file @
0bb072e4
#!/bin/bash
#!/bin/bash
echo
"----------Building manager Docker--------------"
echo
"----------Building manager Docker--------------"
cd
manager
&&
mvn
-Dmaven
.test.skip
=
true
dockerfile:build
cd
manager
&&
mvn
-Dmaven
.test.skip
=
true
dockerfile:build
status
=
$?
[
$status
-eq
0
]
&&
echo
"build successful"
||
exit
-1
cd
../
cd
../
echo
"----------Building provisioner Docker--------------"
echo
"----------Building provisioner Docker--------------"
cd
provisioner
&&
mvn
-Dmaven
.test.skip
=
true
dockerfile:build
cd
provisioner
&&
mvn
-Dmaven
.test.skip
=
true
dockerfile:build
[
$status
-eq
0
]
&&
echo
"build successful"
||
exit
-1
cd
../
cd
../
echo
"----------Building sure_tosca-flask-server Docker--------------"
echo
"----------Building sure_tosca-flask-server Docker--------------"
cd
sure_tosca-flask-server
&&
docker build
-t
alogo53/sure-tosca:3.0.0
.
cd
sure_tosca-flask-server
&&
docker build
-t
alogo53/sure-tosca:3.0.0
.
[
$status
-eq
0
]
&&
echo
"build successful"
||
exit
-1
echo
"----------Building planner Docker--------------"
echo
"----------Building planner Docker--------------"
cd
../
cd
../
cd
planner
&&
docker build
-t
alogo53/planner:3.0.0
.
cd
planner
&&
docker build
-t
alogo53/planner:3.0.0
.
[
$status
-eq
0
]
&&
echo
"build successful"
||
exit
-1
echo
"----------Building deployer Docker--------------"
echo
"----------Building deployer Docker--------------"
cd
../
cd
../
cd
planner
&&
docker build
-t
alogo53/deployer:3.0.0
.
cd
deployer
&&
docker build
-t
alogo53/deployer:3.0.0
.
[
$status
-eq
0
]
&&
echo
"build successful"
||
exit
-1
planner/.idea/misc.xml
View file @
0bb072e4
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
6
(planner)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
8
(planner)"
project-jdk-type=
"Python SDK"
/>
</project>
</project>
\ No newline at end of file
planner/.idea/planner.iml
View file @
0bb072e4
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<content
url=
"file://$MODULE_DIR$"
>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
</content>
</content>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
6
(planner)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
8
(planner)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</component>
</module>
</module>
\ No newline at end of file
planner/Dockerfile
View file @
0bb072e4
FROM
python:3.
7
-buster
FROM
python:3.
8
-buster
RUN
mkdir
-p
/usr/src/app
RUN
mkdir
-p
/usr/src/app
WORKDIR
/usr/src/app
WORKDIR
/usr/src/app
...
...
planner/__main__.py
View file @
0bb072e4
...
@@ -7,11 +7,16 @@ import os.path
...
@@ -7,11 +7,16 @@ import os.path
import
tempfile
import
tempfile
import
time
import
time
import
logging
import
logging
from
concurrent.futures
import
thread
from
threading
import
Thread
import
pika
import
pika
import
yaml
import
yaml
import
sys
import
sys
import
copy
import
copy
from
time
import
sleep
from
toscaparser.tosca_template
import
ToscaTemplate
from
toscaparser.tosca_template
import
ToscaTemplate
from
planner.planner
import
Planner
from
planner.planner
import
Planner
...
@@ -20,7 +25,6 @@ from util import tosca_helper
...
@@ -20,7 +25,6 @@ from util import tosca_helper
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
# if not getattr(logger, 'handler_set', None):
# if not getattr(logger, 'handler_set', None):
# logger.setLevel(logging.INFO)
# logger.setLevel(logging.INFO)
# h = logging.StreamHandler()
# h = logging.StreamHandler()
...
@@ -29,6 +33,8 @@ logger = logging.getLogger(__name__)
...
@@ -29,6 +33,8 @@ logger = logging.getLogger(__name__)
# logger.addHandler(h)
# logger.addHandler(h)
# logger.handler_set = True
# logger.handler_set = True
done
=
False
def
init_chanel
(
args
):
def
init_chanel
(
args
):
global
rabbitmq_host
global
rabbitmq_host
...
@@ -41,7 +47,7 @@ def init_chanel(args):
...
@@ -41,7 +47,7 @@ def init_chanel(args):
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
rabbitmq_host
))
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
rabbitmq_host
))
channel
=
connection
.
channel
()
channel
=
connection
.
channel
()
channel
.
queue_declare
(
queue
=
queue_name
)
channel
.
queue_declare
(
queue
=
queue_name
)
return
channel
return
channel
,
connection
def
start
(
this_channel
):
def
start
(
this_channel
):
...
@@ -113,6 +119,12 @@ def handle_delivery(message):
...
@@ -113,6 +119,12 @@ def handle_delivery(message):
return
json
.
dumps
(
response
)
return
json
.
dumps
(
response
)
def
threaded_function
(
args
):
while
not
done
:
connection
.
process_data_events
()
sleep
(
5
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
logging
.
basicConfig
(
level
=
logging
.
INFO
)
logging
.
basicConfig
(
level
=
logging
.
INFO
)
if
sys
.
argv
[
1
]
==
"test_local"
:
if
sys
.
argv
[
1
]
==
"test_local"
:
...
@@ -133,7 +145,20 @@ if __name__ == "__main__":
...
@@ -133,7 +145,20 @@ if __name__ == "__main__":
else
:
else
:
print
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
print
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
logger
.
info
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
logger
.
info
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
channel
=
init_chanel
(
sys
.
argv
)
global
channel
global
connection
channel
,
connection
=
init_chanel
(
sys
.
argv
)
global
queue_name
global
queue_name
queue_name
=
sys
.
argv
[
2
]
queue_name
=
sys
.
argv
[
2
]
start
(
channel
)
# start(channel)
thread
=
Thread
(
target
=
threaded_function
,
args
=
(
1
,))
thread
.
start
()
logger
.
info
(
"Awaiting RPC requests"
)
try
:
channel
.
start_consuming
()
except
KeyboardInterrupt
:
# thread.stop()
done
=
True
thread
.
join
()
logger
.
info
(
"Threads successfully closed"
)
planner/planner/__pycache__/__init__.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
planner/planner/__pycache__/planner.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
planner/service/__pycache__/__init__.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
planner/service/__pycache__/simple_spec_alayzer.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
planner/service/__pycache__/spec_service.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
planner/service/__pycache__/specification_analyzer.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
planner/util/__pycache__/__init__.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
planner/util/__pycache__/tosca_helper.cpython-38.pyc
0 → 100644
View file @
0bb072e4
File added
provisioner/Dockerfile
View file @
0bb072e4
...
@@ -3,8 +3,11 @@ COPY target/provisioner-3.0.0-jar-with-dependencies.jar provisioner-3.0.0-jar-wi
...
@@ -3,8 +3,11 @@ COPY target/provisioner-3.0.0-jar-with-dependencies.jar provisioner-3.0.0-jar-wi
COPY
etc/ etc
COPY
etc/ etc
CMD
jar -xf provisioner-3.0.0-jar-with-dependencies.jar application.properties && \
CMD
jar -xf provisioner-3.0.0-jar-with-dependencies.jar application.properties && \
cat application.properties && \
sed -ie "s
#^message.broker.host=.*#message.broker.host=$RABBITMQ_HOST#" application.properties && \
sed -ie "s
#^message.broker.host=.*#message.broker.host=$RABBITMQ_HOST#" application.properties && \
sed -ie "s
#^sure_tosca.base.path=.*#sure-tosca.base.path=$SURE_TOSCA_BASE_PATH#" application.properties && \
sed -ie "s
#^sure_tosca.base.path=.*#sure-tosca.base.path=$SURE_TOSCA_BASE_PATH#" application.properties && \
echo "cloud.storm.db.path=/etc/UD" >> application.properties && \
cat application.properties && \
cat application.properties && \
jar -uf provisioner-3.0.0-jar-with-dependencies.jar application.properties && \
jar -uf provisioner-3.0.0-jar-with-dependencies.jar application.properties && \
sleep 5 && \
java -jar provisioner-3.0.0-jar-with-dependencies.jar
java -jar provisioner-3.0.0-jar-with-dependencies.jar
sure_tosca-flask-server/.idea/misc.xml
View file @
0bb072e4
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
7
(sure_tosca-flask-server)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.
8
(sure_tosca-flask-server)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"PyCharmProfessionalAdvertiser"
>
<component
name=
"PyCharmProfessionalAdvertiser"
>
<option
name=
"shown"
value=
"true"
/>
<option
name=
"shown"
value=
"true"
/>
</component>
</component>
...
...
sure_tosca-flask-server/.idea/sure_tosca-flask-server.iml
View file @
0bb072e4
...
@@ -4,10 +4,7 @@
...
@@ -4,10 +4,7 @@
<content
url=
"file://$MODULE_DIR$"
>
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/venv"
/>
</content>
</content>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
7
(sure_tosca-flask-server)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.
8
(sure_tosca-flask-server)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
</component>
<component
name=
"TestRunnerService"
>
<option
name=
"PROJECT_TEST_RUNNER"
value=
"Unittests"
/>
</component>
</module>
</module>
\ No newline at end of file
sure_tosca-flask-server/sure_tosca/controllers/default_controller.py
View file @
0bb072e4
...
@@ -391,7 +391,7 @@ def set_node_properties(id, properties, node_name): # noqa: E501
...
@@ -391,7 +391,7 @@ def set_node_properties(id, properties, node_name): # noqa: E501
if
res
:
if
res
:
return
res
return
res
return
'Not Found'
,
404
return
'Not Found'
,
404
k
def
upload_tosca_template
(
file
):
# noqa: E501
def
upload_tosca_template
(
file
):
# noqa: E501
"""upload a tosca template description file
"""upload a tosca template description file
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment