Skip to content

Commit

Permalink
13x - Ubuntu 20.04, PHP 8.2, PostgreSQL 15, Node 18 (#242)
Browse files Browse the repository at this point in the history
* Fix boot timeouts
* Add PHP 8.2, set up and use ~/.homestead=features
* Update Node and PostgreSQL
* Update docker compose
* upgrade to Node 18 (#241)
* Node 18 has been promoted to LTS. https://nodejs.org/en/blog/release/v18.12.0/
* Updates for release
* Postgresql 15
* Fix postgresql
  • Loading branch information
svpernova09 authored Jan 4, 2023
1 parent 86bace7 commit 1f78d8c
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-20.04"
config.vm.provider "virtualbox" do |v|
config.vm.provider "parallels" do |v|
v.memory = 4096
v.cpus = 4
end
Expand Down
2 changes: 1 addition & 1 deletion bin/link-to-bento.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ New-Item -Path ..\bento\packer_templates\ubuntu\http\preseed-hyperv.cfg -ItemTyp
((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
((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
((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
# ((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
((Get-Content -path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json -Raw) -replace '"boot_wait": "5s"', '"boot_wait": "3s"') | Set-Content -Path ..\bento\packer_templates\ubuntu\ubuntu-20.04-amd64.json
((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
4 changes: 2 additions & 2 deletions bin/link-to-bento.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

sed -i '' 's/scripts\/cleanup.sh/scripts\/homestead.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
sed -i '' 's/"cpus": "1"/"cpus": "2"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
#sed -i '' 's/"boot_wait": "5s"/"boot_wait": "10s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
sed -i '' 's/"boot_wait": "5s"/"boot_wait": "3s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
sed -i '' 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
sed -i '' 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json
sed -i '' '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-amd64.json

# Run for ARM
sed -i '' 's/scripts\/cleanup.sh/scripts\/homestead-arm.sh/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
#sed -i '' 's/"boot_wait": "5s"/"boot_wait": "10s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
sed -i '' 's/"boot_wait": "5s"/"boot_wait": "3s"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
sed -i '' 's/"memory": "1024"/"memory": "2048"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
sed -i '' 's/"disk_size": "65536"/"disk_size": "524288"/' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
sed -i '' '/\/_common\/motd.sh/d' ../bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
85 changes: 75 additions & 10 deletions scripts/amd64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ usermod -aG docker vagrant

# Install docker-compose
curl \
-L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" \
-L "https://github.com/docker/compose/releases/download/2.10.1/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

# Configure feature tracking path
mkdir -p /home/vagrant/.homestead-features

if "$SKIP_PHP"; then
echo "SKIP_PHP is being used, so we're not installing PHP"
else
Expand Down Expand Up @@ -115,6 +118,8 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/5.6/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php56

# PHP 7.0
apt-get install -y --allow-change-held-packages \
php7.0-bcmath php7.0-bz2 php7.0-cgi php7.0-cli php7.0-common php7.0-curl php7.0-dba php7.0-dev php7.0-enchant \
Expand Down Expand Up @@ -157,6 +162,8 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.0/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php70

# PHP 7.1
apt-get install -y --allow-change-held-packages \
php7.1-bcmath php7.1-bz2 php7.1-cgi php7.1-cli php7.1-common php7.1-curl php7.1-dba php7.1-dev php7.1-enchant \
Expand Down Expand Up @@ -199,6 +206,8 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.1/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php71

# PHP 7.2
apt-get install -y --allow-change-held-packages \
php7.2-bcmath php7.2-bz2 php7.2-dba php7.2-enchant php7.2-fpm php7.2-imap php7.2-interbase php7.2-intl \
Expand Down Expand Up @@ -242,6 +251,8 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.2/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php72

# PHP 7.3
apt-get install -y --allow-change-held-packages \
php7.3 php7.3-bcmath php7.3-bz2 php7.3-cgi php7.3-cli php7.3-common php7.3-curl php7.3-dba php7.3-dev php7.3-enchant \
Expand Down Expand Up @@ -284,6 +295,8 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.3/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php73

# PHP 7.4
apt-get install -y --allow-change-held-packages \
php7.4 php7.4-bcmath php7.4-bz2 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-dba php7.4-dev \
Expand Down Expand Up @@ -326,6 +339,8 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/7.4/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php74

# PHP 8.0
apt-get install -y --allow-change-held-packages \
php8.0 php8.0-bcmath php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-dba php8.0-dev \
Expand Down Expand Up @@ -368,6 +383,8 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.0/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php80

# PHP 8.1
apt-get install -y --allow-change-held-packages \
php8.1 php8.1-bcmath php8.1-bz2 php8.1-cgi php8.1-cli php8.1-common php8.1-curl php8.1-dba php8.1-dev \
Expand Down Expand Up @@ -410,6 +427,53 @@ else
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.1/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php8.1

# PHP 8.2
apt-get install -y --allow-change-held-packages \
php8.2 php8.2-bcmath php8.2-bz2 php8.2-cgi php8.2-cli php8.2-common php8.2-curl php8.2-dba php8.2-dev \
php8.2-enchant php8.2-fpm php8.2-gd php8.2-gmp php8.2-imap php8.2-interbase php8.2-intl php8.2-ldap \
php8.2-mbstring php8.2-mysql php8.2-odbc php8.2-opcache php8.2-pgsql php8.2-phpdbg php8.2-pspell php8.2-readline \
php8.2-snmp php8.2-soap php8.2-sqlite3 php8.2-sybase php8.2-tidy php8.2-xml php8.2-xsl \
php8.2-zip
# php8.2-imagick php8.2-memcached php8.2-redis php8.2-xmlrpc php8.2-xdebug

# Configure php.ini for CLI
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.2/cli/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.2/cli/php.ini
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.2/cli/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.2/cli/php.ini

# Configure Xdebug
echo "xdebug.mode = debug" >> /etc/php/8.2/mods-available/xdebug.ini
echo "xdebug.discover_client_host = true" >> /etc/php/8.2/mods-available/xdebug.ini
echo "xdebug.client_port = 9003" >> /etc/php/8.2/mods-available/xdebug.ini
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.2/mods-available/xdebug.ini
echo "opcache.revalidate_freq = 0" >> /etc/php/8.2/mods-available/opcache.ini

# Configure php.ini for FPM
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.2/fpm/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.2/fpm/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.2/fpm/php.ini
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.2/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.2/fpm/php.ini
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.2/fpm/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.2/fpm/php.ini

printf "[openssl]\n" | tee -a /etc/php/8.2/fpm/php.ini
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.2/fpm/php.ini
printf "[curl]\n" | tee -a /etc/php/8.2/fpm/php.ini
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.2/fpm/php.ini

# Configure FPM
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.2/fpm/pool.d/www.conf
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.2/fpm/pool.d/www.conf

touch /home/vagrant/.homestead-features/php8.2

# Disable old PHP FPM
systemctl disable php5.6-fpm
systemctl disable php7.0-fpm
Expand All @@ -418,10 +482,11 @@ else
systemctl disable php7.3-fpm
systemctl disable php7.4-fpm
systemctl disable php8.0-fpm
systemctl disable php8.1-fpm

update-alternatives --set php /usr/bin/php8.1
update-alternatives --set php-config /usr/bin/php-config8.1
update-alternatives --set phpize /usr/bin/phpize8.1
update-alternatives --set php /usr/bin/php8.2
update-alternatives --set php-config /usr/bin/php-config8.2
update-alternatives --set phpize /usr/bin/phpize8.2

# Install Composer
curl -sS https://getcomposer.org/installer | php
Expand All @@ -441,7 +506,7 @@ EOF
sed -i "s/www-data/vagrant/" /etc/apache2/envvars

# Enable FPM
a2enconf php8.0-fpm
a2enconf php8.2-fpm

# Assume user wants mode_rewrite support
sudo a2enmod rewrite
Expand Down Expand Up @@ -507,7 +572,7 @@ EOF
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.0/fpm/pool.d/www.conf

service nginx restart
service php8.0-fpm restart
service php8.2-fpm restart

# Add Vagrant User To WWW-Data
usermod -a -G www-data vagrant
Expand Down Expand Up @@ -648,15 +713,15 @@ fi
if "$SKIP_POSTGRESQL"; then
echo "SKIP_POSTGRESQL is being used, so we're not installing PostgreSQL"
else
# Install Postgres 13
apt-get install -y postgresql-13 postgresql-server-dev-12 postgresql-13-postgis-3 postgresql-13-postgis-3-scripts
# Install Postgres 14
apt-get install -y postgresql-15 postgresql-server-dev-15 postgresql-15-postgis-3 postgresql-15-postgis-3-scripts

# Configure Postgres Users
sudo -u postgres psql -c "CREATE ROLE homestead LOGIN PASSWORD 'secret' SUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;"

# Configure Postgres Remote Access
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/13/main/postgresql.conf
echo "host all all 10.0.2.2/32 md5" | tee -a /etc/postgresql/13/main/pg_hba.conf
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/15/main/postgresql.conf
echo "host all all 10.0.2.2/32 md5" | tee -a /etc/postgresql/15/main/pg_hba.conf

sudo -u postgres /usr/bin/createdb --echo --owner=homestead homestead
service postgresql restart
Expand Down
Loading

0 comments on commit 1f78d8c

Please sign in to comment.