Skip to content

Commit

Permalink
Include setup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
wilson1000 committed Oct 6, 2023
1 parent c0c0b5f commit 1285417
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.env
.env.backup
.phpunit.result.cache
.setup-complete
docker-compose.override.yml
Homestead.json
Homestead.yaml
Expand Down
10 changes: 10 additions & 0 deletions bin/restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# epoch age (in seconds) of .setup-complete
SETUP_COMPLETE_AGE=$(stat -f '%c' .setup-complete);
if [[ -f .setup-complete && $(($(date +%s)-SETUP_COMPLETE_AGE)) -lt 30 ]];then
printf '\e[33mINFO: Performing a restart\e[0m\n'
make restart

printf '\e[33mINFO: Done\e[0m\n'
fi
19 changes: 19 additions & 0 deletions bin/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# this block forces one-time setup on entry and a reinstall if environment changes
if [ ! -f .setup-complete ] || [ "$APP_ENV" != "$(cat .setup-complete)" ]; then
printf '\e[33mINFO: Beginning a fresh install\e[0m\n'

# composer
composer install

# clean first
php artisan db:wipe
php artisan key:generate
php artisan migrate
php artisan db:seed

# create a control file
# at minimum, this file is referenced in .gitignore and Makefile
echo "$APP_ENV" > .setup-complete
fi

0 comments on commit 1285417

Please sign in to comment.