Skip to content

Commit

Permalink
Release v1.0.37
Browse files Browse the repository at this point in the history
  • Loading branch information
rvwoens committed Aug 17, 2020
1 parent 2a2e168 commit 0ec51ab
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 42 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ The git repository setup makes it very easy to deploy a product version to the s

```bash
yum -y install tar
curl -s -L https://github.com/rvwoens/centos-laravel-stack/archive/v1.0.36.tar.gz | tar -xz
cd centos-laravel-stack-1.0.36
curl -s -L https://github.com/rvwoens/centos-laravel-stack/archive/v1.0.37.tar.gz | tar -xz
cd centos-laravel-stack-1.0.37
./setup_full

```
Expand Down Expand Up @@ -112,7 +112,7 @@ and the pushed tag/branch is automatically checked out to you server's path and
updated.

You can create a custom post-deployment script called ```production_deploy``` with your own artisan/composer/npm commands.
a typical production_deploy could look like this:
a typical production_deploy could look like this
```
echo "DEPLOY"
echo ">>>>>>>>> artisan DOWN"
Expand All @@ -128,7 +128,12 @@ yarn run production
echo ">>>>>>>>> artisan UP"
php artisan up
```
Make sure ```production_deploy``` is executable.

### extra utilities in ~/bin
* artisan - make sure you only need to type 'artisan' (on any laravel top directory)
* clear-laravel - clears all possible caches and restores path permissions
* logtail - tails the latest laravel log for a live logview (from any laravel top directory)



