Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

✨ ❄️ πŸ’‘ ⬆️ Update to Homestead ^5 and use per project & make command for config #27

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

Closed
svpernova09 wants to merge 5 commits into laravelio:master from svpernova09:feature/homestead-per-project
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions Homestead.yaml.example
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ip: 192.168.10.30
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- { map: ~/PhpstormProjects/pastebin, to: /home/vagrant/pastebin }
Copy link
Member

@driesvints driesvints Jun 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change ~/PhpstormProjects/pastebin back to ~/Sites/pastebin?

Copy link
Contributor Author

@svpernova09 svpernova09 Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

sites:
- { map: pastebin.app, to: /home/vagrant/pastebin/public }
databases:
- homestead
name: pastebin
hostname: pastebin
Copy link
Member

@driesvints driesvints Jun 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to keep it as an example file πŸ‘

5 changes: 5 additions & 0 deletions after.sh
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/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.
Copy link
Member

@driesvints driesvints Jun 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not adding anything to this file, can't we just remove it?

Copy link
Contributor Author

@svpernova09 svpernova09 Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We certainly can. If we need it in the future we can just re-run the Homestead make command or just simply drop this file into the root and Homestead will pick it up and execute it automatically. Will remove it for now.

208 changes: 208 additions & 0 deletions aliases
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
alias ..="cd .."
alias ...="cd ../.."

alias h='cd ~'
alias c='clear'
alias art=artisan

alias phpspec='vendor/bin/phpspec'
alias phpunit='vendor/bin/phpunit'
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

php artisan dusk "$@"
}

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/serve-apache.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-apache.sh "1ドル" "2ドル" 80
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/serve-laravel.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-laravel.sh "1ドル" "2ドル" 80
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/serve-proxy.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-proxy.sh "1ドル" "2ドル" 80
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/serve-silverstripe.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-silverstripe.sh "1ドル" "2ドル" 80
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/serve-spa.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-spa.sh "1ドル" "2ドル" 80
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/serve-statamic.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-statamic.sh "1ドル" "2ドル" 80
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/serve-symfony2.sh
sudo bash /vagrant/vendor/laravel/homestead/scripts/serve-symfony2.sh "1ドル" "2ドル" 80
else
echo "Error: missing required parameters."
echo "Usage: "
echo " serve-symfony2 domain path"
fi
}

function share() {
if [[ "1ドル" ]]
then
ngrok http ${@:2} -host-header="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 2>/dev/null | pv --size=$ADJUSTED_SIZE | gzip > "$FILE"
else
mysqldump -uhomestead -psecret --all-databases --skip-lock-tables 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.remote_host=192.168.10.1 \
-dxdebug.remote_autostart=1 \
"$@"

if ! $XDEBUG_ENABLED; then xoff; fi
}
Copy link
Member

@driesvints driesvints Jun 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's best to not include this file on the main repo and only allow people to add it if they want to. Or perhaps add it in Homestead itself? In any case, it has little to do with the Pastebin source code...

Copy link
Contributor Author

@svpernova09 svpernova09 Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aliases file is a lot of support functions for generating host files for nginx as well as a ton of helper methods for toggling xdebug on and off. Honestly we can remove whatever you want to pear down the file to only what the specific project needs. I would recommend leaving the command shortcuts so that anyone used to having those in a Homestead project would still find them in a project that's using Homestead.

Copy link
Member

@driesvints driesvints Jun 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be an idea to make the Homestead.yaml file to load in the aliases based on a filepath so the aliases file doesn't needs to be committed?

I'm sorry but I'm not really a fan of committing these sorts of files to a project's codebase. They seem to be too personal. I doubt I'll ever make use of most of them.

Copy link
Contributor Author

@svpernova09 svpernova09 Jul 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can gitignore the aliases file if you prefer. That way when you run the make command they will be there if you want them, but won't be checked in.

Copy link
Member

@driesvints driesvints Jul 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a good idea πŸ‘

2 changes: 1 addition & 1 deletion composer.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"require-dev": {
"codeclimate/php-test-reporter": "^0.4.4",
"fzaninotto/faker": "^1.6",
"laravel/homestead": "^5.0",
"laravel/homestead": "^5",
Copy link
Member

@driesvints driesvints Jun 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particularly reason why you changed this?

Copy link
Contributor Author

@svpernova09 svpernova09 Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Homestead follows semantic versioning and we end up doing minor releases somewhat often. It's easy to fall behind if you're sticking to a major version. With this change we'll get 5.* instead of only 5.0.*

driesvints reacted with thumbs up emoji
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
Expand Down
Loading

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /