Skip to content

Instantly share code, notes, and snippets.

@Braunson
Last active June 24, 2020 19:43
Show Gist options
  • Save Braunson/f7205b83bef1acfb2fe833fdefd30271 to your computer and use it in GitHub Desktop.
Save Braunson/f7205b83bef1acfb2fe833fdefd30271 to your computer and use it in GitHub Desktop.
Slightly modified version of https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh to support one argument, the URL to serve the site on.
#!/bin/bash
LATEST_VERSION=$(curl -sS 'https://api.github.com/repos/phpmyadmin/phpmyadmin/releases/latest' | awk -F '"' '/tag_name/{print $4}')
DOWNLOAD_URL="https://api.github.com/repos/phpmyadmin/phpmyadmin/tarball/$LATEST_VERSION"
SERVE_URL=${1:-phpmyadmin.local}
echo "Downloading phpMyAdmin $LATEST_VERSION"
wget $DOWNLOAD_URL -q -O 'phpmyadmin.tar.gz'
mkdir phpmyadmin && tar xf phpmyadmin.tar.gz -C phpmyadmin --strip-components 1
rm phpmyadmin.tar.gz
# Create an SSL Cert and site instance
echo "Serving the domain: $1"
# As per https://github.com/laravel/homestead/issues/1439#issuecomment-649013549
# serve-laravel $SERVE_URL $(pwd)/phpmyadmin
bash /vagrant/scripts/create-certificate.sh "$SERVE_URL"
dos2unix /vagrant/scripts/site-types/laravel.sh
bash /vagrant/scripts/site-types/laravel.sh "$SERVE_URL" "$(pwd)/phpmyadmin" 80 443 "7.4"
echo "Installing dependencies for phpMyAdmin on $1"
cd phpmyadmin && composer update --no-dev --quiet --no-interaction && yarn
echo "Setting the proper ownership"
chown -R vagrant:vagrant $(pwd)/phpmyadmin
sudo service nginx reload
@Braunson
Copy link
Author

Braunson commented Jun 23, 2020

Usage

You would use it like this:

curl -s -S https://gist.githubusercontent.com/Braunson/f7205b83bef1acfb2fe833fdefd30271/raw/phpmyadmin.sh | bash -s phpmyadmin.local

or for a shorter snippet

curl -s -S -L https://bit.ly/2YsR9wo | bash -s phpmyadmin.local

Place this in either after.sh or user-customizations.sh scripts if your using Laravel Homestead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment