enabling xdebug with the Vagrant env

pull/202/head
Cédric Bonhomme 2019-08-23 08:41:26 +02:00
parent 1caf57ad6d
commit 05c42afc0d
No known key found for this signature in database
GPG Key ID: A1CB94DE57B7A70D
2 changed files with 23 additions and 8 deletions

1
vagrant/Vagrantfile vendored
View File

@ -22,6 +22,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# within the machine from a port on the host machine. In the example below, # within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine. # accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network :forwarded_port, guest: 80, host: 5001 config.vm.network :forwarded_port, guest: 80, host: 5001
config.vm.network :forwarded_port, guest: 3306, host: 3306
# Create a private network, which allows host-only access to the machine # Create a private network, which allows host-only access to the machine
# using a specific IP. # using a specific IP.

View File

@ -22,6 +22,8 @@ max_execution_time=100
max_input_time=223 max_input_time=223
memory_limit=512M memory_limit=512M
PHP_INI=/etc/php/7.2/apache2/php.ini PHP_INI=/etc/php/7.2/apache2/php.ini
X_DEBUG_CFG=/etc/php/7.2/apache2/conf.d/20-xdebug.ini
MARIA_DB_CFG=/etc/mysql/mariadb.conf.d/50-server.cnf
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
export LANGUAGE=en_US.UTF-8 export LANGUAGE=en_US.UTF-8
@ -70,8 +72,12 @@ expect -f - <<-EOF
EOF EOF
sudo apt-get purge -y expect > /dev/null 2>&1 sudo apt-get purge -y expect > /dev/null 2>&1
echo -e "\n--- Configuring … ---\n"
sed -i "s/skip-external-locking/#skip-external-locking/g" $MARIA_DB_CFG
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" $MARIA_DB_CFG
echo -e "\n--- Installing PHP-specific packages… ---\n" echo -e "\n--- Installing PHP-specific packages… ---\n"
apt-get -y install php apache2 libapache2-mod-php php-curl php-gd php-mysql php-pear php-apcu php-xml php-mbstring php-intl php-imagick php-zip > /dev/null apt-get -y install php apache2 libapache2-mod-php php-curl php-gd php-mysql php-pear php-apcu php-xml php-mbstring php-intl php-imagick php-zip php-xdebug > /dev/null
echo -e "\n--- Configuring PHP… ---\n" echo -e "\n--- Configuring PHP… ---\n"
for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit for key in upload_max_filesize post_max_size max_execution_time max_input_time memory_limit
@ -79,6 +85,14 @@ do
sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" $PHP_INI
done done
echo -e "\n--- Configuring Description Xdebug ---\n"
cat > $X_DEBUG_CFG <<EOF
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.idekey=IDEKEY
EOF
echo -e "\n--- Enabling mod-rewrite and ssl… ---\n" echo -e "\n--- Enabling mod-rewrite and ssl… ---\n"
a2enmod rewrite > /dev/null 2>&1 a2enmod rewrite > /dev/null 2>&1
a2enmod ssl > /dev/null 2>&1 a2enmod ssl > /dev/null 2>&1
@ -87,13 +101,13 @@ a2enmod headers > /dev/null 2>&1
echo -e "\n--- Allowing Apache override to all ---\n" echo -e "\n--- Allowing Apache override to all ---\n"
sudo sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf sudo sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf
#echo -e "\n--- We want to see the PHP errors, turning them on ---\n" echo -e "\n--- We want to see the PHP errors, turning them on ---\n"
#sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/apache2/php.ini sed -i "s/error_reporting = .*/error_reporting = E_ALL/" $PHP_INI
#sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/apache2/php.ini sed -i "s/display_errors = .*/display_errors = On/" $PHP_INI
echo -e "\n--- Setting up our MariaDB user for MONARC… ---\n" echo -e "\n--- Setting up our MariaDB user for MONARC… ---\n"
mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'localhost' IDENTIFIED BY '$DBPASSWORD_MONARC';" mysql -u root -p$DBPASSWORD_ADMIN -e "CREATE USER '$DBUSER_MONARC'@'%' IDENTIFIED BY '$DBPASSWORD_MONARC';"
mysql -u root -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'localhost';" mysql -u root -p$DBPASSWORD_ADMIN -e "GRANT ALL PRIVILEGES ON * . * TO '$DBUSER_MONARC'@'%';"
mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;" mysql -u root -p$DBPASSWORD_ADMIN -e "FLUSH PRIVILEGES;"
echo -e "\n--- Installing composer… ---\n" echo -e "\n--- Installing composer… ---\n"
@ -133,12 +147,12 @@ cd $PATH_TO_MONARC
# Interfaces # Interfaces
mkdir node_modules mkdir node_modules
cd node_modules cd node_modules
git clone --config core.filemode=false https://github.com/monarc-project/ng-client.git ng_client > /dev/null 2>&1 git clone --config core.fileMode=false https://github.com/monarc-project/ng-client.git ng_client > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "\nERROR: unable to clone the ng-client repository\n" echo "\nERROR: unable to clone the ng-client repository\n"
exit 1; exit 1;
fi fi
git clone --config core.filemode=false https://github.com/monarc-project/ng-anr.git ng_anr > /dev/null 2>&1 git clone --config core.fileMode=false https://github.com/monarc-project/ng-anr.git ng_anr > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "\nERROR: unable to clone the ng-anr repository\n" echo "\nERROR: unable to clone the ng-anr repository\n"
exit 1; exit 1;