"Fossies" - the Fresh Open Source Software Archive

Member "monasca-api-3.1.0/devstack/Vagrantfile" (27 Sep 2019, 7206 Bytes) of package /linux/misc/openstack/monasca-api-3.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Vagrantfile": 3.0.0_vs_3.1.0.

    1 # -*- mode: ruby -*-
    2 # vi: set ft=ruby :
    3 
    4 # All Vagrant configuration is done below. The "2" in Vagrant.configure
    5 # configures the configuration version (we support older styles for
    6 # backwards compatibility). Please don't change it unless you know what
    7 # you're doing.
    8 Vagrant.configure(2) do |config|
    9 
   10   if Vagrant.has_plugin?("vagrant-cachier")
   11     config.cache.scope = :box
   12   end
   13 
   14   # Handle local proxy settings
   15   if Vagrant.has_plugin?("vagrant-proxyconf")
   16     if ENV["http_proxy"]
   17       config.proxy.http = ENV["http_proxy"]
   18     end
   19     if ENV["https_proxy"]
   20       config.proxy.https = ENV["https_proxy"]
   21     end
   22     if ENV["no_proxy"]
   23       config.proxy.no_proxy = ENV["no_proxy"] + ',192.168.10.6,10.0.2.15,127.0.0.1'
   24     end
   25 
   26   end
   27 
   28   config.vm.hostname = "devstack"
   29   config.vm.box = "bento/ubuntu-18.04"
   30   config.vm.box_check_update = false
   31   config.vm.network "private_network",ip:"192.168.10.6"
   32   config.vm.synced_folder "~/", "/vagrant_home"
   33 
   34   config.vm.provider "virtualbox" do |vb|
   35     vb.gui = false
   36     vb.memory = "12800"
   37     vb.cpus = 4
   38     # vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
   39   end
   40 
   41   config.vm.provision "shell", privileged: false, inline: <<-SHELL
   42     # sudo apt-get update
   43     # sudo apt-get -y upgrade
   44     sudo apt-get -y install git lnav
   45 
   46     if [ $http_proxy ]; then
   47       git config --global url.https://git.openstack.org/.insteadOf https://git.openstack.org/
   48       sudo git config --global url.https://git.openstack.org/.insteadOf https://git.openstack.org/
   49 
   50       protocol=`echo $http_proxy | awk -F: '{print $1}'`
   51       host=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $1}'`
   52       port=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $2}'`
   53 
   54       echo "<settings>
   55               <proxies>
   56                   <proxy>
   57                       <id>$host</id>
   58                       <active>true</active>
   59                       <protocol>$protocol</protocol>
   60                       <host>$host</host>
   61                       <port>$port</port>
   62                   </proxy>
   63               </proxies>
   64              </settings>" > ./maven_proxy_settings.xml
   65 
   66       mkdir -p ~/.m2
   67       cp ./maven_proxy_settings.xml ~/.m2/settings.xml
   68 
   69       sudo mkdir -p /root/.m2
   70       sudo cp ./maven_proxy_settings.xml /root/.m2/settings.xml
   71     fi
   72 
   73     git clone https://opendev.org/openstack/devstack.git -b master --depth 1
   74 
   75     # If using vagrant-cachier, restore cached downloads of 3rd-party dependencies
   76     if [ -d "/tmp/vagrant-cache" ]; then
   77         if [ -d "/tmp/vagrant-cache/downloads" ]; then
   78           echo "Restoring downloads"
   79           cp /tmp/vagrant-cache/downloads/* devstack/files
   80         fi
   81         if [ -f "/tmp/vagrant-cache/pip-cache.tar.gz" ]; then
   82           echo "Restoring ~/.cache"
   83           tar xzf /tmp/vagrant-cache/pip-cache.tar.gz -C ~
   84         fi
   85         if [ -f "/tmp/vagrant-cache/nvm-cache.tar.gz" ]; then
   86           echo "Restoring ~/.nvm/.cache"
   87           mkdir -p ~/.nvm
   88           tar xzf /tmp/vagrant-cache/nvm-cache.tar.gz -C ~/.nvm
   89         fi
   90         if [ -f "/tmp/vagrant-cache/npm-pkgs.tar.gz" ]; then
   91           echo "Restoring ~/.npm"
   92           tar xzf /tmp/vagrant-cache/npm-pkgs.tar.gz -C ~
   93         fi
   94         if [ -f "/tmp/vagrant-cache/root-pip-cache.tar.gz" ]; then
   95           echo "Restoring ~root/.cache"
   96           sudo tar xzf /tmp/vagrant-cache/root-pip-cache.tar.gz -C ~root
   97         fi
   98         if [ -f "/tmp/vagrant-cache/root-m2-cache.tar.gz" ]; then
   99           echo "Restoring ~root/.m2"
  100           sudo tar xzf /tmp/vagrant-cache/root-m2-cache.tar.gz -C ~root
  101         fi
  102     fi
  103 
  104     cd devstack
  105     echo '[[local|localrc]]
  106 
  107 GIT_DEPTH=1
  108 
  109 SERVICE_HOST=192.168.10.6
  110 HOST_IP=192.168.10.6
  111 HOST_IP_IFACE=eth1
  112 
  113 DATABASE_PASSWORD=secretdatabase
  114 RABBIT_PASSWORD=secretrabbit
  115 ADMIN_PASSWORD=secretadmin
  116 SERVICE_PASSWORD=secretservice
  117 
  118 LOGFILE=$DEST/logs/stack.sh.log
  119 LOGDIR=$DEST/logs
  120 LOG_COLOR=False
  121 
  122 DEST=/opt/stack
  123 
  124 disable_all_services
  125 enable_service rabbit key tempest horizon
  126 
  127 # Enable more OpenStack services if neccessary:
  128 # https://opendev.org/openstack/devstack/src/branch/master/stackrc#L56-L81
  129 # Nova - services to support libvirt based openstack clouds
  130 # enable_service n-api n-cpu n-cond n-sch n-novnc n-cauth n-api-meta
  131 # Placement and Glance services needed for Nova
  132 # enable_service placement-api placement-client
  133 # enable_service g-api g-reg
  134 # Cinder, Neutron
  135 # enable_service cinder c-api c-vol c-sch c-bak
  136 # enable_service neutron q-svc q-agt q-dhcp q-meta q-l3
  137 
  138 # Uncomment one of the following lines to use either MySQL or PostgreSQL
  139 # as RDB (relational database) backend for monasca.
  140 enable_service mysql
  141 #enable_service postgresql
  142 
  143 # Enable entire storm for the sake of local development mode
  144 enable_service monasca-storm-nimbus
  145 enable_service monasca-storm-supervisor
  146 enable_service monasca-storm-ui
  147 enable_service monasca-storm-logviewer
  148 
  149 # Enable/Disable ORM support for mysql/postgresql
  150 # HINT: If postgresql service is enabled, ORM is enforced
  151 MONASCA_DATABASE_USE_ORM=${MONASCA_DATABASE_USE_ORM:-false}
  152 
  153 # The following two variables allow switching between Java and Python for the implementations
  154 # of the Monasca API and the Monasca Persister. If these variables are not set, then the
  155 # default is to install the Python implementations of both the Monasca API and the Monasca Persister.
  156 
  157 # Uncomment one of the following two lines to choose Java or Python for the Monasca API.
  158 # MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-java}
  159 MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-python}
  160 
  161 # Uncomment one of the following two lines to choose Java or Python for the Monasca Pesister.
  162 # MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_LANG:-java}
  163 MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_LANG:-python}
  164 
  165 # Uncomment one of the following three lines to choose either InfluxDB, Vertica or Cassandra.
  166 # MONASCA_METRICS_DB=${MONASCA_METRICS_DB:-vertica}
  167 # MONASCA_METRICS_DB=${MONASCA_METRICS_DB:-cassandra}
  168 MONASCA_METRICS_DB=${MONASCA_METRICS_DB:-influxdb}
  169 
  170 MONASCA_API_USE_MOD_WSGI=${MONASCA_API_USE_MOD_WSGI:-True}
  171 
  172 # Start devstack with services running under Python 3
  173 USE_PYTHON3=True
  174 
  175 # Uncomment one of the following lines and modify accordingly to enable the Monasca DevStack Plugin
  176 enable_plugin monasca-api https://git.openstack.org/openstack/monasca-api
  177 # enable_plugin monasca-api file:///vagrant_home/Documents/repos/openstack/monasca-api.vertica
  178 
  179 # Uncomment to install tempest tests
  180 # enable_plugin monasca-tempest-plugin https://git.openstack.org/openstack/monasca-tempest-plugin
  181 
  182 ' > local.conf
  183     ./stack.sh
  184     # Cache downloaded files for future runs
  185     if [ -d "/tmp/vagrant-cache" ]; then
  186         mkdir -p /tmp/vagrant-cache/downloads
  187         cp files/*gz files/*.deb /tmp/vagrant-cache/downloads
  188         tar czf /tmp/vagrant-cache/pip-cache.tar.gz -C ~ .cache
  189         tar czf /tmp/vagrant-cache/nvm-cache.tar.gz -C ~/.nvm .cache
  190         tar czf /tmp/vagrant-cache/npm-pkgs.tar.gz -C ~ .npm
  191         sudo tar czf /tmp/vagrant-cache/root-pip-cache.tar.gz -C ~root .cache
  192         sudo tar czf /tmp/vagrant-cache/root-m2-cache.tar.gz -C ~root .m2
  193     fi
  194   SHELL
  195 
  196 end