Created
January 31, 2017 18:06
-
-
Save jimbaker/e74a7b98bc60519033fd455a22163ad2 to your computer and use it in GitHub Desktop.
Craton dev start script
This file contains 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
docker rm -f craton-api || true | |
docker build --pull -t craton-api:latest . | |
docker run -t --name craton-api -p 127.0.0.1:8080:8080 -d craton-api:latest | |
# wait until API server is available by probing it | |
until curl http://127.0.0.1:8080/v1/regions -H "Content-Type: application/json" -H "X-Auth-Token: demo" -H "X-Auth-User: demo" -H "X-Auth-Project: b9f10eca66ac4c279c139d01e65f96b4" | |
do | |
echo "Waiting for API server"; sleep 1 | |
done | |
sleep 1 | |
# run setup | |
python tools/generate_fake_data.py --url http://127.0.0.1:8080/v1 --user demo --project b9f10eca66ac4c279c139d01e65f96b4 --key demo | |
# verify something is now returned | |
curl http://127.0.0.1:8080/v1/regions -H "Content-Type: application/json" -H "X-Auth-Token: demo" -H "X-Auth-User: demo" -H "X-Auth-Project: b9f10eca66ac4c279c139d01e65f96b4" |
New deploy script, after https://review.openstack.org/#/c/443170/ merged:
Usage: source deploy-craton.sh
Then you can use the $CRATON_API_KEY
, '$CRATON_USERNAME, and
$CRATON_PROJECT_IDenvironment variables in your cURL commands or
$CRATON_HTTP_HEADERS` if you're using HTTPie.
#!/bin/bash
docker rm -f craton-api || true
docker build --pull -t craton-api:latest .
docker run -t --name craton-api -p 127.0.0.1:8080:7780 -d craton-api:latest
# wait until API server is available by probing it
until curl http://127.0.0.1:8080/v1/regions -H "Content-Type: application/json" -H "X-Auth-Token: demo" -H "X-Auth-User: demo" -H "X-Auth-Project: b9f10eca66ac4c279c139d01e65f96b4"
do
echo "Waiting for API server"; sleep 1
done
# sleep 1
# run setup
export CRATON_PROJECT_ID=$(docker logs --tail 10 craton-api | grep -i "projectid:" | grep -Eo '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
export CRATON_USERNAME=$(docker logs --tail 10 craton-api | grep -i "username:" | awk '{print $2}' | grep -Eo '[a-zA-Z0-9]*')
export CRATON_API_KEY=$(docker logs --tail 10 craton-api | grep -i "apikey:" | grep -Eo '[0-9a-f]{32}')
export CRATON_HTTP_HEADERS="x-auth-token:$CRATON_API_KEY x-auth-user:$CRATON_USERNAME x-auth-project:$CRATON_PROJECT_ID"
python tools/generate_fake_data.py --url http://127.0.0.1:8080/v1 --user "$CRATON_USERNAME" --project "$CRATON_PROJECT_ID" --key "$CRATON_API_KEY"
docker exec craton-api mysql -uroot -e "SET GLOBAL log_output = 'TABLE';SET GLOBAL general_log = 'ON';"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@thomasem, so this is only applicable if not running the top-level Dockerfile, which does a similar setup in its last command;
https://github.com/openstack/craton/blob/master/Dockerfile#L78
Here's a setup I run if trying out pieces more directly: