Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal Upstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASC IRIS Web Services
Drupal Upstream
Commits
cecc9309
Commit
cecc9309
authored
5 years ago
by
bcweaver
Browse files
Options
Downloads
Patches
Plain Diff
Add parallel deployment scripts
parent
6ca75574
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/deploy-site-env.sh
+68
-0
68 additions, 0 deletions
scripts/deploy-site-env.sh
scripts/push-parallel-tmux.sh
+57
-0
57 additions, 0 deletions
scripts/push-parallel-tmux.sh
with
125 additions
and
0 deletions
scripts/deploy-site-env.sh
0 → 100755
+
68
−
0
View file @
cecc9309
#!/usr/bin/env bash
LIGHT_GREEN
=
'\x1B[92m'
;
NC
=
'\x1B[39m'
;
if
[[
-z
$1
]]
;
then
echo
;
echo
"Usage:
$0
<site.env>"
;
echo
;
echo
;
fi
if
[[
-z
`
which gdate
`
]]
;
then
echo
"'coreutils' homebrew package not installed..."
;
if
[[
-z
`
which brew
`
]]
;
then
echo
"Homebrew is NOT installed. Homebrew needs to be installed to proceed."
;
echo
"Visit https://https://brew.sh/ for more information."
;
exit
1
;
else
echo
"Attempting to install 'coreutils'..."
;
brew
install
coreutils
;
fi
fi
SITE_NAME
=
${
1
%.*
}
;
ENV
=
${
1
##*.
}
;
shift
;
echo
;
echo
-e
"
${
LIGHT_GREEN
}
==================================================================================
${
NC
}
"
;
printf
"
${
LIGHT_GREEN
}
== %-30s ================================================
${
NC
}
\n
"
$SITE_NAME
echo
-e
"
${
LIGHT_GREEN
}
==================================================================================
${
NC
}
"
;
echo
"SITE_NAME[
$SITE_NAME
] ENV[
$ENV
]"
;
echo
;
echo
"Checking backup... "
;
BACKUP_DATE
=
`
terminus backup:info
--field
=
date
--format
=
string
$SITE_NAME
.
$ENV
`
;
BACKUP_DATE
=
${
BACKUP_DATE
%.*
}
;
echo
"BACKUP_DATE:
`
gdate
-d
@
$BACKUP_DATE
`
"
;
NOW
=
`
gdate +%s
-u
`
;
BACKUP_AGE
=
`
expr
$NOW
-
$BACKUP_DATE
`
;
if
[[
$BACKUP_AGE
-gt
3600
]]
;
then
echo
"Backup is stale (
$BACKUP_AGE
seconds ago)..."
;
echo
"terminus backup:create
$SITE_NAME
.
$ENV
--keep-for=30 --element=db"
;
terminus backup:create
$SITE_NAME
.
$ENV
--keep-for
=
30
--element
=
db
;
else
echo
"Backup is less than an hour old.. skipping new backup."
;
fi
echo
;
if
[[
$ENV
==
'dev'
]]
;
then
terminus site:upstream:clear-cache
$SITE_NAME
;
terminus upstream:updates:list
$SITE_NAME
.
$ENV
;
terminus upstream:updates:apply
$SITE_NAME
.
$ENV
--updatedb
;
else
if
[[
-z
$1
]]
;
then
while
[[
-z
$DEPLOY_MSG
]]
;
do
echo
;
read
-p
"Enter deployment message: "
DEPLOY_MSG
;
echo
;
done
else
DEPLOY_MSG
=
$@
;
fi
terminus
env
:deploy
$SITE_NAME
.
$ENV
--updatedb
--cc
--note
=
"
$DEPLOY_MSG
"
;
fi
This diff is collapsed.
Click to expand it.
scripts/push-parallel-tmux.sh
0 → 100755
+
57
−
0
View file @
cecc9309
#!/usr/bin/env bash
if
[[
-z
`
which parallel
`
||
-z
`
which tmux
`
||
-z
`
which gdate
`
]]
;
then
echo
"Either 'parallel' or 'tmux' is not installed..."
;
if
[[
-z
`
which brew
`
]]
;
then
echo
"Homebrew is NOT installed. Homebrew needs to be installed to proceed."
;
echo
"Visit https://https://brew.sh/ for more information."
;
exit
1
;
else
echo
"Attempting to install parallel, tmux, coreutils..."
;
brew
install
parallel tmux coreutils
;
fi
fi
if
[[
-z
$1
]]
;
then
echo
;
echo
"Usage:
$0
<env> [Deploy message]"
;
echo
;
echo
;
exit
1
;
fi
ENV
=
$1
;
shift
;
if
[[
$ENV
==
'test'
||
$ENV
==
'live'
]]
;
then
if
[[
-z
$1
]]
;
then
while
[[
-z
$DEPLOY_MSG
]]
;
do
echo
;
read
-p
"Enter deployment message: "
DEPLOY_MSG
;
echo
;
done
else
DEPLOY_MSG
=
$@
;
fi
fi
NOW
=
`
date
+%Y%m%d_%H%M
`
;
LOG_DIR
=
"deploy-
$ENV
-
$NOW
"
;
mkdir
$LOG_DIR
;
echo
"LOG_DIR:
$LOG_DIR
"
;
terminus org:site:list ohio-state-arts-and-sciences
--upstream
=
b9baf7af-eb2c-4db5-81e6-32d3d9042572
--tag
=
StandardSite
--fields
=
name
--format
=
string
>
$LOG_DIR
/site_list.txt
;
parallel
--delay
0.1
--tmuxpane
--fg
-a
$LOG_DIR
/site_list.txt
"scripts/deploy-site-env.sh {}.
$ENV
$DEPLOY_MSG
2>&1 | tee
$LOG_DIR
/{}.log"
;
echo
;
echo
;
echo
"Sleeping for 11 seconds..."
;
echo
;
echo
;
sleep
11
;
reset
;
# wait;
cd
$LOG_DIR
;
wc
-l
*
|
sort
-n
|
tee
line-counts.txt
;
cd
..
;
echo
;
echo
;
echo
"Sleeping for 11 more seconds..."
;
echo
;
echo
;
sleep
11
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment