Merge pull request #60 from CanonicalLtd/bug/1823179-no-longer-use-localhost

Updated microstack api endpoints from localhost to 10.20.20.1
This commit is contained in:
Ryan Beisner 2019-04-10 13:47:39 -05:00 committed by GitHub
commit d6d2bac24a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 86 additions and 60 deletions

View File

@ -19,7 +19,7 @@ To quickly configure networks and launch a vm, run `microstack.launch`.
This will launch an instance for you, and make it available to manage via the command line, or via the Horizon Dashboard.
To access the Dashboard, visit http://localhost in a web browser, and login with the following credentials:
To access the Dashboard, visit http://10.20.20.1 in a web browser, and login with the following credentials:
```
username: admin

View File

@ -11,9 +11,9 @@ systemctl restart snap.microstack.keystone-*
openstack user show admin || {
snap-openstack keystone-manage bootstrap \
--bootstrap-password $OS_PASSWORD \
--bootstrap-admin-url http://localhost:5000/v3/ \
--bootstrap-internal-url http://localhost:5000/v3/ \
--bootstrap-public-url http://localhost:5000/v3/ \
--bootstrap-admin-url http://10.20.20.1:5000/v3/ \
--bootstrap-internal-url http://10.20.20.1:5000/v3/ \
--bootstrap-public-url http://10.20.20.1:5000/v3/ \
--bootstrap-region-id microstack
}
@ -40,7 +40,7 @@ openstack service show compute || {
for endpoint in public internal admin; do
openstack endpoint create --region microstack \
compute $endpoint http://localhost:8774/v2.1 || :
compute $endpoint http://10.20.20.1:8774/v2.1 || :
done
}
@ -50,7 +50,7 @@ openstack service show placement || {
for endpoint in public internal admin; do
openstack endpoint create --region microstack \
placement $endpoint http://localhost:8778 || :
placement $endpoint http://10.20.20.1:8778 || :
done
}
@ -65,7 +65,7 @@ snap-openstack nova-manage db sync
systemctl restart snap.microstack.nova-*
while ! nc -z localhost 8774; do sleep 0.1; done;
while ! nc -z 10.20.20.1 8774; do sleep 0.1; done;
sleep 5
@ -99,7 +99,7 @@ openstack service show network || {
for endpoint in public internal admin; do
openstack endpoint create --region microstack \
network $endpoint http://localhost:9696 || :
network $endpoint http://10.20.20.1:9696 || :
done
}
@ -107,7 +107,7 @@ snap-openstack neutron-db-manage upgrade head
systemctl restart snap.microstack.neutron-*
while ! nc -z localhost 9696; do sleep 0.1; done;
while ! nc -z 10.20.20.1 9696; do sleep 0.1; done;
sleep 5
@ -148,7 +148,7 @@ openstack service show image || {
openstack service create --name glance --description "OpenStack Image" image
for endpoint in internal admin public; do
openstack endpoint create --region microstack \
image $endpoint http://localhost:9292 || :
image $endpoint http://10.20.20.1:9292 || :
done
}
@ -156,7 +156,7 @@ snap-openstack glance-manage db_sync
systemctl restart snap.microstack.glance*
while ! nc -z localhost 9292; do sleep 0.1; done;
while ! nc -z 10.20.20.1 9292; do sleep 0.1; done;
sleep 5

View File

@ -1,2 +1,2 @@
[database]
connection = mysql+pymysql://glance:glance@localhost/glance
connection = mysql+pymysql://glance:glance@10.20.20.1/glance

View File

@ -1,7 +1,7 @@
[keystone_authtoken]
auth_uri = http://localhost:5000
auth_url = http://localhost:5000
memcached_servers = localhost:11211
auth_uri = http://10.20.20.1:5000
auth_url = http://10.20.20.1:5000
memcached_servers = 10.20.20.1:11211
auth_type = password
project_domain_name = default
user_domain_name = default

View File

@ -1,2 +1,2 @@
[database]
connection = mysql+pymysql://keystone:keystone@localhost/keystone
connection = mysql+pymysql://keystone:keystone@10.20.20.1/keystone

View File

@ -1,3 +1,3 @@
[DEFAULT]
nova_metadata_ip = localhost
nova_metadata_ip = 10.20.20.1
metadata_proxy_shared_secret = supersecret

View File

@ -1,2 +1,2 @@
[database]
connection = mysql+pymysql://neutron:neutron@localhost/neutron
connection = mysql+pymysql://neutron:neutron@10.20.20.1/neutron

View File

@ -2,9 +2,9 @@
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://localhost:5000
auth_url = http://localhost:5000
memcached_servers = localhost:11211
auth_uri = http://10.20.20.1:5000
auth_url = http://10.20.20.1:5000
memcached_servers = 10.20.20.1:11211
auth_type = password
project_domain_name = default
user_domain_name = default

View File

@ -3,7 +3,7 @@ notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
[nova]
auth_url = http://localhost:5000
auth_url = http://10.20.20.1:5000
auth_type = password
project_domain_name = default
user_domain_name = default

View File

@ -1,5 +1,5 @@
[database]
connection = mysql+pymysql://nova:nova@localhost/nova
connection = mysql+pymysql://nova:nova@10.20.20.1/nova
[api_database]
connection = mysql+pymysql://nova_api:nova_api@localhost/nova_api
connection = mysql+pymysql://nova_api:nova_api@10.20.20.1/nova_api

View File

@ -1,2 +1,2 @@
[glance]
api_servers = http://localhost:9292
api_servers = http://10.20.20.1:9292

View File

@ -1,7 +1,7 @@
[keystone_authtoken]
auth_uri = http://localhost:5000
auth_url = http://localhost:5000
memcached_servers = localhost:11211
auth_uri = http://10.20.20.1:5000
auth_url = http://10.20.20.1:5000
memcached_servers = 10.20.20.1:11211
auth_type = password
project_domain_name = default
user_domain_name = default

View File

@ -1,7 +1,7 @@
[neutron]
url = http://localhost:9696
auth_url = http://localhost:5000
memcached_servers = localhost:11211
url = http://10.20.20.1:9696
auth_url = http://10.20.20.1:5000
memcached_servers = 10.20.20.1:11211
auth_type = password
project_domain_name = default
user_domain_name = default

View File

@ -4,6 +4,6 @@ project_domain_name = default
project_name = service
auth_type = password
user_domain_name = default
auth_url = http://localhost:5000
auth_url = http://10.20.20.1:5000
username = placement
password = placement

View File

@ -1,2 +1,2 @@
[DEFAULT]
transport_url = rabbit://openstack:rabbitmq@localhost
transport_url = rabbit://openstack:rabbitmq@10.20.20.1

View File

@ -36,7 +36,7 @@ WEBROOT = '/'
# with the list of host/domain names that the application can serve.
# For more information see:
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
#ALLOWED_HOSTS = ['horizon.example.com', ]
ALLOWED_HOSTS = ['10.20.20.1', 'localhost']
# Set SSL proxy settings:
# Pass this header from the proxy after terminating the SSL,

20
snap/hooks/configure vendored
View File

@ -9,19 +9,25 @@ sudo sysctl net.ipv4.ip_forward=1
echo "Creating OpenStack Databases"
# Wait for MySQL to startup
while ! nc -z localhost 3306; do sleep 0.1; done;
while ! nc -z 10.20.20.1 3306; do sleep 0.1; done;
sleep 5
# Wait for rabbitmq to start
while ! nc -z localhost 5672; do sleep 0.1; done;
while ! nc -z 10.20.20.1 5672; do sleep 0.1; done;
for db in neutron nova nova_api nova_cell0 cinder glance keystone; do
echo "CREATE DATABASE IF NOT EXISTS ${db}; GRANT ALL PRIVILEGES ON ${db}.* TO '${db}'@'localhost' IDENTIFIED BY '${db}';" \
echo "CREATE DATABASE IF NOT EXISTS ${db}; GRANT ALL PRIVILEGES ON ${db}.* TO '${db}'@'10.20.20.1' IDENTIFIED BY '${db}';" \
| mysql-start-client -u root
done
# Grant nova user access to cell0
echo "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'nova';" | mysql-start-client -u root
echo "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'10.20.20.1' IDENTIFIED BY 'nova';" | mysql-start-client -u root
# Endpoints from localhost -> 10.20.20.1
# TODO Rebuild database so that these are already set to 10.20.20.1,
# after lp:1824176 is addressed, and the process of building a new
# mysql.tar.xz is less fraught.
openstack endpoint list | grep localhost | while read line; do openstack endpoint set `echo $line | cut -d" " -f2` --url `echo $line | cut -d" " -f14 | sed 's/localhost/10.20.20.1/'`; done
# RabbitMQ
echo "Configuring RabbitMQ"
@ -37,12 +43,12 @@ HOME=$SNAP_COMMON/lib/rabbitmq rabbitmqctl set_permissions openstack ".*" ".*" "
# Glance
echo "Waiting for glance to start."
while ! nc -z localhost 9292; do sleep 0.1; done;
while ! nc -z 10.20.20.1 9292; do sleep 0.1; done;
sleep 5
# Wait for identity service
while ! nc -z localhost 5000; do sleep 0.1; done;
while ! nc -z 10.20.20.1 5000; do sleep 0.1; done;
openstack image show cirros || {
[ -f $HOME/images/cirros-0.3.5-x86_64-disk.img ] || {
@ -56,4 +62,4 @@ openstack image show cirros || {
}
# Wait for horizon
while ! nc -z localhost 80; do sleep 0.1; done;
while ! nc -z 10.20.20.1 80; do sleep 0.1; done;

View File

@ -17,7 +17,7 @@ environment:
OS_PROJECT_NAME: admin
OS_USERNAME: admin
OS_PASSWORD: keystone
OS_AUTH_URL: http://localhost:5000
OS_AUTH_URL: http://10.20.20.1:5000
OS_IDENTITY_API_VERSION: 3
OS_IMAGE_API_VERSION: 2
@ -612,8 +612,8 @@ parts:
- --target-list=x86_64-softmmu
override-build: |
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg.orig.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.33.debian.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.33.dsc
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.36.debian.tar.xz
wget http://archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu_2.5+dfsg-5ubuntu10.36.dsc
dpkg-source -x qemu_*.dsc
snapcraftctl build
organize:

View File

@ -6,4 +6,4 @@ set -ex
exit 0
microstack.mysql-client -u root -p$(`sudo cat /var/snap/microstack/common/log/error.log | grep "temporary password" | cut -d " " -f11`) --connect-expired-password | echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'fnord';"
microstack.mysql-client -u root -p$(`sudo cat /var/snap/microstack/common/log/error.log | grep "temporary password" | cut -d " " -f11`) --connect-expired-password | echo "ALTER USER 'root'@'10.20.20.1' IDENTIFIED BY 'fnord';"

View File

@ -64,4 +64,4 @@ while :; do
fi
done
echo "You can also visit the openstack dashboard at 'http://localhost/'"
echo "You can also visit the openstack dashboard at 'http://10.20.20.1/'"

View File

@ -20,8 +20,23 @@ multipass copy-files microstack_rocky_amd64.snap $MACHINE:
multipass exec $MACHINE -- \
sudo snap install --classic --dangerous microstack*.snap
# Run microstack.launch and wait for it to complete.
# Run microstack.launch
multipass exec $MACHINE -- /snap/bin/microstack.launch breakfast
# Verify that endpoints are setup correctly
# List of endpoints should contain 10.20.20.1
if ! multipass exec $MACHINE -- /snap/bin/microstack.openstack endpoint list | grep "10.20.20.1"; then
echo "Endpoints are not set to 10.20.20.1!";
exit 1;
fi
# List of endpoints should not contain localhost
if multipass exec $MACHINE -- /snap/bin/microstack.openstack endpoint list | grep "localhost"; then
echo "Endpoints are not set to 10.20.20.1!";
exit 1;
fi
# Verify that microstack.launch completed
IP=$(multipass exec $MACHINE -- /snap/bin/microstack.openstack server list | grep breakfast | cut -d" " -f9)
echo "Waiting for ping..."
PINGS=1
@ -29,18 +44,23 @@ MAX_PINGS=20
until multipass exec $MACHINE -- ping -c 1 $IP &>/dev/null; do
PINGS=$(($PINGS + 1));
if test $PINGS -gt $MAX_PINGS; then
break
echo "Unable to ping machine!";
exit 1;
fi
done;
# Verify that we can ping the machine, and ping from the machine to
# canonical.com (91.189.94.250).
# TODO no longer hard code canonical.com's IP address.
multipass exec $MACHINE -- ping -c 1 $IP;
sleep 5; # Sometimes the machine is still not quite ready. TODO better wait.
multipass exec $MACHINE -- \
ATTEMPTS=1
MAX_ATTEMPTS=20
until multipass exec $MACHINE -- \
ssh -oStrictHostKeyChecking=no -i .ssh/id_microstack cirros@$IP -- \
ping -c 1 91.189.94.250
ping -c 1 91.189.94.250; do
ATTEMPTS=$(($ATTEMPTS + 1));
if test $ATTEMPTS -gt $MAX_ATTEMPTS; then
echo "Unable to access Internet from machine!";
exit 1;
fi
sleep 5
done;
# Cleanup
unset IP

View File

@ -14,9 +14,9 @@ set -ex
MYSQL_PASSWORD=fnord # TODO use snapctl
MYSQL_TMP_PASSWORD=`sudo cat /var/snap/microstack/common/log/error.log | grep "temporary password" | cut -d " " -f11`
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'fnord';" | microstack.mysql-client -u root -p"$MYSQL_TMP_PASSWORD" --connect-expired-password
echo "ALTER USER 'root'@'10.20.20.1' IDENTIFIED BY 'fnord';" | microstack.mysql-client -u root -p"$MYSQL_TMP_PASSWORD" --connect-expired-password
echo "CREATE DATABASE IF NOT EXISTS keystone; GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';" | sudo microstack.mysql-client -u root -p"$MYSQL_PASSWORD"
echo "CREATE DATABASE IF NOT EXISTS keystone; GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'10.20.20.1' IDENTIFIED BY 'keystone';" | sudo microstack.mysql-client -u root -p"$MYSQL_PASSWORD"
sudo microstack.keystone-manage fernet_setup --keystone-user root --keystone-group root
sudo microstack.keystone-manage db_sync
@ -26,9 +26,9 @@ sudo systemctl restart snap.microstack.*
microstack.openstack user show admin || {
sudo microstack.keystone-manage bootstrap \
--bootstrap-password $OS_PASSWORD \
--bootstrap-admin-url http://localhost:5000/v3/ \
--bootstrap-internal-url http://localhost:5000/v3/ \
--bootstrap-public-url http://localhost:5000/v3/ \
--bootstrap-admin-url http://10.20.20.1:5000/v3/ \
--bootstrap-internal-url http://10.20.20.1:5000/v3/ \
--bootstrap-public-url http://10.20.20.1:5000/v3/ \
--bootstrap-region-id microstack
}