Browse Source

updated aws ami and aws clout-init script

master
Sebastian Rieger 6 months ago
parent
commit
172ccb2722
  1. 3
      example-projects/demo3-microservice-in-aws.py
  2. 21
      faafo/contrib/install-aws.sh

3
example-projects/demo3-microservice-in-aws.py

@ -14,7 +14,8 @@ home = expanduser("~")
# IP, but elastic ips are expensive - make sure to delete them after you used them # IP, but elastic ips are expensive - make sure to delete them after you used them
# The image to look for and use for the started instance # The image to look for and use for the started instance
ubuntu_image_name = 'ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20210128'
# aws ec2 describe-images --owner amazon | grep ubuntu | grep jammy | grep hvm | grep ssd |grep amd64 | grep -v minimal | grep -v pro | grep -v testing | grep -v k8s | grep "Name"
ubuntu_image_name = 'ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20240319'
# TODO: 18.04, currently still needed for faafo, need to port faafo demo app to 20.04 or higher and python3... # TODO: 18.04, currently still needed for faafo, need to port faafo demo app to 20.04 or higher and python3...
# The public key to be used for SSH connection, please make sure, that you have the corresponding private key # The public key to be used for SSH connection, please make sure, that you have the corresponding private key

21
faafo/contrib/install-aws.sh

@ -84,22 +84,24 @@ if [[ -e /etc/os-release ]]; then
if [[ $INSTALL_DATABASE -eq 1 ]]; then if [[ $INSTALL_DATABASE -eq 1 ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server python-mysqldb
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server python3-mysqldb
# HSFD changes for Ubuntu 18.04 # HSFD changes for Ubuntu 18.04
sudo sed -i -e "/bind-address/d" /etc/mysql/mysql.conf.d/mysqld.cnf
#sudo sed -i -e "/bind-address/d" /etc/mysql/my.cnf
sudo service mysql restart
#sudo sed -i -e "/bind-address/d" /etc/mysql/mysql.conf.d/mysqld.cnf
##sudo sed -i -e "/bind-address/d" /etc/mysql/my.cnf
sudo sed -i -e "s/127.0.0.1/0.0.0.0/g" /etc/mysql/mariadb.conf.d/50-server.cnf
sudo mysqladmin password password
sudo systemctl restart mariadb
elif [[ $ID = 'fedora' ]]; then elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported # fedora currently not tested nor supported
sudo dnf install -y mariadb-server python-mysql
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 printf "[mysqld]\nbind-address = 127.0.0.1\n" | sudo tee /etc/my.cnf.d/faafo.conf
sudo mysqladmin password password
sudo systemctl enable mariadb sudo systemctl enable mariadb
sudo systemctl start mariadb sudo systemctl start mariadb
else else
echo "error: distribution $ID not supported" echo "error: distribution $ID not supported"
exit 1 exit 1
fi fi
sudo mysqladmin password password
sudo mysql -uroot -ppassword mysql -e "CREATE DATABASE IF NOT EXISTS faafo; GRANT ALL PRIVILEGES ON faafo.* TO 'faafo'@'%' IDENTIFIED BY 'password';" sudo mysql -uroot -ppassword mysql -e "CREATE DATABASE IF NOT EXISTS faafo; GRANT ALL PRIVILEGES ON faafo.* TO 'faafo'@'%' IDENTIFIED BY 'password';"
URL_DATABASE='mysql://root:password@localhost/faafo' URL_DATABASE='mysql://root:password@localhost/faafo'
fi fi
@ -124,8 +126,7 @@ if [[ -e /etc/os-release ]]; then
if [[ $INSTALL_FAAFO -eq 1 ]]; then if [[ $INSTALL_FAAFO -eq 1 ]]; then
if [[ $ID = 'ubuntu' || $ID = 'debian' ]]; 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
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 # Following is needed because of
# https://bugs.launchpad.net/ubuntu/+source/supervisor/+bug/1594740 # https://bugs.launchpad.net/ubuntu/+source/supervisor/+bug/1594740
if [ $(lsb_release --short --codename) = xenial ]; then if [ $(lsb_release --short --codename) = xenial ]; then
@ -140,7 +141,7 @@ if [[ -e /etc/os-release ]]; then
fi fi
elif [[ $ID = 'fedora' ]]; then elif [[ $ID = 'fedora' ]]; then
# fedora currently not tested nor supported # 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 dnf install -y python3-devel python3-pip supervisor git zlib-devel mariadb-devel gcc which python3-mysql
sudo systemctl enable supervisord sudo systemctl enable supervisord
sudo systemctl start supervisord sudo systemctl start supervisord
#elif [[ $ID = 'opensuse' || $ID = 'sles' ]]; then #elif [[ $ID = 'opensuse' || $ID = 'sles' ]]; then
@ -162,7 +163,7 @@ if [[ -e /etc/os-release ]]; then
sudo mkswap /swap sudo mkswap /swap
sudo swapon /swap sudo swapon /swap
sudo pip install -r requirements.txt 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#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 sudo sed -i -e "s#database_url = .*#database_url = $URL_DATABASE#" /etc/faafo/faafo.conf

Loading…
Cancel
Save