DevStack & Configuration

logo-blue

      DevStack is a series of extensible scripts used to quickly bring up a complete OpenStack environment based on the latest versions of everything from git master. It is used interactively as a development environment and as the basis for much of the OpenStack project’s functional testing.

           (DevStack เป็นชุดของสคริปต์ที่ขยายได้ซึ่งใช้เพื่อสร้างสภาพแวดล้อม OpenStack ที่สมบูรณ์แบบได้อย่างรวดเร็วโดยยึดตามเวอร์ชันล่าสุดของทุกสิ่งจาก git master มันใช้แบบโต้ตอบเป็นสภาพแวดล้อมการพัฒนาและเป็นพื้นฐานสำหรับการทดสอบการทำงานของโครงการ OpenStack)

The source is available at https://git.openstack.org/cgit/openstack-dev/devstack.

Quick Start (เริ่มต้น)

Install Linux  (ติดตั้ง Linux)

Start with a clean and minimal install of a Linux system. DevStack attempts to support the two latest LTS releases of Ubuntu, the latest/current Fedora version, CentOS/RHEL 7, as well as Debian and OpenSUSE.

If you do not have a preference, Ubuntu 18.04 (Bionic Beaver) is the most tested, and will probably go the smoothest.

(หากคุณไม่มีการตั้งค่า Ubuntu 18.04 (Bionic Beaver) นั้นผ่านการทดสอบมากที่สุดและอาจจะราบรื่นที่สุด)

Add Stack User  (optional)

DevStack should be run as a non-root user with sudo enabled (standard logins to cloud images such as “ubuntu” or “cloud-user” are usually fine).

