commit
5fa1c98bbe
10
examples/cli/README
Normal file
10
examples/cli/README
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
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.
|
@ -1,61 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
function clean_local {
|
function deploy {
|
||||||
rm -rf /tmp/tmp*
|
# this two commands will clean db
|
||||||
rm /tmp/storage/* || true
|
solar resource clear_all
|
||||||
rm /tmp/connections.yaml || true
|
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
|
solar changes stage
|
||||||
echo > /tmp/state/commited_data || true
|
solar changes process
|
||||||
echo > /tmp/state/stage_log || true
|
solar orch run-once last
|
||||||
find /vagrant/solar/solar -name '*.pyc' -delete || true
|
solar orch report last
|
||||||
|
|
||||||
sudo docker stop $(sudo docker ps -q) || true
|
|
||||||
sudo docker rm $(sudo docker ps -qa) || true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deploy
|
||||||
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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user