Kuruluma başlamadan önce DevStack kurulumunun yapılmış olması ve Heat servisinin aktif olması gerekmektedir. Eğer hali hazırda bir kurulumunuz yoksa bu ve bu dökümandan yararlanabilirsiniz.
Kuruluma Rabbitmq yapılandırması ile başlayacağız. Rabbitmq yapılandırma dosyasını vim ile açıp aşağıdaki satırları eklemeli ve rabbitmq-server servisini yeniden başlatmalıyız.
$ sudo vim /etc/rabbitmq/rabbitmq.config
[
{rabbit, [
{tcp_listeners, [{"10.0.0.2", 5672}]}
]}
].
$ sudo service rabbitmq-server restart
NOT: tcp_listeners olarak DevStack'ın çalıştığı makinenin (host) ip adresini yazmalısınız.
Murano servisini kurmamız için local.conf dosyamıza aşağıdaki satırı eklemeliyiz.
enable_plugin murano https://opendev.org/openstack/murano liberty-eol
Eğer bir önceki dökümantasyondan takip ediyorsanız local.conf dosyası aşağıdaki gibi olmalıdır.
[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=$ADMIN_PASSWORD
HOST_IP=127.0.0.1
SERVICE_HOST=$HOST_IP
MYSQL_HOST=$HOST_IP
RABBIT_HOST=$HOST_IP
GLANCE_HOSTPORT=$HOST_IP:9292
FORCE=yes
disable_service n-net
enable_service q-svc, q-agt, q-dhcp, q-l3, q-meta, neutron, h-eng, h-api, h-api-cfn, h-api-cw
enable_plugin ceilometer https://opendev.org/openstack/ceilometer liberty-eol
enable_plugin murano https://opendev.org/openstack/murano liberty-eol
Ardından bazı gereksinimlerin versiyonlarını güncellemeliyiz. /opt/stack/requirements/upper-constraints.txt
dosyasını açmalı ve aşağıdaki paketlerin versiyonlarını karşılarında belirtildiği gibi değiştirmeliyiz.
python-congressclient===1.2.0
python-muranoclient===0.7.3
NOT: Yukarıdaki satırları doğrudan dosyaya kopyalamayınız. Belirtilen paketlerin yalnızca versiyonlarını yukarıdaki gibi güncelleyiniz.
Şimdi de bir kaç projeyi klonlamalıyız. /opt/stack/
dizininde olduğunuzdan emin olun.
$ git clone https://opendev.org/openstack/murano -b liberty-eol
$ git clone https://opendev.org/openstack/murano-agent -b liberty-eol
$ git clone https://github.com/openstack/murano-apps -b liberty-eol
$ git clone https://opendev.org/openstack/murano-dashboard -b liberty-eol
$ git clone https://opendev.org/openstack/diskimage-builder -b 1.1.2
Projeleri klonladıktan sonra /opt/stack/murano/devstack/plugin.sh
dosyasını vim ile açıp :%s/stable\/liberty/liberty-eol
komutunu çalıştırmalıyız. Buradaki amaç eski git branch'ini yenisi ile (liberty-eol) değiştirmek.
Son olarak ./stack.sh yaparak DevStack’ı başlatmalıyız.
NOT: Daha önce DevStack çalıştırdıysanız lütfen ./unstack.sh yaparak sonlandırınız.
$ source /opt/stack/devstack/openrc
$ openstack service list
+----------------------------------+-------------+---------------------+
| ID | Name | Type |
+----------------------------------+-------------+---------------------+
| 149b2815ab674101ab498548ecdee6c9 | murano | application_catalog |
| 150990d70ed04dc28c40ed7750ab6212 | glance | image |
| 4a990a1cad744750b52e6b239a182cd3 | nova_legacy | compute_legacy |
| 57711fcdcce64a6fb9271de1f3f7f0c0 | keystone | identity |
| 75dd9962eed4423c98c77f36b8c4cdc9 | nova | compute |
| 761404213f534bf28474b9f34977e17c | cinder | volume |
| 912b64637aeb404e976f41ca52fed591 | neutron | network |
| 9c3b320910d340e383ebc3707ccf4033 | ceilometer | metering |
| bef4fc43973b4901acacf0df0f1e6f57 | cinderv2 | volumev2 |
| c79d5c7d45fd4c9297018c497942f6c4 | ec2 | ec2 |
| d1790758d67448aa9ee55c3ed32ef48f | heat | orchestration |
| e8d007dd64d141a18022554a3bf15396 | heat-cfn | cloudformation |
+----------------------------------+-------------+---------------------+
$ murano package-list
+----------------------------------+--------------+-----------+-----------+-----------+
| ID | Name | FQN | Author | Is Public |
+----------------------------------+--------------+-----------+-----------+-----------+
| 0569e7da4428404eb0079f9381b70619 | Core library | io.murano | murano.io | True |
+----------------------------------+--------------+-----------+-----------+-----------+
Murano aracılığı ile kuracağımız uygulamaların barınacağı platformu disk-image-builder scripti ile hazırlamalıyız. Fakat öncesinde Murano Agent'i biraz düzenlememiz gerekiyor.
/opt/stack/murano-agent/contrib/elements/murano-agent/install.d/74-murano-agent
dosyasını vim ile açmalı ve aşağıdaki değişiklikleri uygulamalıyız.
$ vim /opt/stack/murano-agent/contrib/elements/murano-agent/install.d/74-murano-agent
Değişiklikten önce 74-murano-agent dosyası
#!/bin/bash
set -eu
install-packages git-core wget make gcc python-pip python-dev python-setuptools python-virtualenv chef puppet
name=murano-agent
svc_root=${DIB_MURANO_AGENT_SVC_ROOT:-/opt/stack/$name}
install_dir=${DIB_MURANO_AGENT_INSTALL_DIR:-/opt/stack/venvs/$name}
repo=${DIB_MURANO_AGENT_REPO:-git://git.openstack.org/openstack/murano-agent.git}
branch=${DIB_MURANO_AGENT_BRANCH:-master}
ref=${DIB_MURANO_AGENT_REF:-''}
# clone murano-agent source code into /opt/stack/murano-agent
mkdir -p $svc_root
git clone --depth=1 -b $branch $repo $svc_root
if [ -n "$ref" ]; then
pushd $svc_root
git fetch $repo $ref && git checkout FETCH_HEAD
popd
fi
Değişiklikten sonra 74-murano-agent dosyası
#!/bin/bash
set -eu
install-packages git-core wget make gcc python-pip python-dev python-setuptools python-virtualenv chef puppet
name=murano-agent
svc_root=${DIB_MURANO_AGENT_SVC_ROOT:-/opt/stack/$name}
install_dir=${DIB_MURANO_AGENT_INSTALL_DIR:-/opt/stack/venvs/$name}
#edit repo address
repo=${DIB_MURANO_AGENT_REPO:-https://opendev.org/openstack/murano-agent}
#edit repo branch
branch=${DIB_MURANO_AGENT_BRANCH:-liberty-eol}
ref=${DIB_MURANO_AGENT_REF:-''}
# clone murano-agent source code into /opt/stack/murano-agent
mkdir -p $svc_root
git clone --depth=1 -b $branch $repo $svc_root
#add pytz
echo "pytz==2015.4" >> /opt/stack/murano-agent/requirements.txt
if [ -n "$ref" ]; then
pushd $svc_root
git fetch $repo $ref && git checkout FETCH_HEAD
popd
fi
Burada yapılan değişiklik git adresinin güncellenmesi ve bir pip paketinin eklenmesidir.
Artık diskimizi oluturabiliriz. Bunun için /opt/stack/
dizininde iken aşağıdaki adımları uygulamalıyız.
$ export ELEMENTS_PATH=murano-agent/contrib/elements
$ export DIB_RELEASE=trusty
$ /opt/stack/diskimage-builder/bin/disk-image-create vm ubuntu murano-agent -o ubuntu-murano-agent.qcow2
...
Converting image using qemu-img convert
Image file ubuntu-murano-agent.qcow2 created...
$ glance image-create --disk-format qcow2 --container-format bare --name ubuntu-murano --file ubuntu-murano-agent.qcow2 --property murano_image_info='{"title": "Ubuntu for Murano", "type": "linux"}'
+-------------------+-------------------------------------------------+
| Property | Value |
+-------------------+-------------------------------------------------+
| checksum | 5971cef26757f74d6daff026eea859fb |
| container_format | bare |
| created_at | 2019-08-05T09:24:48Z |
| disk_format | qcow2 |
| id | 9965c19a-4827-4a24-a8b2-51a09f701ec2 |
| min_disk | 0 |
| min_ram | 0 |
| murano_image_info | {"title": "Ubuntu for Murano", "type": "linux"} |
| name | ubuntu-murano |
| owner | cc0f379dcdde4879b70a339ac8540f4f |
| protected | False |
| size | 495804928 |
| status | active |
| tags | [] |
| updated_at | 2019-08-05T09:24:51Z |
| virtual_size | None |
| visibility | private |
+-------------------+-------------------------------------------------+
Disk imajımız hazır. Şimdi de ağ yapılandırması için gereken aşağıdaki komutu çalıştırmalıyız.
$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
NOT: Yukarıdaki komutu sunucunuz yeniden başladığında yeniden çalıştırmalısınız.
Bu adımda uygulama kataloğunda sergilemek için bir uygulama paketleyeceğiz. Murano-apps projesi, örnek uygulamaların barındığı projedir. Bu dökümantasyonda murano-apps projesindeki Apache Tomcat'ı kuracağız. Yapmamız gereken Tomcat uygulamasının kurulum scriptine gerekli dns değişikliğini eklemek ve uygulamayı .zip olarak paketlemek.
/opt/stack/murano-apps/Tomcat/package/Resources/scripts/deployTomcat.sh
dosyasını vim ile açıyoruz ve sudo echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
satırını ekliyoruz.
$ vim /opt/stack/murano-apps/Tomcat/package/Resources/scripts/deployTomcat.sh
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
sudo echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
sudo apt-get update
sudo apt-get -y -q install tomcat7
sudo iptables -I INPUT 1 -p tcp -m tcp --dport 8080 -j ACCEPT -m comment --comment "by murano, Tomcat"
Ardından uygulamamızı zip olarak paketliyoruz.
$ sudo apt install zip
Unpacking zip (3.0-8) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up zip (3.0-8) ...
$ zip -r tomcat.zip /opt/stack/murano-apps/Tomcat/package/
adding: opt/stack/murano-apps/Tomcat/package/LICENSE (deflated 65%)
adding: opt/stack/murano-apps/Tomcat/package/Classes/ (stored 0%)
adding: opt/stack/murano-apps/Tomcat/package/Classes/Tomcat.yaml (deflated 60%)
tomcat.zip adında dns düzenlemesi yapılmış uygulama paketimiz hazır.
Bu dökümantasyonda hazır bir uygulama kullandık. Dilerseniz otomatik olarak ölçeklenen, daha detaylı uygulamalar yazabilirsiniz. Bu konuda kaynak olması açısından aşağıdaki linklerden yararlanabilirsiniz.
Murano otomatik ölçeklendirme: Youtube, Github
Bu adımda yolumuza Horizon ile devam edeceğiz. http://127.0.0.1/dashboard
adresinden Horizon'a erişebiliriz.
NOT: Varsayılan kullanıcı adımız admin, şifremiz ise secret'tir.
Giriş yaptıktan sonra Murano için hazırladığımız imaj dosyasını Murano > Manage > Images
sekmesinden görebiliriz.
Uygulama kataloğumuzda henüz bir uygulama yok. Uygulama eklemek için Murano > Manage > Package Definitions
sekmesine gelip Import Packge butonuna tıklayarak hazırladığımız uygulamayı ekleyebiliriz.
Eklediğimiz uygulamaları Murano > Application Catalog > Applications
altında görüntüleyebilir ve Quick Deploy seçeneği ile hızlıca kurabiliriz.
NOT : Deploy işlemi yaparken Network kısmının Auto seçildiğinden ve Floating IP kısmına tik koyduğunuzdan emin olun.
Quick Deploy yaptığımızda otomatik olarak bir environment oluşmakta. Deploy this Environment butonuna tıklayarak otomatik olarak oluşmuş olan quick-env-1 environmentimizi deploy edebiliriz.
Yaklaşık olarak 15 dakika beklemenin ardından Murano > Application Catalog > Environments > quick-env-1 > Last Deployment Log
sekmesinde scriptimizin başarıyla ayağa kaldırıldığı ve uygulamanın yayımlandığı adresi görebiliriz.
2019-08-05 14:17:42 — Action deploy is scheduled
2019-08-05 14:17:45 — Creating VM for Tomcat
2019-08-05 14:18:42 — Instance is created. Deploying Tomcat
2019-08-05 14:37:37 — Deployment finished
2019-08-05 14:37:37 — Tomcat is available at http://172.24.4.4:8080
Bu adrese gittiğimizde bizleri Apache Tomcat karşılamakta.
Tomcat is available at http://172.24.4.4:8080
curl http://172.24.4.4:8080
If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!
This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat7/webapps/ROOT/index.html
Tomcat7 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME
in /usr/share/tomcat7
and CATALINA_BASE
in /var/lib/tomcat7
, following the rules from /usr/share/doc/tomcat7-common/RUNNING.txt.gz
.
You might consider installing the following packages, if you haven't already done so:
tomcat7-docs: This package installs a web application that allows to browse the Tomcat 7 documentation locally. Once installed, you can access it by clicking here.
tomcat7-examples: This package installs a web application that allows to access the Tomcat 7 Servlet and JSP examples. Once installed, you can access it by clicking here.
tomcat7-admin: This package installs two web applications that can help managing this Tomcat instance. Once installed, you can access the manager webapp and the host-manager webapp.
NOTE: For security reasons, using the manager webapp is restricted to users with role "manager-gui". The host-manager webapp is restricted to users with role "admin-gui". Users are defined in /etc/tomcat7/tomcat-users.xml
.
Apache Tomcat karşılama sayfası yukarıdaki gibidir.
Bu dökümanda Murano servisini DevStack Liberty versiyonuna nasıl implemente edeceğimizi açıkladık. Dilerseniz Neutron-LBaaS Servisi için DevStack Yapılandırması ve Yük Dağıtımı dökümanını da inceleyebilirsiniz.