Skip to content

Commit 468d453

Browse files
authored
14x (#249)
Ubuntu 22.04 PHP 8.3 Default Add Golang to base box Remove Drush Launcher Remove Drupal Launcher Replace MailHog with Mailpit
1 parent 2b9d4fb commit 468d453

File tree

4 files changed

+204
-110
lines changed

4 files changed

+204
-110
lines changed

Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
Vagrant.configure("2") do |config|
6-
config.vm.box = "bento/ubuntu-20.04"
6+
config.vm.box = "bento/ubuntu-22.04"
77
config.vm.provider "parallels" do |v|
88
v.memory = 4096
99
v.cpus = 4

bin/link-to-bento.sh

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
#!/usr/bin/env bash
22

3-
/bin/ln -f scripts/amd64.sh ../bento/packer_templates/ubuntu/scripts/homestead.sh
4-
/bin/ln -f scripts/arm.sh ../bento/packer_templates/ubuntu/scripts/homestead-arm.sh
5-
/bin/ln -f http/preseed.cfg ../bento/packer_templates/ubuntu/http
6-
/bin/ln -f http/preseed-hyperv.cfg ../bento/packer_templates/ubuntu/http
3+
/bin/ln -f scripts/amd64.sh ../bento/packer_templates/scripts/ubuntu/homestead_amd64.sh
4+
/bin/ln -f scripts/arm.sh ../bento/packer_templates/scripts/ubuntu/homestead_arm.sh
75

8-
sed -i 's/scripts\/cleanup.sh/scripts\/homestead.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
9-
sed -i 's/"cpus": "1"/"cpus": "2"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
10-
sed -i 's/"boot_wait": "5s"/"boot_wait": "3s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
11-
sed -i 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
12-
sed -i 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
13-
sed -i '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
6+
echo " " > ../bento/packer_templates/scripts/_common/motd.sh
7+
sed -i 's/${var.os_name}\/cleanup_${var.os_name}.sh/ubuntu\/homestead_amd64.sh/' ../bento/packer_templates/pkr-builder.pkr.hcl
8+
# Set disk_size
9+
sed -i 's/65536/524288/' ../bento/packer_templates/pkr-variables.pkr.hcl
1410

15-
# Run for ARM
16-
sed -i 's/scripts\/cleanup.sh/scripts\/homestead-arm.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
17-
sed -i 's/"boot_wait": "5s"/"boot_wait": "3s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
18-
sed -i 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
19-
sed -i 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
20-
sed -i '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
11+
12+
13+
#sed -i 's/scripts\/cleanup.sh/scripts\/homestead.sh/' ../packer_templates/pkr-builder.pkr.hcl
14+
#sed -i 's/"cpus": "1"/"cpus": "2"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
15+
#sed -i 's/"boot_wait": "5s"/"boot_wait": "3s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
16+
#sed -i 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
17+
#sed -i 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
18+
#sed -i '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
19+
20+
## Run for ARM
21+
#sed -i 's/scripts\/cleanup.sh/scripts\/homestead-arm.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
22+
#sed -i 's/"boot_wait": "5s"/"boot_wait": "3s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
23+
#sed -i 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
24+
#sed -i 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
25+
#sed -i '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json

scripts/amd64.sh

Lines changed: 90 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ ca-certificates
3131

3232
# Install Some PPAs
3333
apt-add-repository ppa:ondrej/php -y
34-
apt-add-repository ppa:chris-lea/redis-server -y
3534

3635
# NodeJS
37-
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
36+
sudo mkdir -p /etc/apt/keyrings
37+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
38+
NODE_MAJOR=21
39+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
3840

3941
# PostgreSQL
40-
tee /etc/apt/sources.list.d/pgdg.list <<END
41-
deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main
42-
END
43-
44-
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
42+
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
43+
# Import the repository signing key:
44+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ACCC4CF8
45+
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
4546

4647
## Update Package Lists
4748
apt-get update -y
@@ -61,7 +62,7 @@ usermod -aG docker vagrant
6162

6263
# Install docker-compose
6364
curl \
64-
-L "https://github.com/docker/compose/releases/download/2.10.1/docker-compose-$(uname -s)-$(uname -m)" \
65+
-L "https://github.com/docker/compose/releases/download/2.23.0/docker-compose-$(uname -s)-$(uname -m)" \
6566
-o /usr/local/bin/docker-compose
6667
chmod +x /usr/local/bin/docker-compose
6768

@@ -444,11 +445,11 @@ else
444445
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.2/cli/php.ini
445446

446447
# Configure Xdebug
447-
echo "xdebug.mode = debug" >> /etc/php/8.2/mods-available/xdebug.ini
448-
echo "xdebug.discover_client_host = true" >> /etc/php/8.2/mods-available/xdebug.ini
449-
echo "xdebug.client_port = 9003" >> /etc/php/8.2/mods-available/xdebug.ini
450-
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.2/mods-available/xdebug.ini
451-
echo "opcache.revalidate_freq = 0" >> /etc/php/8.2/mods-available/opcache.ini
448+
echo "xdebug.mode = debug" >> /etc/php/8.2/mods-available/xdebug.ini
449+
echo "xdebug.discover_client_host = true" >> /etc/php/8.2/mods-available/xdebug.ini
450+
echo "xdebug.client_port = 9003" >> /etc/php/8.2/mods-available/xdebug.ini
451+
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.2/mods-available/xdebug.ini
452+
echo "opcache.revalidate_freq = 0" >> /etc/php/8.2/mods-available/opcache.ini
452453

453454
# Configure php.ini for FPM
454455
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.2/fpm/php.ini
@@ -473,6 +474,51 @@ else
473474

474475
touch /home/vagrant/.homestead-features/php82
475476

477+
# PHP 8.3
478+
apt-get install -y --allow-change-held-packages \
479+
php8.3 php8.3-bcmath php8.3-bz2 php8.3-cgi php8.3-cli php8.3-common php8.3-curl php8.3-dba php8.3-dev \
480+
php8.3-enchant php8.3-fpm php8.3-gd php8.3-gmp php8.3-imap php8.3-interbase php8.3-intl php8.3-ldap \
481+
php8.3-mbstring php8.3-mysql php8.3-odbc php8.3-opcache php8.3-pgsql php8.3-phpdbg php8.3-pspell php8.3-readline \
482+
php8.3-snmp php8.3-soap php8.3-sqlite3 php8.3-sybase php8.3-tidy php8.3-xml php8.3-xsl \
483+
php8.3-zip
484+
# php8.3-imagick php8.3-memcached php8.3-redis php8.3-xmlrpc php8.3-xdebug
485+
486+
# Configure php.ini for CLI
487+
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/cli/php.ini
488+
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/cli/php.ini
489+
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/cli/php.ini
490+
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/cli/php.ini
491+
492+
# Configure Xdebug
493+
# echo "xdebug.mode = debug" >> /etc/php/8.3/mods-available/xdebug.ini
494+
# echo "xdebug.discover_client_host = true" >> /etc/php/8.3/mods-available/xdebug.ini
495+
# echo "xdebug.client_port = 9003" >> /etc/php/8.3/mods-available/xdebug.ini
496+
# echo "xdebug.max_nesting_level = 512" >> /etc/php/8.3/mods-available/xdebug.ini
497+
# echo "opcache.revalidate_freq = 0" >> /etc/php/8.3/mods-available/opcache.ini
498+
499+
# Configure php.ini for FPM
500+
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/fpm/php.ini
501+
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/fpm/php.ini
502+
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.3/fpm/php.ini
503+
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/fpm/php.ini
504+
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.3/fpm/php.ini
505+
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.3/fpm/php.ini
506+
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/fpm/php.ini
507+
508+
printf "[openssl]\n" | tee -a /etc/php/8.3/fpm/php.ini
509+
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini
510+
printf "[curl]\n" | tee -a /etc/php/8.3/fpm/php.ini
511+
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini
512+
513+
# Configure FPM
514+
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
515+
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
516+
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
517+
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
518+
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.3/fpm/pool.d/www.conf
519+
520+
touch /home/vagrant/.homestead-features/php8.3
521+
476522
# Disable old PHP FPM
477523
systemctl disable php5.6-fpm
478524
systemctl disable php7.0-fpm
@@ -482,10 +528,11 @@ else
482528
systemctl disable php7.4-fpm
483529
systemctl disable php8.0-fpm
484530
systemctl disable php8.1-fpm
531+
systemctl disable php8.2-fpm
485532

486-
update-alternatives --set php /usr/bin/php8.2
487-
update-alternatives --set php-config /usr/bin/php-config8.2
488-
update-alternatives --set phpize /usr/bin/phpize8.2
533+
update-alternatives --set php /usr/bin/php8.3
534+
update-alternatives --set php-config /usr/bin/php-config8.3
535+
update-alternatives --set phpize /usr/bin/phpize8.3
489536

490537
# Install Composer
491538
curl -sS https://getcomposer.org/installer | php
@@ -505,7 +552,7 @@ EOF
505552
sed -i "s/www-data/vagrant/" /etc/apache2/envvars
506553

507554
# Enable FPM
508-
a2enconf php8.2-fpm
555+
a2enconf php8.3-fpm
509556

510557
# Assume user wants mode_rewrite support
511558
sudo a2enmod rewrite
@@ -571,7 +618,7 @@ EOF
571618
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.0/fpm/pool.d/www.conf
572619

573620
service nginx restart
574-
service php8.2-fpm restart
621+
service php8.3-fpm restart
575622

576623
# Add Vagrant User To WWW-Data
577624
usermod -a -G www-data vagrant
@@ -583,17 +630,6 @@ EOF
583630
chmod +x wp-cli.phar
584631
mv wp-cli.phar /usr/local/bin/wp
585632

586-
# Install Drush Launcher.
587-
curl --silent --location https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar --output drush.phar
588-
chmod +x drush.phar
589-
mv drush.phar /usr/local/bin/drush
590-
drush self-update
591-
592-
# Install Drupal Console Launcher.
593-
curl --silent --location https://drupalconsole.com/installer --output drupal.phar
594-
chmod +x drupal.phar
595-
mv drupal.phar /usr/local/bin/drupal
596-
597633
# Add Composer Global Bin To Path
598634
printf "\nPATH=\"$(sudo su - vagrant -c 'composer config -g home 2>/dev/null')/vendor/bin:\$PATH\"\n" | tee -a /home/vagrant/.profile
599635
fi
@@ -736,25 +772,40 @@ service redis-server start
736772
# Configure Beanstalkd
737773
sed -i "s/#START=yes/START=yes/" /etc/default/beanstalkd
738774

739-
# Install & Configure MailHog
740-
wget --quiet -O /usr/local/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64
741-
chmod +x /usr/local/bin/mailhog
742-
sudo tee /etc/systemd/system/mailhog.service <<EOL
775+
# Install Golang
776+
if [[ "$ARCH" == "aarch64" ]]; then
777+
GOLANG_LATEST_STABLE_VERSION=$(curl https://go.dev/dl/?mode=json | grep -o 'go.*.linux-arm64.tar.gz' | head -n 1 | tr -d '\r\n')
778+
wget https://dl.google.com/go/${GOLANG_LATEST_STABLE_VERSION} -O golang.tar.gz
779+
else
780+
GOLANG_LATEST_STABLE_VERSION=$(curl https://go.dev/dl/?mode=json | grep -o 'go.*.linux-amd64.tar.gz' | head -n 1 | tr -d '\r\n')
781+
wget https://dl.google.com/go/${GOLANG_LATEST_STABLE_VERSION} -O golang.tar.gz
782+
fi
783+
784+
tar -C /usr/local -xzf golang.tar.gz go
785+
printf "\nPATH=\"/usr/local/go/bin:\$PATH\"\n" | tee -a /home/vagrant/.profile
786+
rm -rf golang.tar.gz
787+
788+
# Install & Configure Mailpit
789+
curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh | bash
790+
chmod +x /usr/local/bin/mailpit
791+
tee /etc/systemd/system/mailpit.service <<EOL
743792
[Unit]
744-
Description=Mailhog
793+
Description=Mailpit
745794
After=network.target
746795
747796
[Service]
748797
User=vagrant
749-
ExecStart=/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &
798+
StandardOutput=journal
799+
StandardError=journal
800+
ExecStart=/usr/bin/env /usr/local/bin/mailpit
750801
751802
[Install]
752803
WantedBy=multi-user.target
753804
EOL
754805

755-
sudo systemctl daemon-reload
756-
sudo systemctl enable mailhog
757-
sudo service mailhog restart
806+
systemctl daemon-reload
807+
systemctl enable mailpit
808+
service mailpit restart
758809

759810
# Configure Supervisor
760811
systemctl enable supervisor.service
@@ -812,7 +863,7 @@ apt-get -y purge ppp pppconfig pppoeconf
812863
sed -i "s/^makestep.*/makestep 1 -1/" /etc/chrony/chrony.conf
813864

814865
# Delete oddities
815-
apt-get -y purge popularity-contest installation-report command-not-found friendly-recovery laptop-detect
866+
apt-get -y purge popularity-contest command-not-found friendly-recovery laptop-detect
816867

817868
# Exlude the files we don't need w/o uninstalling linux-firmware
818869
echo "==> Setup dpkg excludes for linux-firmware"

0 commit comments

Comments
 (0)