Skip to content

Commit 80c6918

Browse files
committed
WIP Rebuilding deploy script.
Still not entirely ready to even test. Needs a new `deps-install`, hook into provisioning, etc.
1 parent 8889e21 commit 80c6918

1 file changed

Lines changed: 11 additions & 54 deletions

File tree

deploy

Lines changed: 11 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@ ${0##*/}
1414
project root folder.
1515
1616
Usage:
17-
bin/${0##*/} [tag|branch|sha|ref] [dev|prod|staging] [user] [group]
17+
bin/${0##*/} [tag|branch|sha|ref] [dev|prod|staging]
1818
1919
\$1 = The new commit to which to update.
2020
Will be merged into the current branch/commit.
21-
Default: (The remote tracking branch for the currently-checked-out branch.)
21+
Default: (The remote tracking branch for the
22+
currently-checked-out branch.)
2223
\$2 = The local config file "environment" to use.
2324
Default: $APP_ENV if set, 'prod' if not.
24-
\$3 = The local user to associate the project with.
25-
Default: owner of ./
26-
\$4 = The local group to associate the project with.
27-
Default: group of ./
2825
2926
Environment Variables:
3027
APP_ENV = If set and \$2 is blank, will be used as the active
@@ -46,26 +43,18 @@ echo "## Starting update process."
4643
# Set variables.
4744
DIR="$( cd -P "$( dirname "$0" )"/.. >/dev/null 2>&1 && pwd )"
4845
BIN_DIR="$DIR/bin"
49-
CONFIG_DIR="$DIR/Config"
50-
MIGRATION_DIR="$CONFIG_DIR/Migration"
46+
CONFIG_DIR="$DIR/config"
47+
MIGRATION_DIR="$CONFIG_DIR/Migrations"
5148
SLEEP_TIME=10
52-
DEFAULT_DBUPDATES_FILE="$CONFIG_DIR/sql/db_updates.sql"
53-
DEFAULT_ENVVARS_FILE="$CONFIG_DIR/env_vars.txt"
5449
EXISTINGCOMMIT=$( git rev-parse HEAD )
5550
EXISTINGBRANCH=$( git rev-parse --abbrev-ref HEAD )
5651

5752
if [ -d "$MIGRATION_DIR" ] && [ "$(ls -A $MIGRATION_DIR)" ]; then
5853
DB_UPDATES_METHOD='migrations'
59-
elif [ -e "$DEFAULT_DBUPDATES_FILE" ]; then
60-
DB_UPDATES_METHOD='db_updates'
6154
else
6255
DB_UPDATES_METHOD='none'
6356
fi
6457

65-
if [ -r $DEFAULT_ENVVARS_FILE ]; then
66-
source "${DEFAULT_ENVVARS_FILE}"
67-
fi
68-
6958

7059
# Input processing.
7160
if [ $1 ]; then
@@ -83,18 +72,6 @@ else
8372
ARG_APPENV="prod"
8473
fi
8574

86-
if [ $3 ]; then
87-
ARG_OWNER=$3
88-
else
89-
ARG_OWNER=""
90-
fi
91-
92-
if [ $4 ]; then
93-
ARG_GROUP=$4
94-
else
95-
ARG_GROUP=""
96-
fi
97-
9875

9976
# Check for local changes that would cause a merge (without -f) to fail later.
10077
$BIN_DIR/git-localchanges
@@ -128,22 +105,6 @@ git fetch origin refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
128105
# Apply database updates, one way or another.
129106
if [ "$DB_UPDATES_METHOD" = 'migrations' ]; then
130107
echo "## Deferring database migrations until after merge."
131-
elif [ "$DB_UPDATES_METHOD" = 'db_updates' ]; then
132-
# Show manual pending DB updates to user. (Or use possibly use bin/db-apply-updates here to execute the SQL against the DB automatically,
133-
# which should be fairly recoverable if it's wrong [which it can be] considering we have already made a backup.)
134-
DB_CHANGES="$( $BIN_DIR/db-show-updates $EXISTINGCOMMIT $ARG_NEWCOMMIT)"
135-
if [ -n "$DB_CHANGES" ]; then
136-
echo "## There are database updates to apply!"
137-
echo '---------'
138-
echo ''
139-
echo "$DB_CHANGES"
140-
echo ''
141-
echo '---------'
142-
echo ''
143-
read -p "Press [ENTER] to continue when these updates have been applied to the local DB."
144-
else
145-
echo "## No database updates to apply.";
146-
fi
147108
elif [ "$DB_UPDATES_METHOD" = 'none' ]; then
148109
echo "## Could not automatically determine database change tracking system."
149110
read -p "## Make sure any pending DB changes have been made and press [ENTER] to continue."
@@ -175,19 +136,11 @@ $BIN_DIR/set-configs $ARG_APPENV
175136

176137

177138
# Make sure any external packages are installed and available.
178-
$BIN_DIR/deps-install
139+
composer install --no-interaction
179140

180141

181142
# Purge cache folders.
182-
$BIN_DIR/clear-cache
183-
184-
185-
# Set file ownership.
186-
$BIN_DIR/set-owner ${ARG_OWNER} ${ARG_GROUP}
187-
188-
189-
# Set write permissions.
190-
$BIN_DIR/writedirs
143+
$BIN_DIR/cache-clear
191144

192145

193146
# Send an email report if the ENV var is set in Config/env_vars.txt
@@ -198,6 +151,10 @@ if [ -n "${LOADSYS_EMAIL}" ]; then
198151
cat > "$MSG_BODY" <<-EOD
199152
A code push has been completed for ${LOADSYS_PROJECT_NAME}.
200153
154+
(Previous commit: ${EXISTINGCOMMIT})
155+
156+
-------------------------------------------------------
157+
201158
${GIT_LOG}
202159
203160
EOD

0 commit comments

Comments
 (0)