Expand Down
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=v1.0.36
date="Mon Aug 17 15:20:10 CEST 2020"
version=v1.0.37
date="Mon Aug 17 22:47:34 CEST 2020"
8 changes: 8 additions & 0 deletions parts/01_user_create
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ chmod u-w /etc/sudoers
logline "01.07 copy user scripts"
cp -R ${BASH_SOURCE%/*}/userbin/* /home/$username/bin
chown -R $username:users /home/$username/bin
chmod a+x /home/$username/bin/*

logline "01.08 create user crontab"
cp -R ${BASH_SOURCE%/*}/usercron/* /home/$username/crontab
chown -R $username:users /home/$username/crontab
chmod a+x /home/$username/crontab/every*
# start the cron for user
su $username -l -c "cd crontab;crontab crondef"

logline "01.99 user create END"

65 changes: 28 additions & 37 deletions parts/userbin/addvhost
Original file line number Diff line number Diff line change
Expand Up @@ -88,47 +88,38 @@ cd $GITSITE
git init --bare
cd hooks
cat <<-EOF-postreceive >post-receive
#!/bin/bash
GIT_DIR=$GITSITE
WORK_DIR=$WWWSITE
sudo chown -R $USER:users \$WORK_DIR
#check the pushed branch
while read oldrev newrev refname
do
echo "REFNAME = \$refname"
branch=\$(git rev-parse --symbolic --abbrev-ref \$refname)
echo "BRANCH = \$branch"
done
git --work-tree=\$WORK_DIR --git-dir=\$GIT_DIR checkout \$branch -f
cd \$WORK_DIR
#!/bin/bash
GIT_DIR=$GITSITE
WORK_DIR=$WWWSITE
sudo chown -R $USER:nginx \$WORK_DIR
#check the pushed branch
while read oldrev newrev refname
do
echo "REFNAME = \$refname"
branch=\$(git rev-parse --symbolic --abbrev-ref \$refname)
echo "BRANCH = \$branch"
done
echo ">>>> post-receive GIT checking out \$branch to \$WORK_DIR"
git --work-tree=\$WORK_DIR --git-dir=\$GIT_DIR checkout \$branch -f
cd \$WORK_DIR
if [ -x production_deploy ]; then
# custom post-deployment script exists
./production_deploy
else
# run some default post-deployment stuff
composer install
composer dump-autoload
npm install
php artisan migrate
## laravel 5.6 webpack style
if grep "npm run production" package.json ; then
npm run production
fi
## older laravel gulpfiles
if [ -e gulpfile.js ]; then
gulp
fi
echo ">>>> post-receive GIT running production_deploy"
./production_deploy
fi
sudo chown nginx:nginx ./ -R
sudo chmod -R a+w storage
# end of deploy script
EOF-postreceive
# end of deploy script
EOF-postreceive
chmod a+x post-receive

echo "Adding Laravel schedule to crontab"
cd ~/crontab
echo "* * * * * php $WWWSITE/artisan schedule:run >> /dev/null 2>&1" >>crondef
crontab crondef
cd ~

myip=`curl -s ifconfig.me`
Expand Down
1 change: 1 addition & 0 deletions parts/userbin/artisan
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
php artisan $@
8 changes: 8 additions & 0 deletions parts/userbin/clear-laravel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# clear all laravel caches and reset all path-permissions
sudo chmod -R a+w storage
sudo chmod -R a+w bootstrap/cache
php artisan clear-compiled
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
15 changes: 15 additions & 0 deletions parts/userbin/logtail
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# tail the newest laravel log on storage
if [ -d ./app/storage/logs ]; then
DIR="./app/storage/logs/log-"
elif [ -d ./storage/logs ]; then
DIR="./storage/logs/"
else
echo "app/storage/logs and storage/logs not found"
exit
fi
# pick the newest logfile
LOG=`ls -t $DIR* | head -1`
# LOG2=`ls -t ./app/storage/logs/log-cli* | head -1`
echo "** LOGFILE $LOG $LOG2"
tail -n 40 -f $LOG
34 changes: 34 additions & 0 deletions parts/usercron/crondef
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

#########################################################################################
## every5min
##########################################################################################
* * * * * $HOME/crontab/everymin >>$HOME/crontab/log/everymin.log 2>&1

#########################################################################################
# every5min
#########################################################################################
*/5 * * * * $HOME/crontab/every5min >>$HOME/crontab/log/every5min.log 2>&1

#########################################################################################
# every15min 2 minutes after the quarter hour
#########################################################################################
2,17,32,47 * * * * $HOME/crontab/every15min >>$HOME/crontab/log/every15min.log 2>&1

#########################################################################################
# every hour at xx:19
#########################################################################################
19 * * * * $HOME/crontab/everyhour >>$HOME/crontab/log/everyhour.log 2>&1

#########################################################################################
# the nightjob at 04:21
#########################################################################################
21 4 * * * $HOME/crontab/everyday >>$HOME/crontab/log/everyday.log 2>&1

########################################################################################
# Weekly - every mondaymorning at 0:11
########################################################################################
11 0 * * 1 $HOME/crontab/everyweek >>$HOME/crontab/log/everyweek.log 2>&1

########################################################################################
# addvhost will add laravel schedules here
########################################################################################
4 changes: 4 additions & 0 deletions parts/usercron/every5min
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
echo "=== EVERY5MIN run @ `date` ================================"
# example every5min
echo "=== END RUN @ `date` =================================="
4 changes: 4 additions & 0 deletions parts/usercron/everyday
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
echo "=== EVERYDAY run @ `date` ================================"
# example everyday
echo "=== END RUN @ `date` =================================="
4 changes: 4 additions & 0 deletions parts/usercron/everyhour
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
echo "=== EVERYHOUR run @ `date` ================================"
# example everyhour
echo "=== END RUN @ `date` =================================="
4 changes: 4 additions & 0 deletions parts/usercron/everymin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
echo "=== EVERYMINUTE run @ `date` ================================"
# example everyminute
echo "=== END RUN @ `date` =================================="
4 changes: 4 additions & 0 deletions parts/usercron/everyweek
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
echo "=== EVERYWEEK run @ `date` ================================"
# example everyweek
echo "=== END RUN @ `date` =================================="
1 change: 1 addition & 0 deletions parts/usercron/log/stub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# this is a stub to make sure log dir is created

0 comments on commit 0ec51ab

Please sign in to comment.