Run all openstack services in virtualenvs:

Python package dependency conflicts have been observed
to occur for certain combinations of services at certain
revision.

Running all services in virtualenvs removes the issue.

Change-Id: I100817569b43a5af3427b0ae20cebdc7d55d03a5
This commit is contained in:
Tim Miller 2013-04-01 14:55:15 -07:00
parent ff7eac3c65
commit ea57869d3e
3 changed files with 33 additions and 7 deletions

View File

@ -18,7 +18,10 @@ pre-start script
end script end script
respawn respawn
exec sudo -u $user $cmd $args
script
exec sudo -u $user /opt/stack/venvs/$user/bin/$cmd $args
end script
EOF EOF
} }

View File

@ -4,9 +4,32 @@ set -eux
pypi_mirror=http://pypi.openstack.org/ pypi_mirror=http://pypi.openstack.org/
pip_install="pip install -i $pypi_mirror " pip_install="pip install -i $pypi_mirror "
function python-install() {
local name=$1
local svc_root=$2
pushd /opt/stack/venvs
virtualenv --system-site-packages $name
popd
set +u
source /opt/stack/venvs/$name/bin/activate
set -u
[ -e $svc_root/tools/pip-requires ] && pip install -r $svc_root/tools/pip-requires
$pip_install $svc_root
set +u
deactivate
set -u
}
function install-os-service() { function install-os-service() {
local user=$1 local user=$1
local repo=$2 local repo=$(echo $2 | sed 's/github.com/review.openstack.org/')
local branch=$3 local branch=$3
id $user || useradd $user --system -d /var/run/$user -s /bin/false id $user || useradd $user --system -d /var/run/$user -s /bin/false
@ -19,16 +42,12 @@ function install-os-service() {
if [ ! -e $svc_root ]; then if [ ! -e $svc_root ]; then
git clone --depth=1 -b $branch $repo $svc_root git clone --depth=1 -b $branch $repo $svc_root
python-install $user $svc_root
[ -e $svc_root/tools/pip-requires ] && pip install -r $svc_root/tools/pip-requires
$pip_install $svc_root
else else
if ! git $git_dir remote -v | grep $repo; then if ! git $git_dir remote -v | grep $repo; then
echo "ERROR: $svc_root exists and did not come from $repo" echo "ERROR: $svc_root exists and did not come from $repo"
exit 1 exit 1
fi fi
# raise an error unless existing repo is at expected git-rev
actual_rev=$(git $git_dir show | head -1 | awk '{print $2}') actual_rev=$(git $git_dir show | head -1 | awk '{print $2}')
git $git_dir checkout $branch git $git_dir checkout $branch
expected_rev=$(git $git_dir show | head -1 | awk '{print $2}') expected_rev=$(git $git_dir show | head -1 | awk '{print $2}')

View File

@ -3,7 +3,11 @@ set -eux
install-packages python-pip install-packages python-pip
pip install -U distribute # required by virtualenv
pip install virtualenv
install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-install /usr/local/bin/os-svc-install install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-install /usr/local/bin/os-svc-install
install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-daemon /usr/local/bin/os-svc-daemon install -m 0755 -o root -g root $(dirname $0)/../bin/os-svc-daemon /usr/local/bin/os-svc-daemon
install -m 0755 -o root -g root $(dirname $0)/../bin/os-db-create /usr/local/bin/os-db-create install -m 0755 -o root -g root $(dirname $0)/../bin/os-db-create /usr/local/bin/os-db-create
install -m 0755 -o root -g root -d /opt/stack/venvs