Skip to content

Instantly share code, notes, and snippets.

@aorjoa
Last active February 23, 2016 06:50
Show Gist options
  • Save aorjoa/198b535419e22c8ade23 to your computer and use it in GitHub Desktop.
Save aorjoa/198b535419e22c8ade23 to your computer and use it in GitHub Desktop.
Provision with Gattai
pk007server@localhost:~/WIP
$ cat provision.yml
---
machines:
node:
driver: aiyara
instances: 3
base-index: 1
base-address: 192.168.5.202/24
cluster-store: node-master
options:
aiyara-ip-address: $MACHINE_IP
aiyara-ssh-user: root
aiyara-ssh-key: $HOME/.ssh/id_rsa
aiyara-ssh-port: 22
engine-install-url: http://192.168.5.201
# post-provision:
# - docker network create -d overlay multihost
pre-provision:
- sshpass -p 1234
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
root@$MACHINE_IP 'mkdir ~/.ssh'
- cat ~/.ssh/id_rsa.pub | sshpass -p 1234
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
root@$MACHINE_IP 'cat > ~/.ssh/authorized_keys'
- cat os-release | sshpass -p 1234
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
root@$MACHINE_IP 'cat > /etc/os-release'
- sshpass -p 1234
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
root@$MACHINE_IP 'rm /var/log || mkdir /var/log'
node-master:
driver: aiyara
options:
aiyara-ip-address: 192.168.5.201
aiyara-ssh-user: root
aiyara-ssh-key: $HOME/.ssh/id_rsa
aiyara-ssh-port: 22
engine-install-url: http://192.168.5.201
pre-provision:
- sshpass -p 1234
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
[email protected] 'mkdir ~/.ssh'
- cat ~/.ssh/id_rsa.pub | sshpass -p 1234
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
[email protected] 'cat > ~/.ssh/authorized_keys'
- cat os-release | sshpass -p 1234
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
[email protected] 'cat > /etc/os-release'
post-provision:
- docker run -d --net=host --name=consul aiyara/consul:0.5.2
agent -data-dir /data
-client 192.168.5.201
-server -bootstrap-expect 1
@aorjoa
Copy link
Author

aorjoa commented Feb 22, 2016

first of all, i would like to initial gattai system via command $ gattai init
then copy above provision.yml to former provision,yml which come from gattai initial command.
after that make sure your /etc/os-release because it's use to provision driver (you must place file os-release side the provision.xml).

$ cat /etc/os-release
NAME="AiyaraOS"
VERSION="14.04.3 LTS,Trusty Tahr"
ID=aiyara
ID_LIKE=ubuntu
PRETTY_NAME="Ubuntu 14.04.3 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

$ gattai -D p node
$ gattai -D p node-master
$ gattai ls
NAME          DRIVER   STATE     URL
node-1        aiyara   Running   tcp://192.168.5.202:2376
node-2        aiyara   Running   tcp://192.168.5.203:2376
node-3        aiyara   Running   tcp://192.168.5.204:2376
node-master   aiyara   Running   tcp://192.168.5.201:2376
$ gattai cluster -i aiyara/swarm -m node-master node
Use discovery: consul://192.168.5.201:8500/node-master
Machine 'node-1' joined cluster...
Machine 'node-2' joined cluster...
Machine 'node-3' joined cluster...
Manager 'node-master' started successfully...
Active host is now set to 'node-master' (swarm).
$ gattai active -m node-master
node-master
$ gattai info
Containers: 3
Images: 7
Role: primary
Strategy: spread
Filters: health, port, dependency, affinity, constraint
Nodes: 3
 node-1: 192.168.5.202:2376
  └ Containers: 1
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 1.936 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=3.10.40-Aiyara-MK-IV, operatingsystem=Ubuntu 14.04.3 LTS, provider=aiyara, storagedriver=aufs
 node-2: 192.168.5.203:2376
  └ Containers: 1
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 1.936 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=3.10.40-Aiyara-MK-IV, operatingsystem=Ubuntu 14.04.3 LTS, provider=aiyara, storagedriver=aufs
 node-3: 192.168.5.204:2376
  └ Containers: 1
  └ Reserved CPUs: 0 / 1
  └ Reserved Memory: 0 B / 1.936 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=3.10.40-Aiyara-MK-IV, operatingsystem=Ubuntu 14.04.3 LTS, provider=aiyara, storagedriver=aufs
CPUs: 5
Total Memory: 5.809 GiB
Name: 5dae37b4645d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment