microstack/snap/hooks/post-refresh
Pete Vander Giessen 1a25e50a17 Made horizon, rabbit and mysql ports configurable
Addresses requests to make it easier to avoid conflicts between the
Horizon dashboard and http services that might already be running on
the machine.

Configurable via snap config. Exposing via arguments to .init and
testing post init configuration is left for a separate PR.

Eventually, these may move to non standard ports by default. This PR
sets the stage for that, but further discussion is needed before we
decide whether to implement.

(This commit also contains a sneaky fix for the username display at the
end of the launch script.)

Closes-Bug: 1814829
Change-Id: If728d6ec8024bca4d3e809637fbdcc03ed4e6934
2019-11-27 15:27:54 +00:00

34 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -ex
if [ -z "$(snapctl get config)" ]; then
# [2019-11-15] Handle build 171 (beta) -> 182
# We are upgrading from a version of the snap from before we put all
# config values under a config tree. Set the default values now (the
# old values were not documented, and we assume that they were not
# set).
set-default-config
# Make a place for our horizon config overrides to live. We piggy
# back on the above check, because the changes were made
# concurrently.
mkdir -p ${SNAP_COMMON}/etc/horizon/local_settings.d
fi
# Add default ports for mysql, rabbit and dashboard services.
# [2019-11-21] build 171 (beta) -> master
if [ -z "$(snapctl get config.network.ports.dashboard)" ]; then
snapctl set config.network.ports.dashboard=80
fi
if [ -z "$(snapctl get config.network.ports.mysql)" ]; then
snapctl set config.network.ports.mysql=3306
fi
if [ -z "$(snapctl get config.network.ports.rabbit)" ]; then
snapctl set config.network.ports.rabbit=5672
fi
snap-openstack setup # Write any template changes.