initial commit
This commit is contained in:
commit
880c23b277
2 changed files with 57 additions and 0 deletions
10
template_prep.sh
Executable file
10
template_prep.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
find "${HOME}/Dockers/" -iname '*.env' -not -iname '.*' -exec cp "{}" "{}_template" \;
|
||||
find "${HOME}/Dockers/" -iname '*.env_template' -exec sed -i 's/=.*/=/' {} \;
|
||||
#cp .env .env_template
|
||||
#sed -i 's/=.*/=/' .env_template
|
||||
|
||||
#git add .
|
||||
#git commit -m "New backup `date +'%Y-%m-%d %H:%M:%S'`"
|
||||
#git push
|
47
updater.sh
Executable file
47
updater.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
|
||||
script_root="$( dirname $0 )"
|
||||
dockers_root="${HOME}/Dockers"
|
||||
|
||||
project_setup(){
|
||||
project_dir="${dockers_root}/${1}"
|
||||
cat "${dockers_root}/.env" | tee "${project_dir}/.env" >/dev/null
|
||||
cat "${project_dir}/${1}.env" | tee -a "${project_dir}/.env" >/dev/null
|
||||
}
|
||||
project_pull(){
|
||||
project_yml="${dockers_root}/${1}/docker-compose.yml"
|
||||
project_dir="${dockers_root}/${1}"
|
||||
echo "pulling resources for ${project_yml}"
|
||||
sudo docker-compose --file "${project_yml}" pull
|
||||
}
|
||||
project_up(){
|
||||
project_yml="${dockers_root}/${1}/docker-compose.yml"
|
||||
project_dir="${dockers_root}/${1}"
|
||||
echo "bringing up ${project_yml}"
|
||||
sudo docker-compose --file "${project_yml}" --project-directory "${project_dir}" --project-name "${project_name}" up -d
|
||||
}
|
||||
|
||||
if [ -z ${1} ];then
|
||||
for d in $( find "${dockers_root}" -maxdepth 1 -type d );do
|
||||
echo "docker: ${d}"
|
||||
if [ -f "${d}/docker-compose.yml" ];then
|
||||
project_name="$(basename ${d})"
|
||||
echo "project: ${project_name}"
|
||||
project_setup "${project_name}"
|
||||
project_pull "${project_name}"
|
||||
project_up "${project_name}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "searching for ${dockers_root}/${1}/docker-compose.yml"
|
||||
if [ -f "${dockers_root}/${1}/docker-compose.yml" ];then
|
||||
echo "Single project"
|
||||
project_setup "${1}"
|
||||
project_pull "${1}"
|
||||
project_up "${1}"
|
||||
else
|
||||
echo "project ${1} does not exist"
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo docker image prune -f
|
Loading…
Add table
Reference in a new issue