(ควรเรียกใช้ DevStack ในฐานะผู้ใช้ที่ไม่ใช่รูทด้วยการเปิดใช้งาน sudo (การลงชื่อเข้าใช้มาตรฐานไปยังอิมเมจคลาวด์เช่น“ ubuntu” หรือ“ cloud-user” มักจะใช้ได้)

If you are not using a cloud image, you can create a separate stack user to run DevStack with (หากคุณไม่ได้ใช้อิมเมจคลาวด์คุณสามารถสร้างผู้ใช้สแต็กแยกต่างหากเพื่อรัน DevStack ด้วย)

$ sudo useradd -s /bin/bash -d /opt/stack -m stack

Since this user will be making many changes to your system, it should have sudo privileges: (เนื่องจากผู้ใช้รายนี้จะทำการเปลี่ยนแปลงกับระบบของคุณมากมายจึงควรมีสิทธิ์ sudo)

$ echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
$ sudo su - stack

Download DevStack

$ git clone https://git.openstack.org/openstack-dev/devstack
$ cd devstack

The devstack repo contains a script that installs OpenStack and templates for configuration (devstackrepo ประกอบด้วยสคริปต์ที่ติดตั้ง OpenStack และแม่แบบสำหรับไฟล์การกำหนดค่า)

Create a local.conf

Create a local.conf file with four passwords preset at the root of the devstack git repo (สร้างlocal.confไฟล์ด้วยรหัสผ่านสี่ค่าที่ตั้งไว้ที่รูทของ devstack git repo)

[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD

This is the minimum required config to get started with DevStack                                         (นี่คือการกำหนดค่าขั้นต่ำที่จำเป็นในการเริ่มต้นกับ DevStack)

NoteThere is a sample local.conf file under the samples directory in the devstack repository. (นี่คือการกำหนดค่าขั้นต่ำที่จำเป็นในการเริ่มต้นกับ DevStack)

# Sample ``local.conf`` for user-configurable variables in ``stack.sh``

# NOTE: Copy this file to the root DevStack directory for it to work properly.

# ``local.conf`` is a user-maintained settings file that is sourced from ``stackrc``.
# This gives it the ability to override any variables set in ``stackrc``.
# Also, most of the settings in ``stack.sh`` are written to only be set if no
# value has already been set; this lets ``local.conf`` effectively override the
# default values.

# This is a collection of some of the settings we have found to be useful
# in our DevStack development environments. Additional settings are described
# in https://docs.openstack.org/devstack/latest/configuration.html#local-conf
# These should be considered as samples and are unsupported DevStack code.

# The ``localrc`` section replaces the old ``localrc`` configuration file.
# Note that if ``localrc`` is present it will be used in favor of this section.
[[local|localrc]]

# Minimal Contents
# ----------------

# While ``stack.sh`` is happy to run without ``localrc``, devlife is better when
# there are a few minimal variables set:

# If the ``*_PASSWORD`` variables are not set here you will be prompted to enter
# values for them by ``stack.sh``and they will be added to ``local.conf``.
ADMIN_PASSWORD=nomoresecret
DATABASE_PASSWORD=stackdb
RABBIT_PASSWORD=stackqueue
SERVICE_PASSWORD=$ADMIN_PASSWORD

# ``HOST_IP`` and ``HOST_IPV6`` should be set manually for best results if
# the NIC configuration of the host is unusual, i.e. ``eth1`` has the default
# route but ``eth0`` is the public interface.  They are auto-detected in
# ``stack.sh`` but often is indeterminate on later runs due to the IP moving
# from an Ethernet interface to a bridge on the host. Setting it here also
# makes it available for ``openrc`` to include when setting ``OS_AUTH_URL``.
# Neither is set by default.
#HOST_IP=w.x.y.z
#HOST_IPV6=2001:db8::7


# Logging
# -------

# By default ``stack.sh`` output only goes to the terminal where it runs.  It can
# be configured to additionally log to a file by setting ``LOGFILE`` to the full
# path of the destination log file.  A timestamp will be appended to the given name.
LOGFILE=$DEST/logs/stack.sh.log

# Old log files are automatically removed after 7 days to keep things neat.  Change
# the number of days by setting ``LOGDAYS``.
LOGDAYS=2

# Nova logs will be colorized if ``SYSLOG`` is not set; turn this off by setting
# ``LOG_COLOR`` false.
#LOG_COLOR=False


# Using milestone-proposed branches
# ---------------------------------

# Uncomment these to grab the milestone-proposed branches from the
# repos:
#CINDER_BRANCH=milestone-proposed
#GLANCE_BRANCH=milestone-proposed
#HORIZON_BRANCH=milestone-proposed
#KEYSTONE_BRANCH=milestone-proposed
#KEYSTONECLIENT_BRANCH=milestone-proposed
#NOVA_BRANCH=milestone-proposed
#NOVACLIENT_BRANCH=milestone-proposed
#NEUTRON_BRANCH=milestone-proposed
#SWIFT_BRANCH=milestone-proposed

# Using git versions of clients
# -----------------------------
# By default clients are installed from pip.  See LIBS_FROM_GIT in
# stackrc for details on getting clients from specific branches or
# revisions.  e.g.
# LIBS_FROM_GIT="python-ironicclient"
# IRONICCLIENT_BRANCH=refs/changes/44/2.../1

# Swift
# -----

# Swift is now used as the back-end for the S3-like object store. Setting the
# hash value is required and you will be prompted for it if Swift is enabled
# so just set it to something already:
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5

# For development purposes the default of 3 replicas is usually not required.
# Set this to 1 to save some resources:
SWIFT_REPLICAS=1

# The data for Swift is stored by default in (``$DEST/data/swift``),
# or (``$DATA_DIR/swift``) if ``DATA_DIR`` has been set, and can be
# moved by setting ``SWIFT_DATA_DIR``. The directory will be created
# if it does not exist.
SWIFT_DATA_DIR=$DEST/data

Start the install

$ ./stack.sh

This will take a 15 – 20 minutes, largely depending on the speed of your internet connection. Many git trees and packages will be installed during this process.          (การดำเนินการนี้จะใช้เวลา 15 – 20 นาทีขึ้นอยู่กับความเร็วในการเชื่อมต่ออินเทอร์เน็ตของคุณเป็นหลัก ต้นไม้และแพ็คเกจ git จำนวนมากจะถูกติดตั้งในระหว่างกระบวนการนี้)



Configuration

local.conf

การกำหนดค่า DevStack local.confมีการแก้ไขผ่านทางไฟล์ เป็นไฟล์รูปแบบ INI ที่ได้รับการแก้ไขซึ่งแนะนำส่วนหัวของเมตาเพื่อนำข้อมูลเพิ่มเติมเกี่ยวกับไฟล์การกำหนดค่าที่จะเปลี่ยนแปลง

ตัวอย่างมีให้ใน devstack/samples

ส่วนหัวใหม่จะคล้ายกับส่วนหัว INI ปกติ แต่มีวงเล็บสองอัน ( ) และสองเขตภายในที่คั่นด้วยไพพ์ ( ) โปรดทราบว่าไม่มีช่องว่างระหว่างวงเล็บคู่และเขตข้อมูลภายใน ในทำนองเดียวกันไม่มีช่องว่างระหว่างไปป์และฟิลด์ภายใน:[[ ... ]]|

'[[' <phase> '|' <config-file-name> ']]'

โดยที่<phase>เป็นหนึ่งในชุดของชื่อเฟสที่กำหนดโดยstack.sh และ<config-file-name>เป็นชื่อไฟล์การกำหนดค่า ชื่อไฟล์จะถูก eval’ed ในstack.shบริบทเพื่อให้ตัวแปรสภาพแวดล้อมทั้งหมดพร้อมใช้งานและอาจถูกนำมาใช้ ขอแนะนำให้ใช้ตัวแปรไฟล์กำหนดค่าโครงการในส่วนหัว (ดูNOVA_CONFตัวอย่างด้านล่าง) หากเส้นทางของไฟล์กำหนดค่าไม่มีอยู่ไฟล์จะถูกข้ามไป

ขั้นตอนที่กำหนดคือ

  • ท้องถิ่น – สารสกัดlocalrcจากlocal.confก่อน stackrcมีที่มา
  • post-config – ทำงานหลังจากมีการกำหนดค่าบริการเลเยอร์ 2 และก่อนเริ่มบริการ
  • พิเศษ – รันหลังจากเซอร์วิสเริ่มทำงานและก่อนที่ไฟล์ใด ๆ extra.dจะถูกเรียกใช้งาน
  • โพสต์พิเศษ – ทำงานหลังจากไฟล์ในextra.dจะถูกดำเนินการ
  • ทดสอบการกำหนดค่า – ทำงานหลังจากการกำหนดค่า tempest (และปลั๊กอิน)

ไฟล์ถูกประมวลผลตามลำดับอย่างเคร่งครัด meta-section อาจถูกระบุมากกว่าหนึ่งครั้ง แต่หากการตั้งค่าใด ๆ ที่ซ้ำกันครั้งสุดท้ายที่ปรากฏในไฟล์จะถูกนำมาใช้

[[post-config|$NOVA_CONF]]
[DEFAULT]
use_syslog = True

[osapi_v3]
enabled = False

A specific meta-section หมวดเฉพาะlocal|localrcจะใช้ในการจัดทำlocalrcไฟล์เริ่มต้น (จริง ๆ.localrc.auto) สิ่งนี้อนุญาตให้การตั้งค่าแบบกำหนดเองทั้งหมดสำหรับ DevStack อยู่ในไฟล์เดียว หากlocalrc มีอยู่มันจะถูกใช้แทนเพื่อรักษาความเข้ากันได้ย้อนหลัง

[[local|localrc]]
IPV4_ADDRS_SAFE_TO_USE=10.254.1.0/24
ADMIN_PASSWORD=speciale
LOGFILE=$DEST/logs/stack.sh.log

โปรดทราบว่าQ_PLUGIN_CONF_FILEจะไม่ซ้ำกันในการที่จะ ไม่เริ่มต้นด้วย/ตัวอักษร (เครื่องหมายทับ) ต้องเพิ่มเครื่องหมายทับ:

[[post-config|/$Q_PLUGIN_CONF_FILE]]

นอกจากนี้โปรดทราบว่าlocalrcส่วนนี้มีที่มาเป็นเชลล์สคริปต์ส่วนและต้องเป็นไปตามข้อกำหนดของเชลล์โดยเฉพาะไม่มีช่องว่างรอบ=(เท่ากับ)

openrc

openrcกำหนดค่าข้อมูลรับรองการเข้าสู่ระบบที่เหมาะสมสำหรับใช้กับเครื่องมือบรรทัดคำสั่ง OpenStack openrcแหล่งstackrcที่มาที่จุดเริ่มต้น (ซึ่งจะเปิดแหล่งที่มาlocalrcส่วนของ local.conf) เพื่อรับHOST_IPและ / หรือSERVICE_HOST ใช้ในจุดสิ้นสุด ค่าที่แสดงด้านล่างเป็นค่าเริ่มต้น

OS_PROJECT_NAME (OS_TENANT_NAME)

Keystone ได้สร้างมาตรฐานโครงการคำว่าเป็นหน่วยงานที่เป็นเจ้าของทรัพยากร ในบางแห่งการอ้างอิงยังคงมีอยู่กับผู้เช่าระยะก่อนหน้า สำหรับการใช้งานนี้ นอกจากนี้project_nameเป็นที่ต้องการ project_id OS_TENANT_NAME ยังคงรองรับความเข้ากันได้กับเครื่องมือรุ่นเก่า

OS_PROJECT_NAME=demo

OS_USERNAME
นอกเหนือจากการเป็นเจ้าของกิจการ (โครงการ) OpenStack เรียกนิติบุคคลที่มีประสิทธิภาพการดำเนินการของผู้ใช้

OS_USERNAME=demo
OS_PASSWORD
การตรวจสอบความถูกต้องเริ่มต้นของ Keystone จำเป็นต้องมีรหัสผ่าน ข้อควรระวังทั่วไปเกี่ยวกับการใส่รหัสผ่านในตัวแปรสภาพแวดล้อมใช้สำหรับ DevStack ส่วนใหญ่ที่ใช้สิ่งนี้อาจเป็นการแลกเปลี่ยนที่ยอมรับได้

OS_PASSWORD=secret
HOST_IP, SERVICE_HOST
ชุด API HOST_IPโฮสต์ปลายทางโดยใช้ SERVICE_HOSTอาจใช้เพื่อระบุจุดสิ้นสุดซึ่งสะดวกสำหรับlocal.confการกำหนดค่าบางอย่าง โดยทั่วไปแล้วHOST_IPจะมีการตั้งค่าใน localrcส่วน

HOST_IP=127.0.0.1
SERVICE_HOST=$HOST_IP
OS_AUTH_URL
ตรวจสอบกับเมฆ OpenStack ใช้ Keystone ส่งกลับ Tokenและบริการแคตตาล็อก แคตตาล็อกประกอบด้วยจุดสิ้นสุดสำหรับบริการทั้งหมดที่ผู้ใช้ / ผู้เช่าสามารถเข้าถึง – รวมถึง Nova, Glance, Keystone และ Swift

OS_AUTH_URL=http://$SERVICE_HOST:5000/v3.0
KEYSTONECLIENT_DEBUG, NOVACLIENT_DEBUG
DEBUGชุดบรรทัดคำสั่งระดับการบันทึกของลูกค้า สิ่งเหล่านี้ถูกใส่ความคิดเห็นโดยค่าเริ่มต้น

# export KEYSTONECLIENT_DEBUG=1
# export NOVACLIENT_DEBUG=1

Minimal Configuration

ในขณะที่stack.shมีความสุขในการทำงานโดยไม่มีlocalrcส่วนใน local.confdevlife จะดีกว่าเมื่อมีตัวแปรขั้นต่ำเพียงไม่กี่ชุด นี่เป็นตัวอย่างของการกำหนดค่าขั้นต่ำที่สัมผัสกับค่าที่จำเป็นต้องตั้งค่าบ่อยที่สุด

  • ไม่มีการบันทึก
  • ตั้งค่ารหัสผ่านล่วงหน้าเพื่อป้องกันการแจ้งเตือนแบบโต้ตอบ
  • ย้ายเครือข่ายออกห่างจากเครือข่ายท้องถิ่น ( IPV4_ADDRS_SAFE_TO_USE และFLOATING_RANGEแสดงความคิดเห็นด้านล่าง)
  • ตั้งค่า IP โฮสต์หากการตรวจสอบไม่น่าเชื่อถือ ( HOST_IPแสดงความคิดเห็นด้านล่าง)
[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
#IPV4_ADDRS_SAFE_TO_USE=172.31.1.0/24
#FLOATING_RANGE=192.168.20.0/25
#HOST_IP=10.3.4.5

ถ้าตัวแปรไม่ได้ตั้งค่าที่นี่คุณจะได้รับแจ้งให้ป้อนค่าสำหรับพวกเขาโดย*_PASSWORDstack.shช่วงเครือข่ายต้องไม่ทับซ้อนกับเครือข่ายใด ๆ ที่ใช้งานบนโฮสต์ การทับซ้อนไม่ใช่เรื่องแปลกเนื่องจากช่วง ‘ส่วนตัว’ ของ RFC-1918 มักใช้สำหรับทั้งเครือข่ายท้องถิ่นและช่วงคงที่และลอยตัวของโนวา

HOST_IPโดยปกติจะถูกตรวจพบในการรันครั้งแรกstack.shแต่มักจะไม่สามารถระบุได้ในภายหลังการทำงานเนื่องจาก IP ที่ถูกย้ายจากอินเตอร์เฟส Ethernet ไปยังบริดจ์บนโฮสต์ การตั้งค่าที่นี่ยังทำให้สามารถopenrcตั้งค่าOS_AUTH_URLได้ HOST_IPไม่ได้ตั้งค่าเริ่มต้น

HOST_IPV6ตรวจพบตามปกติในการรันครั้งแรกstack.shแต่จะไม่ถูกตั้งค่าหากไม่มีที่อยู่ IPv6 ในอินเตอร์เฟสอีเทอร์เน็ตเริ่มต้น การตั้งค่าที่นี่ยังทำให้สามารถopenrcตั้งค่า   OS_AUTH_URLได้ HOST_IPV6ไม่ได้ตั้งค่าเริ่มต้น

สำหรับการกำหนดค่าสถาปัตยกรรมเฉพาะที่แตกต่างจากค่าเริ่มต้น x86 ที่นี่เห็นซุ้มประตูการกำหนดค่า

Historical Notes

DevStack ในอดีตได้รับการกำหนดค่าท้องถิ่นและการปรับแต่งจากlocalrcไฟล์ ในเดือนตุลาคม 2013 มี local.confการแนะนำวิธีการกำหนดค่า (ในการทบทวน 46768 ) เพื่อทำให้กระบวนการนี้ง่ายขึ้น