Browse Source

changed Ubuntu to 20.04, made python3 the default while installing faafo, added comment to show use of different faafo branches for cloud-init

pull/3/head
Sebastian Rieger 7 months ago
parent
commit
4bfb746cad
  1. 4
      demo1-getting-started.py
  2. 10
      demo2-instance-with-init-script.py
  3. 12
      demo3-microservice.py
  4. 13
      demo4-scale-out-add-worker.py
  5. 16
      demo4-scale-out.py
  6. 7
      faafo/contrib/install-aws.sh
  7. 13
      faafo/contrib/install.sh

4
demo1-getting-started.py

@ -32,8 +32,8 @@ project_name = 'CloudComp' + str(group_number)
project_network = 'CloudComp' + str(group_number) + '-net'
# The image to look for and use for the started instance
ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
# TODO: Ubuntu >18.04 would require major updates to faafo example again/better option: complete rewrite of example?
#ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
ubuntu_image_name = "Ubuntu 20.04 - Focal Fossa - 64-bit - Cloud Based Image"
# default region
region_name = 'RegionOne'

10
demo2-instance-with-init-script.py

@ -20,8 +20,8 @@ project_name = 'CloudComp' + str(group_number)
project_network = 'CloudComp' + str(group_number) + '-net'
# The image to look for and use for the started instance
ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
# TODO: Ubuntu >18.04 would require major updates to faafo example again/better option: complete rewrite of example?
#ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
ubuntu_image_name = "Ubuntu 20.04 - Focal Fossa - 64-bit - Cloud Based Image"
# The public key to be used for SSH connection, please make sure, that you have the corresponding private key
#
@ -144,8 +144,12 @@ def main():
#
###########################################################################
#hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh'
# testing / faafo dev branch:
hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/branch/dev_faafo/faafo/contrib/install.sh'
userdata = '''#!/usr/bin/env bash
curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
-i faafo -i messaging -r api -r worker -r demo
'''

12
demo3-microservice.py

@ -24,8 +24,8 @@ project_name = 'CloudComp' + str(group_number)
project_network = 'CloudComp' + str(group_number) + '-net'
# The image to look for and use for the started instance
ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
# TODO: Ubuntu >18.04 would require major updates to faafo example again/better option: complete rewrite of example?
#ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
ubuntu_image_name = "Ubuntu 20.04 - Focal Fossa - 64-bit - Cloud Based Image"
# The public key to be used for SSH connection, please make sure, that you have the corresponding private key
#
@ -171,8 +171,12 @@ def main():
#
# Thanks to Stefan Friedmann for finding this fix ;)
#hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh'
# testing / faafo dev branch:
hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/branch/dev_faafo/faafo/contrib/install.sh'
userdata = '''#!/usr/bin/env bash
curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
-i messaging -i faafo -r api
rabbitmqctl add_user faafo guest
rabbitmqctl set_user_tags faafo administrator
@ -231,7 +235,7 @@ def main():
###########################################################################
userdata = '''#!/usr/bin/env bash
curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
-i faafo -r worker -e 'http://%(ip_controller)s' -m 'amqp://faafo:guest@%(ip_controller)s:5672/'
''' % {'ip_controller': ip_controller}

13
demo4-scale-out-add-worker.py

@ -26,8 +26,8 @@ project_name = 'CloudComp' + str(group_number)
project_network = 'CloudComp' + str(group_number) + '-net'
# The image to look for and use for the started instance
ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
# TODO: Ubuntu >18.04 would require major updates to faafo example again/better option: complete rewrite of example?
#ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
ubuntu_image_name = "Ubuntu 20.04 - Focal Fossa - 64-bit - Cloud Based Image"
# The public key to be used for SSH connection, please make sure, that you have the corresponding private key
#
@ -167,13 +167,17 @@ def main():
#
###########################################################################
#hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh'
# testing / faafo dev branch:
hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/branch/dev_faafo/faafo/contrib/install.sh'
userdata_worker = '''#!/usr/bin/env bash
curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
-i faafo -r worker -e 'http://%(api_1_ip)s' -m 'amqp://faafo:guest@%(services_ip)s:5672/'
''' % {'api_1_ip': api_1_ip, 'services_ip': services_ip}
# userdata-api-2 = '''#!/usr/bin/env bash
# curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
# curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
# -i faafo -r worker -e 'http://%(api_2_ip)s' -m 'amqp://faafo:guest@%(services_ip)s:5672/'
# ''' % {'api_2_ip': api_2_ip, 'services_ip': services_ip}
@ -185,6 +189,7 @@ def main():
ex_userdata=userdata_worker,
ex_security_groups=[worker_security_group])
print(instance_worker_3)
if __name__ == '__main__':
main()

