[openstack-dev] [Openstack] [TROVE] Manual Installation Again

Mark Kirkwood mark.kirkwood at catalyst.net.nz
Mon Mar 24 06:01:45 UTC 2014


I've outlined two methods here, both assume you are using devstack, so 
would need some editorializing for an actual deployment (userids, paths 
etc):

1/ diskimage builder + triplo

This essentially copies how trove-integration does it.

2/ Do it yourself install of required software in base image

This was my hope for a simpler method that needed fewer extra tools - it 
ended up being about a similar level of complexity I fear.

One difference between the two methods: 1/ installs mysql but rsyncs the 
trove software on 1st boot. 2/ installs mysql and trove in the image (so 
it starts up quicker). I guess an addition 3/ is possible where we 
install mysql on 1st boot and also the python deps + rsync trove 
software then too. This might make more sense when we have official pkgs 
for trove that we can just apt-get (and will pull in the right deps at 
that point).

I'm happy to add this to the review, but the text is quite bulky and 
maybe we need to decide which method is best (at the moment anyway)!

Cheers

Mark


On 17/03/14 22:37, tattabbum wrote:
> Hi Mark,
> have you some news about the right steps (Prepare Image) that are needed
> perform in order to launch a trove instance with a correctly configured
> trove-guest agent?
>
> As you, I have read all the trove-integration/script/redstack script to find
> the right commands to perform a manual trove installatio, and I have
> realized the gerrit review https://review.openstack.org/#/c/78608/.
> I would be happy if you could contribute to the review, particularly for the
> "Prepare Image" steps.
>

-------------- next part --------------
Method 1 - Building our own vm via diskimage builder and tripleo
----------------------------------------------------------------

Generate keys:

$ ssh-keygen [no passphrase]
$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys

Get custom tripleo elements for various db builds;

$ git clone https://github.com/openstack/trove-integration.git 
$ cp -rp trove-integration/scripts/files ~/scripts
$ rm -rf trove-integration

$ vi scripts/files/elements/fedora-guest/extra-data.d/20-guest-upstart
$ vi scripts/files/elements/ubuntu-guest/extra-data.d/20-guest-upstart 
[ s/REDSTACK_SCRIPTS/CUSTOM_SCRIPTS ]

Check out diskimage-builder and tripleo-image-elements,
so after ./stack.sh has run do:

$ cd /opt/stack
$ git clone git://git.openstack.org/openstack/diskimage-builder.git
$ git clone git://git.openstack.org/openstack/tripleo-image-elements.git

$ export CUSTOM_SCRIPTS=/home/stack/scripts
$ export ELEMENTS_PATH=$CUSTOM_SCRIPTS/files/elements:/opt/stack/tripleo-image-elements/elements
$ export HOMEDIR=/home/stack
$ export SSH_DIR=${HOMEDIR}/.ssh
$ export GUEST_USERNAME=stack
$ export HOST_USERNAME=stack
$ export NETWORK_GATEWAY=10.0.0.1
$ export SERVICE_TYPE=mysql
$ export GUEST_LOGDIR=/tmp
$ export ESCAPED_GUEST_LOGDIR=`echo $GUEST_LOGDIR | sed 's/\//\\\\\//g'`

$ export RELEASE=precise
$ export DIB_RELEASE=$RELEASE
$ export DIB_CLOUD_IMAGES=cloud-images.ubuntu.com

$ export PATH_TROVE=/opt/stack/trove
$ export ESCAPED_PATH_TROVE=`echo $PATH_TROVE | sed 's/\//\\\\\//g'`

$ /opt/stack/diskimage-builder/bin/disk-image-create \
    -a amd64 -o ubuntu_mysql \
    ubuntu vm heat-cfntools ubuntu-guest ubuntu-mysql


Method 2 - building own vm with minimal other tools
---------------------------------------------------

Generate keys:

$ ssh-keygen [no passphrase]
$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys

Get the ubuntu cloud image and set it up for easy access:

$ sudo apt-get install cloud-utils genisoimage

$ cd images
$ wget http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img
$ cat > my-user-data <<EOF
#cloud-config
password: password
chpasswd: { expire: False }
ssh_pwauth: True
EOF

$ cloud-localds my-seed.img my-user-data

Boot the vm see [1]

$ sudo kvm -net nic -net user -hda precise-server-cloudimg-amd64-disk1.img -hdb my-seed.img -m 512

(guest) $ sudo groupadd stack
(guest) $ sudo useradd -g stack -s /bin/bash -m stack
(guest) $ sudo mkdir -p /home/stack/.ssh
(guest) $ sudo chown -R stack:stack /home/stack
(guest) $ sudo chmod 700 /home/stack/.ssh
(guest) $ sudo -u stack rsync <host>:/home/stack/.ssh\* home/stack/.ssh
(guest) $ sudo -u stack rsync -a <host>:/opt/stack/trove /home/stack
(guest) $ sudo apt-get install libmysqlclient18 mysql-server-5.5 mysql-client-5.5 

(guest) $ sudo apt-get install python-dev libxml2-dev libxslt1-dev python-setuptools \
             python-pip python-sqlalchemy python-lxml python-routes python-eventlet \
             python-webob python-pastedeploy python-paste python-netaddr \
             python-httplib2 python-iso8601 python-pexpect python-mysqldb python-migrate

(guest) $ sudo pip install pip\>=1.4
(guest) $ sudo pip install http://tarballs.openstack.org/oslo.config/oslo.config-1.2.0a3.tar.gz\#egg=oslo.config-1.2.0a3

(guest) $ sudo pip install extras python-novaclient python-swiftclient python-cinderclient \
               'kombu>2.4.7' six babel python-heatclient passlib jinja2

(guest) $ sudo vi /etc/sudoers.d/60_trove_guest
(guest) $ cat /etc/sudoers.d/60_trove_guest
stack ALL=(ALL) NOPASSWD:ALL

(guest) $ sudo chmod 440 /etc/sudoers.d/60_trove_guest

(guest) $ sudo vi /etc/init/trove-guest.conf
(guest) $ cat /etc/init/trove-guest.conf
description "Trove Guest"
author "Auto-Gen"

start on (filesystem and net-device-up IFACE!=lo)
stop on runlevel [016]
chdir /var/run
pre-start script
    mkdir -p /var/run/trove
    chown stack:root /var/run/trove/

    mkdir -p /var/lock/trove
    chown stack:root /var/lock/trove/

    mkdir -p /tmp
    chown stack:root /tmp
    chmod +r /etc/guest_info
end script

exec su -c "/home/stack/trove/contrib/trove-guestagent --config-file=/etc/guest_info --config-file=/home/stack/trove/etc/trove/trove-guestagent.conf.sample" stack

(guest) $ sudo usermod -s /bin/false ubuntu
(guest) $ exit

Stop the guest, and make a compressed qcow2

$ qemu-img convert -f qcow2 -O qcow2 -c precise-server-cloudimg-amd64-disk1.img ubuntu_mysql.qcow2

Ready for upload via glance [2]
Notes

[1] May need to use additional options to make it easy to access vm:
      -net user,net=10.0.0.0/24,host=10.0.0.1,restrict=off 
    but reboot with defaults afterwards to avoid any odd settings persisting...
[2] Might want to shrink root volume 1st.



More information about the OpenStack-dev mailing list