Skip to content

Instantly share code, notes, and snippets.

@antonym
Created March 14, 2017 23:02
Show Gist options
  • Save antonym/12611a83d10e199f2458229890ae4362 to your computer and use it in GitHub Desktop.
Save antonym/12611a83d10e199f2458229890ae4362 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo Dropping craton database...
mysqladmin drop craton -f
echo Creating craton database...
mysql -uroot -e "CREATE DATABASE craton CHARACTER SET = 'utf8'"
mysql -uroot -e "GRANT ALL PRIVILEGES ON craton.* TO 'craton'@'%' IDENTIFIED BY 'craton'"
mysqladmin flush-privileges
echo Migrating craton database...
craton-dbsync --config-file=/etc/craton/craton-api.conf upgrade
bootstrap_output=`craton-dbsync --config-file=/etc/craton/craton-api.conf bootstrap`
echo Recreating all users and projects...
mysql -u root craton -e "INSERT into projects (created_at, updated_at, name, id) values (NOW(), NOW(), 'rax1', '717e9a216e2d44e0bc848398563bdada');"
mysql -u root craton -e "INSERT into users (created_at, updated_at, project_id, username, api_key, is_admin) values (NOW(), NOW(), '717e9a216e2d44e0bc848398563bdada', 'raxdemo1', 'raxdemo1', False);"
mysql -u root craton -e "INSERT into projects (created_at, updated_at, name, id) values (NOW(), NOW(), 'rax2', '717e9a216e2d44e0bc848398563bdadb');"
mysql -u root craton -e "INSERT into users (created_at, updated_at, project_id, username, api_key, is_admin) values (NOW(), NOW(), '717e9a216e2d44e0bc848398563bdadb', 'raxdemo2', 'raxdemo2', False);"
mysql -u root craton -e "INSERT into projects (created_at, updated_at, name, id) values (NOW(), NOW(), 'rax3', '717e9a216e2d44e0bc848398563bdadc');"
mysql -u root craton -e "INSERT into users (created_at, updated_at, project_id, username, api_key, is_admin) values (NOW(), NOW(), '717e9a216e2d44e0bc848398563bdadc', 'raxdemo3', 'raxdemo3', False);"
mysql -u root craton -e "INSERT into projects (created_at, updated_at, name, id) values (NOW(), NOW(), 'rax4', '717e9a216e2d44e0bc848398563bdadd');"
mysql -u root craton -e "INSERT into users (created_at, updated_at, project_id, username, api_key, is_admin) values (NOW(), NOW(), '717e9a216e2d44e0bc848398563bdadd', 'raxdemo4', 'raxdemo4', False);"
mysql -u root craton -e "INSERT into projects (created_at, updated_at, name, id) values (NOW(), NOW(), 'rax5', '717e9a216e2d44e0bc848398563bdade');"
mysql -u root craton -e "INSERT into users (created_at, updated_at, project_id, username, api_key, is_admin) values (NOW(), NOW(), '717e9a216e2d44e0bc848398563bdade', 'raxdemo5', 'raxdemo5', False);"
mysql -u root craton -e "INSERT into projects (created_at, updated_at, name, id) values (NOW(), NOW(), 'rax6', '717e9a216e2d44e0bc848398563bdadf');"
mysql -u root craton -e "INSERT into users (created_at, updated_at, project_id, username, api_key, is_admin) values (NOW(), NOW(), '717e9a216e2d44e0bc848398563bdadf', 'raxdemo6', 'raxdemo6', False);"
echo $bootstrap_output
craton cloud-create -n cloud
craton region-create -n region --cloud 1
craton cell-create -n cell --region 1 --cloud 1
craton host-create -n test -i 10.10.10.10 -r 1 --cloud 1 -c 1 -t server
craton host-show 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment