LAB project: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 3: | Line 3: | ||
=Diagram= | =Diagram= | ||
[[file:Infocepo.drawio.png]] | [[file:Infocepo.drawio.png]] | ||
==HA== | |||
I love COROSYNC/PACEMAKER, but for this LAB I wanted something from scratch: | |||
[[ha.sh#ha.sh code]] | |||
==My LAB tools== | |||
*DEBIAN (Generic OS) | |||
*x86&amd64 CPU (for ARM I will use QEMU emulator) | |||
*[https://app.diagrams.net/ Diagram editor] | |||
*MEDIAWIKI (sharing editor) | |||
*LXD/SNAP (container&virtual tool) | |||
*tcpdump (Network monitoring) | |||
*nmap (Network scanner) | |||
==Tested in this LAB== | |||
*NEXTCLOUD | |||
*This site is hosted on it. | |||
*KUBERNETES | |||
*MARIADB GALERA Cluster | |||
*OPENSTACK | |||
*PROMETHEUS | |||
*GLUSTERFS | |||
*KATA | |||
=ha.sh code= | ==DNS provider== | ||
*[http://www.namecheap.com Namecheap] | |||
==Production Infrastructure model== | |||
*[https://wikitech.wikimedia.org/wiki/Wikimedia_infrastructure Wikipedia] | |||
==IT salaries== | |||
*[http://jobsearchtech.about.com/od/educationfortechcareers/tp/HighestCerts.htm Top technical certifications] | |||
*[https://www.silkhom.com/barometre-2021-des-tjm-dans-informatique-digital/ IT] | |||
*[http://www.journaldunet.com/solutions/emploi-rh/salaire-dans-l-informatique-hays/ IT] | |||
==ha.sh code== | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
#!/bin/bash | #!/bin/bash | ||
Line 82: | Line 113: | ||
systemctl start kexec.target | systemctl start kexec.target | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== CV | ==My LAB tools== | ||
*DEBIAN (Generic OS) | |||
*x86&amd64 CPU (for ARM I will use QEMU emulator) | |||
*[https://app.diagrams.net/ Diagram editor] | |||
*MEDIAWIKI (sharing editor) | |||
*LXD/SNAP (container&virtual tool) | |||
*tcpdump (Network monitoring) | |||
*nmap (Network scanner) | |||
==DNS provider== | |||
*[http://www.namecheap.com Namecheap] | |||
== CV == | |||
[[CV_PACHECO]] | [[CV_PACHECO]] |
Revision as of 11:53, 26 February 2022
Resilient, low power and encrypted LAB CLOUD project.
Diagram
HA
I love COROSYNC/PACEMAKER, but for this LAB I wanted something from scratch: ha.sh#ha.sh code
My LAB tools
- DEBIAN (Generic OS)
- x86&amd64 CPU (for ARM I will use QEMU emulator)
- Diagram editor
- MEDIAWIKI (sharing editor)
- LXD/SNAP (container&virtual tool)
- tcpdump (Network monitoring)
- nmap (Network scanner)
Tested in this LAB
- NEXTCLOUD
- This site is hosted on it.
- KUBERNETES
- MARIADB GALERA Cluster
- OPENSTACK
- PROMETHEUS
- GLUSTERFS
- KATA
DNS provider
Production Infrastructure model
IT salaries
ha.sh code
#!/bin/bash
#pacheco at infocepo.com
echo "$(date): init"
#Clean
cd /share/admin &&./stopInfocepo.sh
#Screen off
vbetool dpms off
#If I was the master sleep a little !
ipPublic="$(dig +short myip.opendns.com @resolver1.opendns.com )"
ipMasterOld="$(nslookup infocepo.com |sed -rn 's#^Address: (.*)$#\1#p' )"
[ "${ipPublic}" = "${ipMasterOld}" ] &&sleep 240
#Wait master down (big loop)
while (nc -zw2 infocepo.com 443 >/dev/null 2>&1 ||(sleep 10 ;nc -zw4 infocepo.com 443 >/dev/null 2>&1 ) );do
if [ -z "$(find /root/ha_synced -type f -mmin -60 2>/dev/null )" ] ;then
# haUpdate="$(cd /share/admin ;./bisync.sh /share/admin/ /share/admin/ infocepo.com |grep -w ha.sh )"
# if [ ! -z "${haUpdate}" ] ;then
# echo "Alert! ha.sh updated"
# (bash -x /root/enable/ha.sh >>/var/log/ha.log 2>&1 )&
# kill -9 $$
# fi
rsync --numeric-ids --delete --force --modify-window=1 --ignore-errors --block-size=128.00K --inplace --no-whole-file \
-z --compress-level=9 \
-aAXxv \
--backup-dir=rsync-rollback/$(date '+%Y-%m-%d') \
--exclude=rsync-rollback \
--exclude=.rsync_* \
--rsh="ssh -i /root/.ssh/me@infocepo.com.key -p 1901 -oStrictHostKeyChecking=no" \
infocepo.com:/share/ /share/ &&touch /root/ha_synced
fi
sleep 10
done
#Maybe it's me down ! If INTERNET down, reboot
! ping -w2 -c1 wikipedia.org >/dev/null 2>&1 &&systemctl start kexec.target
#Become master
#Register DNS
ipMasterDown="$(nslookup infocepo.com |sed -rn 's#^Address: (.*)$#\1#p' )"
curl 'https://dynamicdns.park-your-domain.com/update?host=@&domain=infocepo.com&password='"$(cat /share/admin/.namecheap-password )"'&ip='"${ipPublic}"
#Random startup time
sleep $((RANDOM%10))
cd /share/admin &&./infocepoStart.sh &
#Wait DNS propagation
sleep $((240-25))
#Monitor
echo "$(date): up"
[ "${ipPublic}" = "${ipMasterDown}" ] &&ipMasterDown=""
while [ "${ipPublic}" = "$(nslookup infocepo.com |sed -rn 's#^Address: (.*)$#\1#p' )" ] \
&&( ! nc -zw2 "${ipMasterDown}" 443 >/dev/null 2>&1 ) \
&&(nc -zw2 "${ipPublic}" 443 >/dev/null 2>&1 ||nc -zw4 "${ipPublic}" 443 >/dev/null 2>&1 ) \
&&(nc -zw2 "${ipMasterDown}" 1901 >/dev/null 2>&1 ||ping -w2 -c1 debian.org >/dev/null 2>&1 ||ping -w2 -c1 wikipedia.org >/dev/null 2>&1 ) ;do
sleep 4
done
echo "$(date): down"
#Stop
cd /share/admin &&./stopInfocepo.sh
#Comment these lines for production
#if ping -w2 -c1 wikipedia.org >/dev/null 2>&1 ;then
# (bash -x /root/enable/ha.sh >>/var/log/ha.log 2>&1 )&
# kill -9 $$
#fi
#Reboot
systemctl start kexec.target
My LAB tools
- DEBIAN (Generic OS)
- x86&amd64 CPU (for ARM I will use QEMU emulator)
- Diagram editor
- MEDIAWIKI (sharing editor)
- LXD/SNAP (container&virtual tool)
- tcpdump (Network monitoring)
- nmap (Network scanner)