Optimize Vagrant Mode #1579 (#1665)

This commit is contained in:
Christian Rotzoll 2020-10-14 01:31:27 +02:00 committed by rootzoll
parent 4e0b4f1675
commit b5816c7f79
14 changed files with 63 additions and 46 deletions

2
Vagrantfile vendored
View File

@ -3,7 +3,7 @@
Vagrant.configure('2') do |config|
config.vm.box = 'raspiblitz'
config.vm.box = 'rootzoll/raspiblitz'
config.vm.network "private_network", type: "dhcp"

View File

@ -14,11 +14,10 @@ On MacOS you need to install:
3. vagrant: `brew install vagrant`
4. virtualbox: `brew cask install virtualbox` (maybe re-run after you changed the requested secruity permission to be successfull)
```sha
```
cd alternative.platforms/amd64/packer
packer build raspiblitz.json
vagrant box add --force raspiblitz output/raspiblitz.box
vagrant box add --force rotzoll/raspiblitz output/raspiblitz.box
cd ../../..
```

View File

@ -1,26 +1,18 @@
#!/bin/bash
set -e
echo "************* Vagrant Provisioning ********************"
echo "************* Vagrant provisioning ********************"
echo 'Syncing local code with RaspiBlitzVM'
echo 'linking development files'
source_dir=/vagrant/home.admin
dest_dir=$HOME
# make sure the lastest sync script is in place
cp /vagrant/home.admin/XXsyncScripts.sh /home/admin/XXsyncScripts.sh
cd $source_dir
for f in *; do
if [ "$f" = "assets" ] ; then
continue
fi
# execute 'patch' command to sync laptop with VM
/home/admin/XXsyncScripts.sh -run
source_file="$source_dir/$f"
dest_file="$dest_dir/$f"
if [ -L $dest_file ] && [ "$(readlink "$dest_file")" = "$source_file" ]; then
continue
fi
rm -rf "$dest_file"
ln -s "$source_file" "$dest_file"
done
echo
echo "************* NEXT ********************"
echo "vagrant ssh --> ssh into your RaspiBlitzVM"
echo "vagrant provision --> trigger code sync from outside VM"
echo "patch --> trigger code sync from inside the VM"
echo

View File

@ -20,6 +20,20 @@ if [ ${isMounted} -eq 0 ] && [ ${#hddCandidate} -eq 0 ]; then
echo "***********************************************************"
echo "WARNING: NO HDD FOUND -> Shutdown, connect HDD and restart."
echo "***********************************************************"
vagrant=$(df | grep -c "/vagrant")
if [ ${vagrant} ]; then
echo "To connect a HDD data disk to your VagrantVM:"
echo "- shutdown VM with command: off"
echo "- open your VirtualBox GUI and select RaspiBlitzVM"
echo "- change the 'mass storage' settings"
echo "- add a second 'Primary Slave' drive to the already existing controller"
echo "- close VirtualBox GUI and run: vagrant up & vagrant ssh"
echo "***********************************************************"
echo "You can either create a new dynamic VDI with around 900GB or download"
echo "a VDI with a presynced blockchain to speed up setup. If you dont have 900GB"
echo "space on your laptop you can store the VDI file on an external drive."
echo "***********************************************************"
fi
exit
fi

0
home.admin/XXsendNotification.py Normal file → Executable file
View File

View File

@ -30,6 +30,7 @@ if [ "$1" == "info" ]; then
fi
# change branch if set as parameter
vagrant=0
clean=0
install=0
wantedBranch="$1"
@ -38,6 +39,12 @@ if [ "${wantedBranch}" = "-run" ]; then
# "-run" ist just used by "patch" command and will ignore all further parameter
wantedBranch="${activeBranch}"
wantedGitHubUser="${activeGitHubUser}"
# detect if running in vagrant VM
vagrant=$(df | grep -c "/vagrant")
if [ "$2" = "git" ]; then
echo "# forcing guthub over vagrant sync"
vagrant=0
fi
fi
if [ "${wantedBranch}" = "-clean" ]; then
clean=1
@ -57,7 +64,7 @@ if [ "${wantedBranch}" = "-justinstall" ]; then
fi
# set to another GutHub repo as origin
if [ ${#wantedGitHubUser} -gt 0 ]; then
if [ ${#wantedGitHubUser} -gt 0 ] && [ ${vagrant} -eq 0 ]; then
echo "# your active GitHubUser is: ${activeGitHubUser}"
echo "# your wanted GitHubUser is: ${wantedGitHubUser}"
if [ "${activeGitHubUser}" = "${wantedGitHubUser}" ]; then
@ -77,7 +84,7 @@ if [ ${#wantedGitHubUser} -gt 0 ]; then
fi
fi
if [ ${#wantedBranch} -gt 0 ]; then
if [ ${#wantedBranch} -gt 0 ] && [ ${vagrant} -eq 0 ]; then
echo "# your active branch is: ${activeBranch}"
echo "# your wanted branch is: ${wantedBranch}"
if [ "${wantedBranch}" = "${activeBranch}" ]; then
@ -109,11 +116,12 @@ if [ ${#wantedBranch} -gt 0 ]; then
fi
fi
origin=$(git remote -v | grep 'origin' | tail -n1)
checkSumBlitzPyBefore=$(find /home/admin/raspiblitz/home.admin/BlitzPy -type f -exec md5sum {} \; | md5sum)
checkSumBlitzTUIBefore=$(find /home/admin/raspiblitz/home.admin/BlitzTUI -type f -exec md5sum {} \; | md5sum)
echo "# *** SYNCING SHELL SCRIPTS WITH GITHUB ***"
if [ ${vagrant} -eq 0 ]; then
origin=$(git remote -v | grep 'origin' | tail -n1)
echo "# *** SYNCING RASPIBLITZ CODE WITH GITHUB ***"
echo "# This is for developing on your RaspiBlitz."
echo "# THIS IS NOT THE REGULAR UPDATE MECHANISM"
echo "# and can lead to dirty state of your scripts."
@ -122,13 +130,21 @@ echo "# BRANCH --> ${activeBranch}"
echo "# ******************************************"
git pull 1>&2
cd ..
else
cd ..
echo "# --> VAGRANT IS ACTIVE"
echo "# *** SYNCING RASPIBLITZ CODE WITH VAGRANT LINKED DIRECTORY ***"
echo "# This is for developing on your RaspiBlitz with a VM."
sudo rm -r /home/admin/raspiblitz
sudo cp -r /vagrant /home/admin/raspiblitz
sudo chown admin:admin -R /home/admin/raspiblitz
fi
if [ ${clean} -eq 1 ]; then
echo "# Cleaning scripts & assets/config.scripts"
echo "# Cleaning assets .. "
sudo rm -f *.sh
sudo rm -rf assets
mkdir assets
sudo rm -rf config.scripts
mkdir config.scripts
sudo -u admin mkdir assets
else
echo "# ******************************************"
echo "# NOT cleaning/deleting old files"
@ -137,16 +153,12 @@ else
fi
echo "# COPYING from GIT-Directory to /home/admin/"
sudo rm -r /home/admin/config.scripts
sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/*.* /home/admin
echo "# .."
sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/assets /home/admin
echo "# .."
sudo -u admin chmod +x /home/admin/*.sh
echo "# .."
sudo -u admin chmod +x /home/admin/*.py
echo "# .."
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
echo "# .."
sudo -u admin chmod +x /home/admin/config.scripts/*.py
echo "# ******************************************"

View File

View File

0
home.admin/config.scripts/blitz.subscriptions.py Normal file → Executable file
View File

0
home.admin/config.scripts/bonus.angular_cli.sh Normal file → Executable file
View File

0
home.admin/config.scripts/bonus.circuitbreaker.sh Normal file → Executable file
View File

0
home.admin/config.scripts/bonus.mempool.sh Normal file → Executable file
View File

0
home.admin/config.scripts/bonus.typescript.sh Normal file → Executable file
View File

0
home.admin/config.scripts/lnd.initwallet.py Normal file → Executable file
View File