Skip to content

Commit

Permalink
devops: update doc and script
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0Vu committed May 30, 2024
1 parent 2144ed6 commit 62ee579
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
18 changes: 18 additions & 0 deletions devops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PROVIDER=0
ERROR=0
CONFIGDIR=$(pwd)
BINARYDIR=$(pwd)
STOPONLY=0

while [ $# -gt 0 ]; do
case "$1" in
Expand All @@ -25,6 +26,10 @@ while [ $# -gt 0 ]; do
--binarydir)
BINARYDIR="$2"
shift
;;
--stoponly)
STOPONLY=1
shift
;;
*)
echo "Illegal option $1"
Expand All @@ -47,6 +52,7 @@ Available options:
--provider update provider
--configdir config directory
--binarydir binary directory
--stoponly stop service
EOF
exit 1
}
Expand Down Expand Up @@ -76,6 +82,10 @@ main () {
stopRemoteService "providernet"
stopRemoteService "sentrynet"

if [ $STOPONLY = 1 ]; then
exit 0
fi

echo "upload binary files"
ansible-playbook -i testnet/remote/ansible/inventory/digital_ocean.py -l sentrynet testnet/remote/ansible/config.yml -e CONFIGDIR=$CONFIGDIR -e BINARY=$BINARYDIR/katzenmint
if [ $? -ne 0 ]; then
Expand All @@ -90,6 +100,10 @@ main () {
stopRemoteService "mixnet"
fi

if [ $STOPONLY = 1 ]; then
exit 0
fi

echo "upload binary files"
ansible-playbook -i testnet/remote/ansible/inventory/digital_ocean.py -l mixnet testnet/remote/ansible/config.yml -e CONFIGDIR=$CONFIGDIR -e BINARY=$BINARYDIR/meson-server
if [ $? -ne 0 ]; then
Expand All @@ -104,6 +118,10 @@ main () {
stopRemoteService "providernet"
fi

if [ $STOPONLY = 1 ]; then
exit 0
fi

echo "upload binary files"
ansible-playbook -i testnet/remote/ansible/inventory/digital_ocean.py -l providernet testnet/remote/ansible/config.yml -e CONFIGDIR=$CONFIGDIR -e BINARY=$BINARYDIR
if [ $? -ne 0 ]; then
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/
##### Meson mix services

* create droplets on Digital Ocean
* go to `docker/remote/terraform`
* go to `testnetremote/terraform`
* apply terraform config`terraform apply -var DO_API_TOKEN="$DO_API_TOKEN" -var SSH_KEY_FILE="$SSH_KEY_FILE"`
* remove droplets on Digital Ocean
* go to `docker/remote/terraform`
* go to `testnetremote/terraform`
* `terraform destroy -var DO_API_TOKEN="$DO_API_TOKEN" -var SSH_KEY_FILE="$SSH_KEY_FILE"`
> if you want to remove specific droplet, added -target: -target="module.cluster.digitalocean_droplet.cluster[3]"
* katzenmint-pki
* go to `docker/remote/ansible`
* go to `testnetremote/ansible`
* install the service `ansible-playbook -i inventory/digital_ocean.py -l sentrynet install.yml`
* upload config and binary `ansible-playbook -i inventory/digital_ocean.py -l sentrynet config.yml -e CONFIGDIR=/path/to/config/directory -e BINARY=/path/to/binary`
* mix
* go to `docker/remote/ansible`
* go to `testnetremote/ansible`
* install the service `ansible-playbook -i inventory/digital_ocean.py -l mixnet install.yml`
* upload config and binary `ansible-playbook -i inventory/digital_ocean.py -l mixnet config.yml -e CONFIGDIR=/path/to/config/directory -e BINARY=/path/to/binary`
* provider
* go to `docker/remote/ansible`
* go to `testnetremote/ansible`
* install the service `ansible-playbook -i inventory/digital_ocean.py -l providernet install.yml`
* upload config and binary `ansible-playbook -i inventory/digital_ocean.py -l providernet config.yml -e CONFIGDIR=/path/to/config/directory -e BINARYDIR=/path/to/binary/directory`

0 comments on commit 62ee579

Please sign in to comment.