16
demo4-scale-out.py

@ -26,8 +26,8 @@ project_name = 'CloudComp' + str(group_number)
project_network = 'CloudComp' + str(group_number) + '-net'
# The image to look for and use for the started instance
ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
# TODO: Ubuntu >18.04 would require major updates to faafo example again/better option: complete rewrite of example?
#ubuntu_image_name = "Ubuntu 18.04 - Bionic Beaver - 64-bit - Cloud Based Image"
ubuntu_image_name = "Ubuntu 20.04 - Focal Fossa - 64-bit - Cloud Based Image"
# The public key to be used for SSH connection, please make sure, that you have the corresponding private key
#
@ -232,8 +232,12 @@ def main():
#
# Thanks to Stefan Friedmann for finding this fix ;)
#hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh'
# testing / faafo dev branch:
hsfd_faafo_cloud_init_script = 'https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/branch/dev_faafo/faafo/contrib/install.sh'
userdata_service = '''#!/usr/bin/env bash
curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
-i database -i messaging
rabbitmqctl add_user faafo guest
rabbitmqctl set_user_tags faafo administrator
@ -259,7 +263,7 @@ def main():
###########################################################################
userdata_api = '''#!/usr/bin/env bash
curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
-i faafo -r api -m 'amqp://faafo:guest@%(services_ip)s:5672/' \
-d 'mysql+pymysql://faafo:password@%(services_ip)s:3306/faafo'
''' % {'services_ip': services_ip}
@ -301,12 +305,12 @@ def main():
###########################################################################
userdata_worker = '''#!/usr/bin/env bash
curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
-i faafo -r worker -e 'http://%(api_1_ip)s' -m 'amqp://faafo:guest@%(services_ip)s:5672/'
''' % {'api_1_ip': api_1_ip, 'services_ip': services_ip}
# userdata_api-api-2 = '''#!/usr/bin/env bash
# curl -L -s https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples/raw/master/faafo/contrib/install.sh | bash -s -- \
# curl -L -s ''' + hsfd_faafo_cloud_init_script + ''' | bash -s -- \
# -i faafo -r worker -e 'http://%(api_2_ip)s' -m 'amqp://faafo:guest@%(services_ip)s:5672/'
# ''' % {'api_2_ip': api_2_ip, 'services_ip': services_ip}

7
faafo/contrib/install-aws.sh

