Created
January 7, 2019 16:20
-
-
Save cdent/98b2dba62af8b353bdfe089f4606b248 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Either install from pip if no $1, or $1 is a path or URL | |
# to an installable placement (such as a local cop of the | |
# repo). | |
PLACEMENT_LOCATION=${1:-openstack-placement} | |
# Make the virtualenv | |
python -m virtualenv -p python3 placetest | |
# Install placement and uwsgi | |
placetest/bin/pip install $PLACEMENT_LOCATION uwsgi | |
# Set basic configuration | |
export OS_API__AUTH_STRATEGY=noauth2 | |
# Note that using sqlite doesn't work well with concurrent | |
# requests. Use mysql or postgresql if that's important here. | |
export OS_PLACEMENT_DATABASE__CONNECTION=sqlite:///placetest/cats | |
# Sync the database to have the right tables because we don't | |
# have https://review.openstack.org/#/c/619050/ yet | |
placetest/bin/placement-manage db sync | |
# run uwsgi in the background with moderate horsepower | |
placetest/bin/uwsgi -H placetest --http :8000 \ | |
--wsgi-file placetest/bin/placement-api \ | |
--daemonize placetest/placement-api.log \ | |
--safe-pidfile placetest/uwsgi.pid \ | |
--master --processes 2 --threads 25 | |
# retrive the version doc | |
curl -s http://localhost:8000/ | |
echo | |
echo "placement at http://localhost:8000" | |
echo "log at placetest/placement-api.log" | |
echo "api-ref: https://developer.openstack.org/api-ref/placement/" | |
echo "running via uwsgi, stop with kill -INT $(cat placetest/uwsgi.pid)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment