From 8b1673bde4f131890112f1c12aa88f7a6e24efd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Ole=C5=9B?= Date: Mon, 7 Sep 2015 21:23:14 +0000 Subject: [PATCH 1/3] Update CLI example --- examples/cli/README | 6 ++++ examples/cli/example.sh | 66 ++++++++--------------------------------- 2 files changed, 18 insertions(+), 54 deletions(-) create mode 100644 examples/cli/README diff --git a/examples/cli/README b/examples/cli/README new file mode 100644 index 00000000..ec1ed499 --- /dev/null +++ b/examples/cli/README @@ -0,0 +1,6 @@ +This example shows how to use solar via CLI. + +Usage +===== + +`./example.sh` diff --git a/examples/cli/example.sh b/examples/cli/example.sh index 1b16f316..3622c31e 100755 --- a/examples/cli/example.sh +++ b/examples/cli/example.sh @@ -1,61 +1,19 @@ #!/bin/bash set -eux -function clean_local { - rm -rf /tmp/tmp* - rm /tmp/storage/* || true - rm /tmp/connections.yaml || true +function deploy { + # this two commands will clean db + solar resource clear_all + solar connections clear_all - mkdir -p /tmp/state + solar resource create node1 /vagrant/resources/ro_node ip=10.0.0.3 ssh_user=vagrant ssh_key='/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key' + solar resource create mariadb1 /vagrant/resources/mariadb_service image=mariadb port=3306 + solar connect node1 mariadb1 - echo > /tmp/state/commit_log || true - echo > /tmp/state/commited_data || true - echo > /tmp/state/stage_log || true - find /vagrant/solar/solar -name '*.pyc' -delete || true - - sudo docker stop $(sudo docker ps -q) || true - sudo docker rm $(sudo docker ps -qa) || true + solar changes stage + solar changes process + solar orch run-once last + solar orch report last } - -function start { - solar profile -c -t env/test_env -i prf1 - solar discover - - solar assign -n 'node/node_2 | node/node_1' -r 'resources/docker' - solar assign -n 'node/node_1' -r 'resources/mariadb' - solar assign -n 'node/node_1' -r 'resources/keystone' - solar assign -n 'node/node_1' -r 'resources/haproxy' - solar assign -n 'node/node_1' -r 'resources/rabbitmq' - - solar connect --profile prf1 - - ./cli.py changes stage - ./cli.py changes commit -} - - -function scaleup { - solar assign -n 'node/node_2' -r 'resource/keystone_config' - solar assign -n 'node/node_2' -r 'resource/keystone_service' - - solar connect --profile prf1 - - ./cli.py changes stage - ./cli.py changes commit -} - - -function clean { - solar run -a remove -t 'resource/mariadb_service' || true - solar run -a remove -t 'resource/keystone_service' || true - solar run -a remove -t 'resource/haproxy_service' || true - solar run -a remove -t 'resource/rabbitmq_service' || true -} - -function clean_all { - clean - clean_local -} - -$1 +deploy From 6843f6dd960f6a0ed7218bd8e57583a33b57cb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Ole=C5=9B?= Date: Mon, 7 Sep 2015 21:30:05 +0000 Subject: [PATCH 2/3] Add `bash` to command --- examples/cli/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cli/README b/examples/cli/README index ec1ed499..c45f547c 100644 --- a/examples/cli/README +++ b/examples/cli/README @@ -3,4 +3,4 @@ This example shows how to use solar via CLI. Usage ===== -`./example.sh` +`bash ./example.sh` From 19a1538c0c57de6d3933a46263a5122df95f8409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Ole=C5=9B?= Date: Mon, 7 Sep 2015 21:33:35 +0000 Subject: [PATCH 3/3] Make README more user friendly --- examples/cli/README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/cli/README b/examples/cli/README index c45f547c..fa249101 100644 --- a/examples/cli/README +++ b/examples/cli/README @@ -3,4 +3,8 @@ This example shows how to use solar via CLI. Usage ===== +Run + `bash ./example.sh` + +after this you can run `solar orch report last` and wait until all tasks have status SUCCESS.