Skip to content

Commit 567cc64

Browse files
committed
Update boot wait, update build functinoality
1 parent 9f94a64 commit 567cc64

File tree

3 files changed

+62
-34
lines changed

3 files changed

+62
-34
lines changed

bin/link-to-bento.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ New-Item -Path ..\bento\packer_templates\ubuntu\http\preseed-hyperv.cfg -ItemTyp
88
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace 'scripts/cleanup.sh','scripts/homestead.sh') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
99
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"memory": "1024"', '"memory": "2084"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
1010
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"disk_size": "65536"', '"disk_size": "131072"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
11+
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"boot_wait": "5s"', '"boot_wait": "10s"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
1112
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"type": "hyperv-iso",', '"type": "hyperv-iso","configuration_version": "9.0",') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json

bin/link-to-bento.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
sed -i '' 's/scripts\/cleanup.sh/scripts\/homestead.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
88
sed -i '' 's/"cpus": "1"/"cpus": "2"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
9+
sed -i '' 's/"boot_wait": "5s"/"boot_wait": "10s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
910
sed -i '' 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
1011
sed -i '' 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
1112
sed -i '' '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json

scripts/provision.sh

Lines changed: 60 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
export DEBIAN_FRONTEND=noninteractive
33
SKIP_PHP=false
44
SKIP_MYSQL=false
5+
SKIP_MARIADB=true
56
SKIP_POSTGRESQL=false
67

78
echo "### Settler Build Configuration ###"
89
echo "SKIP_PHP = ${SKIP_PHP}"
910
echo "SKIP_MYSQL = ${SKIP_MYSQL}"
11+
echo "SKIP_MARIADB = ${SKIP_MARIADB}"
1012
echo "SKIP_POSTGRESQL = ${SKIP_POSTGRESQL}"
1113
echo "### Settler Build Configuration ###"
1214

@@ -393,6 +395,7 @@ else
393395
/usr/local/bin/composer global require "laravel/installer=^4.0.2"
394396
/usr/local/bin/composer global require "laravel/spark-installer=dev-master"
395397
/usr/local/bin/composer global require "slince/composer-registry-manager=^2.0"
398+
/usr/local/bin/composer global require tightenco/takeout
396399
EOF
397400

398401
# Set Some PHP CLI Settings
@@ -511,6 +514,7 @@ apt-get install -y sqlite3 libsqlite3-dev
511514

512515
if "$SKIP_MYSQL"; then
513516
echo "SKIP_MYSQL is being used, so we're not installing MySQL"
517+
apt-get install -y mysql-client
514518
else
515519
# Install MySQL
516520
echo "mysql-server mysql-server/root_password password secret" | debconf-set-selections
@@ -524,38 +528,6 @@ bind-address = 0.0.0.0
524528
default_authentication_plugin = mysql_native_password
525529
EOF
526530

527-
# Install LMM for database snapshots
528-
apt-get install -y thin-provisioning-tools bc
529-
git clone https://github.com/Lullabot/lmm.git /opt/lmm
530-
sed -e 's/mysql/homestead-vg/' -i /opt/lmm/config.sh
531-
ln -s /opt/lmm/lmm /usr/local/sbin/lmm
532-
533-
# Create a thinly provisioned volume to move the database to. We use 64G as the
534-
# size leaving ~5GB free for other volumes.
535-
mkdir -p /homestead-vg/master
536-
sudo lvs
537-
lvcreate -L 64G -T homestead-vg/thinpool
538-
539-
# Create a 64GB volume for the database. If needed, it can be expanded with
540-
# lvextend.
541-
lvcreate -V64G -T homestead-vg/thinpool -n mysql-master
542-
mkfs.ext4 /dev/homestead-vg/mysql-master
543-
echo "/dev/homestead-vg/mysql-master\t/homestead-vg/master\text4\terrors=remount-ro\t0\t1" >> /etc/fstab
544-
mount -a
545-
chown mysql:mysql /homestead-vg/master
546-
547-
# Move the data directory and symlink it in.
548-
systemctl stop mysql
549-
mv /var/lib/mysql/* /homestead-vg/master
550-
rm -rf /var/lib/mysql
551-
ln -s /homestead-vg/master /var/lib/mysql
552-
553-
# Allow mysqld to access the new data directories.
554-
echo '/homestead-vg/ r,' >> /etc/apparmor.d/local/usr.sbin.mysqld
555-
echo '/homestead-vg/** rwk,' >> /etc/apparmor.d/local/usr.sbin.mysqld
556-
systemctl restart apparmor
557-
systemctl start mysql
558-
559531
# Configure MySQL Password Lifetime
560532
echo "default_password_lifetime = 0" >> /etc/mysql/mysql.conf.d/mysqld.cnf
561533

@@ -579,10 +551,64 @@ EOF
579551
character-set-server=utf8mb4
580552
collation-server=utf8mb4_bin
581553
EOL
554+
service mysql restart
555+
fi
556+
557+
if "$SKIP_MARIADB"; then
558+
echo "$SKIP_MARIADB is being used, so we're not installing MariaDB"
559+
else
560+
# Disable Apparmor
561+
# See https://github.com/laravel/homestead/issues/629#issue-247524528
562+
service apparmor stop
563+
update-rc.d -f apparmor remove
564+
565+
# Remove MySQL
566+
apt-get remove -y --purge mysql-server mysql-client mysql-common
567+
apt-get autoremove -y
568+
apt-get autoclean
582569

583-
# Add Timezone Support To MySQL
584-
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql --user=root --password=secret mysql
570+
rm -rf /var/lib/mysql/*
571+
rm -rf /var/log/mysql
572+
rm -rf /etc/mysql
573+
574+
# Add Maria PPA
575+
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
576+
577+
echo "mariadb-server mysql-server/data-dir select ''" | debconf-set-selections
578+
echo "mariadb-server mysql-server/root_password password secret" | debconf-set-selections
579+
echo "mariadb-server mysql-server/root_password_again password secret" | debconf-set-selections
580+
581+
mkdir /etc/mysql
582+
touch /etc/mysql/debian.cnf
583+
584+
# Install MariaDB
585+
apt-get install -y mariadb-server mariadb-client
586+
587+
# Configure Maria Remote Access and ignore db dirs
588+
sed -i "s/bind-address = 127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/mariadb.conf.d/50-server.cnf
589+
cat > /etc/mysql/mariadb.conf.d/50-server.cnf << EOF
590+
[mysqld]
591+
bind-address = 0.0.0.0
592+
ignore-db-dir = lost+found
593+
#general_log
594+
#general_log_file=/var/log/mysql/mariadb.log
595+
EOF
596+
597+
export MYSQL_PWD=secret
598+
599+
mysql --user="root" -e "GRANT ALL ON *.* TO root@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
585600
service mysql restart
601+
602+
mysql --user="root" -e "CREATE USER IF NOT EXISTS 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret';"
603+
mysql --user="root" -e "GRANT ALL ON *.* TO 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
604+
mysql --user="root" -e "GRANT ALL ON *.* TO 'homestead'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
605+
mysql --user="root" -e "FLUSH PRIVILEGES;"
606+
service mysql restart
607+
608+
mysql_upgrade --user="root" --verbose --force
609+
service mysql restart
610+
611+
unset MYSQL_PWD
586612
fi
587613

588614
if "$SKIP_POSTGRESQL"; then

0 commit comments

Comments
 (0)