Skip to content

opensvc/vdc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#!/bin/bash

set -a

[[ ! -f /data/vdc/vdc.env ]] && {
    echo "Error : /data/vdc/vdc.env not found"
    exit 0
}

. /data/vdc/vdc.env

# network config
echo sudo nmcli c show
echo sudo nmcli d show

# create network config

# VDC_CLUSTER_IDX can go up to 255
VDC_CLUSTER_IDX=${VDC_CLUSTER_IDX:-"29"}

# to add new clusters id, update VDC_CLUSTER_IDX to the target value, and generate the commands

for cid in $(seq 0 $VDC_CLUSTER_IDX)
do
	for nid in 0 1 2
	do
		gw="10.${cid}.${nid}.1"
		br="br-${cid}-${nid}"
		dum="dum-${cid}-${nid}"
		if test "$gw" = "10.0.1.1" -o "$gw" = "10.0.2.1"
		then
			continue
		fi
		echo "# $br"
		echo sudo nmcli c del bridge-$br
		echo sudo nmcli c del dummy-$dum
		echo sudo ip link del $dum
		echo
		echo sudo nmcli c add type dummy ifname $dum con-name dummy-$dum
		echo sudo nmcli c mod dummy-$dum ipv4.method disabled
		echo sudo nmcli c add type bridge ifname $br con-name bridge-$br
		echo sudo nmcli c mod bridge-$br bridge.stp no
		echo sudo nmcli c mod dummy-$dum connection.master $br connection.slave-type bridge
		echo sudo nmcli c mod bridge-$br ipv4.method manual ipv4.addresses $gw/24
		echo sudo nmcli c up bridge-$br
		echo sudo nmcli c up dummy-$dum
	done
done

# sudo nmcli c add type ethernet ifname enp0s31f6 con-name enp0s31f6
# sudo nmcli c mod enp0s31f6 connection.master br-prd connection.slave-type bridge

# zpool create
echo
echo zpool create -f data /dev/disk/by-id/wwn-0x5000c500a8f5c148 
echo zpool add data cache /dev/disk/by-id/nvme-eui.0025385571b178e8-part3
echo zpool add data log /dev/disk/by-id/nvme-eui.0025385571b178e8-part4
echo zfs create data/vdc
echo zfs set canmount=noauto data/vdc
echo mount -t zfs data/vdc /data
echo "cd /data & git clone git+ssh://opensvc@www.opensvc.com/home/opensvc/vdc"

# libvirt pool create
echo mkdir -p /data/vdc/pool

# repos
echo sudo apt install yum-utils createrepo
    # centos7
    echo sudo mkdir -p /data/vdc/share/repos/centos/7/{base,centosplus,extras,updates}
    echo sudo mkdir -p /data/vdc/share/repos/epel/7
    echo sudo mkdir -p /data/vdc/share/repos/elrepo/7
    echo cd /data/vdc/share/repos
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=base \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/centos/7/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=extras \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/centos/7/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=updates \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/centos/7/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=epel7 \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/epel/7/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=elrepo7 \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/elrepo/7
    echo sudo createrepo /data/vdc/share/repos/centos/7/base/ -g comps.xml
    echo sudo createrepo /data/vdc/share/repos/centos/7/extras/
    echo sudo createrepo /data/vdc/share/repos/centos/7/updates/
    echo sudo createrepo /data/vdc/share/repos/epel/7/
    echo sudo createrepo /data/vdc/share/repos/elrepo/7/

    # centos8 (createrepo not needed)
    echo sudo mkdir -p /data/vdc/share/repos/centos/8/{BaseOS,extras,AppStream}
    echo sudo mkdir -p /data/vdc/share/repos/epel/8
    echo sudo mkdir -p /data/vdc/share/repos/elrepo/8
    echo cd /data/vdc/share/repos
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=BaseOS \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/centos/8/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=extras \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/centos/8/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=AppStream \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/centos/8/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=epel \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/epel/8/
    echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=elrepo8 \
      --newest-only --delete --downloadcomps --download-metadata \
      --download_path=/data/vdc/share/repos/elrepo/8
    echo sudo createrepo /data/vdc/share/repos/centos/8/BaseOS/ -g comps.xml
    echo sudo createrepo /data/vdc/share/repos/centos/8/extras/
    echo sudo createrepo /data/vdc/share/repos/centos/8/AppStream/
    echo sudo createrepo /data/vdc/share/repos/epel/8/
    echo sudo createrepo /data/vdc/share/repos/elrepo/8/


# provision lab vm
echo cd /data/vdc/build/lab
echo vagrant up --no-parallel

# unprovision lab vm
echo cd /data/vdc/build/lab
echo vagrant destroy

# vagrant/vbox survival guide
# ----------------------
# vagrant up --debug &> vagrant.log
# vboxmanage showvminfo vm-name
# vboxmanage list hdds      # liste les disques de la database vagrant
# vboxmanage closemedium disk eb42735a-980c-4da5-9ae4-95c5ff48b1bb --delete  # retire un disque de la database vagrant

# vbox upgrade
# ----------------------
# stop all running vms
# apt install ./virtualbox-6.0_6.0.12-133076~Ubuntu~bionic_amd64.deb
# check with vboxmanage --version
# vboxmanage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-6.0.12.vbox-extpack

# openssl latest version build centos7
# sudo yum install libtool perl-core zlib-devel -y
# curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz
# tar xzf OpenSSL_1_1_1c.tar.gz -C /opt
# cd /opt/openssl-OpenSSL_1_1_1c
# ./config --prefix=/opt/openssl --openssldir=/usr/local/ssl
# make && make test && make install
# tar czvf /root/openssl.osvc.tar.gz /opt/openssl /usr/local/ssl
# echo "pathmunge /opt/openssl/bin" > /etc/profile.d/openssl.sh
# echo "/opt/openssl/lib" > /etc/ld.so.conf.d/openssl-1.1.1c.conf && ldconfig -v

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •