premiers tests ok
This commit is contained in:
commit
c2aaf2183e
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml,yaml.example}]
|
||||
indent_size = 2
|
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Release Notes
|
||||
|
||||
Please visit https://github.com/laravel/homestead/releases for details about each release.
|
||||
|
||||
Official documentation [is located here](https://laravel.com/docs/homestead).
|
47
Homestead.yaml
Normal file
47
Homestead.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
ip: "192.168.56.56"
|
||||
memory: 2048
|
||||
cpus: 2
|
||||
provider: virtualbox
|
||||
|
||||
# authorize: Path\id_rsa.pub
|
||||
|
||||
# keys:
|
||||
# - Path\id_rsa
|
||||
|
||||
# folders:
|
||||
# - map: Path\Code
|
||||
# to: /home/vagrant/code
|
||||
|
||||
sites:
|
||||
- map: homestead.test
|
||||
to: /home/vagrant/code/public
|
||||
|
||||
databases:
|
||||
- homestead
|
||||
|
||||
features:
|
||||
- mariadb: false
|
||||
- postgresql: false
|
||||
- ohmyzsh: false
|
||||
- webdriver: false
|
||||
|
||||
services:
|
||||
- enabled:
|
||||
- "mysql"
|
||||
# - disabled:
|
||||
# - "postgresql@11-main"
|
||||
|
||||
# ports:
|
||||
# - send: 33060 # MySQL/MariaDB
|
||||
# to: 3306
|
||||
# - send: 4040
|
||||
# to: 4040
|
||||
# - send: 54320 # PostgreSQL
|
||||
# to: 5432
|
||||
# - send: 8025 # Mailpit
|
||||
# to: 8025
|
||||
# - send: 9600
|
||||
# to: 9600
|
||||
# - send: 27017
|
||||
# to: 27017
|
48
Homestead.yaml.example
Normal file
48
Homestead.yaml.example
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
ip: "192.168.56.56"
|
||||
memory: 2048
|
||||
cpus: 2
|
||||
provider: virtualbox
|
||||
|
||||
authorize: ~/.ssh/id_rsa.pub
|
||||
|
||||
keys:
|
||||
- ~/.ssh/id_rsa
|
||||
|
||||
folders:
|
||||
- map: ~/code
|
||||
to: /home/vagrant/code
|
||||
|
||||
sites:
|
||||
- map: homestead.test
|
||||
to: /home/vagrant/code/public
|
||||
|
||||
databases:
|
||||
- homestead
|
||||
|
||||
features:
|
||||
- mariadb: false
|
||||
- postgresql: false
|
||||
- ohmyzsh: false
|
||||
- webdriver: false
|
||||
- influxdb: false
|
||||
|
||||
services:
|
||||
- enabled:
|
||||
- "mysql"
|
||||
# - disabled:
|
||||
# - "postgresql@11-main"
|
||||
|
||||
# ports:
|
||||
# - send: 33060 # MySQL/MariaDB
|
||||
# to: 3306
|
||||
# - send: 4040
|
||||
# to: 4040
|
||||
# - send: 54320 # PostgreSQL
|
||||
# to: 5432
|
||||
# - send: 8025 # Mailpit
|
||||
# to: 8025
|
||||
# - send: 9600
|
||||
# to: 9600
|
||||
# - send: 27017
|
||||
# to: 27017
|
21
LICENSE.txt
Normal file
21
LICENSE.txt
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) <Taylor Otwell>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
60
Vagrantfile
vendored
Normal file
60
Vagrantfile
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
|
||||
VAGRANTFILE_API_VERSION ||= "2"
|
||||
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
|
||||
|
||||
homesteadYamlPath = confDir + "/Homestead.yaml"
|
||||
homesteadJsonPath = confDir + "/Homestead.json"
|
||||
afterScriptPath = confDir + "/after.sh"
|
||||
customizationScriptPath = confDir + "/user-customizations.sh"
|
||||
aliasesPath = confDir + "/aliases"
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
|
||||
|
||||
Vagrant.require_version '>= 2.4'
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
if File.exist? aliasesPath then
|
||||
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
|
||||
config.vm.provision "handle_aliases", type: "shell" do |s|
|
||||
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
|
||||
end
|
||||
end
|
||||
|
||||
if File.exist? homesteadYamlPath then
|
||||
settings = YAML::load(File.read(homesteadYamlPath))
|
||||
elsif File.exist? homesteadJsonPath then
|
||||
settings = JSON::parse(File.read(homesteadJsonPath))
|
||||
else
|
||||
abort "Homestead settings file not found in #{confDir}"
|
||||
end
|
||||
|
||||
Homestead.configure(config, settings)
|
||||
|
||||
if File.exist? afterScriptPath then
|
||||
config.vm.provision "Run after.sh", type: "shell", path: afterScriptPath, privileged: false, keep_color: true
|
||||
end
|
||||
|
||||
if File.exist? customizationScriptPath then
|
||||
config.vm.provision "Run customize script", type: "shell", path: customizationScriptPath, privileged: false, keep_color: true
|
||||
end
|
||||
|
||||
if Vagrant.has_plugin?('vagrant-hostsupdater')
|
||||
config.hostsupdater.remove_on_suspend = false
|
||||
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
|
||||
elsif Vagrant.has_plugin?('vagrant-hostmanager')
|
||||
config.hostmanager.enabled = true
|
||||
config.hostmanager.manage_host = true
|
||||
config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
|
||||
elsif Vagrant.has_plugin?('vagrant-goodhosts')
|
||||
config.goodhosts.aliases = settings['sites'].map { |site| site['map'] }
|
||||
end
|
||||
|
||||
if Vagrant.has_plugin?('vagrant-notify-forwarder')
|
||||
config.notify_forwarder.enable = true
|
||||
end
|
||||
end
|
23
after.sh
Normal file
23
after.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If you would like to do some extra provisioning you may
|
||||
# add any commands you wish to this file and they will
|
||||
# be run after the Homestead machine is provisioned.
|
||||
#
|
||||
# If you have user-specific configurations you would like
|
||||
# to apply, you may also create user-customizations.sh,
|
||||
# which will be run after this script.
|
||||
|
||||
|
||||
# If you're not quite ready for the latest Node.js version,
|
||||
# uncomment these lines to roll back to a previous version
|
||||
|
||||
# Remove current Node.js version:
|
||||
#sudo apt-get -y purge nodejs
|
||||
#sudo rm -rf /usr/lib/node_modules/npm/lib
|
||||
#sudo rm -rf //etc/apt/sources.list.d/nodesource.list
|
||||
|
||||
# Install Node.js Version desired (i.e. v13)
|
||||
# More info: https://github.com/nodesource/distributions/blob/master/README.md#debinstall
|
||||
#curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
|
||||
#sudo apt-get install -y nodejs
|
357
aliases
Normal file
357
aliases
Normal file
@ -0,0 +1,357 @@
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
|
||||
alias h='cd ~'
|
||||
alias c='clear'
|
||||
alias art=artisan
|
||||
|
||||
alias codecept='vendor/bin/codecept'
|
||||
alias phpspec='vendor/bin/phpspec'
|
||||
alias pint='vendor/bin/pint'
|
||||
alias serve=serve-laravel
|
||||
|
||||
alias xoff='sudo phpdismod -s cli xdebug'
|
||||
alias xon='sudo phpenmod -s cli xdebug'
|
||||
|
||||
alias nrd="npm run dev"
|
||||
alias nrw="npm run watch"
|
||||
alias nrwp="npm run watch-poll"
|
||||
alias nrh="npm run hot"
|
||||
alias nrp="npm run production"
|
||||
|
||||
alias yrd="yarn dev"
|
||||
alias yrw="yarn watch"
|
||||
alias yrwp="yarn watch-poll"
|
||||
alias yrh="yarn hot"
|
||||
alias yrp="yarn production"
|
||||
|
||||
function artisan() {
|
||||
php artisan "$@"
|
||||
}
|
||||
|
||||
function dusk() {
|
||||
pids=$(pidof /usr/bin/Xvfb)
|
||||
|
||||
if [ ! -n "$pids" ]; then
|
||||
Xvfb :0 -screen 0 1280x960x24 &
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
php artisan dusk
|
||||
else
|
||||
php artisan dusk --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function p() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest "$@"
|
||||
else
|
||||
vendor/bin/phpunit "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function pf() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest --filter "$@"
|
||||
else
|
||||
vendor/bin/phpunit --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function php56() {
|
||||
sudo update-alternatives --set php /usr/bin/php5.6
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config5.6
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize5.6
|
||||
}
|
||||
|
||||
function php70() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.0
|
||||
}
|
||||
|
||||
function php71() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.1
|
||||
}
|
||||
|
||||
function php72() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.2
|
||||
}
|
||||
|
||||
function php73() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.3
|
||||
}
|
||||
|
||||
function php74() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.4
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.4
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.4
|
||||
}
|
||||
|
||||
function php80() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.0
|
||||
}
|
||||
|
||||
function php81() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.1
|
||||
}
|
||||
|
||||
function php82() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.2
|
||||
}
|
||||
|
||||
function php83() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.3
|
||||
}
|
||||
|
||||
function serve-apache() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/apache.sh
|
||||
sudo bash /vagrant/scripts/site-types/apache.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-apache-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/apache-proxy.sh
|
||||
sudo bash /vagrant/scripts/site-types/apache-proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-laravel() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/laravel.sh
|
||||
sudo bash /vagrant/scripts/site-types/laravel.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/proxy.sh
|
||||
sudo bash /vagrant/scripts/site-types/proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-silverstripe() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/silverstripe.sh
|
||||
sudo bash /vagrant/scripts/site-types/silverstripe.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-silverstripe domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-spa() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/spa.sh
|
||||
sudo bash /vagrant/scripts/site-types/spa.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-spa domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-statamic() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/statamic.sh
|
||||
sudo bash /vagrant/scripts/site-types/statamic.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-statamic domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony2() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/symfony2.sh
|
||||
sudo bash /vagrant/scripts/site-types/symfony2.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony2 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony4() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/symfony4.sh
|
||||
sudo bash /vagrant/scripts/site-types/symfony4.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony4 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-pimcore() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/pimcore.sh
|
||||
sudo bash /vagrant/scripts/site-types/pimcore.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-pimcore domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function share() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:80 --host-header=rewrite
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " share domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " share domain -region=eu -subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function sshare() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:443 --host-header=rewrite
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " sshare domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " sshare domain --subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function flip() {
|
||||
sudo bash /vagrant/scripts/flip-webserver.sh
|
||||
}
|
||||
|
||||
function __has_pv() {
|
||||
$(hash pv 2>/dev/null);
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
function __pv_install_message() {
|
||||
if ! __has_pv; then
|
||||
echo $1
|
||||
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function dbexport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
# This gives an estimate of the size of the SQL file
|
||||
# It appears that 80% is a good approximation of
|
||||
# the ratio of estimated size to actual size
|
||||
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
|
||||
|
||||
__pv_install_message "Want to see export progress?"
|
||||
|
||||
echo "Exporting databases to '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
|
||||
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
|
||||
|
||||
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
|
||||
else
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | gzip > "$FILE"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function dbimport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
__pv_install_message "Want to see import progress?"
|
||||
|
||||
echo "Importing databases from '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
else
|
||||
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function xphp() {
|
||||
(php -m | grep -q xdebug)
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
XDEBUG_ENABLED=true
|
||||
else
|
||||
XDEBUG_ENABLED=false
|
||||
fi
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xon; fi
|
||||
|
||||
HOST_IP=$(last --limit=1 | grep -oP '\d+(\.\d+){3}')
|
||||
|
||||
php \
|
||||
-dxdebug.client_host=${HOST_IP} \
|
||||
-dxdebug.start_with_request=yes \
|
||||
"$@"
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xoff; fi
|
||||
}
|
1
art/logo.svg
Normal file
1
art/logo.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 9.6 KiB |
18
bin/homestead
Normal file
18
bin/homestead
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
// Are we running global or per project?
|
||||
if(is_file( __DIR__.'/../vendor/autoload.php')) {
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
} else {
|
||||
require __DIR__.'/../../../autoload.php';
|
||||
}
|
||||
|
||||
$app = new Symfony\Component\Console\Application('Laravel Homestead', '15.0.3');
|
||||
|
||||
$app->add(new Laravel\Homestead\MakeCommand);
|
||||
$app->add(new Laravel\Homestead\WslApplyFeatures);
|
||||
$app->add(new Laravel\Homestead\WslCreateSiteCommand);
|
||||
$app->add(new Laravel\Homestead\WslCreateDatabaseCommand());
|
||||
|
||||
$app->run();
|
239
bin/wsl-init
Normal file
239
bin/wsl-init
Normal file
@ -0,0 +1,239 @@
|
||||
#!/usr/bin/env bash
|
||||
##################################
|
||||
# Usage: #
|
||||
# sudo ./bin/homestead/wsl-init #
|
||||
##################################
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
echo "What is your WSL user name?"
|
||||
read WSL_USER_NAME
|
||||
|
||||
echo "What is your WSL user group? (Same as username if you're unsure)"
|
||||
read WSL_USER_GROUP
|
||||
|
||||
# Update Package List
|
||||
apt-get update
|
||||
|
||||
# Update System Packages
|
||||
apt-get upgrade -y
|
||||
|
||||
# Force Locale
|
||||
echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale
|
||||
locale-gen en_US.UTF-8
|
||||
|
||||
apt-get install -y software-properties-common curl gnupg debian-keyring debian-archive-keyring apt-transport-https \
|
||||
ca-certificates
|
||||
|
||||
# Install Some PPAs
|
||||
apt-add-repository ppa:ondrej/php -y
|
||||
|
||||
# Prepare keyrings directory
|
||||
sudo mkdir -p /etc/apt/keyrings
|
||||
|
||||
# NodeJS
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_21.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
|
||||
|
||||
# PostgreSQL
|
||||
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/keyrings/postgresql.gpg
|
||||
sudo sh -c 'echo "deb [signed-by=/etc/apt/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
|
||||
## Update Package Lists
|
||||
apt-get update -y
|
||||
|
||||
# Install Some Basic Packages
|
||||
apt-get install -y build-essential dos2unix gcc git git-lfs libmcrypt4 libpcre3-dev libpng-dev chrony unzip make pv \
|
||||
python3-pip re2c supervisor unattended-upgrades whois vim cifs-utils bash-completion zsh graphviz avahi-daemon tshark
|
||||
|
||||
# Install Generic PHP packages
|
||||
apt-get install -y --allow-change-held-packages \
|
||||
php-imagick php-memcached php-redis php-xdebug php-dev php-swoole
|
||||
|
||||
# PHP 8.3
|
||||
apt-get install -y --allow-change-held-packages \
|
||||
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 \
|
||||
php8.3-enchant php8.3-fpm php8.3-gd php8.3-gmp php8.3-imap php8.3-interbase php8.3-intl php8.3-ldap \
|
||||
php8.3-mbstring php8.3-mysql php8.3-odbc php8.3-opcache php8.3-pgsql php8.3-phpdbg php8.3-pspell php8.3-readline \
|
||||
php8.3-snmp php8.3-soap php8.3-sqlite3 php8.3-sybase php8.3-tidy php8.3-xml php8.3-xsl \
|
||||
php8.3-zip php8.3-imagick php8.3-memcached php8.3-redis php8.3-xmlrpc php8.3-xdebug
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.mode = debug" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "xdebug.discover_client_host = true" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "xdebug.client_port = 9003" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/8.3/mods-available/opcache.ini
|
||||
|
||||
# Fixed php fpm bind listening socket - no such file issue.
|
||||
mkdir -p /run/php
|
||||
touch /run/php/php8.3-fpm.sock
|
||||
|
||||
# Install Composer
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
chown -R vagrant:vagrant /home/vagrant/.config
|
||||
|
||||
# Install Global Packages
|
||||
sudo su vagrant <<'EOF'
|
||||
/usr/local/bin/composer global require "laravel/envoy=^2.0"
|
||||
/usr/local/bin/composer global require "laravel/installer=^5.0"
|
||||
/usr/local/bin/composer global config --no-plugins allow-plugins.slince/composer-registry-manager true
|
||||
/usr/local/bin/composer global require "slince/composer-registry-manager=^2.0"
|
||||
EOF
|
||||
|
||||
# Install Nginx
|
||||
apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages nginx
|
||||
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
rm /etc/nginx/sites-available/default
|
||||
|
||||
# Create a configuration file for Nginx overrides.
|
||||
mkdir -p /home/$WSL_USER_NAME/.config/nginx
|
||||
chown -R $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME
|
||||
touch /home/$WSL_USER_NAME/.config/nginx/nginx.conf
|
||||
ln -sf /home/$WSL_USER_NAME/.config/nginx/nginx.conf /etc/nginx/conf.d/nginx.conf
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
|
||||
# Set The Nginx & PHP-FPM User
|
||||
sed -i "s/user www-data;/user $WSL_USER_NAME;/" /etc/nginx/nginx.conf
|
||||
sed -i "s/# server_names_hash_bucket_size.*/server_names_hash_bucket_size 64;/" /etc/nginx/nginx.conf
|
||||
|
||||
sed -i "s/user = www-data/user = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
|
||||
sed -i "s/listen\.owner.*/listen.owner = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.group.*/listen.group = $WSL_USER_NAME/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
|
||||
# Disable XDebug On The CLI
|
||||
sudo phpdismod -s cli xdebug
|
||||
|
||||
service nginx restart
|
||||
service php8.3-fpm restart
|
||||
|
||||
# Add $WSL_USER_NAME User To WWW-Data
|
||||
usermod -a -G www-data $WSL_USER_NAME
|
||||
id $WSL_USER_NAME
|
||||
groups $WSL_USER_GROUP
|
||||
|
||||
# Install Node
|
||||
apt-get install -y nodejs
|
||||
/usr/bin/npm install -g npm
|
||||
|
||||
# Install SQLite
|
||||
apt-get install -y sqlite3 libsqlite3-dev
|
||||
|
||||
# Disable Apparmor
|
||||
# See https://github.com/laravel/homestead/issues/629#issue-247524528
|
||||
service apparmor stop
|
||||
update-rc.d -f apparmor remove
|
||||
|
||||
# Remove MySQL
|
||||
apt-get remove -y --purge mysql-server mysql-client mysql-common
|
||||
apt-get autoremove -y
|
||||
apt-get autoclean
|
||||
|
||||
rm -rf /var/lib/mysql/*
|
||||
rm -rf /var/log/mysql
|
||||
rm -rf /etc/mysql
|
||||
|
||||
# Add Maria PPA
|
||||
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
|
||||
|
||||
echo "mariadb-server mysql-server/data-dir select ''" | debconf-set-selections
|
||||
echo "mariadb-server mysql-server/root_password password secret" | debconf-set-selections
|
||||
echo "mariadb-server mysql-server/root_password_again password secret" | debconf-set-selections
|
||||
|
||||
mkdir /etc/mysql
|
||||
touch /etc/mysql/debian.cnf
|
||||
|
||||
# Install MariaDB
|
||||
apt-get install -y mariadb-server mariadb-client
|
||||
|
||||
# Configure Maria Remote Access and ignore db dirs
|
||||
sed -i "s/bind-address = 127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||
cat > /etc/mysql/mariadb.conf.d/50-server.cnf << EOF
|
||||
[mysqld]
|
||||
bind-address = 0.0.0.0
|
||||
ignore-db-dir = lost+found
|
||||
#general_log
|
||||
#general_log_file=/var/log/mysql/mariadb.log
|
||||
EOF
|
||||
|
||||
export MYSQL_PWD=secret
|
||||
|
||||
mysql --user="root" -e "GRANT ALL ON *.* TO root@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
|
||||
service mysql restart
|
||||
|
||||
mysql --user="root" -e "CREATE USER IF NOT EXISTS 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret';"
|
||||
mysql --user="root" -e "GRANT ALL ON *.* TO 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
|
||||
mysql --user="root" -e "GRANT ALL ON *.* TO 'homestead'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
|
||||
mysql --user="root" -e "FLUSH PRIVILEGES;"
|
||||
service mysql restart
|
||||
|
||||
mysql_upgrade --user="root" --verbose --force
|
||||
service mysql restart
|
||||
|
||||
unset MYSQL_PWD
|
||||
|
||||
# Install Postgres 15
|
||||
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/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
|
||||
# Disable to lower initial overhead
|
||||
systemctl disable postgresql
|
||||
|
||||
# Install Redis, Memcached, & Beanstalk
|
||||
apt-get install -y redis-server memcached
|
||||
systemctl enable redis-server
|
||||
service redis-server start
|
||||
|
||||
# One last upgrade check
|
||||
apt-get upgrade -y
|
||||
|
||||
# Clean Up
|
||||
apt -y autoremove
|
||||
apt -y clean
|
||||
chown -R $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME
|
||||
chown -R $WSL_USER_NAME:$WSL_USER_GROUP /usr/local/bin
|
||||
|
||||
# Add Composer Global Bin To Path
|
||||
printf "\nPATH=\"$(sudo su - $WSL_USER_NAME -c 'composer config -g home 2>/dev/null')/vendor/bin:\$PATH\"\n" | tee -a /home/$WSL_USER_NAME/.profile
|
||||
|
||||
apt-get -y autoremove;
|
||||
apt-get -y clean;
|
||||
|
||||
# What are you doing Ubuntu?
|
||||
# https://askubuntu.com/questions/1250974/user-root-cant-write-to-file-in-tmp-owned-by-someone-else-in-20-04-but-can-in
|
||||
sysctl fs.protected_regular=0
|
||||
|
||||
# Setup Homestead repo
|
||||
su $WSL_USER_NAME -c 'composer install'
|
||||
su $WSL_USER_NAME -c 'bash init.sh'
|
39
composer.json
Normal file
39
composer.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "laravel/homestead",
|
||||
"description": "A virtual machine for web artisans.",
|
||||
"require": {
|
||||
"php": "^8.1 || <8.3",
|
||||
"symfony/console": "^6.0 || ^7.0",
|
||||
"symfony/process": "^6.0 || ^7.0",
|
||||
"symfony/yaml": "^6.0 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"dms/phpunit-arraysubset-asserts": "^0.2.1",
|
||||
"phpstan/phpstan": "^1.10"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
},
|
||||
{
|
||||
"name": "Joe Ferguson",
|
||||
"email": "joe@joeferguson.me"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\Homestead\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"bin": [
|
||||
"bin/homestead"
|
||||
]
|
||||
}
|
2708
composer.lock
generated
Normal file
2708
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
13
init.bat
Normal file
13
init.bat
Normal file
@ -0,0 +1,13 @@
|
||||
@echo off
|
||||
|
||||
if ["%~1"]==["json"] (
|
||||
copy /-y resources\Homestead.json Homestead.json
|
||||
)
|
||||
if ["%~1"]==[""] (
|
||||
copy /-y resources\Homestead.yaml Homestead.yaml
|
||||
)
|
||||
|
||||
copy /-y resources\after.sh after.sh
|
||||
copy /-y resources\aliases aliases
|
||||
|
||||
echo Homestead initialized!
|
12
init.sh
Normal file
12
init.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
cp -i resources/Homestead.json Homestead.json
|
||||
else
|
||||
cp -i resources/Homestead.yaml Homestead.yaml
|
||||
fi
|
||||
|
||||
cp -i resources/after.sh after.sh
|
||||
cp -i resources/aliases aliases
|
||||
|
||||
echo "Homestead initialized!"
|
17
phpstan.src.neon.dist
Normal file
17
phpstan.src.neon.dist
Normal file
@ -0,0 +1,17 @@
|
||||
parameters:
|
||||
paths:
|
||||
- src
|
||||
level: 0
|
||||
ignoreErrors:
|
||||
- "#\\(void\\) is used#"
|
||||
- "#Access to an undefined property#"
|
||||
- "#Call to an undefined method#"
|
||||
- "#but return statement is missing.#"
|
||||
- "#Caught class [a-zA-Z0-9\\\\_]+ not found.#"
|
||||
- "#Class [a-zA-Z0-9\\\\_]+ not found.#"
|
||||
- "#has invalid type#"
|
||||
- "#should always throw an exception or terminate script execution#"
|
||||
- "#Instantiated class [a-zA-Z0-9\\\\_]+ not found.#"
|
||||
- "#Unsafe usage of new static#"
|
||||
excludePaths:
|
||||
- "src/Illuminate/Testing/ParallelRunner.php"
|
13
phpunit.xml.dist
Normal file
13
phpunit.xml.dist
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Laravel Homestead tests">
|
||||
<directory>./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
110
readme.md
Normal file
110
readme.md
Normal file
@ -0,0 +1,110 @@
|
||||
### Laravel Homestead
|
||||
|
||||
Ceci est une adaptation des distributions officielles, pour le montage d'un environnement de développement complet sur un ordinateur personnel.
|
||||
|
||||
|
||||
## Préparation du déploiement
|
||||
|
||||
Clôner le dépôt sur la machine.
|
||||
|
||||
Dans le fichier `Homestead.yaml`, renseigner :
|
||||
```
|
||||
authorize: ## Le chemin de la clé publique de la machine ##
|
||||
|
||||
keys:
|
||||
- ## Le chemin de la clé privée de la machine ##
|
||||
|
||||
folders:
|
||||
- map: ## Le répertoire de montage pour le code du projet (à créer sur la machine) ##
|
||||
to: /home/vagrant/code
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Création de la VM
|
||||
|
||||
Depuis la racine du dépôt, lancer l'import de la box et son provisionning avec `vagrant up`
|
||||
|
||||
|
||||
## Création d'un projet Laravel
|
||||
|
||||
Se connecter au terminal de la VM depuis la racine du dépôt, avec `vagrant ssh`.
|
||||
|
||||
Pour le premier projet, récupérer l'installeur :
|
||||
|
||||
```
|
||||
composer global require laravel/installer
|
||||
```
|
||||
|
||||
Puis, construire le projet au niveau du point de montage entre la VM et la machine :
|
||||
|
||||
```
|
||||
cd code
|
||||
laravel new test_app
|
||||
```
|
||||
Possibilité de choisir un starter kit (pas utile pour tester), un système de test, d'initialiser immédiatement un dépôt git pour le projet...
|
||||
|
||||
Quand prompt, sélectionner MySQL comme SGBD. Ne PAS demander à faire automatiquement les premières migrations.
|
||||
|
||||
## Configuration de la base de données
|
||||
|
||||
Une fois connecté en root (`mysql -u root`), créer l'utilisateur de l'application et la base de données de cette dernière :
|
||||
```
|
||||
CREATE USER 'admin_test'@'%' IDENTIFIED BY 'mdp_test';
|
||||
CREATE DATABASE test_app;
|
||||
GRANT ALL PRIVILEGES ON test_app.* TO 'admin_test'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
Ensuite, dans les fichiers du projet au niveau du point de montage, aller éditer dans le fichier `.env` :
|
||||
|
||||
```
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=test_app
|
||||
DB_USERNAME=admin_test
|
||||
DB_PASSWORD=mdp_test
|
||||
```
|
||||
|
||||
## Première migration
|
||||
Réaliser la première migration (utilisation des classes du code pour structurer la base de données) :
|
||||
```
|
||||
cd test_app
|
||||
php artisan make:migration 1st_tables
|
||||
php artisan migrate
|
||||
```
|
||||
|
||||
## Démarrage du serveur web et connexion
|
||||
Démarrer le serveur web de la VM avec :
|
||||
```
|
||||
php artisan serve --port=8000 --host=0.0.0.0
|
||||
```
|
||||
|
||||
L'application est alors accessible via : http://192.168.56.56:8000/
|
||||
|
||||
## Ressources officielles
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/homestead/actions">
|
||||
<img src="https://github.com/laravel/homestead/workflows/tests/badge.svg" alt="Build Status">
|
||||
</a>
|
||||
<a href="https://packagist.org/packages/laravel/homestead">
|
||||
<img src="https://img.shields.io/packagist/dt/laravel/homestead" alt="Total Downloads">
|
||||
</a>
|
||||
<a href="https://packagist.org/packages/laravel/homestead">
|
||||
<img src="https://img.shields.io/packagist/v/laravel/homestead" alt="Latest Stable Version">
|
||||
</a>
|
||||
<a href="https://packagist.org/packages/laravel/homestead">
|
||||
<img src="https://img.shields.io/packagist/l/laravel/homestead" alt="License">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, or any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
|
||||
|
||||
Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP, MySQL, Postgres, Redis, Memcached, Node, and all of the other goodies you need to develop amazing Laravel applications.
|
||||
|
||||
Official documentation [is located here](https://laravel.com/docs/homestead).
|
||||
|
47
resources/Homestead.json
Normal file
47
resources/Homestead.json
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"ip": "192.168.56.56",
|
||||
"memory": 2048,
|
||||
"cpus": 2,
|
||||
"provider": "virtualbox",
|
||||
"authorize": "~/.ssh/id_rsa.pub",
|
||||
"keys": [
|
||||
"~/.ssh/id_rsa"
|
||||
],
|
||||
"folders": [
|
||||
{
|
||||
"map": "~/code",
|
||||
"to": "/home/vagrant/code"
|
||||
}
|
||||
],
|
||||
"sites": [
|
||||
{
|
||||
"map": "homestead.test",
|
||||
"to": "/home/vagrant/code/public"
|
||||
}
|
||||
],
|
||||
"databases": [
|
||||
"homestead"
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"mysql": true
|
||||
},
|
||||
{
|
||||
"mariadb": false
|
||||
},
|
||||
{
|
||||
"postgresql": false
|
||||
},
|
||||
{
|
||||
"ohmyzsh": false
|
||||
},
|
||||
{
|
||||
"webdriver": false
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"mysql": true
|
||||
}
|
||||
]
|
||||
}
|
47
resources/Homestead.yaml
Normal file
47
resources/Homestead.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
ip: "192.168.56.56"
|
||||
memory: 2048
|
||||
cpus: 2
|
||||
provider: virtualbox
|
||||
|
||||
authorize: ~/.ssh/id_rsa.pub
|
||||
|
||||
keys:
|
||||
- ~/.ssh/id_rsa
|
||||
|
||||
folders:
|
||||
- map: ~/code
|
||||
to: /home/vagrant/code
|
||||
|
||||
sites:
|
||||
- map: homestead.test
|
||||
to: /home/vagrant/code/public
|
||||
|
||||
databases:
|
||||
- homestead
|
||||
|
||||
features:
|
||||
- mariadb: false
|
||||
- postgresql: false
|
||||
- ohmyzsh: false
|
||||
- webdriver: false
|
||||
|
||||
services:
|
||||
- enabled:
|
||||
- "mysql"
|
||||
# - disabled:
|
||||
# - "postgresql@11-main"
|
||||
|
||||
# ports:
|
||||
# - send: 33060 # MySQL/MariaDB
|
||||
# to: 3306
|
||||
# - send: 4040
|
||||
# to: 4040
|
||||
# - send: 54320 # PostgreSQL
|
||||
# to: 5432
|
||||
# - send: 8025 # Mailpit
|
||||
# to: 8025
|
||||
# - send: 9600
|
||||
# to: 9600
|
||||
# - send: 27017
|
||||
# to: 27017
|
23
resources/after.sh
Normal file
23
resources/after.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If you would like to do some extra provisioning you may
|
||||
# add any commands you wish to this file and they will
|
||||
# be run after the Homestead machine is provisioned.
|
||||
#
|
||||
# If you have user-specific configurations you would like
|
||||
# to apply, you may also create user-customizations.sh,
|
||||
# which will be run after this script.
|
||||
|
||||
|
||||
# If you're not quite ready for the latest Node.js version,
|
||||
# uncomment these lines to roll back to a previous version
|
||||
|
||||
# Remove current Node.js version:
|
||||
#sudo apt-get -y purge nodejs
|
||||
#sudo rm -rf /usr/lib/node_modules/npm/lib
|
||||
#sudo rm -rf //etc/apt/sources.list.d/nodesource.list
|
||||
|
||||
# Install Node.js Version desired (i.e. v13)
|
||||
# More info: https://github.com/nodesource/distributions/blob/master/README.md#debinstall
|
||||
#curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
|
||||
#sudo apt-get install -y nodejs
|
357
resources/aliases
Normal file
357
resources/aliases
Normal file
@ -0,0 +1,357 @@
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
|
||||
alias h='cd ~'
|
||||
alias c='clear'
|
||||
alias art=artisan
|
||||
|
||||
alias codecept='vendor/bin/codecept'
|
||||
alias phpspec='vendor/bin/phpspec'
|
||||
alias pint='vendor/bin/pint'
|
||||
alias serve=serve-laravel
|
||||
|
||||
alias xoff='sudo phpdismod -s cli xdebug'
|
||||
alias xon='sudo phpenmod -s cli xdebug'
|
||||
|
||||
alias nrd="npm run dev"
|
||||
alias nrw="npm run watch"
|
||||
alias nrwp="npm run watch-poll"
|
||||
alias nrh="npm run hot"
|
||||
alias nrp="npm run production"
|
||||
|
||||
alias yrd="yarn dev"
|
||||
alias yrw="yarn watch"
|
||||
alias yrwp="yarn watch-poll"
|
||||
alias yrh="yarn hot"
|
||||
alias yrp="yarn production"
|
||||
|
||||
function artisan() {
|
||||
php artisan "$@"
|
||||
}
|
||||
|
||||
function dusk() {
|
||||
pids=$(pidof /usr/bin/Xvfb)
|
||||
|
||||
if [ ! -n "$pids" ]; then
|
||||
Xvfb :0 -screen 0 1280x960x24 &
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
php artisan dusk
|
||||
else
|
||||
php artisan dusk --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function p() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest "$@"
|
||||
else
|
||||
vendor/bin/phpunit "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function pf() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest --filter "$@"
|
||||
else
|
||||
vendor/bin/phpunit --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function php56() {
|
||||
sudo update-alternatives --set php /usr/bin/php5.6
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config5.6
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize5.6
|
||||
}
|
||||
|
||||
function php70() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.0
|
||||
}
|
||||
|
||||
function php71() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.1
|
||||
}
|
||||
|
||||
function php72() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.2
|
||||
}
|
||||
|
||||
function php73() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.3
|
||||
}
|
||||
|
||||
function php74() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.4
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.4
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.4
|
||||
}
|
||||
|
||||
function php80() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.0
|
||||
}
|
||||
|
||||
function php81() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.1
|
||||
}
|
||||
|
||||
function php82() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.2
|
||||
}
|
||||
|
||||
function php83() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.3
|
||||
}
|
||||
|
||||
function serve-apache() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/apache.sh
|
||||
sudo bash /vagrant/scripts/site-types/apache.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-apache-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/apache-proxy.sh
|
||||
sudo bash /vagrant/scripts/site-types/apache-proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-laravel() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/laravel.sh
|
||||
sudo bash /vagrant/scripts/site-types/laravel.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/proxy.sh
|
||||
sudo bash /vagrant/scripts/site-types/proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-silverstripe() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/silverstripe.sh
|
||||
sudo bash /vagrant/scripts/site-types/silverstripe.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-silverstripe domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-spa() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/spa.sh
|
||||
sudo bash /vagrant/scripts/site-types/spa.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-spa domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-statamic() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/statamic.sh
|
||||
sudo bash /vagrant/scripts/site-types/statamic.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-statamic domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony2() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/symfony2.sh
|
||||
sudo bash /vagrant/scripts/site-types/symfony2.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony2 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony4() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/symfony4.sh
|
||||
sudo bash /vagrant/scripts/site-types/symfony4.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony4 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-pimcore() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/scripts/site-types/pimcore.sh
|
||||
sudo bash /vagrant/scripts/site-types/pimcore.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-pimcore domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function share() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:80 --host-header=rewrite
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " share domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " share domain -region=eu -subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function sshare() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:443 --host-header=rewrite
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " sshare domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " sshare domain --subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function flip() {
|
||||
sudo bash /vagrant/scripts/flip-webserver.sh
|
||||
}
|
||||
|
||||
function __has_pv() {
|
||||
$(hash pv 2>/dev/null);
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
function __pv_install_message() {
|
||||
if ! __has_pv; then
|
||||
echo $1
|
||||
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function dbexport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
# This gives an estimate of the size of the SQL file
|
||||
# It appears that 80% is a good approximation of
|
||||
# the ratio of estimated size to actual size
|
||||
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
|
||||
|
||||
__pv_install_message "Want to see export progress?"
|
||||
|
||||
echo "Exporting databases to '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
|
||||
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
|
||||
|
||||
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
|
||||
else
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | gzip > "$FILE"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function dbimport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
__pv_install_message "Want to see import progress?"
|
||||
|
||||
echo "Importing databases from '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
else
|
||||
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function xphp() {
|
||||
(php -m | grep -q xdebug)
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
XDEBUG_ENABLED=true
|
||||
else
|
||||
XDEBUG_ENABLED=false
|
||||
fi
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xon; fi
|
||||
|
||||
HOST_IP=$(last --limit=1 | grep -oP '\d+(\.\d+){3}')
|
||||
|
||||
php \
|
||||
-dxdebug.client_host=${HOST_IP} \
|
||||
-dxdebug.start_with_request=yes \
|
||||
"$@"
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xoff; fi
|
||||
}
|
53
resources/localized/Vagrantfile
vendored
Normal file
53
resources/localized/Vagrantfile
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
|
||||
VAGRANTFILE_API_VERSION ||= "2"
|
||||
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
|
||||
|
||||
homesteadYamlPath = File.expand_path("Homestead.yaml", File.dirname(__FILE__))
|
||||
homesteadJsonPath = File.expand_path("Homestead.json", File.dirname(__FILE__))
|
||||
afterScriptPath = "after.sh"
|
||||
customizationScriptPath = "user-customizations.sh"
|
||||
aliasesPath = "aliases"
|
||||
|
||||
require File.expand_path(confDir + '/scripts/homestead.rb')
|
||||
|
||||
Vagrant.require_version '>= 2.2.4'
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
if File.exist? aliasesPath then
|
||||
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
|
||||
config.vm.provision "shell" do |s|
|
||||
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
|
||||
end
|
||||
end
|
||||
|
||||
if File.exist? homesteadYamlPath then
|
||||
settings = YAML::load(File.read(homesteadYamlPath))
|
||||
elsif File.exist? homesteadJsonPath then
|
||||
settings = JSON::parse(File.read(homesteadJsonPath))
|
||||
else
|
||||
abort "Homestead settings file not found in " + File.dirname(__FILE__)
|
||||
end
|
||||
|
||||
Homestead.configure(config, settings)
|
||||
|
||||
if File.exist? afterScriptPath then
|
||||
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
|
||||
end
|
||||
|
||||
if File.exist? customizationScriptPath then
|
||||
config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
|
||||
end
|
||||
|
||||
if Vagrant.has_plugin?('vagrant-hostsupdater')
|
||||
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
|
||||
elsif Vagrant.has_plugin?('vagrant-hostmanager')
|
||||
config.hostmanager.enabled = true
|
||||
config.hostmanager.manage_host = true
|
||||
config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
|
||||
end
|
||||
end
|
321
resources/localized/aliases
Normal file
321
resources/localized/aliases
Normal file
@ -0,0 +1,321 @@
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
|
||||
alias h='cd ~'
|
||||
alias c='clear'
|
||||
alias art=artisan
|
||||
|
||||
alias codecept='vendor/bin/codecept'
|
||||
alias phpspec='vendor/bin/phpspec'
|
||||
alias serve=serve-laravel
|
||||
|
||||
alias xoff='sudo phpdismod -s cli xdebug'
|
||||
alias xon='sudo phpenmod -s cli xdebug'
|
||||
|
||||
function artisan() {
|
||||
php artisan "$@"
|
||||
}
|
||||
|
||||
function dusk() {
|
||||
pids=$(pidof /usr/bin/Xvfb)
|
||||
|
||||
if [ ! -n "$pids" ]; then
|
||||
Xvfb :0 -screen 0 1280x960x24 &
|
||||
fi
|
||||
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
php artisan dusk
|
||||
else
|
||||
php artisan dusk --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function p() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest "$@"
|
||||
else
|
||||
vendor/bin/phpunit "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function pf() {
|
||||
if [ -f vendor/bin/pest ]; then
|
||||
vendor/bin/pest --filter "$@"
|
||||
else
|
||||
vendor/bin/phpunit --filter "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function php56() {
|
||||
sudo update-alternatives --set php /usr/bin/php5.6
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config5.6
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize5.6
|
||||
}
|
||||
|
||||
function php70() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.0
|
||||
}
|
||||
|
||||
function php71() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.1
|
||||
}
|
||||
|
||||
function php72() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.2
|
||||
}
|
||||
|
||||
function php73() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.3
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.3
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.3
|
||||
}
|
||||
|
||||
function php74() {
|
||||
sudo update-alternatives --set php /usr/bin/php7.4
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config7.4
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize7.4
|
||||
}
|
||||
|
||||
function php80() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.0
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.0
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.0
|
||||
}
|
||||
|
||||
function php81() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.1
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.1
|
||||
}
|
||||
|
||||
function php82() {
|
||||
sudo update-alternatives --set php /usr/bin/php8.2
|
||||
sudo update-alternatives --set php-config /usr/bin/php-config8.2
|
||||
sudo update-alternatives --set phpize /usr/bin/phpize8.2
|
||||
}
|
||||
|
||||
function serve-apache() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/apache.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/apache.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-apache domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-laravel() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/laravel.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/laravel.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-proxy() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/proxy.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/proxy.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-proxy domain port"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-silverstripe() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/silverstripe.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/silverstripe.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-silverstripe domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-spa() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/spa.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/spa.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-spa domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-statamic() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/statamic.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/statamic.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-statamic domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony2() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/symfony2.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/symfony2.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony2 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-symfony4() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/symfony4.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/symfony4.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-symfony4 domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function serve-pimcore() {
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/create-certificate.sh "$1"
|
||||
sudo dos2unix /vagrant/vendor/laravel/homestead/scripts/site-types/pimcore.sh
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/site-types/pimcore.sh "$1" "$2" 80 443 "${3:-8.3}"
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " serve-pimcore domain path"
|
||||
fi
|
||||
}
|
||||
|
||||
function share() {
|
||||
if [[ "$1" ]]
|
||||
then
|
||||
ngrok http ${@:2} $1:80
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " share domain"
|
||||
echo "Invocation with extra params passed directly to ngrok"
|
||||
echo " share domain -region=eu -subdomain=test1234"
|
||||
fi
|
||||
}
|
||||
|
||||
function flip() {
|
||||
sudo bash /vagrant/vendor/laravel/homestead/scripts/flip-webserver.sh
|
||||
}
|
||||
|
||||
function __has_pv() {
|
||||
$(hash pv 2>/dev/null);
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
function __pv_install_message() {
|
||||
if ! __has_pv; then
|
||||
echo $1
|
||||
echo "Install pv with \`sudo apt-get install -y pv\` then run this command again."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function dbexport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
# This gives an estimate of the size of the SQL file
|
||||
# It appears that 80% is a good approximation of
|
||||
# the ratio of estimated size to actual size
|
||||
SIZE_QUERY="select ceil(sum(data_length) * 0.8) as size from information_schema.TABLES"
|
||||
|
||||
__pv_install_message "Want to see export progress?"
|
||||
|
||||
echo "Exporting databases to '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
ADJUSTED_SIZE=$(mysql --vertical -uhomestead -psecret -e "$SIZE_QUERY" 2>/dev/null | grep 'size' | awk '{print $2}')
|
||||
HUMAN_READABLE_SIZE=$(numfmt --to=iec-i --suffix=B --format="%.3f" $ADJUSTED_SIZE)
|
||||
|
||||
echo "Estimated uncompressed size: $HUMAN_READABLE_SIZE"
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
|
||||
else
|
||||
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables --routines 2>/dev/null | gzip > "$FILE"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function dbimport() {
|
||||
FILE=${1:-/vagrant/mysqldump.sql.gz}
|
||||
|
||||
__pv_install_message "Want to see import progress?"
|
||||
|
||||
echo "Importing databases from '$FILE'"
|
||||
|
||||
if __has_pv; then
|
||||
pv "$FILE" --progress --eta | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
else
|
||||
cat "$FILE" | zcat | mysql -uhomestead -psecret 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
function xphp() {
|
||||
(php -m | grep -q xdebug)
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
XDEBUG_ENABLED=true
|
||||
else
|
||||
XDEBUG_ENABLED=false
|
||||
fi
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xon; fi
|
||||
|
||||
php \
|
||||
-dxdebug.client_host=192.168.10.1 \
|
||||
-dxdebug.start_with_request=yes \
|
||||
"$@"
|
||||
|
||||
if ! $XDEBUG_ENABLED; then xoff; fi
|
||||
}
|
||||
|
||||
function update-socket-wrench() {
|
||||
cd /var/www/socket-wrench
|
||||
git pull origin release
|
||||
composer install
|
||||
php artisan migrate --force
|
||||
}
|
||||
|
||||
function seed-socket-wrench() {
|
||||
cd /var/www/socket-wrench
|
||||
php artisan db:seed
|
||||
}
|
6
scripts/clear-nginx.sh
Normal file
6
scripts/clear-nginx.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Clear The Old Nginx Sites
|
||||
|
||||
rm -f /etc/nginx/sites-enabled/*
|
||||
rm -f /etc/nginx/sites-available/*
|
41
scripts/clear-variables.sh
Normal file
41
scripts/clear-variables.sh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Clear The Old Environment Variables
|
||||
|
||||
sed -i '/# Set Homestead Environment Variable/,+1d' /home/vagrant/.profile
|
||||
|
||||
if [ -f /etc/php/5.6/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/5.6/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/7.0/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/7.0/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/7.1/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/7.1/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/7.2/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/7.2/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/7.3/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/7.3/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/7.4/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/7.4/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/8.0/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/8.0/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/8.1/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/8.1/fpm/pool.d/www.conf
|
||||
fi
|
||||
|
||||
if [ -f /etc/php/8.2/fpm/pool.d/www.conf ]; then
|
||||
sed -i '/env\[.*/,+1d' /etc/php/8.2/fpm/pool.d/www.conf
|
||||
fi
|
5
scripts/configure-avahi.sh
Normal file
5
scripts/configure-avahi.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sed -i "s/#browse-domains=.*/browse-domains=$1/" /etc/avahi/avahi-daemon.conf
|
||||
sed -i "s/browse-domains=.*/browse-domains=$1/" /etc/avahi/avahi-daemon.conf
|
||||
service avahi-daemon restart
|
125
scripts/create-certificate.sh
Normal file
125
scripts/create-certificate.sh
Normal file
@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -f
|
||||
PATH_SSL="/etc/ssl/certs"
|
||||
|
||||
# Path to the custom Homestead $(hostname) Root CA certificate.
|
||||
PATH_ROOT_CNF="${PATH_SSL}/ca.homestead.$(hostname).cnf"
|
||||
PATH_ROOT_CRT="${PATH_SSL}/ca.homestead.$(hostname).crt"
|
||||
PATH_ROOT_KEY="${PATH_SSL}/ca.homestead.$(hostname).key"
|
||||
|
||||
# Path to the custom site certificate.
|
||||
PATH_CNF="${PATH_SSL}/${1}.cnf"
|
||||
PATH_CRT="${PATH_SSL}/${1}.crt"
|
||||
PATH_CSR="${PATH_SSL}/${1}.csr"
|
||||
PATH_KEY="${PATH_SSL}/${1}.key"
|
||||
|
||||
BASE_CNF="
|
||||
[ ca ]
|
||||
default_ca = ca_homestead_$(hostname)
|
||||
|
||||
[ ca_homestead_$(hostname) ]
|
||||
dir = $PATH_SSL
|
||||
certs = $PATH_SSL
|
||||
new_certs_dir = $PATH_SSL
|
||||
|
||||
private_key = $PATH_ROOT_KEY
|
||||
certificate = $PATH_ROOT_CRT
|
||||
|
||||
default_md = sha256
|
||||
|
||||
name_opt = ca_default
|
||||
cert_opt = ca_default
|
||||
default_days = 365
|
||||
preserve = no
|
||||
policy = policy_loose
|
||||
|
||||
[ policy_loose ]
|
||||
countryName = optional
|
||||
stateOrProvinceName = optional
|
||||
localityName = optional
|
||||
organizationName = optional
|
||||
organizationalUnitName = optional
|
||||
commonName = supplied
|
||||
emailAddress = optional
|
||||
|
||||
[ req ]
|
||||
prompt = no
|
||||
encrypt_key = no
|
||||
default_bits = 2048
|
||||
distinguished_name = req_distinguished_name
|
||||
string_mask = utf8only
|
||||
default_md = sha256
|
||||
x509_extensions = v3_ca
|
||||
|
||||
[ v3_ca ]
|
||||
authorityKeyIdentifier = keyid,issuer
|
||||
basicConstraints = critical, CA:true, pathlen:0
|
||||
keyUsage = critical, digitalSignature, keyCertSign
|
||||
subjectKeyIdentifier = hash
|
||||
|
||||
[ server_cert ]
|
||||
authorityKeyIdentifier = keyid,issuer:always
|
||||
basicConstraints = CA:FALSE
|
||||
extendedKeyUsage = serverAuth
|
||||
keyUsage = critical, digitalSignature, keyEncipherment
|
||||
subjectAltName = @alternate_names
|
||||
subjectKeyIdentifier = hash
|
||||
"
|
||||
|
||||
# Only generate the root certificate when there isn't one already there.
|
||||
if [ ! -f $PATH_ROOT_CNF ] || [ ! -f $PATH_ROOT_KEY ] || [ ! -f $PATH_ROOT_CRT ]
|
||||
then
|
||||
# Generate an OpenSSL configuration file specifically for this certificate.
|
||||
cnf="
|
||||
${BASE_CNF}
|
||||
[ req_distinguished_name ]
|
||||
O = Vagrant
|
||||
C = UN
|
||||
CN = Homestead $(hostname) Root CA
|
||||
"
|
||||
echo "$cnf" > $PATH_ROOT_CNF
|
||||
|
||||
# Finally, generate the private key and certificate.
|
||||
openssl genrsa -out "$PATH_ROOT_KEY" 4096 2>/dev/null
|
||||
openssl req -config "$PATH_ROOT_CNF" \
|
||||
-key "$PATH_ROOT_KEY" \
|
||||
-x509 -new -extensions v3_ca -days 3650 -sha256 \
|
||||
-out "$PATH_ROOT_CRT" 2>/dev/null
|
||||
|
||||
# Symlink ca to local certificate storage and run update command
|
||||
ln --force --symbolic $PATH_ROOT_CRT /usr/local/share/ca-certificates/
|
||||
update-ca-certificates
|
||||
fi
|
||||
|
||||
# Only generate a certificate if there isn't one already there.
|
||||
if [ ! -f $PATH_CNF ] || [ ! -f $PATH_KEY ] || [ ! -f $PATH_CRT ]
|
||||
then
|
||||
# Uncomment the global 'copy_extentions' OpenSSL option to ensure the SANs are copied into the certificate.
|
||||
sed -i '/copy_extensions\ =\ copy/s/^#\ //g' /etc/ssl/openssl.cnf
|
||||
|
||||
# Generate an OpenSSL configuration file specifically for this certificate.
|
||||
cnf="
|
||||
${BASE_CNF}
|
||||
[ req_distinguished_name ]
|
||||
O = Vagrant
|
||||
C = UN
|
||||
CN = $1
|
||||
|
||||
[ alternate_names ]
|
||||
DNS.1 = $1
|
||||
DNS.2 = *.$1
|
||||
"
|
||||
echo "$cnf" > $PATH_CNF
|
||||
|
||||
# Finally, generate the private key and certificate signed with the Homestead $(hostname) Root CA.
|
||||
openssl genrsa -out "$PATH_KEY" 2048 2>/dev/null
|
||||
openssl req -config "$PATH_CNF" \
|
||||
-key "$PATH_KEY" \
|
||||
-new -sha256 -out "$PATH_CSR" 2>/dev/null
|
||||
openssl x509 -req -extfile "$PATH_CNF" \
|
||||
-extensions server_cert -days 365 -sha256 \
|
||||
-in "$PATH_CSR" \
|
||||
-CA "$PATH_ROOT_CRT" -CAkey "$PATH_ROOT_KEY" -CAcreateserial \
|
||||
-out "$PATH_CRT" 2>/dev/null
|
||||
fi
|
3
scripts/create-couch.sh
Normal file
3
scripts/create-couch.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
curl -sX PUT http://127.0.0.1:5984/$1
|
30
scripts/create-ecosystem.sh
Normal file
30
scripts/create-ecosystem.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mkdir /home/vagrant/ecosystem 2>/dev/null
|
||||
|
||||
PATH_ECOSYSTEM="/home/vagrant/ecosystem"
|
||||
|
||||
rm -rf /home/vagrant/ecosystem/*
|
||||
|
||||
PATH_JSON="${PATH_ECOSYSTEM}/${1}.json"
|
||||
|
||||
# variables
|
||||
# 1 = name
|
||||
# 2 = script
|
||||
# 3 = args
|
||||
# 4 = path
|
||||
|
||||
BASE_ECO='
|
||||
{
|
||||
"name": "'$1'",
|
||||
"script": "'$2'",
|
||||
"args": "'$3'",
|
||||
"cwd": "'$4'"
|
||||
}
|
||||
'
|
||||
|
||||
# Only generate a ecosystem if there isn't one already there.
|
||||
if [ ! -f $PATH_JSON ]
|
||||
then
|
||||
echo "$BASE_ECO" > $PATH_JSON
|
||||
fi
|
3
scripts/create-influxdb.sh
Normal file
3
scripts/create-influxdb.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
influx bucket create --token="homestead_secret" --name="$1" --org="homestead"
|
11
scripts/create-minio-bucket.sh
Normal file
11
scripts/create-minio-bucket.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -d /usr/local/share/minio/$1 ]]; then
|
||||
echo "Bucket already exists, skipping..."
|
||||
exit
|
||||
fi
|
||||
|
||||
mc mb /usr/local/share/minio/$1
|
||||
mc anonymous set $2 /usr/local/share/minio/$1
|
||||
# Minio CLI Makes Buckets Under Root For Some Reason
|
||||
sudo chown minio-user:minio-user /usr/local/share/minio/*
|
3
scripts/create-mongo.sh
Normal file
3
scripts/create-mongo.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mongosh $1 --eval "db.test.insertOne({name:'db creation'})"
|
31
scripts/create-mysql.sh
Normal file
31
scripts/create-mysql.sh
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cat > /root/.my.cnf << EOF
|
||||
[client]
|
||||
user = root
|
||||
password = secret
|
||||
host = 127.0.0.1
|
||||
EOF
|
||||
|
||||
cat > /home/vagrant/.my.cnf << EOF
|
||||
[client]
|
||||
user = homestead
|
||||
password = secret
|
||||
host = 127.0.0.1
|
||||
EOF
|
||||
|
||||
chown vagrant /home/vagrant/.my.cnf
|
||||
|
||||
DB=$1
|
||||
|
||||
mariadb=$(ps ax | grep mariadb | wc -l)
|
||||
mysql=$(ps ax | grep mysql | wc -l)
|
||||
|
||||
if [ "$mariadb" -gt 1 ]; then
|
||||
mariadb -e "CREATE DATABASE IF NOT EXISTS \`$DB\` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci"
|
||||
elif [ "$mysql" -gt 1 ]; then
|
||||
mysql -e "CREATE DATABASE IF NOT EXISTS \`$DB\` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci"
|
||||
else
|
||||
# Skip Creating database
|
||||
echo "We didn't find MariaDB (\$mariadb) or MySQL (\$mysql), skipping \`$DB\` creation"
|
||||
fi
|
13
scripts/create-ngrok.sh
Normal file
13
scripts/create-ngrok.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PATH_NGROK="/home/vagrant/.config/ngrok"
|
||||
PATH_CONFIG="${PATH_NGROK}/ngrok.yml"
|
||||
|
||||
# Only create a ngrok config file if there isn't one already there.
|
||||
if [ ! -f $PATH_CONFIG ]; then
|
||||
mkdir -p "$PATH_NGROK"
|
||||
cat > "$PATH_CONFIG" << EOF
|
||||
version: 2
|
||||
web_addr: $1:4040
|
||||
EOF
|
||||
fi
|
14
scripts/create-postgres.sh
Normal file
14
scripts/create-postgres.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DB=$1;
|
||||
postgres=$(pidof postgres)
|
||||
|
||||
if [ -z "$postgres" ]
|
||||
then
|
||||
# Skip Creating postgres database
|
||||
echo "We didn't find a PID for postgres, skipping \$DB creation"
|
||||
else
|
||||
if ! su postgres -c "psql $DB -c '\q' 2>/dev/null"; then
|
||||
su postgres -c "createdb -O homestead '$DB'"
|
||||
fi
|
||||
fi
|
13
scripts/cron-schedule.sh
Normal file
13
scripts/cron-schedule.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -d /etc/cron.d ]; then
|
||||
mkdir /etc/cron.d
|
||||
fi
|
||||
|
||||
SITE_DOMAIN=$1
|
||||
SITE_PUBLIC_DIRECTORY=$2
|
||||
SITE_PHP_VERSION=$3
|
||||
|
||||
cron="* * * * * vagrant . /home/vagrant/.profile; /usr/bin/php$SITE_PHP_VERSION $SITE_PUBLIC_DIRECTORY/../artisan schedule:run >> /dev/null 2>&1"
|
||||
|
||||
echo "$cron" > "/etc/cron.d/$SITE_DOMAIN"
|
59
scripts/features/blackfire.sh
Normal file
59
scripts/features/blackfire.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Make sure Blackfire is updated to v2
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/blackfire ] && [ ! -f /usr/bin/blackfire-agent ]
|
||||
then
|
||||
echo "blackfire already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/blackfire
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
curl -fsSL https://packages.blackfire.io/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/blackfire.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/blackfire.gpg] http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list
|
||||
|
||||
# Install Blackfire
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y blackfire blackfire-php
|
||||
|
||||
agent="[blackfire]
|
||||
ca-cert=
|
||||
collector=https://blackfire.io
|
||||
log-file=stderr
|
||||
log-level=1
|
||||
server-id=${server_id}
|
||||
server-token=${server_token}
|
||||
socket=unix:///var/run/blackfire/agent.sock
|
||||
spec=
|
||||
"
|
||||
|
||||
client="[blackfire]
|
||||
ca-cert=
|
||||
client-id=${client_id}
|
||||
client-token=${client_token}
|
||||
endpoint=https://blackfire.io
|
||||
timeout=15s
|
||||
"
|
||||
|
||||
echo "$agent" > "/etc/blackfire/agent"
|
||||
echo "$client" > "/home/vagrant/.blackfire.ini"
|
||||
|
||||
service php5.6-fpm restart
|
||||
service php7.0-fpm restart
|
||||
service php7.1-fpm restart
|
||||
service php7.2-fpm restart
|
||||
service php7.3-fpm restart
|
||||
service php7.4-fpm restart
|
||||
service php8.0-fpm restart
|
||||
service blackfire-agent restart
|
97
scripts/features/cassandra.sh
Normal file
97
scripts/features/cassandra.sh
Normal file
@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/cassandra ]
|
||||
then
|
||||
echo "cassandra already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/cassandra
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Cassandra and driver dependencies
|
||||
echo "deb https://debian.cassandra.apache.org 41x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
|
||||
curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install cassandra openjdk-8-jdk git libgmp-dev php7.1-dev php7.2-dev php7.3-dev php7.4-dev -y
|
||||
|
||||
# Start Cassandra and boot at runtime
|
||||
sudo service cassandra start
|
||||
sudo update-rc.d cassandra defaults
|
||||
|
||||
# Install DataStax C++ (required for PHP Extension)
|
||||
wget -q https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.28.0/libuv1-dev_1.28.0-1_amd64.deb
|
||||
wget -q https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.28.0/libuv1_1.28.0-1_amd64.deb
|
||||
wget -q https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.12.0/cassandra-cpp-driver-dev_2.12.0-1_amd64.deb
|
||||
wget -q https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.12.0/cassandra-cpp-driver_2.12.0-1_amd64.deb
|
||||
dpkg -i libuv1_1.28.0-1_amd64.deb
|
||||
dpkg -i libuv1-dev_1.28.0-1_amd64.deb
|
||||
dpkg -i cassandra-cpp-driver_2.12.0-1_amd64.deb
|
||||
dpkg -i cassandra-cpp-driver-dev_2.12.0-1_amd64.deb
|
||||
rm libuv1-dev_1.28.0-1_amd64.deb libuv1_1.28.0-1_amd64.deb cassandra-cpp-driver-dev_2.12.0-1_amd64.deb cassandra-cpp-driver_2.12.0-1_amd64.deb
|
||||
|
||||
# Install PHP Extension
|
||||
cd /usr/src
|
||||
git clone https://github.com/datastax/php-driver.git
|
||||
|
||||
cd /usr/src/php-driver/ext
|
||||
sudo phpize7.1
|
||||
mkdir /usr/src/php-driver/build
|
||||
cd /usr/src/php-driver/build
|
||||
sudo ../ext/configure --with-php-config=/usr/bin/php-config7.1 > /dev/null
|
||||
make clean >/dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo chmod 644 /usr/lib/php/20160303/cassandra.so
|
||||
|
||||
cd /usr/src/php-driver/ext
|
||||
sudo phpize7.2
|
||||
cd /usr/src/php-driver/build
|
||||
sudo /usr/src/php-driver/ext/configure --with-php-config=/usr/bin/php-config7.2 > /dev/null
|
||||
sudo make clean >/dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo chmod 644 /usr/lib/php/20170718/cassandra.so
|
||||
|
||||
cd /usr/src/php-driver/ext
|
||||
sudo phpize7.3
|
||||
cd /usr/src/php-driver/build
|
||||
sudo /usr/src/php-driver/ext/configure --with-php-config=/usr/bin/php-config7.3 > /dev/null
|
||||
sudo make clean >/dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo chmod 644 /usr/lib/php/20180731/cassandra.so
|
||||
|
||||
echo "; configuration for php cassandra module" >/etc/php/7.1/mods-available/cassandra.ini
|
||||
echo "; priority=20" >>/etc/php/7.1/mods-available/cassandra.ini
|
||||
echo "extension=cassandra.so" >>/etc/php/7.1/mods-available/cassandra.ini
|
||||
|
||||
echo "; configuration for php cassandra module" >/etc/php/7.2/mods-available/cassandra.ini
|
||||
echo "; priority=20" >>/etc/php/7.2/mods-available/cassandra.ini
|
||||
echo "extension=cassandra.so" >>/etc/php/7.2/mods-available/cassandra.ini
|
||||
|
||||
echo "; configuration for php cassandra module" >/etc/php/7.3/mods-available/cassandra.ini
|
||||
echo "; priority=20" >>/etc/php/7.3/mods-available/cassandra.ini
|
||||
echo "extension=cassandra.so" >>/etc/php/7.3/mods-available/cassandra.ini
|
||||
|
||||
sudo phpenmod cassandra
|
||||
|
||||
# Clean Up
|
||||
sudo rm -R /usr/src/php-driver
|
||||
|
||||
# Just in case other Java versions exist, set JAVA_HOME, because Cassandra doesn't work with newer
|
||||
# Java versions than Java 8
|
||||
echo "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" | sudo tee -a /etc/default/cassandra
|
||||
sudo service cassandra stop
|
||||
sudo service cassandra start
|
30
scripts/features/chronograf.sh
Normal file
30
scripts/features/chronograf.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/chronograf ]
|
||||
then
|
||||
echo "chronograf already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/chronograf
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
chronourl="https://dl.influxdata.com/chronograf/releases/chronograf_1.5.0.1_amd64.deb"
|
||||
|
||||
wget -q -O chronograf.deb $chronourl
|
||||
sudo dpkg -i chronograf.deb
|
||||
rm chronograf.deb
|
||||
|
||||
systemctl enable chronograf
|
||||
systemctl daemon-reload
|
||||
systemctl start chronograf
|
47
scripts/features/couchdb.sh
Normal file
47
scripts/features/couchdb.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/couchdb ]
|
||||
then
|
||||
echo "couchdb already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/couchdb
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
curl -fsSL https://couchdb.apache.org/repo/keys.asc | sudo gpg --dearmor -o /etc/apt/keyrings/couchdb.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/couchdb.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ jammy main" | sudo tee /etc/apt/sources.list.d/couchdb.list
|
||||
|
||||
sudo apt-get update
|
||||
echo "couchdb couchdb/mode select standalone
|
||||
couchdb couchdb/mode seen true
|
||||
couchdb couchdb/bindaddress string 127.0.0.1
|
||||
couchdb couchdb/bindaddress seen true" | debconf-set-selections
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y couchdb
|
||||
|
||||
sudo chown -R couchdb:couchdb /etc/couchdb
|
||||
sudo chmod -R 0770 /etc/couchdb
|
||||
|
||||
sudo sed -i "s/;bind_address =.*/bind_address = 0.0.0.0/" /opt/couchdb/etc/local.ini
|
||||
|
||||
sudo service couchdb restart
|
||||
|
||||
sudo service nginx restart
|
||||
|
||||
sudo service php5.6-fpm restart
|
||||
sudo service php7.0-fpm restart
|
||||
sudo service php7.1-fpm restart
|
||||
sudo service php7.2-fpm restart
|
||||
sudo service php7.3-fpm restart
|
||||
sudo service php7.4-fpm restart
|
||||
sudo service php8.0-fpm restart
|
39
scripts/features/crystal.sh
Normal file
39
scripts/features/crystal.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/crystal ]
|
||||
then
|
||||
echo "crystal already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/crystal
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Crystal Programming Language Support
|
||||
curl -fsSL https://keybase.io/crystal/pgp_keys.asc | sudo gpg --dearmor -o /etc/apt/keyrings/crystal.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/crystal.gpg] https://dist.crystal-lang.org/apt crystal main" | sudo tee /etc/apt/sources.list.d/crystal.list
|
||||
|
||||
apt-get update
|
||||
apt-get install -y crystal
|
||||
|
||||
# Install Lucky Framework for Crystal
|
||||
|
||||
wget https://github.com/luckyframework/lucky_cli/archive/v0.11.0.tar.gz
|
||||
tar -zxvf v0.11.0.tar.gz
|
||||
cd lucky_cli-0.11.0
|
||||
shards install
|
||||
crystal build src/lucky.cr --release --no-debug
|
||||
mv lucky /usr/local/bin/.
|
||||
cd /home/vagrant
|
||||
rm -rf lucky_cli-0.11.0
|
||||
rm -rf v0.11.0.tar.gz
|
23
scripts/features/dockstead.sh
Normal file
23
scripts/features/dockstead.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/dockstead ]
|
||||
then
|
||||
echo "dockstead already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/dockstead
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Ensure we're in swarm mode
|
||||
docker swarm init --advertise-addr 192.168.56.56
|
5
scripts/features/dockstead/env.docker
Normal file
5
scripts/features/dockstead/env.docker
Normal file
@ -0,0 +1,5 @@
|
||||
# Mysql Parameters
|
||||
MYSQL_ROOT_PASSWORD=secret
|
||||
MYSQL_DATABASE=homestead
|
||||
MYSQL_USER=homestead
|
||||
MYSQL_PASSWORD=secret
|
25
scripts/features/dockstead/mysql-5.7.yaml
Normal file
25
scripts/features/dockstead/mysql-5.7.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
#
|
||||
# docker stack deploy -c /vagrant/scripts/features/dockstead/mysql-5.7.yaml mysql-56
|
||||
#
|
||||
version: "3.7"
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
volumes:
|
||||
- type: volume
|
||||
source: mysql-data
|
||||
target: /var/lib/mysql
|
||||
volume:
|
||||
nocopy: true
|
||||
ports:
|
||||
- "3306:3306"
|
||||
healthcheck:
|
||||
test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD
|
||||
interval: 3s
|
||||
timeout: 1s
|
||||
retries: 5
|
||||
env_file:
|
||||
- env.docker
|
||||
volumes:
|
||||
mysql-data:
|
12
scripts/features/dockstead/mysql-57.sh
Normal file
12
scripts/features/dockstead/mysql-57.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Stop the default MySQL Service
|
||||
sudo service mysql stop
|
||||
|
||||
# Update /home/vagrant/.my.cnf
|
||||
sed -i "s/localhost/127.0.0.1/" /home/vagrant/.my.cnf
|
||||
|
||||
# Start the MySQL 5.7 stack
|
||||
docker stack deploy -c /vagrant/scripts/features/dockstead/mysql-5.7.yaml mysql-57
|
||||
echo "Sleeping for 30 seconds while we wait for MySQL service to come up"
|
||||
sleep 30
|
59
scripts/features/dragonflydb.sh
Normal file
59
scripts/features/dragonflydb.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/dragonflydb ]; then
|
||||
echo "Dragonflydb already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ARCH=$(arch)
|
||||
DRAGONFLY_URL="https://dragonflydb.gateway.scarf.sh/latest/dragonfly-$ARCH.tar.gz"
|
||||
|
||||
# Install Dragonfly
|
||||
if ! curl -sSL "$DRAGONFLY_URL" -o dragonflydb.tar.gz; then
|
||||
echo "Error downloading Dragonfly archive."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! tar -xzf dragonflydb.tar.gz "dragonfly-$ARCH"; then
|
||||
echo "Error extracting Dragonfly archive."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv "dragonfly-$ARCH" /usr/local/bin/dragonfly
|
||||
|
||||
# Create systemd service file
|
||||
cat > /etc/systemd/system/dragonfly.service << EOF
|
||||
[Unit]
|
||||
Description=DragonFly
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=vagrant
|
||||
ExecStart=/usr/bin/env /usr/local/bin/dragonfly
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Disable and stop redis
|
||||
systemctl disable --now redis-server
|
||||
|
||||
# Enable and start dragonfly
|
||||
systemctl enable --now dragonfly
|
||||
|
||||
# Clean up
|
||||
rm -rf dragonflydb.tar.gz
|
||||
|
||||
# Mark installation as complete
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/dragonflydb
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
62
scripts/features/elasticsearch.sh
Normal file
62
scripts/features/elasticsearch.sh
Normal file
@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/elasticsearch ]
|
||||
then
|
||||
echo "Elasticsearch already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/elasticsearch
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Determine version from config
|
||||
|
||||
set -- "$1"
|
||||
IFS=".";
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
installVersion="" # by not specifying we'll install latest
|
||||
majorVersion="7" # default to version 7
|
||||
else
|
||||
installVersion="=$version"
|
||||
majorVersion="$(echo $version | head -c 1)"
|
||||
fi
|
||||
|
||||
|
||||
echo "Elasticsearch installVersion: $installVersion"
|
||||
echo "Elasticsearch majorVersion: $majorVersion"
|
||||
|
||||
|
||||
# Install Java & Elasticsearch
|
||||
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /etc/apt/keyrings/elasticsearch.gpg
|
||||
|
||||
if [ ! -f /etc/apt/sources.list.d/elastic-$majorVersion.x.list ]; then
|
||||
echo "deb [signed-by=/etc/apt/keyrings/elasticsearch.gpg] https://artifacts.elastic.co/packages/$majorVersion.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-$majorVersion.x.list
|
||||
fi
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install openjdk-11-jre
|
||||
sudo apt-get -y install elasticsearch"$installVersion"
|
||||
|
||||
# Start Elasticsearch on boot
|
||||
|
||||
sudo update-rc.d elasticsearch defaults 95 10
|
||||
|
||||
# Update configuration to use 'homestead' as the cluster
|
||||
|
||||
sudo sed -i "s/#cluster.name: my-application/cluster.name: homestead/" /etc/elasticsearch/elasticsearch.yml
|
||||
|
||||
# Enable Start Elasticsearch
|
||||
|
||||
sudo systemctl enable elasticsearch.service
|
||||
sudo service elasticsearch start
|
54
scripts/features/eventstore.sh
Normal file
54
scripts/features/eventstore.sh
Normal file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/eventstore ]
|
||||
then
|
||||
echo "eventstore already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/eventstore
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Determine wanted version from config
|
||||
set -- "$1"
|
||||
IFS=".";
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
installVersion="" # by not specifying we'll install latest
|
||||
else
|
||||
installVersion="=${version}"
|
||||
fi
|
||||
|
||||
# Install repository
|
||||
curl -s https://packagecloud.io/install/repositories/EventStore/EventStore-OSS/script.deb.sh | bash
|
||||
|
||||
# Install EventStore package
|
||||
apt-get install -y eventstore-oss"$installVersion"
|
||||
|
||||
# Update configuration
|
||||
sed -i "s/RunProjections: None/RunProjections: ${run_projections:-All}/" /etc/eventstore/eventstore.conf
|
||||
|
||||
configuration="
|
||||
extIp: ${external_ip:-0.0.0.0}
|
||||
extTcpPort: ${external_tcp_port:-2112}
|
||||
extHttpPort: ${external_http_port:-2113}
|
||||
AdminOnExt: ${admin_on_ext:-true}
|
||||
"
|
||||
echo "$configuration" >> /etc/eventstore/eventstore.conf
|
||||
|
||||
# Allow the Event Store executable to bind to a port lower than 1024
|
||||
setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/eventstored
|
||||
|
||||
# Enable and Start EventStore
|
||||
systemctl enable eventstore.service
|
||||
systemctl start eventstore.service
|
27
scripts/features/flyway.sh
Normal file
27
scripts/features/flyway.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/flyway ]
|
||||
then
|
||||
echo "flyway CLI already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/flyway
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Flyway
|
||||
wget https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/4.2.0/flyway-commandline-4.2.0-linux-x64.tar.gz
|
||||
tar -zxvf flyway-commandline-4.2.0-linux-x64.tar.gz -C /usr/local
|
||||
chmod +x /usr/local/flyway-4.2.0/flyway
|
||||
ln -s /usr/local/flyway-4.2.0/flyway /usr/local/bin/flyway
|
||||
rm -rf flyway-commandline-4.2.0-linux-x64.tar.gz
|
28
scripts/features/gearman.sh
Normal file
28
scripts/features/gearman.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/gearman ]
|
||||
then
|
||||
echo "gearman already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/gearman
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Gearman Job Server and PHP Extension
|
||||
sudo apt-get update
|
||||
sudo apt-get install gearman-job-server php-gearman -y
|
||||
|
||||
# Listen on 0.0.0.0
|
||||
sudo sed -i 's/localhost/0.0.0.0/g' /etc/default/gearman-job-server
|
||||
sudo service gearman-job-server restart
|
35
scripts/features/golang.sh
Normal file
35
scripts/features/golang.sh
Normal file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/golang ]
|
||||
then
|
||||
echo "Golang already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/golang
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
ARCH=$(arch)
|
||||
|
||||
# Install Golang
|
||||
if [[ "$ARCH" == "aarch64" ]]; then
|
||||
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')
|
||||
wget https://dl.google.com/go/${GOLANG_LATEST_STABLE_VERSION} -O golang.tar.gz
|
||||
else
|
||||
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')
|
||||
wget https://dl.google.com/go/${GOLANG_LATEST_STABLE_VERSION} -O golang.tar.gz
|
||||
fi
|
||||
|
||||
tar -C /usr/local -xzf golang.tar.gz go
|
||||
printf "\nPATH=\"/usr/local/go/bin:\$PATH\"\n" | tee -a /home/vagrant/.profile
|
||||
rm -rf golang.tar.gz
|
30
scripts/features/grafana.sh
Normal file
30
scripts/features/grafana.sh
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/grafana ]
|
||||
then
|
||||
echo "grafana already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/grafana
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
curl -fsSL https://packages.grafana.com/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/grafana.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
|
||||
|
||||
apt-get update -y
|
||||
apt-get install -y grafana
|
||||
|
||||
systemctl enable grafana-server
|
||||
systemctl daemon-reload
|
||||
systemctl start grafana-server
|
23
scripts/features/heroku.sh
Normal file
23
scripts/features/heroku.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/heroku ]
|
||||
then
|
||||
echo "Heroku CLI already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/heroku
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Heroku CLI
|
||||
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
|
42
scripts/features/influxdb.sh
Normal file
42
scripts/features/influxdb.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/influxdb ]
|
||||
then
|
||||
echo "influxdb already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# InfluxDB v2.7.5 - from https://www.influxdata.com/downloads/
|
||||
# influxdata-archive_compat.key GPG fingerprint:
|
||||
# 9D53 9D90 D332 8DC7 D6C8 D3B9 D8FF 8E1F 7DF8 B07E
|
||||
wget -q https://repos.influxdata.com/influxdata-archive_compat.key
|
||||
echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
|
||||
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
|
||||
|
||||
apt-get update
|
||||
apt-get install -y influxdb2
|
||||
|
||||
systemctl enable --now influxdb
|
||||
|
||||
influx setup \
|
||||
--force \
|
||||
--username "homestead" \
|
||||
--password "secretkey" \
|
||||
--org "homestead" \
|
||||
--bucket "homestead" \
|
||||
--name "homestead" \
|
||||
--token "homestead_secret"
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/influxdb
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
53
scripts/features/logstash.sh
Normal file
53
scripts/features/logstash.sh
Normal file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/logstash ]
|
||||
then
|
||||
echo "logstash already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/logstash
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Determine version from config
|
||||
|
||||
set -- "$1"
|
||||
IFS=".";
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
installVersion="" # by not specifying we'll install latest
|
||||
majorVersion="7" # default to version 7
|
||||
else
|
||||
installVersion="=$version"
|
||||
majorVersion="$(echo $version | head -c 1)"
|
||||
fi
|
||||
|
||||
|
||||
echo "Logstash installVersion: $installVersion"
|
||||
echo "Logstash majorVersion: $majorVersion"
|
||||
|
||||
|
||||
# Install Java & Logstash
|
||||
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /etc/apt/keyrings/elasticsearch.gpg
|
||||
|
||||
if [ ! -f /etc/apt/sources.list.d/elastic-$majorVersion.x.list ]; then
|
||||
echo "deb [signed-by=/etc/apt/keyrings/elasticsearch.gpg] https://artifacts.elastic.co/packages/$majorVersion.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-$majorVersion.x.list
|
||||
fi
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install openjdk-11-jre
|
||||
sudo apt-get -y install logstash"$installVersion"
|
||||
|
||||
# Enable Start Elasticsearch
|
||||
|
||||
sudo systemctl enable --now logstash.service
|
82
scripts/features/mariadb.sh
Normal file
82
scripts/features/mariadb.sh
Normal file
@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/mariadb ]; then
|
||||
echo "MariaDB already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/mariadb
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Disable Apparmor
|
||||
# See https://github.com/laravel/homestead/issues/629#issue-247524528
|
||||
service apparmor stop
|
||||
update-rc.d -f apparmor remove
|
||||
|
||||
# Remove MySQL
|
||||
apt-get -o Dpkg::Options::="--force-confnew" remove -y --purge mysql-server mysql-client
|
||||
apt-get autoremove -y
|
||||
apt-get autoclean
|
||||
|
||||
rm -rf /var/lib/mysql/*
|
||||
rm -rf /var/log/mysql
|
||||
rm -rf /etc/mysql
|
||||
|
||||
# Determine version from config
|
||||
set -- "$1"
|
||||
IFS="."
|
||||
|
||||
# Add Maria PPA
|
||||
if [ -z "${version}" ]; then
|
||||
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
|
||||
else
|
||||
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
|
||||
sudo bash mariadb_repo_setup --mariadb-server-version="$version"
|
||||
echo "MariaDB specific target version : $version"
|
||||
fi
|
||||
|
||||
debconf-set-selections <<< "mariadb-server mysql-server/data-dir select ''"
|
||||
debconf-set-selections <<< "mariadb-server mysql-server/root_password password secret"
|
||||
debconf-set-selections <<< "mariadb-server mysql-server/root_password_again password secret"
|
||||
mkdir /etc/mysql
|
||||
touch /etc/mysql/debian.cnf
|
||||
|
||||
# Install MariaDB
|
||||
apt-get -o Dpkg::Options::="--force-confnew" install -y mariadb-server mariadb-client mysql-common
|
||||
|
||||
# Configure Maria Remote Access and ignore db dirs
|
||||
sed -i "s/bind-address = 127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||
cat > /etc/mysql/mariadb.conf.d/50-server.cnf << EOF
|
||||
[mysqld]
|
||||
bind-address = 0.0.0.0
|
||||
ignore-db-dir = lost+found
|
||||
#general_log
|
||||
#general_log_file=/var/log/mysql/mariadb.log
|
||||
EOF
|
||||
|
||||
export MYSQL_PWD=secret
|
||||
|
||||
mariadb --user="root" --password="secret" -h localhost -e "GRANT ALL ON *.* TO root@'localhost' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
|
||||
mariadb --user="root" --password="secret" -h localhost -e "GRANT ALL ON *.* TO root@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
|
||||
service mariadb restart
|
||||
|
||||
mariadb --user="root" --password="secret" -h localhost -e "CREATE USER IF NOT EXISTS 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret';"
|
||||
mariadb --user="root" --password="secret" -h localhost -e "GRANT ALL ON *.* TO 'homestead'@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
|
||||
mariadb --user="root" --password="secret" -h localhost -e "GRANT ALL ON *.* TO 'homestead'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
|
||||
mariadb --user="root" --password="secret" -h localhost -e "FLUSH PRIVILEGES;"
|
||||
service mariadb restart
|
||||
|
||||
mariadb-upgrade --user="root" --verbose --force
|
||||
service mariadb restart
|
||||
|
||||
unset MYSQL_PWD
|
45
scripts/features/meilisearch.sh
Normal file
45
scripts/features/meilisearch.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/meilisearch ]
|
||||
then
|
||||
echo "meilisearch already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/meilisearch
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# add the sources for meilisearch
|
||||
curl -L https://install.meilisearch.com | sh
|
||||
mv ./meilisearch /usr/bin/
|
||||
|
||||
# Create a service file
|
||||
cat > /etc/systemd/system/meilisearch.service << EOF
|
||||
[Unit]
|
||||
Description=MeiliSearch
|
||||
After=systemd-user-sessions.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/meilisearch --http-addr '0.0.0.0:7700'
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOF
|
||||
|
||||
# Set the service meilisearch
|
||||
systemctl daemon-reload
|
||||
systemctl enable meilisearch
|
||||
|
||||
# Start the meilisearch service
|
||||
systemctl start meilisearch
|
68
scripts/features/minio.sh
Normal file
68
scripts/features/minio.sh
Normal file
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/minio ]
|
||||
then
|
||||
echo "minio already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ARCH=$(arch)
|
||||
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/minio
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
if [[ "$ARCH" == "aarch64" ]]; then
|
||||
curl -sO https://dl.minio.io/server/minio/release/linux-arm64/minio
|
||||
else
|
||||
curl -sO https://dl.minio.io/server/minio/release/linux-amd64/minio
|
||||
fi
|
||||
|
||||
sudo chmod +x minio
|
||||
sudo mv minio /usr/local/bin
|
||||
sudo useradd -r minio-user -s /sbin/nologin
|
||||
sudo mkdir /usr/local/share/minio
|
||||
sudo mkdir /etc/minio
|
||||
|
||||
cat <<EOT >> /etc/default/minio
|
||||
# Local export path.
|
||||
MINIO_VOLUMES="/usr/local/share/minio/"
|
||||
# Use if you want to run Minio on a custom port.
|
||||
MINIO_OPTS="--config-dir /etc/minio --address :9600 --console-address :9601"
|
||||
MINIO_CONFIG_ENV_FILE=/etc/default/minio
|
||||
MINIO_ROOT_USER=homestead
|
||||
MINIO_ROOT_PASSWORD=secretkey
|
||||
|
||||
EOT
|
||||
|
||||
sudo chown minio-user:minio-user /usr/local/share/minio
|
||||
sudo chown minio-user:minio-user /etc/minio
|
||||
|
||||
curl -sO https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service
|
||||
sudo mv minio.service /etc/systemd/system
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable minio
|
||||
sudo systemctl start minio
|
||||
|
||||
sudo ufw allow 9600
|
||||
|
||||
# Installing Minio Client
|
||||
if [[ "$ARCH" == "aarch64" ]]; then
|
||||
curl -sO https://dl.minio.io/client/mc/release/linux-arm64/mc
|
||||
else
|
||||
curl -sO https://dl.minio.io/client/mc/release/linux-amd64/mc
|
||||
fi
|
||||
|
||||
chmod +x mc
|
||||
sudo mv mc /usr/local/bin
|
||||
mc config host add homestead http://127.0.1.1:9600 homestead secretkey
|
164
scripts/features/mongodb.sh
Normal file
164
scripts/features/mongodb.sh
Normal file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/mongodb ]
|
||||
then
|
||||
echo "MongoDB already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ARCH=$(arch)
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/mongodb
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc | sudo gpg --dearmor -o /etc/apt/keyrings/mongodb.gpg
|
||||
if [[ "$ARCH" == "aarch64" ]]; then
|
||||
echo "deb [signed-by=/etc/apt/keyrings/mongodb.gpg arch=arm64] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
else
|
||||
echo "deb [signed-by=/etc/apt/keyrings/mongodb.gpg arch=amd64] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
fi
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confnew" install mongodb-org autoconf g++ make openssl libssl-dev libcurl4-openssl-dev pkg-config libsasl2-dev php-dev
|
||||
|
||||
sudo ufw allow 27017
|
||||
sudo sed -i "s/bindIp: .*/bindIp: 0.0.0.0/" /etc/mongod.conf
|
||||
|
||||
sudo systemctl enable mongod
|
||||
sudo systemctl start mongod
|
||||
|
||||
sudo rm -rf /tmp/mongo-php-driver /usr/src/mongo-php-driver
|
||||
git clone -c advice.detachedHead=false -q -b '1.16.2' --single-branch https://github.com/mongodb/mongo-php-driver.git /tmp/mongo-php-driver
|
||||
sudo mv /tmp/mongo-php-driver /usr/src/mongo-php-driver
|
||||
cd /usr/src/mongo-php-driver
|
||||
git submodule -q update --init
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php56 ]
|
||||
then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confold" install php5.6-dev
|
||||
phpize5.6
|
||||
./configure --with-php-config=/usr/bin/php-config5.6 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/5.6/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/5.6/mods-available/mongo.ini /etc/php/5.6/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/5.6/mods-available/mongo.ini /etc/php/5.6/fpm/conf.d/20-mongo.ini
|
||||
sudo service php5.6-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php70 ]
|
||||
then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confold" install php7.0-dev
|
||||
phpize7.0
|
||||
./configure --with-php-config=/usr/bin/php-config7.0 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/7.0/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/7.0/mods-available/mongo.ini /etc/php/7.0/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/7.0/mods-available/mongo.ini /etc/php/7.0/fpm/conf.d/20-mongo.ini
|
||||
sudo service php7.0-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php71 ]
|
||||
then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confold" install php7.1-dev
|
||||
phpize7.1
|
||||
./configure --with-php-config=/usr/bin/php-config7.1 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/7.1/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/7.1/mods-available/mongo.ini /etc/php/7.1/fpm/conf.d/20-mongo.ini
|
||||
sudo service php7.1-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php72 ]
|
||||
then
|
||||
phpize7.2
|
||||
./configure --with-php-config=/usr/bin/php-config7.2 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/7.2/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/7.2/mods-available/mongo.ini /etc/php/7.2/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/7.2/mods-available/mongo.ini /etc/php/7.2/fpm/conf.d/20-mongo.ini
|
||||
sudo service php7.2-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php73 ]
|
||||
then
|
||||
phpize7.3
|
||||
./configure --with-php-config=/usr/bin/php-config7.3 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/7.3/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/7.3/mods-available/mongo.ini /etc/php/7.3/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/7.3/mods-available/mongo.ini /etc/php/7.3/fpm/conf.d/20-mongo.ini
|
||||
sudo service php7.3-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php74 ]
|
||||
then
|
||||
phpize7.4
|
||||
./configure --with-php-config=/usr/bin/php-config7.4 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/7.4/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/7.4/mods-available/mongo.ini /etc/php/7.4/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/7.4/mods-available/mongo.ini /etc/php/7.4/fpm/conf.d/20-mongo.ini
|
||||
sudo service php7.4-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php80 ]
|
||||
then
|
||||
phpize8.0
|
||||
./configure --with-php-config=/usr/bin/php-config8.0 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/8.0/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/8.0/mods-available/mongo.ini /etc/php/8.0/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/8.0/mods-available/mongo.ini /etc/php/8.0/fpm/conf.d/20-mongo.ini
|
||||
sudo service php8.0-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php81 ]
|
||||
then
|
||||
phpize8.1
|
||||
./configure --with-php-config=/usr/bin/php-config8.1 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/8.1/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/8.1/mods-available/mongo.ini /etc/php/8.1/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/8.1/mods-available/mongo.ini /etc/php/8.1/fpm/conf.d/20-mongo.ini
|
||||
sudo service php8.1-fpm restart
|
||||
fi
|
||||
|
||||
phpize8.2
|
||||
./configure --with-php-config=/usr/bin/php-config8.2 > /dev/null
|
||||
make clean > /dev/null
|
||||
make >/dev/null 2>&1
|
||||
sudo make install
|
||||
sudo bash -c "echo 'extension=mongodb.so' > /etc/php/8.2/mods-available/mongo.ini"
|
||||
sudo ln -s /etc/php/8.2/mods-available/mongo.ini /etc/php/8.2/cli/conf.d/20-mongo.ini
|
||||
sudo ln -s /etc/php/8.2/mods-available/mongo.ini /etc/php/8.2/fpm/conf.d/20-mongo.ini
|
||||
sudo service php8.2-fpm restart
|
||||
|
||||
mongosh admin --eval "db.createUser({user:'homestead',pwd:'secret',roles:['root']})"
|
53
scripts/features/neo4j.sh
Normal file
53
scripts/features/neo4j.sh
Normal file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/neo4j ]
|
||||
then
|
||||
echo "neo4j already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/neo4j
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
|
||||
echo 'deb https://debian.neo4j.com stable latest' | sudo tee /etc/apt/sources.list.d/neo4j.list
|
||||
|
||||
apt-get update
|
||||
|
||||
# Install Neo4j Community Edition
|
||||
apt-get install -y neo4j
|
||||
|
||||
# Stop Neo4j for configuration
|
||||
systemctl stop neo4j
|
||||
|
||||
# Configure Neo4j Remote Access
|
||||
sed -i "s/#dbms.connectors.default_listen_address=0.0.0.0/dbms.connectors.default_listen_address=0.0.0.0/" /etc/neo4j/neo4j.conf
|
||||
|
||||
# Enable Neo4j as system service
|
||||
systemctl enable neo4j
|
||||
systemctl start neo4j
|
||||
|
||||
# Poll Neo4j
|
||||
end="$((SECONDS+60))"
|
||||
while true; do
|
||||
nc -w 2 localhost 7687 && break
|
||||
[[ "${SECONDS}" -ge "${end}" ]] && exit 1
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Add new Neo4j user
|
||||
cypher-shell -u neo4j -p neo4j "CALL dbms.changePassword('secret');"
|
||||
cypher-shell -u neo4j -p secret "CALL dbms.security.createUser('homestead', 'secret', false);"
|
||||
|
||||
# Delete default Neo4j user
|
||||
cypher-shell -u homestead -p secret "CALL dbms.security.deleteUser('neo4j');"
|
39
scripts/features/ohmyzsh.sh
Normal file
39
scripts/features/ohmyzsh.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/oh-my-zsh ]
|
||||
then
|
||||
echo "oh-my-zsh already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/oh-my-zsh
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install oh-my-zsh
|
||||
git clone https://github.com/ohmyzsh/ohmyzsh.git /home/vagrant/.oh-my-zsh
|
||||
cp /home/vagrant/.oh-my-zsh/templates/zshrc.zsh-template /home/vagrant/.zshrc
|
||||
|
||||
# Set theme and plugins according to config
|
||||
if [ -n "${theme}" ]; then
|
||||
sed -i "s/^ZSH_THEME=.*/ZSH_THEME=\"${theme}\"/" /home/vagrant/.zshrc
|
||||
fi
|
||||
if [ -n "${plugins}" ]; then
|
||||
sed -i "s/^plugins=.*/plugins=(${plugins})/" /home/vagrant/.zshrc
|
||||
fi
|
||||
|
||||
printf "\nemulate sh -c 'source ~/.bash_aliases'\n" | tee -a /home/vagrant/.zprofile
|
||||
printf "\nemulate sh -c 'source ~/.profile'\n" | tee -a /home/vagrant/.zprofile
|
||||
chown -R vagrant:vagrant /home/vagrant/.oh-my-zsh
|
||||
chown vagrant:vagrant /home/vagrant/.zshrc
|
||||
chown vagrant:vagrant /home/vagrant/.zprofile
|
||||
chsh -s /bin/zsh vagrant
|
34
scripts/features/openresty.sh
Normal file
34
scripts/features/openresty.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/openresty ]
|
||||
then
|
||||
echo "openresty already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/openresty
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Openresty
|
||||
curl -fsSL https://openresty.org/package/pubkey.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/openresty.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/openresty.gpg] http://openresty.org/package/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/openresty.list
|
||||
|
||||
sudo apt-get update
|
||||
sudo service nginx stop
|
||||
sudo apt-get install -y openresty
|
||||
sudo sed -i "s/listen\s*80;/listen\ 8888;/g" /etc/openresty/nginx.conf
|
||||
|
||||
# Start Openresty
|
||||
|
||||
sudo service openresty restart
|
||||
sudo service nginx start
|
74
scripts/features/php5.6.sh
Normal file
74
scripts/features/php5.6.sh
Normal file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php5.6-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php5.6-fpm
|
||||
service php5.6-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php56 ]
|
||||
then
|
||||
echo "PHP 5.6 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php56
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 5.6
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --allow-change-held-packages \
|
||||
php5.6-bcmath php5.6-bz2 php5.6-cgi php5.6-cli php5.6-common php5.6-curl php5.6-dba php5.6-dev php5.6-enchant \
|
||||
php5.6-fpm php5.6-gd php5.6-gmp php5.6-imap php5.6-interbase php5.6-intl php5.6-json php5.6-ldap php5.6-mbstring \
|
||||
php5.6-mcrypt php5.6-mysql php5.6-odbc php5.6-opcache php5.6-pgsql php5.6-phpdbg php5.6-pspell php5.6-readline \
|
||||
php5.6-recode php5.6-snmp php5.6-soap php5.6-sqlite3 php5.6-sybase php5.6-tidy php5.6-xml php5.6-xmlrpc php5.6-xsl \
|
||||
php5.6-zip php5.6-memcached php5.6-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/5.6/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/5.6/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/5.6/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/5.6/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.remote_enable = 1" >> /etc/php/5.6/mods-available/xdebug.ini
|
||||
echo "xdebug.remote_connect_back = 1" >> /etc/php/5.6/mods-available/xdebug.ini
|
||||
echo "xdebug.remote_port = 9000" >> /etc/php/5.6/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/5.6/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/5.6/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/5.6/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/5.6/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/5.6/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/5.6/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/5.6/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/5.6/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/5.6/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/5.6/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/5.6/fpm/php.ini
|
||||
|
||||
printf "[curl]\n" | tee -a /etc/php/5.6/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/5.6/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/5.6/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php5.6-fpm
|
||||
service php5.6-fpm restart
|
73
scripts/features/php7.0.sh
Normal file
73
scripts/features/php7.0.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php7.0-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php7.0-fpm
|
||||
service php7.0-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php70 ]
|
||||
then
|
||||
echo "PHP 7.0 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php70
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 7.0
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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 \
|
||||
php7.0-fpm php7.0-gd php7.0-gmp php7.0-imap php7.0-interbase php7.0-intl php7.0-json php7.0-ldap php7.0-mbstring \
|
||||
php7.0-mcrypt php7.0-mysql php7.0-odbc php7.0-opcache php7.0-pgsql php7.0-phpdbg php7.0-pspell php7.0-readline \
|
||||
php7.0-recode php7.0-snmp php7.0-soap php7.0-sqlite3 php7.0-sybase php7.0-tidy php7.0-xml php7.0-xmlrpc php7.0-xsl \
|
||||
php7.0-zip php7.0-memcached php7.0-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.0/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.remote_enable = 1" >> /etc/php/7.0/mods-available/xdebug.ini
|
||||
echo "xdebug.remote_connect_back = 1" >> /etc/php/7.0/mods-available/xdebug.ini
|
||||
echo "xdebug.remote_port = 9000" >> /etc/php/7.0/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/7.0/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/7.0/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.0/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.0/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.0/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/7.0/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.0/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/7.0/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.0/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.0/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php7.0-fpm
|
||||
service php7.0-fpm restart
|
73
scripts/features/php7.1.sh
Normal file
73
scripts/features/php7.1.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php7.1-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php7.1-fpm
|
||||
service php7.1-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php71 ]
|
||||
then
|
||||
echo "PHP 7.1 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php71
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 7.1
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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 \
|
||||
php7.1-fpm php7.1-gd php7.1-gmp php7.1-imap php7.1-interbase php7.1-intl php7.1-json php7.1-ldap php7.1-mbstring \
|
||||
php7.1-mcrypt php7.1-mysql php7.1-odbc php7.1-opcache php7.1-pgsql php7.1-phpdbg php7.1-pspell php7.1-readline \
|
||||
php7.1-recode php7.1-snmp php7.1-soap php7.1-sqlite3 php7.1-sybase php7.1-tidy php7.1-xdebug php7.1-xml php7.1-xmlrpc \
|
||||
php7.1-xsl php7.1-zip php7.1-memcached php7.1-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.1/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.1/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.1/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.1/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.remote_enable = 1" >> /etc/php/7.1/mods-available/xdebug.ini
|
||||
echo "xdebug.remote_connect_back = 1" >> /etc/php/7.1/mods-available/xdebug.ini
|
||||
echo "xdebug.remote_port = 9000" >> /etc/php/7.1/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/7.1/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/7.1/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.1/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.1/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.1/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.1/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.1/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.1/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.1/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/7.1/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.1/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/7.1/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.1/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.1/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php7.1-fpm
|
||||
service php7.1-fpm restart
|
74
scripts/features/php7.2.sh
Normal file
74
scripts/features/php7.2.sh
Normal file
@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php7.2-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php7.2-fpm
|
||||
service php7.2-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php72 ]
|
||||
then
|
||||
echo "PHP 7.2 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php72
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 7.2
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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 \
|
||||
php7.2-mbstring php7.2-phpdbg php7.2-soap php7.2-sybase php7.2-xsl php7.2-zip php7.2-cgi php7.2-cli php7.2-common \
|
||||
php7.2-curl php7.2-dev php7.2-gd php7.2-gmp php7.2-json php7.2-ldap php7.2-mysql php7.2-odbc php7.2-opcache \
|
||||
php7.2-pgsql php7.2-pspell php7.2-readline php7.2-recode php7.2-snmp php7.2-sqlite3 php7.2-tidy php7.2-xdebug \
|
||||
php7.2-xml php7.2-xmlrpc php7.2-memcached php7.2-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.2/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.2/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.2/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.2/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.mode = debug" >> /etc/php/7.2/mods-available/xdebug.ini
|
||||
echo "xdebug.discover_client_host = true" >> /etc/php/7.2/mods-available/xdebug.ini
|
||||
echo "xdebug.client_port = 9003" >> /etc/php/7.2/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/7.2/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/7.2/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.2/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.2/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.2/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.2/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.2/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.2/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.2/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/7.2/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.2/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/7.2/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.2/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf
|
||||
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.2/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php7.2-fpm
|
||||
service php7.2-fpm restart
|
73
scripts/features/php7.3.sh
Normal file
73
scripts/features/php7.3.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php7.3-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php7.3-fpm
|
||||
service php7.3-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php73 ]
|
||||
then
|
||||
echo "PHP 7.3 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php73
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 7.3
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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 \
|
||||
php7.3-fpm php7.3-gd php7.3-gmp php7.3-imap php7.3-interbase php7.3-intl php7.3-json php7.3-ldap php7.3-mbstring \
|
||||
php7.3-mysql php7.3-odbc php7.3-opcache php7.3-pgsql php7.3-phpdbg php7.3-pspell php7.3-readline php7.3-recode \
|
||||
php7.3-snmp php7.3-soap php7.3-sqlite3 php7.3-sybase php7.3-tidy php7.3-xdebug php7.3-xml php7.3-xmlrpc php7.3-xsl \
|
||||
php7.3-zip php7.3-memcached php7.3-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.3/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.3/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.3/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.3/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.mode = debug" >> /etc/php/7.3/mods-available/xdebug.ini
|
||||
echo "xdebug.discover_client_host = true" >> /etc/php/7.3/mods-available/xdebug.ini
|
||||
echo "xdebug.client_port = 9003" >> /etc/php/7.3/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/7.3/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/7.3/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.3/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.3/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.3/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.3/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.3/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.3/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.3/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/7.3/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.3/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/7.3/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.3/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.3/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php7.3-fpm
|
||||
service php7.3-fpm restart
|
73
scripts/features/php7.4.sh
Normal file
73
scripts/features/php7.4.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php7.4-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php7.4-fpm
|
||||
service php7.4-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php74 ]
|
||||
then
|
||||
echo "PHP 7.4 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php74
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 7.4
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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 \
|
||||
php7.4-enchant php7.4-fpm php7.4-gd php7.4-gmp php7.4-imap php7.4-interbase php7.4-intl php7.4-json php7.4-ldap \
|
||||
php7.4-mbstring php7.4-mysql php7.4-odbc php7.4-opcache php7.4-pgsql php7.4-phpdbg php7.4-pspell php7.4-readline \
|
||||
php7.4-snmp php7.4-soap php7.4-sqlite3 php7.4-sybase php7.4-tidy php7.4-xdebug php7.4-xml php7.4-xmlrpc php7.4-xsl \
|
||||
php7.4-zip php7.4-memcached php7.4-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.4/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.4/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.4/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.4/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.mode = debug" >> /etc/php/7.4/mods-available/xdebug.ini
|
||||
echo "xdebug.discover_client_host = true" >> /etc/php/7.4/mods-available/xdebug.ini
|
||||
echo "xdebug.client_port = 9003" >> /etc/php/7.4/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/7.4/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/7.4/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.4/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/7.4/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.4/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/7.4/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/7.4/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/7.4/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php7.4-fpm
|
||||
service php7.4-fpm restart
|
73
scripts/features/php8.0.sh
Normal file
73
scripts/features/php8.0.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php8.0-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php8.0-fpm
|
||||
service php8.0-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php80 ]
|
||||
then
|
||||
echo "PHP 8.0 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php80
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 8.0
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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 \
|
||||
php8.0-enchant php8.0-fpm php8.0-gd php8.0-gmp php8.0-imap php8.0-interbase php8.0-intl php8.0-ldap \
|
||||
php8.0-mbstring php8.0-mysql php8.0-odbc php8.0-opcache php8.0-pgsql php8.0-phpdbg php8.0-pspell php8.0-readline \
|
||||
php8.0-snmp php8.0-soap php8.0-sqlite3 php8.0-sybase php8.0-tidy php8.0-xdebug php8.0-xml php8.0-xmlrpc php8.0-xsl \
|
||||
php8.0-zip php8.0-memcached php8.0-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.0/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.0/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.0/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.mode = debug" >> /etc/php/8.0/mods-available/xdebug.ini
|
||||
echo "xdebug.discover_client_host = true" >> /etc/php/8.0/mods-available/xdebug.ini
|
||||
echo "xdebug.client_port = 9003" >> /etc/php/8.0/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.0/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/8.0/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.0/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.0/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.0/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.0/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.0/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.0/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/8.0/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.0/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/8.0/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.0/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.0/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php8.0-fpm
|
||||
service php8.0-fpm restart
|
75
scripts/features/php8.1.sh
Normal file
75
scripts/features/php8.1.sh
Normal file
@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php8.1-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php8.1-fpm
|
||||
service php8.1-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php81 ]
|
||||
then
|
||||
echo "PHP 8.1 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php81
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 8.1
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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 \
|
||||
php8.1-enchant php8.1-fpm php8.1-gd php8.1-gmp php8.1-imap php8.1-interbase php8.1-intl php8.1-ldap \
|
||||
php8.1-mbstring php8.1-mysql php8.1-odbc php8.1-opcache php8.1-pgsql php8.1-phpdbg php8.1-pspell php8.1-readline \
|
||||
php8.1-snmp php8.1-soap php8.1-sqlite3 php8.1-sybase php8.1-tidy php8.1-xml php8.1-xsl \
|
||||
php8.1-zip
|
||||
|
||||
# php8.1-xdebug php8.1-xmlrpc php8.1-memcached php8.1-redis
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.1/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.1/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.1/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
# echo "xdebug.mode = debug" >> /etc/php/8.1/mods-available/xdebug.ini
|
||||
# echo "xdebug.discover_client_host = true" >> /etc/php/8.1/mods-available/xdebug.ini
|
||||
# echo "xdebug.client_port = 9003" >> /etc/php/8.1/mods-available/xdebug.ini
|
||||
# echo "xdebug.max_nesting_level = 512" >> /etc/php/8.1/mods-available/xdebug.ini
|
||||
# echo "opcache.revalidate_freq = 0" >> /etc/php/8.1/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.1/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.1/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.1/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.1/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.1/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.1/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.1/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/8.1/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.1/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/8.1/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.1/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.1/fpm/pool.d/www.conf
|
||||
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
|
||||
|
||||
systemctl enable php8.1-fpm
|
||||
service php8.1-fpm restart
|
73
scripts/features/php8.2.sh
Normal file
73
scripts/features/php8.2.sh
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php8.2-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php8.2-fpm
|
||||
service php8.2-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php82 ]
|
||||
then
|
||||
echo "PHP 8.2 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php82
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 8.2
|
||||
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --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
|
||||
|
||||
systemctl enable php8.2-fpm
|
||||
service php8.2-fpm restart
|
70
scripts/features/php8.3.sh
Normal file
70
scripts/features/php8.3.sh
Normal file
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
SERVICE_STATUS=$(systemctl is-enabled php8.3-fpm.service)
|
||||
|
||||
if [ "$SERVICE_STATUS" == "disabled" ];
|
||||
then
|
||||
systemctl enable php8.3-fpm
|
||||
service php8.3-fpm restart
|
||||
fi
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/php83 ]
|
||||
then
|
||||
echo "PHP 8.3 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/php83
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# PHP 8.3
|
||||
apt-get install -y --allow-change-held-packages \
|
||||
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 \
|
||||
php8.3-enchant php8.3-fpm php8.3-gd php8.3-gmp php8.3-imap php8.3-interbase php8.3-intl php8.3-ldap \
|
||||
php8.3-mbstring php8.3-mysql php8.3-odbc php8.3-opcache php8.3-pgsql php8.3-phpdbg php8.3-pspell php8.3-readline \
|
||||
php8.3-snmp php8.3-soap php8.3-sqlite3 php8.3-sybase php8.3-tidy php8.3-xml php8.3-xsl \
|
||||
php8.3-zip php8.3-imagick php8.3-memcached php8.3-redis php8.3-xmlrpc php8.3-xdebug
|
||||
|
||||
# Configure php.ini for CLI
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/cli/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/cli/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/cli/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/cli/php.ini
|
||||
|
||||
# Configure Xdebug
|
||||
echo "xdebug.mode = debug" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "xdebug.discover_client_host = true" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "xdebug.client_port = 9003" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "xdebug.max_nesting_level = 512" >> /etc/php/8.3/mods-available/xdebug.ini
|
||||
echo "opcache.revalidate_freq = 0" >> /etc/php/8.3/mods-available/opcache.ini
|
||||
|
||||
# Configure php.ini for FPM
|
||||
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/8.3/fpm/php.ini
|
||||
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.3/fpm/php.ini
|
||||
|
||||
printf "[openssl]\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
printf "openssl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
printf "[curl]\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
printf "curl.cainfo = /etc/ssl/certs/ca-certificates.crt\n" | tee -a /etc/php/8.3/fpm/php.ini
|
||||
|
||||
# Configure FPM
|
||||
sed -i "s/user = www-data/user = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
sed -i "s/group = www-data/group = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.owner.*/listen.owner = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
sed -i "s/listen\.group.*/listen.group = vagrant/" /etc/php/8.3/fpm/pool.d/www.conf
|
||||
sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/8.3/fpm/pool.d/www.conf
|
23
scripts/features/pm2.sh
Normal file
23
scripts/features/pm2.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/pm2 ]
|
||||
then
|
||||
echo "pm2 already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/pm2
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install pm2
|
||||
npm install -g pm2
|
27
scripts/features/python.sh
Normal file
27
scripts/features/python.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/pythontools ]
|
||||
then
|
||||
echo "pythontools already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/pythontools
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Python
|
||||
apt-get update
|
||||
apt-get install -y python3-pip build-essential libssl-dev libffi-dev python3-dev python3-venv
|
||||
sudo -H -u vagrant bash -c 'pip3 install django'
|
||||
sudo -H -u vagrant bash -c 'pip3 install numpy'
|
||||
sudo -H -u vagrant bash -c 'pip3 install masonite'
|
26
scripts/features/r-base.sh
Normal file
26
scripts/features/r-base.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/r-base ]
|
||||
then
|
||||
echo "r-base already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/r-base
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo gpg --dearmor -o /etc/apt/keyrings/r-project.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/r-project.gpg] https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" | sudo tee /etc/apt/sources.list.d/r-project.list
|
||||
|
||||
apt-get update
|
||||
apt install -y r-base
|
59
scripts/features/rabbitmq.sh
Normal file
59
scripts/features/rabbitmq.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/rabbitmq ]
|
||||
then
|
||||
echo "rabbitmq already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/rabbitmq
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
sudo apt-get install curl gnupg debian-keyring debian-archive-keyring apt-transport-https -y
|
||||
|
||||
# Import signing keys
|
||||
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor -o /etc/apt/keyrings/com.rabbitmq.team.gpg
|
||||
curl -1sLf "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf77f1eda57ebb1cc" | sudo gpg --dearmor -o /etc/apt/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg
|
||||
curl -1sLf "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" | sudo gpg --dearmor -o /etc/apt/keyrings/io.packagecloud.rabbitmq.gpg
|
||||
|
||||
## Add apt repositories maintained by Team RabbitMQ
|
||||
tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
|
||||
deb [signed-by=/etc/apt/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu jammy main
|
||||
deb-src [signed-by=/etc/apt/keyrings/net.launchpad.ppa.rabbitmq.erlang.gpg] http://ppa.launchpad.net/rabbitmq/rabbitmq-erlang/ubuntu jammy main
|
||||
deb [signed-by=/etc/apt/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ jammy main
|
||||
deb-src [signed-by=/etc/apt/keyrings/io.packagecloud.rabbitmq.gpg] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ jammy main
|
||||
EOF
|
||||
|
||||
## Update package indices
|
||||
apt-get update
|
||||
|
||||
## Install Erlang packages
|
||||
apt-get install -y erlang-base \
|
||||
erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
|
||||
erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
|
||||
erlang-runtime-tools erlang-snmp erlang-ssl \
|
||||
erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl
|
||||
|
||||
## Install rabbitmq-server and its dependencies
|
||||
apt-get install rabbitmq-server php-amqp php-bcmath -y --fix-missing
|
||||
|
||||
# Enable RabbitMQ HTTP Admin Interface
|
||||
rabbitmq-plugins enable rabbitmq_management
|
||||
rabbitmqctl add_user homestead secret
|
||||
rabbitmqctl set_user_tags homestead administrator
|
||||
rabbitmqctl set_permissions -p / homestead ".*" ".*" ".*"
|
||||
rabbitmqctl set_topic_permissions -p / homestead ".*" ".*" ".*"
|
||||
|
||||
# Install rabbitmqadmin CLI tool - https://www.rabbitmq.com/management-cli.html
|
||||
wget -q http://localhost:15672/cli/rabbitmqadmin -O /usr/local/bin/rabbitmqadmin
|
||||
chmod +x /usr/local/bin/rabbitmqadmin
|
22
scripts/features/rustc.sh
Normal file
22
scripts/features/rustc.sh
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/rustc ]; then
|
||||
echo "Rust already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/rustc
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Run the Rust installation script as the user
|
||||
sudo -u $WSL_USER_NAME curl -LsS https://sh.rustup.rs | sudo -u $WSL_USER_NAME sh -s -- -y
|
27
scripts/features/rvm.sh
Normal file
27
scripts/features/rvm.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/rvm ]
|
||||
then
|
||||
echo "rvm already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/rvm
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install RVM as vagrant user
|
||||
sudo -u $WSL_USER_NAME gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
||||
sudo -u $WSL_USER_NAME curl -LsS https://get.rvm.io | sudo -u $WSL_USER_NAME bash -s stable --ruby --gems=bundler --auto-dotfiles
|
||||
|
||||
# To start using RVM we need to run
|
||||
source /home/vagrant/.rvm/scripts/rvm
|
34
scripts/features/solr.sh
Normal file
34
scripts/features/solr.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/solr ]
|
||||
then
|
||||
echo "Solr already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/solr
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
# Install Java Runtime Enviroment
|
||||
sudo apt update
|
||||
sudo apt install default-jre php-solr -y
|
||||
|
||||
# Install Solr 7.7.1
|
||||
wget -q http://archive.apache.org/dist/lucene/solr/7.7.1/solr-7.7.1.tgz
|
||||
tar xzf solr-7.7.1.tgz solr-7.7.1/bin/install_solr_service.sh --strip-components=2
|
||||
sudo bash ./install_solr_service.sh solr-7.7.1.tgz
|
||||
rm solr-7.7.1.tgz install_solr_service.sh
|
||||
|
||||
# Install Homestead Core
|
||||
|
||||
sudo su -c "/opt/solr/bin/solr create -c homestead" solr
|
32
scripts/features/timescaledb.sh
Normal file
32
scripts/features/timescaledb.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/timescale ]
|
||||
then
|
||||
echo "TimescaleDB already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/timescale
|
||||
|
||||
curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /etc/apt/keyrings/timescaledb.gpg
|
||||
echo 'deb [signed-by=/etc/apt/keyrings/timescaledb.gpg] https://packagecloud.io/timescale/timescaledb/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/timescaledb.list
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install timescaledb-2-postgresql-15
|
||||
|
||||
sudo timescaledb-tune --quiet --yes
|
||||
printf "\ntimescaledb.telemetry_level=off\n" | sudo tee -a /etc/postgresql/15/main/postgresql.conf
|
||||
|
||||
sudo service postgresql restart
|
||||
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
88
scripts/features/trader.sh
Normal file
88
scripts/features/trader.sh
Normal file
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/trader ]
|
||||
then
|
||||
echo "Trader PHP extension already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/trader
|
||||
|
||||
# Update PECL Channel
|
||||
sudo pecl channel-update pecl.php.net
|
||||
|
||||
# Install Trader Extension
|
||||
sudo pecl install trader
|
||||
|
||||
sudo cp /usr/lib/php/20210902/trader.so /usr/lib/php/20131226/trader.so
|
||||
sudo cp /usr/lib/php/20210902/trader.so /usr/lib/php/20151012/trader.so
|
||||
sudo cp /usr/lib/php/20210902/trader.so /usr/lib/php/20160303/trader.so
|
||||
sudo cp /usr/lib/php/20210902/trader.so /usr/lib/php/20170718/trader.so
|
||||
sudo cp /usr/lib/php/20210902/trader.so /usr/lib/php/20180731/trader.so
|
||||
sudo cp /usr/lib/php/20210902/trader.so /usr/lib/php/20200930/trader.so
|
||||
|
||||
sudo touch /etc/php/8.1/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/8.1/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/8.1/mods-available/trader.ini /etc/php/8.1/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/8.1/mods-available/trader.ini /etc/php/8.1/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/8.1/mods-available/trader.ini /etc/php/8.1/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/8.1/mods-available/trader.ini /etc/php/8.1/phpdbg/conf.d/20-trader.ini
|
||||
|
||||
sudo touch /etc/php/8.0/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/8.0/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/8.0/mods-available/trader.ini /etc/php/8.0/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/8.0/mods-available/trader.ini /etc/php/8.0/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/8.0/mods-available/trader.ini /etc/php/8.0/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/8.0/mods-available/trader.ini /etc/php/8.0/phpdbg/conf.d/20-trader.ini
|
||||
|
||||
sudo touch /etc/php/7.4/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/7.4/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/7.4/mods-available/trader.ini /etc/php/7.4/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.4/mods-available/trader.ini /etc/php/7.4/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.4/mods-available/trader.ini /etc/php/7.4/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.4/mods-available/trader.ini /etc/php/7.4/phpdbg/conf.d/20-trader.ini
|
||||
|
||||
sudo touch /etc/php/7.3/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/7.3/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/7.3/mods-available/trader.ini /etc/php/7.3/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.3/mods-available/trader.ini /etc/php/7.3/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.3/mods-available/trader.ini /etc/php/7.3/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.3/mods-available/trader.ini /etc/php/7.3/phpdbg/conf.d/20-trader.ini
|
||||
|
||||
sudo touch /etc/php/7.2/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/7.2/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/7.2/mods-available/trader.ini /etc/php/7.2/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.2/mods-available/trader.ini /etc/php/7.2/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.2/mods-available/trader.ini /etc/php/7.2/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.2/mods-available/trader.ini /etc/php/7.2/phpdbg/conf.d/20-trader.ini
|
||||
|
||||
sudo touch /etc/php/7.1/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/7.1/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/7.1/mods-available/trader.ini /etc/php/7.1/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.1/mods-available/trader.ini /etc/php/7.1/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.1/mods-available/trader.ini /etc/php/7.1/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.1/mods-available/trader.ini /etc/php/7.1/phpdbg/conf.d/20-trader.ini
|
||||
|
||||
sudo touch /etc/php/7.0/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/7.0/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/7.0/mods-available/trader.ini /etc/php/7.0/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.0/mods-available/trader.ini /etc/php/7.0/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.0/mods-available/trader.ini /etc/php/7.0/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/7.0/mods-available/trader.ini /etc/php/7.0/phpdbg/conf.d/20-trader.ini
|
||||
|
||||
sudo touch /etc/php/5.6/mods-available/trader.ini
|
||||
sudo bash -c 'echo "extension=trader.so" >> /etc/php/5.6/mods-available/trader.ini'
|
||||
sudo ln -s /etc/php/5.6/mods-available/trader.ini /etc/php/5.6/fpm/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/5.6/mods-available/trader.ini /etc/php/5.6/cgi/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/5.6/mods-available/trader.ini /etc/php/5.6/cli/conf.d/20-trader.ini
|
||||
sudo ln -s /etc/php/5.6/mods-available/trader.ini /etc/php/5.6/phpdbg/conf.d/20-trader.ini
|
32
scripts/features/webdriver.sh
Normal file
32
scripts/features/webdriver.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -f ~/.homestead-features/wsl_user_name ]; then
|
||||
WSL_USER_NAME="$(cat ~/.homestead-features/wsl_user_name)"
|
||||
WSL_USER_GROUP="$(cat ~/.homestead-features/wsl_user_group)"
|
||||
else
|
||||
WSL_USER_NAME=vagrant
|
||||
WSL_USER_GROUP=vagrant
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if [ -f /home/$WSL_USER_NAME/.homestead-features/webdriverutils ]
|
||||
then
|
||||
echo "Web Driver utilities already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/$WSL_USER_NAME/.homestead-features/webdriverutils
|
||||
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
|
||||
|
||||
ARCH=$(arch)
|
||||
|
||||
# Install The Chrome Web Driver & Dusk Utilities
|
||||
if [[ "$ARCH" != "aarch64" ]]; then
|
||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb
|
||||
apt-get install -y /tmp/chrome.deb
|
||||
rm -f /tmp/chrome.deb
|
||||
fi
|
||||
|
||||
apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4 chromium-browser xvfb gtk2-engines-pixbuf \
|
||||
xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable imagemagick x11-apps
|
16
scripts/flip-webserver.sh
Normal file
16
scripts/flip-webserver.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ps auxw | grep apache2 | grep -v grep > /dev/null
|
||||
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
service nginx stop > /dev/null
|
||||
echo 'nginx stopped'
|
||||
service apache2 start > /dev/null
|
||||
echo 'apache started'
|
||||
else
|
||||
service apache2 stop > /dev/null
|
||||
echo 'apache stopped'
|
||||
service nginx start > /dev/null
|
||||
echo 'nginx started'
|
||||
fi
|
779
scripts/homestead.rb
Normal file
779
scripts/homestead.rb
Normal file
@ -0,0 +1,779 @@
|
||||
# Main Homestead Class
|
||||
class Homestead
|
||||
def self.configure(config, settings)
|
||||
# Set The VM Provider
|
||||
ENV['VAGRANT_DEFAULT_PROVIDER'] = settings['provider'] ||= 'virtualbox'
|
||||
|
||||
# Configure Local Variable To Access Scripts From Remote Location
|
||||
script_dir = File.dirname(__FILE__)
|
||||
|
||||
# Allow SSH Agent Forward from The Box
|
||||
config.ssh.forward_agent = true
|
||||
|
||||
# Configure Verify Host Key
|
||||
if settings.has_key?('verify_host_key')
|
||||
config.ssh.verify_host_key = settings['verify_host_key']
|
||||
end
|
||||
|
||||
# Configure The Box
|
||||
config.vm.define settings['name'] ||= 'homestead'
|
||||
config.vm.box = settings['box'] ||= 'laravel/homestead'
|
||||
unless settings.has_key?('SpeakFriendAndEnter')
|
||||
config.vm.box_version = settings['version'] ||= '>= 14.0.2, < 15.0.0'
|
||||
end
|
||||
config.vm.hostname = settings['hostname'] ||= 'homestead'
|
||||
|
||||
# Configure A Private Network IP
|
||||
if settings['ip'] != 'autonetwork'
|
||||
config.vm.network :private_network, ip: settings['ip'] ||= '192.168.56.56'
|
||||
else
|
||||
config.vm.network :private_network, ip: '0.0.0.0', auto_network: true
|
||||
end
|
||||
|
||||
# Configure Additional Networks
|
||||
if settings.has_key?('networks')
|
||||
settings['networks'].each do |network|
|
||||
config.vm.network network['type'], ip: network['ip'], mac: network['mac'], bridge: network['bridge'] ||= nil, dev: network['dev'] ||= nil, netmask: network['netmask'] ||= '255.255.255.0'
|
||||
end
|
||||
end
|
||||
|
||||
# Configure A Few VirtualBox Settings
|
||||
config.vm.provider 'virtualbox' do |vb|
|
||||
vb.name = settings['name'] ||= 'homestead'
|
||||
vb.customize ['modifyvm', :id, '--memory', settings['memory'] ||= '2048']
|
||||
vb.customize ['modifyvm', :id, '--cpus', settings['cpus'] ||= '1']
|
||||
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
|
||||
vb.customize ['modifyvm', :id, '--natdnshostresolver1', settings['natdnshostresolver'] ||= 'on']
|
||||
vb.customize ['modifyvm', :id, '--ostype', 'Ubuntu_64']
|
||||
|
||||
if settings.has_key?('gui') && settings['gui']
|
||||
vb.gui = true
|
||||
end
|
||||
# --paravirtprovider none|default|legacy|minimal|hyperv|kvm
|
||||
# Specifies which paravirtualization interface to provide to
|
||||
# the guest operating system.
|
||||
if settings.has_key?('paravirtprovider') && settings['paravirtprovider']
|
||||
vb.customize ['modifyvm', :id, '--paravirtprovider', settings['paravirtprovider'] ||= 'kvm']
|
||||
end
|
||||
|
||||
if Vagrant::Util::Platform.windows?
|
||||
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
|
||||
end
|
||||
end
|
||||
|
||||
# Override Default SSH port on the host
|
||||
if settings.has_key?('default_ssh_port')
|
||||
config.vm.network :forwarded_port, guest: 22, host: settings['default_ssh_port'], auto_correct: false, id: "ssh"
|
||||
end
|
||||
|
||||
# Configure A Few VMware Settings
|
||||
['vmware_fusion', 'vmware_workstation', 'vmware_desktop'].each do |vmware|
|
||||
config.vm.provider vmware do |v|
|
||||
v.vmx['displayName'] = settings['name'] ||= 'homestead'
|
||||
v.vmx['memsize'] = settings['memory'] ||= 2048
|
||||
v.vmx['numvcpus'] = settings['cpus'] ||= 1
|
||||
v.vmx['guestOS'] = 'ubuntu-64'
|
||||
if settings.has_key?('gui') && settings['gui']
|
||||
v.gui = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Configure A Few Hyper-V Settings
|
||||
config.vm.provider "hyperv" do |h, override|
|
||||
h.vmname = settings['name'] ||= 'homestead'
|
||||
h.cpus = settings['cpus'] ||= 1
|
||||
h.memory = settings['memory'] ||= 2048
|
||||
h.linked_clone = true
|
||||
if settings.has_key?('hyperv_mac') && settings['hyperv_mac']
|
||||
h.mac = settings['hyperv_mac']
|
||||
end
|
||||
if settings.has_key?('hyperv_maxmemory') && settings['hyperv_maxmemory']
|
||||
h.maxmemory = settings['hyperv_maxmemory']
|
||||
end
|
||||
if settings.has_key?('hyperv_enable_virtualization_extensions') && settings['hyperv_enable_virtualization_extensions']
|
||||
h.enable_virtualization_extensions = true
|
||||
end
|
||||
|
||||
if Vagrant.has_plugin?('vagrant-hostmanager')
|
||||
override.hostmanager.ignore_private_ip = true
|
||||
end
|
||||
end
|
||||
|
||||
# Configure A Few Parallels Settings
|
||||
config.vm.provider 'parallels' do |v|
|
||||
v.name = settings['name'] ||= 'homestead'
|
||||
v.update_guest_tools = settings['update_parallels_tools'] ||= false
|
||||
v.memory = settings['memory'] ||= 2048
|
||||
v.cpus = settings['cpus'] ||= 1
|
||||
end
|
||||
|
||||
# Configure libvirt settings
|
||||
config.vm.provider "libvirt" do |libvirt|
|
||||
libvirt.default_prefix = ''
|
||||
libvirt.memory = settings["memory"] ||= "2048"
|
||||
libvirt.cpus = settings["cpus"] ||= "1"
|
||||
libvirt.nested = "true"
|
||||
libvirt.disk_bus = "virtio"
|
||||
libvirt.machine_type = "q35"
|
||||
libvirt.disk_driver :cache => "none"
|
||||
libvirt.memorybacking :access, :mode => 'shared'
|
||||
libvirt.nic_model_type = "virtio"
|
||||
libvirt.driver = "kvm"
|
||||
libvirt.qemu_use_session = false
|
||||
end
|
||||
|
||||
# Standardize Ports Naming Schema
|
||||
if settings.has_key?('ports')
|
||||
settings['ports'].each do |port|
|
||||
port['guest'] ||= port['to']
|
||||
port['host'] ||= port['send']
|
||||
port['protocol'] ||= 'tcp'
|
||||
end
|
||||
else
|
||||
settings['ports'] = []
|
||||
end
|
||||
|
||||
# Default Port Forwarding
|
||||
default_ports = {
|
||||
80 => 8000,
|
||||
443 => 44300,
|
||||
}
|
||||
|
||||
# Use Default Port Forwarding Unless Overridden
|
||||
unless settings.has_key?('default_ports') && settings['default_ports'] == false
|
||||
default_ports.each do |guest, host|
|
||||
unless settings['ports'].any? { |mapping| mapping['guest'] == guest }
|
||||
config.vm.network 'forwarded_port', guest: guest, host: host, auto_correct: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Add Custom Ports From Configuration
|
||||
if settings.has_key?('ports')
|
||||
settings['ports'].each do |port|
|
||||
config.vm.network 'forwarded_port', guest: port['guest'], host: port['host'], protocol: port['protocol'], auto_correct: true
|
||||
end
|
||||
end
|
||||
|
||||
# Configure The Public Key For SSH Access
|
||||
if settings.include? 'authorize'
|
||||
if File.exist? File.expand_path(settings['authorize'])
|
||||
config.vm.provision "setting authorize key", type: "shell" do |s|
|
||||
s.inline = "echo $1 | grep -xq \"$1\" /home/vagrant/.ssh/authorized_keys || echo \"\n$1\" | tee -a /home/vagrant/.ssh/authorized_keys"
|
||||
s.args = [File.read(File.expand_path(settings['authorize']))]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Copy The SSH Private Keys To The Box
|
||||
if settings.include? 'keys'
|
||||
if settings['keys'].to_s.length.zero?
|
||||
puts 'Check your Homestead.yaml file, you have no private key(s) specified.'
|
||||
exit
|
||||
end
|
||||
settings['keys'].each do |key|
|
||||
if File.exist? File.expand_path(key)
|
||||
config.vm.provision "setting authorize permissions for #{key.split('/').last}", type: "shell" do |s|
|
||||
s.privileged = false
|
||||
s.inline = "echo \"$1\" > /home/vagrant/.ssh/\"$2\" && chmod 600 /home/vagrant/.ssh/\"$2\""
|
||||
# s.inline = "echo \"$1\" > /home/vagrant/.ssh/$2 && chmod 600 /home/vagrant/.ssh/$2"
|
||||
s.args = [File.read(File.expand_path(key)), key.split('/').last]
|
||||
end
|
||||
else
|
||||
puts 'Check your Homestead.yaml (or Homestead.json) file, the path to your private key does not exist.'
|
||||
exit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Copy User Files Over to VM
|
||||
if settings.include? 'copy'
|
||||
settings['copy'].each do |file|
|
||||
config.vm.provision 'file' do |f|
|
||||
f.source = File.expand_path(file['from'])
|
||||
f.destination = file['to'].chomp('/') + '/' + file['from'].split('/').last
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Register All Of The Configured Shared Folders
|
||||
if settings.include? 'folders'
|
||||
settings['folders'].each do |folder|
|
||||
if File.exist? File.expand_path(folder['map'])
|
||||
mount_opts = []
|
||||
|
||||
if ENV['VAGRANT_DEFAULT_PROVIDER'] == 'hyperv'
|
||||
folder['type'] = 'smb'
|
||||
end
|
||||
|
||||
if ENV['VAGRANT_DEFAULT_PROVIDER'] == 'libvirt'
|
||||
folder['type'] ||= 'virtiofs'
|
||||
end
|
||||
|
||||
if folder['type'] == 'nfs'
|
||||
mount_opts = folder['mount_options'] ? folder['mount_options'] : ['actimeo=1', 'nolock']
|
||||
|
||||
# Ubuntu 22.04 does not support NFS UDP, so we need to ensure it is disabled
|
||||
nfs_options = {nfs_udp: false}
|
||||
elsif folder['type'] == 'smb'
|
||||
mount_opts = folder['mount_options'] ? folder['mount_options'] : ['vers=3.02', 'mfsymlinks']
|
||||
|
||||
smb_creds = {smb_host: folder['smb_host'], smb_username: folder['smb_username'], smb_password: folder['smb_password']}
|
||||
end
|
||||
|
||||
# For b/w compatibility keep separate 'mount_opts', but merge with options
|
||||
options = (folder['options'] || {})
|
||||
.merge({ mount_options: mount_opts })
|
||||
.merge(smb_creds || {})
|
||||
.merge(nfs_options || {})
|
||||
|
||||
# Double-splat (**) operator only works with symbol keys, so convert
|
||||
options.keys.each{|k| options[k.to_sym] = options.delete(k) }
|
||||
|
||||
config.vm.synced_folder folder['map'], folder['to'], type: folder['type'] ||= nil, **options
|
||||
|
||||
# Bindfs support to fix shared folder (NFS) permission issue on Mac
|
||||
if folder['type'] == 'nfs' && Vagrant.has_plugin?('vagrant-bindfs')
|
||||
config.bindfs.bind_folder folder['to'], folder['to']
|
||||
end
|
||||
else
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = ">&2 echo \"Unable to mount one of your folders. Please check your folders in Homestead.yaml\""
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# use virtiofs for /vagrant mount when using libvirt provider
|
||||
if ENV['VAGRANT_DEFAULT_PROVIDER'] == 'libvirt'
|
||||
config.vm.synced_folder "./", "/vagrant", type: "virtiofs"
|
||||
end
|
||||
|
||||
# Change PHP CLI version based on configuration
|
||||
if settings.has_key?('php') && settings['php']
|
||||
config.vm.provision "Changing PHP CLI Version", type: "shell" do |s|
|
||||
s.name = 'Changing PHP CLI Version'
|
||||
s.inline = "sudo update-alternatives --set php /usr/bin/php#{settings['php']}; sudo update-alternatives --set php-config /usr/bin/php-config#{settings['php']}; sudo update-alternatives --set phpize /usr/bin/phpize#{settings['php']}"
|
||||
end
|
||||
end
|
||||
|
||||
# Creates folder for opt-in features lockfiles
|
||||
config.vm.provision "mk_features", type: "shell", inline: "mkdir -p /home/vagrant/.homestead-features"
|
||||
config.vm.provision "own_features", type: "shell", inline: "chown -Rf vagrant:vagrant /home/vagrant/.homestead-features"
|
||||
|
||||
# Install opt-in features
|
||||
if settings.has_key?('features')
|
||||
if settings.has_key?('in-flight-service')
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Running our in-flight-service.'
|
||||
s.path = script_dir + '/in-flight-service.sh'
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.provision "apt_update", type: "shell", inline: "apt-get update"
|
||||
|
||||
# Ensure we have PHP versions used in sites in our features
|
||||
if settings.has_key?('sites')
|
||||
settings['sites'].each do |site|
|
||||
if site.has_key?('php')
|
||||
settings['features'].push({"php" + site['php'] => true})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Remove duplicate features to prevent trying to install it multiple times
|
||||
settings['features'] = settings['features'].uniq{ |e| e.keys[0] }
|
||||
|
||||
settings['features'].each do |feature|
|
||||
feature_name = feature.keys[0]
|
||||
feature_variables = feature[feature_name]
|
||||
feature_path = script_dir + "/features/" + feature_name + ".sh"
|
||||
|
||||
# Check for boolean parameters
|
||||
# Compares against true/false to show that it really means "<feature>: <boolean>"
|
||||
if feature_variables == false
|
||||
config.vm.provision "shell", inline: "echo Ignoring feature: #{feature_name} because it is set to false \n"
|
||||
next
|
||||
elsif feature_variables == true
|
||||
# If feature_arguments is true, set it to empty, so it could be passed to script without problem
|
||||
feature_variables = {}
|
||||
end
|
||||
|
||||
# Check if feature really exists
|
||||
if !File.exist? File.expand_path(feature_path)
|
||||
config.vm.provision "shell", inline: "echo Invalid feature: #{feature_name} \n"
|
||||
next
|
||||
end
|
||||
|
||||
config.vm.provision "shell" do |s|
|
||||
s.name = "Installing " + feature_name
|
||||
s.path = feature_path
|
||||
s.env = feature_variables
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Enable Services
|
||||
if settings.has_key?('services')
|
||||
settings['services'].each do |service|
|
||||
service['enabled'].each do |enable_service|
|
||||
config.vm.provision "enable #{enable_service}", type: "shell", inline: "sudo systemctl enable #{enable_service}"
|
||||
config.vm.provision "start #{enable_service}", type: "shell", inline: "sudo systemctl start #{enable_service}"
|
||||
end if service.include?('enabled')
|
||||
|
||||
service['disabled'].each do |disable_service|
|
||||
config.vm.provision "disable #{disable_service}", type: "shell", inline: "sudo systemctl disable #{disable_service}"
|
||||
config.vm.provision "stop #{disable_service}", type: "shell", inline: "sudo systemctl stop #{disable_service}"
|
||||
end if service.include?('disabled')
|
||||
end
|
||||
end
|
||||
|
||||
# Clear any existing nginx sites
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.path = script_dir + '/clear-nginx.sh'
|
||||
end
|
||||
|
||||
# Clear any Homestead sites and insert markers in /etc/hosts
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.path = script_dir + '/hosts-reset.sh'
|
||||
end
|
||||
|
||||
# Install All The Configured Nginx Sites
|
||||
if settings.include? 'sites'
|
||||
|
||||
domains = []
|
||||
|
||||
settings['sites'].each do |site|
|
||||
|
||||
domains.push(site['map'])
|
||||
|
||||
# Create SSL certificate
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Certificate: ' + site['map']
|
||||
s.path = script_dir + '/create-certificate.sh'
|
||||
s.args = [site['map']]
|
||||
end
|
||||
|
||||
if site['wildcard'] == 'yes'
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Wildcard Certificate: *.' + site['map']
|
||||
s.path = script_dir + '/create-certificate.sh'
|
||||
s.args = ['*.' + site['map']]
|
||||
end
|
||||
end
|
||||
|
||||
type = site['type'] ||= 'laravel'
|
||||
load_balancer = settings['load_balancer'] ||= false
|
||||
http_port = load_balancer ? '8111' : '80'
|
||||
https_port = load_balancer ? '8112' : '443'
|
||||
|
||||
if load_balancer
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.path = script_dir + '/install-load-balancer.sh'
|
||||
end
|
||||
end
|
||||
|
||||
case type
|
||||
when 'apigility'
|
||||
type = 'zf'
|
||||
when 'expressive'
|
||||
type = 'zf'
|
||||
when 'symfony'
|
||||
type = 'symfony2'
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Site: ' + site['map']
|
||||
if site.include? 'params'
|
||||
params = '('
|
||||
site['params'].each do |param|
|
||||
params += ' [' + param['key'] + ']=' + param['value']
|
||||
end
|
||||
params += ' )'
|
||||
end
|
||||
if site.include? 'headers'
|
||||
headers = '('
|
||||
site['headers'].each do |header|
|
||||
headers += ' [' + header['key'] + ']=' + header['value']
|
||||
end
|
||||
headers += ' )'
|
||||
end
|
||||
if site.include? 'rewrites'
|
||||
rewrites = '('
|
||||
site['rewrites'].each do |rewrite|
|
||||
rewrites += ' [' + rewrite['map'] + ']=' + "'" + rewrite['to'] + "'"
|
||||
end
|
||||
rewrites += ' )'
|
||||
# Escape variables for bash
|
||||
rewrites.gsub! '$', '\$'
|
||||
end
|
||||
|
||||
# Convert the site & any options to an array of arguments passed to the
|
||||
# specific site type script (defaults to laravel)
|
||||
s.path = script_dir + "/site-types/#{type}.sh"
|
||||
s.args = [
|
||||
site['map'], # $1
|
||||
site['to'], # $2
|
||||
site['port'] ||= http_port, # $3
|
||||
site['ssl'] ||= https_port, # $4
|
||||
site['php'] ||= '8.3', # $5
|
||||
params ||= '', # $6
|
||||
site['xhgui'] ||= '', # $7
|
||||
site['exec'] ||= 'false', # $8
|
||||
headers ||= '', # $9
|
||||
rewrites ||= '', # $10
|
||||
site['prod'] ||='' # $11
|
||||
]
|
||||
|
||||
# Should we use the wildcard ssl?
|
||||
if site['wildcard'] == 'yes' or site['use_wildcard'] == 'yes'
|
||||
if site['use_wildcard'] != 'no'
|
||||
if site['type'] != 'apache'
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "sed -i \"s/$1.crt/*.$1.crt/\" /etc/nginx/sites-available/$1"
|
||||
s.args = [site['map']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "sed -i \"s/$1.key/*.$1.key/\" /etc/nginx/sites-available/$1"
|
||||
s.args = [site['map']]
|
||||
end
|
||||
else
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "sed -i \"s/$1.crt/*.$1.crt/\" /etc/apache2/sites-available/$1-ssl.conf"
|
||||
s.args = [site['map']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "sed -i \"s/$1.key/*.$1.key/\" /etc/apache2/sites-available/$1-ssl.conf"
|
||||
s.args = [site['map']]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# generate pm2 json config file
|
||||
if site['pm2']
|
||||
config.vm.provision "shell" do |s2|
|
||||
s2.name = 'Creating Site Ecosystem for pm2: ' + site['map']
|
||||
s2.path = script_dir + "/create-ecosystem.sh"
|
||||
s2.args = Array.new
|
||||
s2.args << site['pm2'][0]['name']
|
||||
s2.args << site['pm2'][0]['script'] ||= "npm"
|
||||
s2.args << site['pm2'][0]['args'] ||= "run serve"
|
||||
s2.args << site['pm2'][0]['cwd']
|
||||
end
|
||||
end
|
||||
|
||||
if site['xhgui'] == 'true'
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.path = script_dir + '/features/mongodb.sh'
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.path = script_dir + '/install-xhgui.sh'
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = 'ln -sf /opt/xhgui/webroot ' + site['to'] + '/xhgui'
|
||||
end
|
||||
else
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = 'rm -rf ' + site['to'].to_s + '/xhgui'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.path = script_dir + "/hosts-add.sh"
|
||||
s.args = ['127.0.0.1', site['map']]
|
||||
end
|
||||
|
||||
# Configure The Cron Schedule
|
||||
if site.has_key?('schedule')
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Schedule'
|
||||
|
||||
if site['schedule']
|
||||
s.path = script_dir + '/cron-schedule.sh'
|
||||
s.args = [site['map'].tr('^A-Za-z0-9', ''), site['to'], site['php'] ||= '']
|
||||
else
|
||||
s.inline = "rm -f /etc/cron.d/$1"
|
||||
s.args = [site['map'].tr('^A-Za-z0-9', '')]
|
||||
end
|
||||
end
|
||||
else
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Checking for old Schedule'
|
||||
s.inline = "rm -f /etc/cron.d/$1"
|
||||
s.args = [site['map'].tr('^A-Za-z0-9', '')]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Configure All Of The Server Environment Variables
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Clear Variables'
|
||||
s.path = script_dir + '/clear-variables.sh'
|
||||
end
|
||||
|
||||
if settings.has_key?('variables')
|
||||
settings['variables'].each do |var|
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/5.6/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/7.0/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/7.1/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/7.2/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/7.3/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/7.4/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/8.0/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/8.1/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/8.2/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\nenv[$1] = '$2'\" >> /etc/php/8.3/fpm/pool.d/www.conf"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "echo \"\n# Set Homestead Environment Variable\nexport $1=$2\" >> /home/vagrant/.profile"
|
||||
s.args = [var['key'], var['value']]
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = 'service php5.6-fpm restart;service php7.0-fpm restart;service php7.1-fpm restart; service php7.2-fpm restart; service php7.3-fpm restart; service php7.4-fpm restart; service php8.0-fpm restart; service php8.1-fpm restart; service php8.2-fpm restart; service php8.3-fpm restart;'
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Restarting Cron'
|
||||
s.inline = 'sudo service cron restart'
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Restart Webserver'
|
||||
s.path = script_dir + '/restart-webserver.sh'
|
||||
end
|
||||
|
||||
# Configure All Of The Configured Databases
|
||||
if settings.has_key?('databases')
|
||||
enabled_databases = Array.new
|
||||
# Check which databases are enabled
|
||||
if settings.has_key?('features')
|
||||
settings['features'].each do |feature|
|
||||
feature_name = feature.keys[0]
|
||||
feature_arguments = feature[feature_name]
|
||||
|
||||
# If feature is set to false, ignore
|
||||
if feature_arguments == false
|
||||
next
|
||||
end
|
||||
|
||||
enabled_databases.push feature_name
|
||||
end
|
||||
end
|
||||
|
||||
# Enable MySQL if MariaDB is not enabled
|
||||
if (!enabled_databases.include? 'mysql') && (!enabled_databases.include? 'mariadb')
|
||||
enabled_databases.push 'mysql'
|
||||
end
|
||||
|
||||
settings['databases'].each do |db|
|
||||
if (enabled_databases.include? 'mysql') || (enabled_databases.include? 'mariadb')
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating MySQL / MariaDB Database: ' + db
|
||||
s.path = script_dir + '/create-mysql.sh'
|
||||
s.args = [db]
|
||||
end
|
||||
end
|
||||
|
||||
if enabled_databases.include? 'postgresql'
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Postgres Database: ' + db
|
||||
s.path = script_dir + '/create-postgres.sh'
|
||||
s.args = [db]
|
||||
end
|
||||
end
|
||||
|
||||
if enabled_databases.include? 'mongodb'
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Mongo Database: ' + db
|
||||
s.path = script_dir + '/create-mongo.sh'
|
||||
s.args = [db]
|
||||
end
|
||||
end
|
||||
|
||||
if enabled_databases.include? 'couchdb'
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Couch Database: ' + db
|
||||
s.path = script_dir + '/create-couch.sh'
|
||||
s.args = [db]
|
||||
end
|
||||
end
|
||||
|
||||
if enabled_databases.include? 'influxdb'
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating InfluxDB Database: ' + db
|
||||
s.path = script_dir + '/create-influxdb.sh'
|
||||
s.args = [db]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# Create Minio Buckets
|
||||
if settings.has_key?('buckets') && settings['features'].any? { |feature| feature.include?('minio') }
|
||||
settings['buckets'].each do |bucket|
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Creating Minio Bucket: ' + bucket['name']
|
||||
s.path = script_dir + '/create-minio-bucket.sh'
|
||||
s.args = [bucket['name'], bucket['policy'] || 'none']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Update Composer On Every Provision
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Update Composer'
|
||||
s.inline = 'sudo chown -R vagrant:vagrant /usr/local/bin && sudo -u vagrant /usr/bin/php8.3 /usr/local/bin/composer self-update --no-progress && sudo chown -R vagrant:vagrant /home/vagrant/.config/'
|
||||
s.privileged = false
|
||||
end
|
||||
|
||||
# Add config file for ngrok
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.path = script_dir + '/create-ngrok.sh'
|
||||
s.args = [settings['ip']]
|
||||
s.privileged = false
|
||||
end
|
||||
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.name = 'Update motd'
|
||||
s.inline = 'sudo service motd-news restart'
|
||||
end
|
||||
|
||||
if settings.has_key?('backup') && settings['backup'] && (Vagrant::VERSION >= '2.1.0' || Vagrant.has_plugin?('vagrant-triggers'))
|
||||
dir_prefix = '/vagrant/.backup'
|
||||
|
||||
# Rebuild the enabled_databases so we can check before backing up
|
||||
enabled_databases = Array.new
|
||||
# Check which databases are enabled
|
||||
if settings.has_key?('features')
|
||||
settings['features'].each do |feature|
|
||||
feature_name = feature.keys[0]
|
||||
feature_arguments = feature[feature_name]
|
||||
|
||||
# If feature is set to false, ignore
|
||||
if feature_arguments == false
|
||||
next
|
||||
end
|
||||
|
||||
enabled_databases.push feature_name
|
||||
end
|
||||
end
|
||||
|
||||
# Enable MySQL if MariaDB is not enabled
|
||||
if (!enabled_databases.include? 'mysql') && (!enabled_databases.include? 'mariadb')
|
||||
enabled_databases.push 'mysql'
|
||||
end
|
||||
|
||||
# Loop over each DB
|
||||
settings['databases'].each do |database|
|
||||
# Backup MySQL/MariaDB
|
||||
if (enabled_databases.include? 'mysql') || (enabled_databases.include? 'mariadb')
|
||||
Homestead.backup_mysql(database, "#{dir_prefix}/mysql_backup", config)
|
||||
end
|
||||
# Backup PostgreSQL
|
||||
if enabled_databases.include? 'postgresql'
|
||||
Homestead.backup_postgres(database, "#{dir_prefix}/postgres_backup", config)
|
||||
end
|
||||
# Backup MongoDB
|
||||
if enabled_databases.include? 'mongodb'
|
||||
Homestead.backup_mongodb(database, "#{dir_prefix}/mongodb_backup", config)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Turn off CFQ scheduler idling https://github.com/laravel/homestead/issues/896
|
||||
if settings.has_key?('disable_cfq')
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = 'sudo sh -c "echo 0 >> /sys/block/sda/queue/iosched/slice_idle"'
|
||||
end
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = 'sudo sh -c "echo 0 >> /sys/block/sda/queue/iosched/group_idle"'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Ajouts perso : exécution de mysql_secure_installation, compte root/root
|
||||
config.vm.provision 'shell' do |s|
|
||||
s.inline = "(echo '' ; echo 'n' ; echo 'y' ; echo 'root' ; echo 'root' ; echo 'y' ; echo 'y' ; echo 'y' ; echo 'y' ) | mysql_secure_installation"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.backup_mysql(database, dir, config)
|
||||
now = Time.now.strftime("%Y%m%d%H%M")
|
||||
config.trigger.before :destroy do |trigger|
|
||||
trigger.warn = "Backing up mysql database #{database}..."
|
||||
trigger.run_remote = {inline: "mkdir -p #{dir}/#{now} && mysqldump --routines #{database} > #{dir}/#{now}/#{database}-#{now}.sql"}
|
||||
end
|
||||
end
|
||||
|
||||
def self.backup_postgres(database, dir, config)
|
||||
now = Time.now.strftime("%Y%m%d%H%M")
|
||||
config.trigger.before :destroy do |trigger|
|
||||
trigger.warn = "Backing up postgres database #{database}..."
|
||||
trigger.run_remote = {inline: "mkdir -p #{dir}/#{now} && echo localhost:5432:#{database}:homestead:secret > ~/.pgpass && chmod 600 ~/.pgpass && pg_dump -U homestead -h localhost #{database} > #{dir}/#{now}/#{database}-#{now}.sql"}
|
||||
end
|
||||
end
|
||||
|
||||
def self.backup_mongodb(database, dir, config)
|
||||
now = Time.now.strftime("%Y%m%d%H%M")
|
||||
config.trigger.before :destroy do |trigger|
|
||||
trigger.warn = "Backing up mongodb database #{database}..."
|
||||
trigger.run_remote = {inline: "mkdir -p #{dir}/#{now} && mongodump --db #{database} --out #{dir}/#{now}"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
26
scripts/hosts-add.sh
Normal file
26
scripts/hosts-add.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Add new IP-host pair to /etc/hosts.
|
||||
|
||||
if [[ "$1" && "$2" ]]
|
||||
then
|
||||
IP=$1
|
||||
HOSTNAME=$2
|
||||
|
||||
if [ -n "$(grep [^\.]$HOSTNAME /etc/hosts)" ]
|
||||
then
|
||||
echo "$HOSTNAME already exists:";
|
||||
echo $(grep [^\.]$HOSTNAME /etc/hosts);
|
||||
else
|
||||
sudo sed -i "/#### HOMESTEAD-SITES-BEGIN/c\#### HOMESTEAD-SITES-BEGIN\\n$IP\t$HOSTNAME" /etc/hosts
|
||||
|
||||
if ! [ -n "$(grep [^\.]$HOSTNAME /etc/hosts)" ]
|
||||
then
|
||||
echo "Failed to add $HOSTNAME.";
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Error: missing required parameters."
|
||||
echo "Usage: "
|
||||
echo " addhost ip domain"
|
||||
fi
|
7
scripts/hosts-reset.sh
Normal file
7
scripts/hosts-reset.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Remove any Homestead entries from /etc/hosts and prepare for adding new ones.
|
||||
|
||||
sudo sed -i '/#### HOMESTEAD-SITES-BEGIN/,/#### HOMESTEAD-SITES-END/d' /etc/hosts
|
||||
|
||||
printf "#### HOMESTEAD-SITES-BEGIN\n#### HOMESTEAD-SITES-END\n" | sudo tee -a /etc/hosts > /dev/null
|
8
scripts/in-flight-service.sh
Normal file
8
scripts/in-flight-service.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/in-flight-service.sh
|
||||
# this script is solely for doing questionable things to update the base OS
|
||||
# Without having to ship an entirely new base box.
|
||||
|
||||
# Fix expired certs: https://github.com/laravel/homestead/issues/1707
|
||||
# sudo rm -rf /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt
|
||||
# sudo update-ca-certificates
|
27
scripts/install-load-balancer.sh
Normal file
27
scripts/install-load-balancer.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
block="
|
||||
upstream homesteadup {
|
||||
server 127.0.1.1:8111;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl default_server;
|
||||
|
||||
location / {
|
||||
proxy_pass http://homesteadup;
|
||||
proxy_set_header HOST \$host;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/homestead.test.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/homestead.test.key;
|
||||
|
||||
}
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/nginx/sites-available/default"
|
||||
ln -fs "/etc/nginx/sites-available/default" "/etc/nginx/sites-enabled/default"
|
153
scripts/install-xhgui.sh
Normal file
153
scripts/install-xhgui.sh
Normal file
@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Check If xhgui Has Been Installed
|
||||
|
||||
if [ -f /home/vagrant/.homestead-features/xhgui ]
|
||||
then
|
||||
echo "xhgui already installed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
touch /home/vagrant/.homestead-features/xhgui
|
||||
chown -Rf vagrant:vagrant /home/vagrant/.homestead-features
|
||||
|
||||
apt install -y php-tideways
|
||||
phpenmod -v ALL tideways
|
||||
|
||||
git clone https://github.com/perftools/xhgui.git /opt/xhgui
|
||||
|
||||
cat <<'EOT' > /opt/xhgui/webroot/.htaccess
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ /xhgui/index.php [QSA,L]
|
||||
</IfModule>
|
||||
EOT
|
||||
|
||||
cat <<'EOT' > /opt/xhgui/config/config.php
|
||||
<?php
|
||||
/**
|
||||
* Configuration for XHGui.
|
||||
*/
|
||||
return array(
|
||||
// Which backend to use for Xhgui_Saver.
|
||||
// Must be one of 'mongodb', or 'file'.
|
||||
//
|
||||
// Example (save to a temporary file):
|
||||
//
|
||||
// 'save.handler' => 'file',
|
||||
// # Beware of file locking. You can adujst this file path
|
||||
// # to reduce locking problems (eg uniqid, time ...)
|
||||
// 'save.handler.filename' => __DIR__.'/../data/xhgui_'.date('Ymd').'.dat',
|
||||
//
|
||||
'save.handler' => 'mongodb',
|
||||
|
||||
// Database options for MongoDB.
|
||||
//
|
||||
// - db.host: Connection string in the form `mongodb://[ip or host]:[port]`.
|
||||
//
|
||||
// - db.db: The database name.
|
||||
//
|
||||
// - db.options: Additional options for the MongoClient contructor,
|
||||
// for example 'username', 'password', or 'replicaSet'.
|
||||
// See <https://secure.php.net/mongoclient_construct#options>.
|
||||
//
|
||||
'db.host' => 'mongodb://127.0.0.1:27017',
|
||||
'db.db' => 'xhprof',
|
||||
'db.options' => array('username' => 'homestead', 'password' => 'secret'),
|
||||
|
||||
// Whether to instrument a user request.
|
||||
//
|
||||
// NOTE: Only applies to using the external/header.php include.
|
||||
//
|
||||
// Must be a function that returns a boolean,
|
||||
// or any non-function value to disable the profiler.
|
||||
//
|
||||
// Default: Profile 1 in 100 requests.
|
||||
//
|
||||
// Example (profile all requests):
|
||||
//
|
||||
// 'profiler.enabled' => function() {
|
||||
// return true;
|
||||
// },
|
||||
//
|
||||
'profiler.enable' => function() {
|
||||
// Never profile ourself.
|
||||
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/xhgui') === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Profile if ?xhgui=on, and continue to profile for the next hour.
|
||||
foreach (array('xhgui') as $switch) {
|
||||
if (isset($_GET[$switch]) && $_GET[$switch] == 'on') {
|
||||
setcookie('xhgui', 'on', time() + 3600);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Profile if we have been set to profiling mode.
|
||||
if (isset($_COOKIE['xhgui']) && $_COOKIE['xhgui'] == 'on') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Profile the CLI when the XHGUI environment variable is set.
|
||||
if (getenv('XHGUI') == 'on') {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
// Transformation for the "simple" variant of the URL.
|
||||
// This is stored as `meta.simple_url` and used for
|
||||
// aggregate data.
|
||||
//
|
||||
// NOTE: Only applies to using the external/header.php include.
|
||||
//
|
||||
// Must be a function that returns a string, or any
|
||||
// non-callable value for the default behaviour.
|
||||
//
|
||||
// Default: Remove numeric values after `=`. For example,
|
||||
// it turns "/foo?page=2" into "/foo?page".
|
||||
'profiler.simple_url' => null,
|
||||
|
||||
// Additional options to be passed to the `_enable()` function
|
||||
// of the profiler extension (xhprof, tideways, etc.).
|
||||
//
|
||||
// NOTE: Only applies to using the external/header.php include.
|
||||
'profiler.options' => array(),
|
||||
|
||||
// Date format used when browsing XHGui pages.
|
||||
//
|
||||
// Must be a format supported by the PHP date() function.
|
||||
// See <https://secure.php.net/date>.
|
||||
'date.format' => 'M jS H:i:s',
|
||||
|
||||
// The number of items to show in "Top lists" with functions
|
||||
// using the most time or memory resources, on XHGui Run pages.
|
||||
'detail.count' => 6,
|
||||
|
||||
// The number of items to show per page, on XHGui list pages.
|
||||
'page.limit' => 25,
|
||||
|
||||
);
|
||||
EOT
|
||||
|
||||
# Add indexes documented at https://github.com/perftools/xhgui#installation
|
||||
mongo --eval "db.results.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } ); \
|
||||
db.results.ensureIndex( { 'profile.main().wt' : -1 } ); \
|
||||
db.results.ensureIndex( { 'profile.main().mu' : -1 } ); \
|
||||
db.results.ensureIndex( { 'profile.main().cpu' : -1 } ); \
|
||||
db.results.ensureIndex( { 'meta.url' : 1 } ); \
|
||||
db.results.ensureIndex( { 'meta.simple_url' : 1 } ); \
|
||||
db.results.ensureIndex( { "meta.request_ts" : 1 }, { expireAfterSeconds : 432000 } )" xhprof
|
||||
|
||||
cd /opt/xhgui
|
||||
php install.php
|
||||
|
||||
for version in 5.6 7.0 7.1 7.2 7.3 7.4
|
||||
do
|
||||
cat << 'EOT' > /etc/php/$version/mods-available/xhgui.ini
|
||||
; Include xhgui's header for performance profiling.
|
||||
auto_prepend_file="/opt/xhgui/external/header.php"
|
||||
EOT
|
||||
done
|
||||
phpenmod -v ALL xhgui
|
13
scripts/restart-webserver.sh
Normal file
13
scripts/restart-webserver.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Restart whichever web server isn't disabled
|
||||
|
||||
# is nginx enabled?
|
||||
OUTPUT="$(systemctl is-enabled nginx)"
|
||||
|
||||
if [ "$OUTPUT" == "enabled" ]; then
|
||||
service nginx restart
|
||||
else
|
||||
service nginx stop
|
||||
service apache2 restart
|
||||
fi
|
134
scripts/site-types/apache-proxy.sh
Normal file
134
scripts/site-types/apache-proxy.sh
Normal file
@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A params=$6 # Create an associative array
|
||||
declare -A headers=${9} # Create an associative array
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
SetEnv ${element} \"${params[$element]}\""
|
||||
done
|
||||
fi
|
||||
headersTXT=""
|
||||
if [ -n "${9}" ]; then
|
||||
for element in "${!headers[@]}"
|
||||
do
|
||||
headersTXT="${headersTXT}
|
||||
Header always set ${element} \"${headers[$element]}\""
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]
|
||||
then
|
||||
if ! [[ "$2" =~ ^[0-9]+$ ]]
|
||||
then
|
||||
if ! [[ "$2" =~ ^https: ]]
|
||||
then
|
||||
socket=$(echo "$2" | sed -E "s/^http(s?):\/\//ws:\/\//g")
|
||||
else
|
||||
socket=$(echo "$2" | sed -E "s/^http(s?):\/\//wss:\/\//g")
|
||||
fi
|
||||
|
||||
proxyPass="
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
||||
RewriteRule /(.*) $socket/ [P,L]
|
||||
|
||||
ProxyPass / ${2}/
|
||||
ProxyPassReverse / ${2}/
|
||||
"
|
||||
else proxyPass="
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
||||
RewriteRule /(.*) ws://127.0.0.1:$2/ [P,L]
|
||||
|
||||
ProxyPass / http://127.0.0.1:$2/
|
||||
ProxyPassReverse / http://127.0.0.1:$2/
|
||||
"
|
||||
fi
|
||||
else proxyPass="
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
||||
RewriteRule /(.*) ws://127.0.0.1/ [P,L]
|
||||
|
||||
ProxyPass / http://127.0.0.1/
|
||||
ProxyPassReverse / http://127.0.0.1/
|
||||
"
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
sudo service nginx stop
|
||||
sudo systemctl disable nginx
|
||||
sudo systemctl enable apache2
|
||||
|
||||
sudo a2enmod proxy
|
||||
sudo a2enmod proxy_http
|
||||
sudo a2enmod proxy_ajp
|
||||
sudo a2enmod rewrite
|
||||
sudo a2enmod deflate
|
||||
sudo a2enmod headers
|
||||
sudo a2enmod proxy_balancer
|
||||
sudo a2enmod proxy_connect
|
||||
sudo a2enmod proxy_html
|
||||
|
||||
block="<VirtualHost *:$3>
|
||||
ServerAdmin webmaster@localhost
|
||||
ServerName $1
|
||||
ServerAlias www.$1
|
||||
|
||||
ProxyPreserveHost On
|
||||
RequestHeader set X-Real-IP %{REMOTE_ADDR}s
|
||||
RequestHeader set Upgrade websocket
|
||||
RequestHeader set Connection Upgrade
|
||||
|
||||
$paramsTXT
|
||||
$headersTXT
|
||||
|
||||
$proxyPass
|
||||
</VirtualHost>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/apache2/sites-available/$1.conf"
|
||||
ln -fs "/etc/apache2/sites-available/$1.conf" "/etc/apache2/sites-enabled/$1.conf"
|
||||
|
||||
blockssl="<IfModule mod_ssl.c>
|
||||
<VirtualHost *:$4>
|
||||
ServerAdmin webmaster@localhost
|
||||
ServerName $1
|
||||
ServerAlias www.$1
|
||||
|
||||
ProxyPreserveHost On
|
||||
RequestHeader set X-Real-IP %{REMOTE_ADDR}s
|
||||
RequestHeader set Upgrade websocket
|
||||
RequestHeader set Connection Upgrade
|
||||
|
||||
$paramsTXT
|
||||
$headersTXT
|
||||
|
||||
SSLEngine on
|
||||
|
||||
SSLCertificateFile /etc/ssl/certs/$1.crt
|
||||
SSLCertificateKeyFile /etc/ssl/certs/$1.key
|
||||
|
||||
$proxyPass
|
||||
</VirtualHost>
|
||||
</IfModule>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||
"
|
||||
|
||||
echo "$blockssl" > "/etc/apache2/sites-available/$1-ssl.conf"
|
||||
ln -fs "/etc/apache2/sites-available/$1-ssl.conf" "/etc/apache2/sites-enabled/$1-ssl.conf"
|
||||
|
||||
ps auxw | grep apache2 | grep -v grep > /dev/null
|
||||
|
||||
service apache2 restart
|
||||
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
service apache2 reload
|
||||
fi
|
154
scripts/site-types/apache.sh
Normal file
154
scripts/site-types/apache.sh
Normal file
@ -0,0 +1,154 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A params=$6 # Create an associative array
|
||||
declare -A headers=${9} # Create an associative array
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
SetEnv ${element} \"${params[$element]}\""
|
||||
done
|
||||
fi
|
||||
headersTXT=""
|
||||
if [ -n "${9}" ]; then
|
||||
for element in "${!headers[@]}"
|
||||
do
|
||||
headersTXT="${headersTXT}
|
||||
Header always set ${element} \"${headers[$element]}\""
|
||||
done
|
||||
fi
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
sudo service nginx stop
|
||||
sudo systemctl disable nginx
|
||||
sudo systemctl enable apache2
|
||||
|
||||
block="<VirtualHost *:$3>
|
||||
ServerAdmin webmaster@localhost
|
||||
ServerName $1
|
||||
ServerAlias www.$1
|
||||
DocumentRoot "$2"
|
||||
$paramsTXT
|
||||
$headersTXT
|
||||
|
||||
<Directory "$2">
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
EnableMMAP Off
|
||||
</Directory>
|
||||
<IfModule mod_fastcgi.c>
|
||||
AddHandler php"$5"-fcgi .php
|
||||
Action php"$5"-fcgi /php"$5"-fcgi
|
||||
Alias /php"$5"-fcgi /usr/lib/cgi-bin/php"$5"
|
||||
FastCgiExternalServer /usr/lib/cgi-bin/php"$5" -socket /var/run/php/php"$5"-fpm.sock -pass-header Authorization
|
||||
</IfModule>
|
||||
<IfModule !mod_fastcgi.c>
|
||||
<IfModule mod_proxy_fcgi.c>
|
||||
<FilesMatch \".+\.ph(ar|p|tml)$\">
|
||||
SetHandler \"proxy:unix:/var/run/php/php"$5"-fpm.sock|fcgi://localhost\"
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog \${APACHE_LOG_DIR}/$1-error.log
|
||||
CustomLog \${APACHE_LOG_DIR}/$1-access.log combined
|
||||
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
</VirtualHost>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/apache2/sites-available/$1.conf"
|
||||
ln -fs "/etc/apache2/sites-available/$1.conf" "/etc/apache2/sites-enabled/$1.conf"
|
||||
|
||||
blockssl="<IfModule mod_ssl.c>
|
||||
<VirtualHost *:$4>
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
ServerName $1
|
||||
ServerAlias www.$1
|
||||
DocumentRoot "$2"
|
||||
$paramsTXT
|
||||
|
||||
<Directory "$2">
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog \${APACHE_LOG_DIR}/$1-error.log
|
||||
CustomLog \${APACHE_LOG_DIR}/$1-access.log combined
|
||||
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
|
||||
# SSL Engine Switch:
|
||||
# Enable/Disable SSL for this virtual host.
|
||||
SSLEngine on
|
||||
|
||||
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
|
||||
SSLCertificateFile /etc/ssl/certs/$1.crt
|
||||
SSLCertificateKeyFile /etc/ssl/certs/$1.key
|
||||
|
||||
|
||||
#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
|
||||
|
||||
#SSLCACertificatePath /etc/ssl/certs/
|
||||
#SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
|
||||
|
||||
#SSLCARevocationPath /etc/apache2/ssl.crl/
|
||||
#SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
|
||||
|
||||
#SSLVerifyClient require
|
||||
#SSLVerifyDepth 10
|
||||
|
||||
<FilesMatch \"\.(cgi|shtml|phtml|php)$\">
|
||||
SSLOptions +StdEnvVars
|
||||
</FilesMatch>
|
||||
<Directory /usr/lib/cgi-bin>
|
||||
SSLOptions +StdEnvVars
|
||||
</Directory>
|
||||
|
||||
<IfModule mod_fastcgi.c>
|
||||
AddHandler php"$5"-fcgi .php
|
||||
Action php"$5"-fcgi /php"$5"-fcgi
|
||||
Alias /php"$5"-fcgi /usr/lib/cgi-bin/php"$5"
|
||||
FastCgiExternalServer /usr/lib/cgi-bin/php"$5" -socket /var/run/php/php"$5"-fpm.sock -pass-header Authorization
|
||||
</IfModule>
|
||||
<IfModule !mod_fastcgi.c>
|
||||
<IfModule mod_proxy_fcgi.c>
|
||||
<FilesMatch \".+\.ph(ar|p|tml)$\">
|
||||
SetHandler \"proxy:unix:/var/run/php/php"$5"-fpm.sock|fcgi://localhost\"
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
BrowserMatch \"MSIE [2-6]\" \
|
||||
nokeepalive ssl-unclean-shutdown \
|
||||
downgrade-1.0 force-response-1.0
|
||||
# MSIE 7 and newer should be able to use keepalive
|
||||
BrowserMatch \"MSIE [17-9]\" ssl-unclean-shutdown
|
||||
|
||||
</VirtualHost>
|
||||
</IfModule>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||
"
|
||||
|
||||
echo "$blockssl" > "/etc/apache2/sites-available/$1-ssl.conf"
|
||||
ln -fs "/etc/apache2/sites-available/$1-ssl.conf" "/etc/apache2/sites-enabled/$1-ssl.conf"
|
||||
|
||||
ps auxw | grep apache2 | grep -v grep > /dev/null
|
||||
|
||||
service apache2 restart
|
||||
service php"$5"-fpm restart
|
||||
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
service apache2 reload
|
||||
fi
|
97
scripts/site-types/cakephp3.sh
Normal file
97
scripts/site-types/cakephp3.sh
Normal file
@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A params=$6 # Create an associative array
|
||||
declare -A headers=${9} # Create an associative array
|
||||
declare -A rewrites=${10} # Create an associative array
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
fastcgi_param ${element} ${params[$element]};"
|
||||
done
|
||||
fi
|
||||
headersTXT=""
|
||||
if [ -n "${9}" ]; then
|
||||
for element in "${!headers[@]}"
|
||||
do
|
||||
headersTXT="${headersTXT}
|
||||
add_header ${element} ${headers[$element]};"
|
||||
done
|
||||
fi
|
||||
rewritesTXT=""
|
||||
if [ -n "${10}" ]; then
|
||||
for element in "${!rewrites[@]}"
|
||||
do
|
||||
rewritesTXT="${rewritesTXT}
|
||||
location ~ ${element} { if (!-f \$request_filename) { return 301 ${rewrites[$element]}; } }"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$7" = "true" ]
|
||||
then configureXhgui="
|
||||
location /xhgui {
|
||||
try_files \$uri \$uri/ /xhgui/index.php?\$args;
|
||||
}
|
||||
"
|
||||
else configureXhgui=""
|
||||
fi
|
||||
|
||||
block="server {
|
||||
listen ${3:-80};
|
||||
listen ${4:-443} ssl http2;
|
||||
server_name www.$1;
|
||||
return 301 http://$1\$request_uri;
|
||||
|
||||
ssl_certificate /etc/ssl/certs/$1.crt;
|
||||
ssl_certificate_key /etc/ssl/certs/$1.key;
|
||||
}
|
||||
|
||||
server {
|
||||
listen ${3:-80};
|
||||
listen ${4:-443} ssl http2;
|
||||
server_name .$1;
|
||||
root \"$2\";
|
||||
|
||||
index index.php;
|
||||
|
||||
charset utf-8;
|
||||
client_max_body_size 100M;
|
||||
$rewritesTXT
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.php?\$args;
|
||||
$headersTXT
|
||||
}
|
||||
|
||||
$configureXhgui
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
access_log $2/../logs/$1-access.log;
|
||||
error_log $2/../logs/$1-error.log error;
|
||||
|
||||
sendfile off;
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files \$uri =404;
|
||||
include fastcgi_params;
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
$paramsTXT
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/ssl/certs/$1.crt;
|
||||
ssl_certificate_key /etc/ssl/certs/$1.key;
|
||||
}
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/nginx/sites-available/$1"
|
||||
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"
|
8
scripts/site-types/crystal.sh
Normal file
8
scripts/site-types/crystal.sh
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo service nginx stop
|
||||
|
||||
if [ -d /etc/apache2/sites-available ]
|
||||
then
|
||||
sudo service apache2 stop
|
||||
fi
|
115
scripts/site-types/elgg.sh
Normal file
115
scripts/site-types/elgg.sh
Normal file
@ -0,0 +1,115 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A params=$6 # Create an associative array
|
||||
declare -A headers=${9} # Create an associative array
|
||||
declare -A rewrites=${10} # Create an associative array
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
fastcgi_param ${element} ${params[$element]};"
|
||||
done
|
||||
fi
|
||||
headersTXT=""
|
||||
if [ -n "${9}" ]; then
|
||||
for element in "${!headers[@]}"
|
||||
do
|
||||
headersTXT="${headersTXT}
|
||||
add_header ${element} ${headers[$element]};"
|
||||
done
|
||||
fi
|
||||
rewritesTXT=""
|
||||
if [ -n "${10}" ]; then
|
||||
for element in "${!rewrites[@]}"
|
||||
do
|
||||
rewritesTXT="${rewritesTXT}
|
||||
location ~ ${element} { if (!-f \$request_filename) { return 301 ${rewrites[$element]}; } }"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$7" = "true" ]
|
||||
then configureXhgui="
|
||||
location /xhgui {
|
||||
try_files \$uri \$uri/ /xhgui/index.php?\$args;
|
||||
}
|
||||
"
|
||||
else configureXhgui=""
|
||||
fi
|
||||
|
||||
block="server {
|
||||
listen ${3:-80};
|
||||
listen ${4:-443} ssl http2;
|
||||
server_name $1;
|
||||
|
||||
root $2;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
error_log /var/log/nginx/$1-error.log error;
|
||||
access_log off;
|
||||
|
||||
gzip on;
|
||||
gzip_types
|
||||
# text/html is always compressed by HttpGzipModule
|
||||
text/css
|
||||
text/javascript
|
||||
text/xml
|
||||
text/plain
|
||||
text/x-component
|
||||
application/javascript
|
||||
application/x-javascript
|
||||
application/json
|
||||
application/xml
|
||||
application/rss+xml
|
||||
font/truetype
|
||||
font/opentype
|
||||
application/vnd.ms-fontobject
|
||||
image/svg+xml;
|
||||
|
||||
client_max_body_size 100M;
|
||||
$rewritesTXT
|
||||
|
||||
location ~ /.well-known {
|
||||
allow all;
|
||||
}
|
||||
|
||||
location ~ (^\.|/\.) {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location = /rewrite.php {
|
||||
rewrite ^(.*)$ /install.php;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ @elgg;
|
||||
$headersTXT
|
||||
}
|
||||
|
||||
$configureXhgui
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
location ~ \.php$ {
|
||||
try_files \$uri @elgg;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
}
|
||||
|
||||
location @elgg {
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root/index.php;
|
||||
fastcgi_param SCRIPT_NAME /index.php;
|
||||
fastcgi_param QUERY_STRING __elgg_uri=\$uri&\$args;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/ssl/certs/$1.crt;
|
||||
ssl_certificate_key /etc/ssl/certs/$1.key;
|
||||
}
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/nginx/sites-available/$1"
|
||||
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"
|
98
scripts/site-types/fastadmin.sh
Normal file
98
scripts/site-types/fastadmin.sh
Normal file
@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A params=$6 # Create an associative array
|
||||
declare -A headers=${9} # Create an associative array
|
||||
declare -A rewrites=${10} # Create an associative array
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
fastcgi_param ${element} ${params[$element]};"
|
||||
done
|
||||
fi
|
||||
headersTXT=""
|
||||
if [ -n "${9}" ]; then
|
||||
for element in "${!headers[@]}"
|
||||
do
|
||||
headersTXT="${headersTXT}
|
||||
add_header ${element} ${headers[$element]};"
|
||||
done
|
||||
fi
|
||||
rewritesTXT=""
|
||||
if [ -n "${10}" ]; then
|
||||
for element in "${!rewrites[@]}"
|
||||
do
|
||||
rewritesTXT="${rewritesTXT}
|
||||
location ~ ${element} { if (!-f \$request_filename) { return 301 ${rewrites[$element]}; } }"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$7" = "true" ]
|
||||
then configureXhgui="
|
||||
location /xhgui {
|
||||
try_files \$uri \$uri/ /xhgui/index.php?\$args;
|
||||
}
|
||||
"
|
||||
else configureXhgui=""
|
||||
fi
|
||||
|
||||
block="server {
|
||||
listen ${3:-80};
|
||||
listen ${4:-443} ssl http2;
|
||||
server_name .$1;
|
||||
root \"$2\";
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
charset utf-8;
|
||||
client_max_body_size 100M;
|
||||
|
||||
$rewritesTXT
|
||||
|
||||
location / {
|
||||
if (!-e \$request_filename) {
|
||||
rewrite ^(.*)$ /index.php?s=/\$1 last;
|
||||
break;
|
||||
}
|
||||
$headersTXT
|
||||
}
|
||||
|
||||
$configureXhgui
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
access_log off;
|
||||
error_log /var/log/nginx/$1-error.log error;
|
||||
|
||||
sendfile off;
|
||||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO \$fastcgi_path_info;
|
||||
$paramsTXT
|
||||
|
||||
fastcgi_intercept_errors off;
|
||||
fastcgi_buffer_size 16k;
|
||||
fastcgi_buffers 4 16k;
|
||||
fastcgi_connect_timeout 300;
|
||||
fastcgi_send_timeout 300;
|
||||
fastcgi_read_timeout 300;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/ssl/certs/$1.crt;
|
||||
ssl_certificate_key /etc/ssl/certs/$1.key;
|
||||
}
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/nginx/sites-available/$1"
|
||||
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"
|
92
scripts/site-types/frontcontroller.sh
Normal file
92
scripts/site-types/frontcontroller.sh
Normal file
@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A params=$6 # Create an associative array
|
||||
declare -A headers=${9} # Create an associative array
|
||||
declare -A rewrites=${10} # Create an associative array
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
fastcgi_param ${element} ${params[$element]};"
|
||||
done
|
||||
fi
|
||||
headersTXT=""
|
||||
if [ -n "${9}" ]; then
|
||||
for element in "${!headers[@]}"
|
||||
do
|
||||
headersTXT="${headersTXT}
|
||||
add_header ${element} ${headers[$element]};"
|
||||
done
|
||||
fi
|
||||
rewritesTXT=""
|
||||
if [ -n "${10}" ]; then
|
||||
for element in "${!rewrites[@]}"
|
||||
do
|
||||
rewritesTXT="${rewritesTXT}
|
||||
location ~ ${element} { if (!-f \$request_filename) { return 301 ${rewrites[$element]}; } }"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$7" = "true" ]
|
||||
then configureXhgui="
|
||||
location /xhgui {
|
||||
try_files \$uri \$uri/ /xhgui/index.php?\$args;
|
||||
}
|
||||
"
|
||||
else configureXhgui=""
|
||||
fi
|
||||
|
||||
block="server {
|
||||
listen ${3:-80};
|
||||
listen ${4:-443} ssl http2;
|
||||
server_name .$1;
|
||||
root \"$2\";
|
||||
|
||||
charset utf-8;
|
||||
|
||||
client_max_body_size 100M;
|
||||
$rewritesTXT
|
||||
|
||||
location / {
|
||||
try_files \$uri /index.php?\$query_string;
|
||||
$headersTXT
|
||||
}
|
||||
|
||||
$configureXhgui
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
access_log off;
|
||||
error_log /var/log/nginx/$1-error.log error;
|
||||
|
||||
sendfile off;
|
||||
|
||||
location = /index.php {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
$paramsTXT
|
||||
|
||||
fastcgi_intercept_errors off;
|
||||
fastcgi_buffer_size 16k;
|
||||
fastcgi_buffers 4 16k;
|
||||
fastcgi_connect_timeout 300;
|
||||
fastcgi_send_timeout 300;
|
||||
fastcgi_read_timeout 300;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/ssl/certs/$1.crt;
|
||||
ssl_certificate_key /etc/ssl/certs/$1.key;
|
||||
}
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/nginx/sites-available/$1"
|
||||
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"
|
93
scripts/site-types/laravel.sh
Normal file
93
scripts/site-types/laravel.sh
Normal file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
declare -A params=$6 # Create an associative array
|
||||
declare -A headers=${9} # Create an associative array
|
||||
declare -A rewrites=${10} # Create an associative array
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
fastcgi_param ${element} ${params[$element]};"
|
||||
done
|
||||
fi
|
||||
headersTXT=""
|
||||
if [ -n "${9}" ]; then
|
||||
for element in "${!headers[@]}"
|
||||
do
|
||||
headersTXT="${headersTXT}
|
||||
add_header ${element} ${headers[$element]};"
|
||||
done
|
||||
fi
|
||||
rewritesTXT=""
|
||||
if [ -n "${10}" ]; then
|
||||
for element in "${!rewrites[@]}"
|
||||
do
|
||||
rewritesTXT="${rewritesTXT}
|
||||
location ~ ${element} { if (!-f \$request_filename) { return 301 ${rewrites[$element]}; } }"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$7" = "true" ]
|
||||
then configureXhgui="
|
||||
location /xhgui {
|
||||
try_files \$uri \$uri/ /xhgui/index.php?\$args;
|
||||
}
|
||||
"
|
||||
else configureXhgui=""
|
||||
fi
|
||||
|
||||
block="server {
|
||||
listen ${3:-80};
|
||||
listen ${4:-443} ssl http2;
|
||||
server_name .$1;
|
||||
root \"$2\";
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
$rewritesTXT
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.php?\$query_string;
|
||||
$headersTXT
|
||||
}
|
||||
|
||||
$configureXhgui
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
access_log off;
|
||||
error_log /var/log/nginx/$1-error.log error;
|
||||
|
||||
sendfile off;
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
$paramsTXT
|
||||
|
||||
fastcgi_intercept_errors off;
|
||||
fastcgi_buffer_size 16k;
|
||||
fastcgi_buffers 4 16k;
|
||||
fastcgi_connect_timeout 300;
|
||||
fastcgi_send_timeout 300;
|
||||
fastcgi_read_timeout 300;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/ssl/certs/$1.crt;
|
||||
ssl_certificate_key /etc/ssl/certs/$1.key;
|
||||
}
|
||||
"
|
||||
|
||||
echo "$block" > "/etc/nginx/sites-available/$1"
|
||||
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"
|
207
scripts/site-types/magento.sh
Normal file
207
scripts/site-types/magento.sh
Normal file
@ -0,0 +1,207 @@
|
||||
declare -A params=$6 # Create an associative array
|
||||
|
||||
paramsTXT=""
|
||||
if [ -n "$6" ]; then
|
||||
for element in "${!params[@]}"
|
||||
do
|
||||
paramsTXT="${paramsTXT}
|
||||
fastcgi_param ${element} ${params[$element]};"
|
||||
done
|
||||
fi
|
||||
|
||||
block="server {
|
||||
listen ${3:-80};
|
||||
listen ${4:-443} ssl http2;
|
||||
server_name .$1;
|
||||
|
||||
set \$MAGE_ROOT $2;
|
||||
|
||||
root \$MAGE_ROOT/pub;
|
||||
|
||||
index index.php;
|
||||
autoindex off;
|
||||
charset utf-8;
|
||||
client_max_body_size 100M;
|
||||
error_page 404 403 = /errors/404.php;
|
||||
|
||||
|
||||
# PHP entry point for setup application
|
||||
location ~* ^/setup($|/) {
|
||||
root \$MAGE_ROOT;
|
||||
location ~ ^/setup/index.php {
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
|
||||
fastcgi_param PHP_FLAG \"session.auto_start=off \n suhosin.session.cryptua=off\";
|
||||
fastcgi_param PHP_VALUE \"memory_limit=756M \n max_execution_time=600\";
|
||||
fastcgi_read_timeout 600s;
|
||||
fastcgi_connect_timeout 600s;
|
||||
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
$paramsTXT
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ ^/setup/(?!pub/). {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ ^/setup/pub/ {
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
}
|
||||
}
|
||||
|
||||
# PHP entry point for update application
|
||||
location ~* ^/update($|/) {
|
||||
root \$MAGE_ROOT;
|
||||
|
||||
location ~ ^/update/index.php {
|
||||
fastcgi_split_path_info ^(/update/index.php)(/.+)$;
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO \$fastcgi_path_info;
|
||||
$paramsTXT
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
# Deny everything but index.php
|
||||
location ~ ^/update/(?!pub/). {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ ^/update/pub/ {
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.php\$is_args\$args;
|
||||
}
|
||||
|
||||
location /pub/ {
|
||||
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
|
||||
deny all;
|
||||
}
|
||||
alias \$MAGE_ROOT/pub/;
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
# Uncomment the following line in production mode
|
||||
# expires max;
|
||||
|
||||
# Remove signature of the static files that is used to overcome the browser cache
|
||||
location ~ ^/static/version {
|
||||
rewrite ^/static/(version[^/]+/)?(.*)$ /static/\$2 last;
|
||||
}
|
||||
|
||||
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|json)$ {
|
||||
add_header Cache-Control \"public\";
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
expires +1y;
|
||||
|
||||
if (!-f \$request_filename) {
|
||||
rewrite ^/static/?(.*)$ /static.php?resource=\$1 last;
|
||||
}
|
||||
}
|
||||
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
|
||||
add_header Cache-Control "no-store";
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
expires off;
|
||||
|
||||
if (!-f \$request_filename) {
|
||||
rewrite ^/static/?(.*)$ /static.php?resource=\$1 last;
|
||||
}
|
||||
}
|
||||
if (!-f \$request_filename) {
|
||||
rewrite ^/static/?(.*)$ /static.php?resource=\$1 last;
|
||||
}
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
try_files \$uri \$uri/ /get.php\$is_args\$args;
|
||||
|
||||
location ~ ^/media/theme_customization/.*\.xml {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
|
||||
add_header Cache-Control \"public\";
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
expires +1y;
|
||||
try_files \$uri \$uri/ /get.php\$is_args\$args;
|
||||
}
|
||||
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
|
||||
add_header Cache-Control \"no-store\";
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
expires off;
|
||||
try_files \$uri \$uri/ /get.php\$is_args\$args;
|
||||
}
|
||||
add_header X-Frame-Options \"SAMEORIGIN\";
|
||||
}
|
||||
|
||||
location /media/customer/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /media/downloadable/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /media/import/ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# PHP entry point for main application
|
||||
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {
|
||||
try_files \$uri =404;
|
||||
fastcgi_pass unix:/var/run/php/php$5-fpm.sock;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
|
||||
fastcgi_param PHP_FLAG \"session.auto_start=off \n suhosin.session.cryptua=off\";
|
||||
fastcgi_param PHP_VALUE \"memory_limit=756M \n max_execution_time=18000\";
|
||||
fastcgi_read_timeout 600s;
|
||||
fastcgi_connect_timeout 600s;
|
||||
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
$paramsTXT
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
gzip on;
|
||||
gzip_disable \"msie6\";
|
||||
|
||||
gzip_comp_level 6;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_proxied any;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/js
|
||||
text/xml
|
||||
text/javascript
|
||||
application/javascript
|
||||
application/x-javascript
|
||||
application/json
|
||||
application/xml
|
||||
application/xml+rss
|
||||
image/svg+xml;
|
||||
gzip_vary on;
|
||||
|
||||
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
|
||||
location ~* (\.php$|\.htaccess$|\.git) {
|
||||
deny all;
|
||||
}
|
||||
|
||||
ssl_certificate /etc/ssl/certs/$1.crt;
|
||||
ssl_certificate_key /etc/ssl/certs/$1.key;
|
||||
|
||||
}"
|
||||
|
||||
echo "$block" > "/etc/nginx/sites-available/$1"
|
||||
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user