Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Vagrant setup #152

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
$script = <<-SCRIPT
sudo yum install epel-release yum-utils -y
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum-config-manager --enable remi-php73
sudo yum install unzip wget php php-common php-opcache php-mcrypt php-cli php-curl php-xml php-mbstring -y
cd /home/vagrant/adyen-php-api-library
echo "Installing composer"
sh bin/composer-installer.sh
if [ $? -ne 0 ]
then
echo "Failed installing composer"
exit 1
else
echo "Composer installed successfully"
sudo mv composer.phar /bin/composer
sudo chmod a+x /bin/composer
composer install
fi
SCRIPT

Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/bionic64"
config.vm.box_version = "1.0.282"
config.vm.box = "centos/7"
config.vm.synced_folder '.', '/home/vagrant/adyen-php-api-library', disabled: false
config.vm.network :forwarded_port, guest:3000, host: 3000
config.vm.provision "shell", inline: $script
end
17 changes: 17 additions & 0 deletions bin/composer-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT