Skip to content

Instantly share code, notes, and snippets.

@ethanbeyer
Last active November 14, 2022 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanbeyer/95b8e761b6d303cdd1204735041252ec to your computer and use it in GitHub Desktop.
Save ethanbeyer/95b8e761b6d303cdd1204735041252ec to your computer and use it in GitHub Desktop.
Ethan's Homestead Debug Info
more /etc/nginx/sites-enabled/test.local
server {
listen 80;
listen 443 ssl http2;
server_name .test.local;
root "/home/vagrant/sites/test.local";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
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/test.local-error.log error;
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
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/test.local.crt;
ssl_certificate_key /etc/ssl/certs/test.local.key;
}
vagrant destroy && vagrant up
testing.box: Are you sure you want to destroy the 'testing.box' VM? [y/N] y
==> testing.box: Forcing shutdown of VM...
==> testing.box: Destroying VM and associated drives...
Bringing machine 'testing.box' up with 'virtualbox' provider...
==> testing.box: Importing base box 'laravel/homestead'...
==> testing.box: Matching MAC address for NAT networking...
==> testing.box: Checking if box 'laravel/homestead' version '12.2.0' is up to date...
==> testing.box: Setting the name of the VM: testing.box
==> testing.box: Fixed port collision for 80 => 8000. Now on port 2200.
==> testing.box: Fixed port collision for 443 => 44300. Now on port 2201.
==> testing.box: Fixed port collision for 22 => 2222. Now on port 2202.
==> testing.box: Clearing any previously set network interfaces...
==> testing.box: Preparing network interfaces based on configuration...
testing.box: Adapter 1: nat
testing.box: Adapter 2: intnet
==> testing.box: Forwarding ports...
testing.box: 80 (guest) => 2200 (host) (adapter 1)
testing.box: 443 (guest) => 2201 (host) (adapter 1)
testing.box: 22 (guest) => 2202 (host) (adapter 1)
==> testing.box: Running 'pre-boot' VM customizations...
==> testing.box: Booting VM...
==> testing.box: Waiting for machine to boot. This may take a few minutes...
testing.box: SSH address: 127.0.0.1:2202
testing.box: SSH username: vagrant
testing.box: SSH auth method: private key
testing.box: Warning: Connection reset. Retrying...
testing.box:
testing.box: Vagrant insecure key detected. Vagrant will automatically replace
testing.box: this with a newly generated keypair for better security.
testing.box:
testing.box: Inserting generated public key within guest...
testing.box: Removing insecure key from the guest if it's present...
testing.box: Key inserted! Disconnecting and reconnecting using new SSH key...
==> testing.box: Machine booted and ready!
==> testing.box: Checking for guest additions in VM...
testing.box: The guest additions on this VM do not match the installed version of
testing.box: VirtualBox! In most cases this is fine, but in rare cases it can
testing.box: prevent things such as shared folders from working properly. If you see
testing.box: shared folder errors, please make sure the guest additions within the
testing.box: virtual machine match the version of VirtualBox you have installed on
testing.box: your host and reload your VM.
testing.box:
testing.box: Guest Additions Version: 6.1.36
testing.box: VirtualBox Version: 7.0
==> testing.box: Setting hostname...
==> testing.box: Configuring and enabling network interfaces...
==> testing.box: Mounting shared folders...
testing.box: /vagrant => /Users/Username/Code/Web/testing/box
testing.box: /home/vagrant/sites/test.local => /Users/Username/Code/Web/testing/sites/test.local
==> testing.box: Detected mount owner ID within mount options. (uid: 1000 guestpath: /home/vagrant/sites/test.local)
==> testing.box: Detected mount group ID within mount options. (gid: 1000 guestpath: /home/vagrant/sites/test.local)
==> testing.box: Running provisioner: file...
testing.box: aliases => /tmp/bash_aliases
==> testing.box: Running provisioner: shell...
testing.box: Running: inline script
==> testing.box: Running provisioner: setting authorize key (shell)...
testing.box: Running: inline script
testing.box:
testing.box: ssh-rsa [REDACTED]
testing.box:
==> testing.box: Running provisioner: setting authorize permissions for id_rsa (shell)...
testing.box: Running: inline script
==> testing.box: Running provisioner: mk_features (shell)...
testing.box: Running: inline script
==> testing.box: Running provisioner: own_features (shell)...
testing.box: Running: inline script
==> testing.box: Running provisioner: apt_update (shell)...
testing.box: Running: inline script
testing.box: Get:1 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]
testing.box: Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease
testing.box: Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
testing.box: Hit:4 http://ppa.launchpad.net/chris-lea/redis-server/ubuntu focal InRelease
testing.box: Get:5 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [20.8 kB]
testing.box: Get:6 https://deb.nodesource.com/node_14.x focal InRelease [4,583 B]
testing.box: Get:7 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease [91.6 kB]
testing.box: Get:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
testing.box: Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease [23.9 kB]
testing.box: Get:10 http://us.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
testing.box: Get:11 https://deb.nodesource.com/node_14.x focal/main amd64 Packages [773 B]
testing.box: Get:12 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,215 kB]
testing.box: Get:13 http://us.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [385 kB]
testing.box: Get:14 http://us.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1,385 kB]
testing.box: Get:15 http://us.archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [196 kB]
testing.box: Get:16 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [976 kB]
testing.box: Get:17 http://us.archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [222 kB]
testing.box: Get:18 http://us.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [24.4 kB]
testing.box: Get:19 http://us.archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [7,316 B]
testing.box: Get:20 http://us.archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [45.7 kB]
testing.box: Get:21 http://us.archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [24.0 kB]
testing.box: Get:22 http://us.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,822 kB]
testing.box: Get:23 http://us.archive.ubuntu.com/ubuntu focal-security/main Translation-en [301 kB]
testing.box: Get:24 http://us.archive.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1,293 kB]
testing.box: Get:25 http://us.archive.ubuntu.com/ubuntu focal-security/restricted Translation-en [183 kB]
testing.box: Get:26 http://us.archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [747 kB]
testing.box: Get:27 http://us.archive.ubuntu.com/ubuntu focal-security/universe Translation-en [138 kB]
testing.box: Get:28 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages [106 kB]
testing.box: Get:29 http://apt.postgresql.org/pub/repos/apt focal-pgdg/main amd64 Packages [254 kB]
testing.box: Get:30 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main Translation-en [34.6 kB]
testing.box: Fetched 10.9 MB in 3s (3,752 kB/s)
testing.box: Reading package lists...
==> testing.box: Running provisioner: shell...
testing.box: Running: inline script
testing.box: Ignoring feature: mysql because it is set to false
==> testing.box: Running provisioner: shell...
testing.box: Running: inline script
testing.box: Ignoring feature: mariadb because it is set to false
==> testing.box: Running provisioner: shell...
testing.box: Running: inline script
testing.box: Ignoring feature: postgresql because it is set to false
==> testing.box: Running provisioner: shell...
testing.box: Running: inline script
testing.box: Ignoring feature: ohmyzsh because it is set to false
==> testing.box: Running provisioner: shell...
testing.box: Running: inline script
testing.box: Ignoring feature: webdriver because it is set to false
==> testing.box: Running provisioner: shell...
testing.box: Running: /var/folders/p5/ymxlcmfs06lg3h0fxhv3dc640000gn/T/vagrant-shell20221114-29294-1dod9sm.sh
==> testing.box: Running provisioner: shell...
testing.box: Running: /var/folders/p5/ymxlcmfs06lg3h0fxhv3dc640000gn/T/vagrant-shell20221114-29294-1szed1t.sh
==> testing.box: Running provisioner: Creating Certificate: test.local (shell)...
testing.box: Running: script: Creating Certificate: test.local
testing.box: Updating certificates in /etc/ssl/certs...
testing.box: rehash: warning: skipping duplicate certificate in ca.homestead.testing.pem
testing.box: rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
testing.box: 1 added, 0 removed; done.
testing.box: Running hooks in /etc/ca-certificates/update.d...
testing.box: done.
==> testing.box: Running provisioner: Creating Site: test.local (shell)...
testing.box: Running: script: Creating Site: test.local
==> testing.box: Running provisioner: shell...
testing.box: Running: inline script
==> testing.box: Running provisioner: shell...
testing.box: Running: /var/folders/p5/ymxlcmfs06lg3h0fxhv3dc640000gn/T/vagrant-shell20221114-29294-19xs184.sh
==> testing.box: Running provisioner: Checking for old Schedule (shell)...
testing.box: Running: script: Checking for old Schedule
==> testing.box: Running provisioner: Clear Variables (shell)...
testing.box: Running: script: Clear Variables
==> testing.box: Running provisioner: Restarting Cron (shell)...
testing.box: Running: script: Restarting Cron
==> testing.box: Running provisioner: Restart Webserver (shell)...
testing.box: Running: script: Restart Webserver
==> testing.box: Running provisioner: Update Composer (shell)...
testing.box: Running: script: Update Composer
testing.box: Upgrading to version 2.4.4 (stable channel).
testing.box:
testing.box: Use composer self-update --rollback to return to version 2.3.10
==> testing.box: Running provisioner: shell...
testing.box: Running: /var/folders/p5/ymxlcmfs06lg3h0fxhv3dc640000gn/T/vagrant-shell20221114-29294-f3cr2f.sh
==> testing.box: Running provisioner: Update motd (shell)...
testing.box: Running: script: Update motd
==> testing.box: Running provisioner: shell...
testing.box: Running: /var/folders/p5/ymxlcmfs06lg3h0fxhv3dc640000gn/T/vagrant-shell20221114-29294-jwbbac.sh
testing.box:
testing.box: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
testing.box:
testing.box: Reading package lists...
testing.box: E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
testing.box: E: Unable to lock directory /var/lib/apt/lists/
testing.box: W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
testing.box: W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
testing.box:
testing.box: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
testing.box:
testing.box: E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
testing.box: E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
testing.box: % Total % Received % Xferd Average Speed Time Time Time Current
testing.box: Dload Upload Total Spent Left Speed
100 14926 100 14926 0 0 119k 0 --:--:-- --:--:-- --:--:-- 119k
testing.box: => Downloading nvm from git to '/home/vagrant/.nvm'
testing.box: Cloning into '/home/vagrant/.nvm'...
=> * (HEAD detached at FETCH_HEAD)
testing.box: master
testing.box: => Compressing and cleaning up git repository
testing.box:
testing.box: => Appending nvm source string to /home/vagrant/.bashrc
testing.box: => Appending bash_completion source string to /home/vagrant/.bashrc
testing.box: => You currently have modules installed globally with `npm`. These will no
testing.box: => longer be linked to the active version of Node when you install a new node
testing.box: => with `nvm`; and they may (depending on how you construct your `$PATH`)
testing.box: => override the binaries of modules installed with `nvm`:
testing.box:
testing.box: /usr/lib
testing.box: ├── bower@1.8.14
testing.box: ├── corepack@0.10.0
testing.box: ├── grunt-cli@1.4.3
testing.box: ├── gulp-cli@2.3.0
testing.box: └── yarn@1.22.19
testing.box: => If you wish to uninstall them at a later point (or re-install them under your
testing.box: => `nvm` Nodes), you can remove them from the system Node as follows:
testing.box:
testing.box: $ nvm use system
testing.box: $ npm uninstall -g a_module
testing.box:
testing.box: => Close and reopen your terminal to start using nvm or run the following to use it now:
testing.box:
testing.box: export NVM_DIR="$HOME/.nvm"
testing.box: [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
testing.box: [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#!/bin/bash
#
# $1 = name of the box being created
BASE=~/Code/Web
NEWBOXBASE=$BASE/$1
mkdir $NEWBOXBASE
mkdir $NEWBOXBASE/box
mkdir $NEWBOXBASE/databases
mkdir $NEWBOXBASE/sites
cd $NEWBOXBASE/box
############
# this is my basic template for the homestead yaml file and i hate reformatting it all the time
cat > Homestead.yaml<< EOF
name: $1.box
hostname: $1
ip: 192.168.56.0
memory: 2048
cpus: 2
provider: virtualbox
ssl: true
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ../sites/SITENAME
to: /home/vagrant/sites/SITENAME
sites:
- map: SITENAME
to: /home/vagrant/sites/SITENAME
# databases:
# - homestead
features:
- mysql: false
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: false
EOF
############
composer require --prefer-source laravel/homestead:dev-main
php vendor/bin/homestead make
############
# adding these common commands to after.sh
cat >> after.sh<< EOF
# update everything
apt update
apt upgrade
# copy the certificate for the server to Homestead root directory
cp /etc/ssl/certs/ca.homestead.$1.crt /vagrant/homestead.$1.crt
# install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
EOF
cd $NEWBOXBASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment