cloud-computing/glusterfs/setup.sh

28 lines
882 B
Bash

#!/bin/bash
BASE_URL=https://git.cringe-studios.com/CringeStudios/cloud-computing/raw/branch/main/glusterfs
HOSTNAME=glusterfs-0
apt update
apt install -y docker docker-compose
hostnamectl set-hostname $HOSTNAME
systemctl enable --now docker
cd /home/ubuntu
wget -O docker-compose.yml $BASE_URL/docker-compose.yml
wget -O my.layout $BASE_URL/my.layout
sfdisk /dev/xvdb < my.layout
sleep 10
mkfs.ext4 /dev/xvdb1
echo "/dev/xvdb1 /data ext4 defaults 0 0" >> /etc/fstab
mkdir -p /data && mount -a && mkdir -p /data/gv0
docker-compose up -d
#sleep 5
#docker-compose exec -T glusterfs gluster peer probe 10.0.1.61
#docker-compose exec -T glusterfs gluster peer probe 10.0.1.62
#docker-compose exec -T glusterfs gluster volume create gv0 disperse 3 redundancy 1 10.0.1.60:/data/gv0 10.0.1.61:/data/gv0 10.0.1.62:/data/gv0
#docker-compose exec -T glusterfs gluster volume start gv0