first init

This commit is contained in:
sHa
2019-06-07 09:31:24 +03:00
commit 22ed076ccf
21 changed files with 266 additions and 0 deletions

10
scripts/app.artisan.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
docker-compose exec app php artisan "$@"

11
scripts/app.composer.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
docker-compose exec app composer "$@"

10
scripts/app.git.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
docker-compose exec app git "$@"

12
scripts/app.npm.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
# appname=$(awk -F'=' '/^APPNAME/ { print $2}' ./docker/.env)
docker-compose exec app npm "$@"

12
scripts/app.php.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
# appname=$(awk -F'=' '/^APPNAME/ { print $2}' ./docker/.env)
docker-compose exec app php "$@"

10
scripts/app.yarn.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
docker-compose exec app yarn "$@"

16
scripts/db.dump.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
DIR=$(dirname "$0")
ROOT=$(cd "$DIR"/.. && pwd)
DATABASE=$(awk -F'=' '/^MYSQL_DATABASE/ { print $2}' $ROOT/docker/config.env)
PWD=$(awk -F'=' '/^MYSQL_ROOT_PASSWORD/ { print $2}' $ROOT/docker/config.env)
docker-compose exec db /usr/bin/mysqldump --skip-comments -uroot --password=$PWD $DATABASE > $ROOT/storage/database/dump/database.sql 2>/dev/null

16
scripts/db.restore.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
DIR=$(dirname "$0")
ROOT=$(cd "$DIR"/.. && pwd)
DATABASE=$(awk -F'=' '/^MYSQL_DATABASE/ { print $2}' $ROOT/docker/config.env)
PWD=$(awk -F'=' '/^MYSQL_ROOT_PASSWORD/ { print $2}' $ROOT/docker/config.env)
docker-compose exec db /usr/bin/mysql -uroot --password=$PWD $DATABASE < $ROOT/storage/database/dump/database.sql

10
scripts/docker.down.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
docker-compose down "$@"

19
scripts/docker.firstrun.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
DIR=$(dirname "$0")
ROOT=$(cd "$DIR"/.. && pwd)
$ROOT/bin/app.composer install
$ROOT/bin/app.composer run-script post-root-package-install
$ROOT/bin/app.composer dump-autoload --optimize
$ROOT/bin/fix_permissions
$ROOT/bin/db.restore

10
scripts/docker.up.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
docker-compose up -d "$@"

16
scripts/fix_permissions.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
DIR=$(dirname "$0")
ROOT=$(cd "$DIR"/.. && pwd)
sudo chmod -R a=rwX,go-rwX "$ROOT"/docker/.ssh/
sudo chown -R :www-data $ROOT
sudo chmod -R g+rwX $ROOT

16
scripts/git.storage_push.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
DIR=$(dirname $BASH_SOURCE)
PROJECT=$(cd $DIR"/.."; pwd)
cd $PROJECT/storage
git add . --all &&
git commit -m "storage"
git push origin master --force

16
scripts/git.submodule_pull.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
DIR=$(dirname "$0")
ROOT=$(cd "$DIR"/.. && pwd)
chmod -R a=rwX,go-rwX "$ROOT"/docker/.ssh/
git submodule init
ssh-agent sh -c "ssh-add -D; ssh-add $ROOT/docker/.ssh/id_rsa; git submodule update"

11
scripts/hello.js Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env node
// @package sscripts
// @author sHa <sha@shadoll.dev>
// @copyright 2019 shadoll
// @version 19.6.7
// @link https://shadoll.dev
const [,, ...args] = process.argv
console.log(`Hello ${args}`)

10
scripts/hello.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
echo "Hello! $@"

34
scripts/zuilip.post-merge.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
#
# @package sscripts
# @author sHa <sha@shadoll.dev>
# @copyright 2019 shadoll
# @version 19.6.7
# @link https://shadoll.dev
#
DIR=`dirname "$(readlink -f "$0")"`
DIR=${DIR%/*}
if [ "${DIR##*/}" = ".git" ]; then
DIR=${DIR%/*}
fi
test -z "$STREAM" && test -f $DIR/.env && STREAM=$(grep -e '^STREAM_NAME=.*' $DIR/.env | cut -d '=' -f2)
test -z "$STREAM" && STREAM="announce"
test -z "$HASH" && test -f $DIR/.env && HASH=$(grep -e '^ZULIP_HASH=.*' $DIR/.env | cut -d '=' -f2)
test -z "$HASH" && HASH="VUsqHUhn5AKndXSUKddYpTsNJm7kPKNY"
test -z "$URL" && test -f $DIR/.env && URL=$(grep -e '^ZULIP_HOST=.*' $DIR/.env | cut -d '=' -f2)
test -z "$URL" && URL="VUsqHUhn5AKndXSUKddYpTsNJm7kPKNY"
HOST=`hostname`
REPO=$(basename -s .git `git config --get remote.origin.url`)
BRANCH=`git branch | grep \* | cut -d ' ' -f2`
curl https://$URL/api/v1/messages \
-u githook-bot@$URL:$HASH \
-d "type=stream" \
-d "to=$STREAM" \
-d "subject=$REPO / $BRANCH" \
-d "content=merged on $HOST"