-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added compose script iterating all services
Tried using main docker-compose - Problems listed as comments in the file
- Loading branch information
1 parent
497c83c
commit 0ed9e46
Showing
4 changed files
with
83 additions
and
1 deletion.
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,6 @@ | ||
{ | ||
"editor.detectIndentation": false, | ||
"files.associations": { | ||
"*.env": "properties" | ||
} | ||
} |
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,50 @@ | ||
#!/bin/bash | ||
|
||
# Execution context | ||
cd "$(dirname "$0")" | ||
|
||
# Service modules | ||
modules=("nginx" "verdaccio") | ||
|
||
help() { | ||
echo "Usage: $0 [-m] [-e] [args...]" | ||
echo "Options:" | ||
echo " -m Interactively choose modules to bring up." | ||
echo " -e Interactively choose .env file for each module." | ||
echo " args Specify the docker compose command to be ran." | ||
} | ||
|
||
# Flags | ||
while getopts "ehm" opt; do | ||
case ${opt} in | ||
e ) custom_env=true ;; | ||
h ) help; exit 2 ;; | ||
m ) select_modules=true ;; | ||
* ) help; exit 1 ;; | ||
esac | ||
done | ||
shift $((OPTIND -1)) | ||
|
||
args=$@ | ||
|
||
# Compose the modules | ||
for module in "${modules[@]}"; do | ||
if [ $select_modules ]; then | ||
read -p "Execute the command for $module? [Y/n] " choice | ||
if [[ $choice =~ ^[Nn]$ ]]; then | ||
echo "Skipping $module..." | ||
continue | ||
fi | ||
fi | ||
|
||
if [ $custom_env ]; then | ||
echo "Choose an .env file for $module (default: $module/.env)" | ||
read -p "$module/" env_file | ||
[ ! -z $env_file ] && env_cmd="--env-file $module/$env_file" | ||
fi | ||
|
||
echo "$module: > docker compose $args" | ||
[ ! -z $env_file ] && echo "env-file $env_file" | ||
# Use Docker Compose to bring up the module | ||
docker compose -f $module/docker-compose.yml $env_cmd $args | ||
done |
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,26 @@ | ||
# name: dean | ||
# services: | ||
# nginx: | ||
# # USES .ENV FROM THE MAIN DIR PATH, NOT NGINX | ||
# extends: | ||
# file: ./nginx/docker-compose.yml | ||
# service: nginx | ||
# verdaccio: | ||
# extends: | ||
# file: ./verdaccio/docker-compose.yml | ||
# service: verdaccio | ||
|
||
# ## ONLY USES .ENV FROM THE FIRST PATH | ||
# # include: | ||
# # - path: | ||
# # - ./verdaccio/docker-compose.yml | ||
# # - ./nginx/docker-compose.yml | ||
|
||
# # ONLY USES .ENV FROM THE FIRST PATH | ||
# # docker compose -f ./nginx/docker-compose.yml -f ./verdaccio/docker-compose.yml up -d | ||
|
||
# # CLOSE, BUT VARIABLES UNDER THE SAME NAME, SUCH AS PORT, NOW NEED TO BE NAMED SERVICE_PORT, OR THEY'RE OVERRIDDEN BY THE LAST --ENV-FILE | ||
# # docker compose --env-file ./nginx/.env --env-file ./verdaccio/.env up -d | ||
|
||
# # I CAN HAVE A SCRIPT ENTER EACH SERVICE AND PERFORM docker compose up -d | ||
# # BUT THAT MISSES THE POINT |
Submodule verdaccio
updated
7 files
+4 −2 | .gitignore | |
+13 −8 | defaults.env | |
+9 −4 | docker-compose.yml | |
+4 −5 | dockerfile | |
+4 −3 | files/conf/config.yaml | |
+1 −1 | files/scripts/healthcheck.sh | |
+2 −4 | readme.md |