This repository has been archived by the owner on Apr 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: Add assets install devcontrol action
- Loading branch information
1 parent
a646e76
commit d8a0e85
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/data | ||
/docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
# @description Install item assets | ||
# | ||
# @example | ||
# assets-install | ||
# | ||
# @arg $1 Task: "brief", "help" or "exec" | ||
# | ||
# @exitcode The result of the assets installation | ||
# | ||
# @stdout "Not implemented" message if the requested task is not implemented | ||
# | ||
function assets-install() { | ||
|
||
# Init | ||
local briefMessage | ||
local helpMessage | ||
|
||
briefMessage="Install assets" | ||
helpMessage=$(cat <<EOF | ||
Install nginx product assets: | ||
* Create the "data/usr/share/nginx/html" directory with all permissions (777) | ||
* Create the network "platform_products" | ||
EOF | ||
) | ||
|
||
# Task choosing | ||
case $1 in | ||
brief) | ||
showBriefMessage "${FUNCNAME[0]}" "$briefMessage" | ||
;; | ||
help) | ||
showHelpMessage "${FUNCNAME[0]}" "$helpMessage" | ||
;; | ||
exec) | ||
# Create network | ||
if [ "$(docker network ls -f name='platform_products' -q)" == "" ]; then | ||
echo -n "- Creating docker network 'platform_products' ..." | ||
docker network create platform_products | ||
echo "[OK]" | ||
else | ||
echo "The 'platform_services' docker network already exists, skipping" | ||
fi | ||
# Create directories | ||
for directory in data data/usr data/usr/share data/usr/share/nginx data/usr/share/nginx/html; do | ||
if [ ! -d ${directory} ]; then | ||
echo -n "- Creating '${directory}' directory..." | ||
mkdir ${directory} | ||
echo "[OK]" | ||
echo -n "- Setting '${directory}' permissions..." | ||
chmod 777 ${directory} | ||
echo "[OK]" | ||
else | ||
echo "The '${directory}' directory already exists, skipping" | ||
fi | ||
done | ||
;; | ||
*) | ||
showNotImplemtedMessage "$1" "${FUNCNAME[0]}" | ||
return 1 | ||
esac | ||
} | ||
|
||
# Main | ||
assets-install "$@" |