@ -78,6 +78,7 @@ if [[ -e /etc/os-release ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
sudo apt-get update
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf update -y
fi
@ -89,6 +90,7 @@ if [[ -e /etc/os-release ]]; then
#sudo sed -i -e "/bind-address/d" /etc/mysql/my.cnf
sudo service mysql restart
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf install -y mariadb-server python-mysql
printf "[mysqld]\nbind-address = 127.0.0.1\n" | sudo tee /etc/my.cnf.d/faafo.conf
sudo systemctl enable mariadb
@ -106,6 +108,7 @@ if [[ -e /etc/os-release ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
sudo apt-get install -y rabbitmq-server
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf install -y rabbitmq-server
sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
@ -117,6 +120,7 @@ if [[ -e /etc/os-release ]]; then
if [[ $INSTALL_FAAFO -eq 1 ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
# TODO: needs to be updated for Ubuntu >= 20.04
sudo apt-get install -y python-dev python-pip supervisor git zlib1g-dev libmysqlclient-dev python-mysqldb
# Following is needed because of
# https://bugs.launchpad.net/ubuntu/+source/supervisor/+bug/1594740
@ -131,6 +135,7 @@ if [[ -e /etc/os-release ]]; then
fi
fi
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf install -y python-devel python-pip supervisor git zlib-devel mariadb-devel gcc which python-mysql
sudo systemctl enable supervisord
sudo systemctl start supervisord
@ -171,6 +176,7 @@ startretries=0"
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
echo "$faafo_api" | sudo tee -a /etc/supervisor/conf.d/faafo.conf
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
echo "$faafo_api" | sudo tee -a /etc/supervisord.d/faafo.ini
else
echo "error: distribution $ID not supported"
@ -188,6 +194,7 @@ startretries=0"
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
echo "$faafo_worker" | sudo tee -a /etc/supervisor/conf.d/faafo.conf
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
echo "$faafo_worker" | sudo tee -a /etc/supervisord.d/faafo.ini
else
echo "error: distribution $ID not supported"

13
faafo/contrib/install.sh

@ -78,6 +78,7 @@ if [[ -e /etc/os-release ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
sudo apt-get update
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf update -y
fi
@ -89,6 +90,7 @@ if [[ -e /etc/os-release ]]; then
#sudo sed -i -e "/bind-address/d" /etc/mysql/my.cnf
sudo service mysql restart
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf install -y mariadb-server python3-mysql
printf "[mysqld]\nbind-address = 127.0.0.1\n" | sudo tee /etc/my.cnf.d/faafo.conf
sudo systemctl enable mariadb
@ -106,6 +108,7 @@ if [[ -e /etc/os-release ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
sudo apt-get install -y rabbitmq-server
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf install -y rabbitmq-server
sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
@ -117,7 +120,7 @@ if [[ -e /etc/os-release ]]; then
if [[ $INSTALL_FAAFO -eq 1 ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
sudo apt-get install -y python3-dev python3-pip supervisor git zlib1g-dev libmysqlclient-dev python3-mysqldb
sudo apt-get install -y python3-dev python3-pip supervisor git zlib1g-dev libmysqlclient-dev python3-mysqldb python-is-python3
# Following is needed because of
# https://bugs.launchpad.net/ubuntu/+source/supervisor/+bug/1594740
if [ $(lsb_release --short --codename) = xenial ]; then
@ -131,6 +134,7 @@ if [[ -e /etc/os-release ]]; then
fi
fi
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
sudo dnf install -y python3-devel python3-pip supervisor git zlib-devel mariadb-devel gcc which python3-mysql
sudo systemctl enable supervisord
sudo systemctl start supervisord
@ -142,12 +146,13 @@ if [[ -e /etc/os-release ]]; then
fi
# HSFD changed to local repo
git clone https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples
#git clone https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples
git clone --branch dev_faafo https://gogs.informatik.hs-fulda.de/srieger/cloud-computing-msc-ai-examples
cd cloud-computing-msc-ai-examples/faafo
# following line required by bug 1636150
sudo pip install --upgrade pbr
sudo pip install -r requirements.txt
sudo python setup.py install
sudo python3 setup.py install
sudo sed -i -e "s#transport_url = .*#transport_url = $URL_MESSAGING#" /etc/faafo/faafo.conf
sudo sed -i -e "s#database_url = .*#database_url = $URL_DATABASE#" /etc/faafo/faafo.conf
@ -165,6 +170,7 @@ startretries=0"
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
echo "$faafo_api" | sudo tee -a /etc/supervisor/conf.d/faafo.conf
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
echo "$faafo_api" | sudo tee -a /etc/supervisord.d/faafo.ini
else
echo "error: distribution $ID not supported"
@ -182,6 +188,7 @@ startretries=0"
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
echo "$faafo_worker" | sudo tee -a /etc/supervisor/conf.d/faafo.conf
elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported
echo "$faafo_worker" | sudo tee -a /etc/supervisord.d/faafo.ini
else
echo "error: distribution $ID not supported"

Loading…
Cancel
Save