Browse Source

Clean up; minor changes

dennisro 5 years ago
parent
commit
99c3221cf2

+ 0 - 2
data/include/functions/configuration_functions.sh

@@ -5,8 +5,6 @@ pre_configure_routine() {
 	if [[ "${CONFIGURED_SERVICES[@]}" =~ ${PROPER_NAME} ]] || [[ -f "${ENV_DIR}/${SERVICE_NAME}" ]]|| [[ "${INSTALLED_SERVICES[@]}" =~ ${PROPER_NAME} ]];then
 	if [[ "${CONFIGURED_SERVICES[@]}" =~ ${PROPER_NAME} ]] || [[ -f "${ENV_DIR}/${SERVICE_NAME}" ]]|| [[ "${INSTALLED_SERVICES[@]}" =~ ${PROPER_NAME} ]];then
 		prompt_confirm  "Existing configuration found. Destroy containers and reconfigure?" && destroy || echo "Exiting..";exit
 		prompt_confirm  "Existing configuration found. Destroy containers and reconfigure?" && destroy || echo "Exiting..";exit
 	fi
 	fi
-
-	[[ ${repoURL} ]] && add_submodule
 }
 }
 
 
 # Ask the user what fqdn to use for the service
 # Ask the user what fqdn to use for the service

+ 2 - 2
data/include/functions/menu_functions.sh

@@ -41,7 +41,7 @@ options_menu() {
 	elif [[ ${missingContainers[@]} ]];then
 	elif [[ ${missingContainers[@]} ]];then
 			echo -e "\n\n\e[3m\xe2\x86\x92 \e[3mThe following containers are missing\e[0m"
 			echo -e "\n\n\e[3m\xe2\x86\x92 \e[3mThe following containers are missing\e[0m"
 			for container in "${missingContainers[@]}";do echo -e "\n    - $container";done
 			for container in "${missingContainers[@]}";do echo -e "\n    - $container";done
-			menu=( "Restore missing containers" "Reconfigure service" "Reinstall service" "Backup Service" "Upgrade Image(s)" "Destroy \"${PROPER_NAME}\"" "$exitmenu" )
+			menu=( "Restore missing containers" "Reconfigure service" "Start container(s)" "Stop container(s)" "Reinstall service" "Backup Service" "Restore Service" "Upgrade Image(s)" "Destroy \"${PROPER_NAME}\"" "$exitmenu" )
 	elif [[ $RUNNING = false ]];then
 	elif [[ $RUNNING = false ]];then
 		menu=( "Reconfigure service" "Reinstall service" "Backup Service" "Start container(s)" "Destroy \"${PROPER_NAME}\"" "$exitmenu" )
 		menu=( "Reconfigure service" "Reinstall service" "Backup Service" "Start container(s)" "Destroy \"${PROPER_NAME}\"" "$exitmenu" )
 		add_ssl_menuentry menu 2
 		add_ssl_menuentry menu 2
@@ -687,7 +687,7 @@ start_all() {
 restart_all() {
 restart_all() {
 	for service in "${INSTALLED_SERVICES[@]}";do
 	for service in "${INSTALLED_SERVICES[@]}";do
 		service="$(echo -e "${service,,}" | tr -cd '[:alnum:]')"
 		service="$(echo -e "${service,,}" | tr -cd '[:alnum:]')"
-		source "${SERVICE_ENV}"
+		source "${ENV_DIR}/${service}.env"
 		source "${SERVICES_DIR}"/${service}/${service}.sh restart_containers
 		source "${SERVICES_DIR}"/${service}/${service}.sh restart_containers
 	done
 	done
 	restart_nginx
 	restart_nginx

+ 1 - 37
data/include/functions/setup_functions.sh

@@ -1,28 +1,5 @@
 # All functions used during setup of a service
 # All functions used during setup of a service
 
 
-docker_build() {
-	if [[ -z $1 ]];then
-		for key in ${!BUILD_IMAGES[@]};do
-			if [[ -f "${BUILD_IMAGES[$key]}/Dockerfile" ]];then
-				if [[ $(docker images | grep "\<${key}\>") ]];then
-					echo ""
-					prompt_confirm "Existing image found for ${key}. Rebuild image?" || return
-				fi
-				echo -e "\n\e[1mBuilding image ${1}\e[0m"
-				docker build -t $key "${BUILD_IMAGES[$key]}"
-			fi
-		done
-	else
-		if [[ -f "${BUILD_IMAGES[$1]}/Dockerfile" ]];then
-				if [[ $(docker images | grep "\<${1}\>") ]];then
-					prompt_confirm "Existing image found for ${1}. Rebuild image?" || return
-				fi
-				echo -e "\n\e[1mBuilding image ${1}\e[0m"
-				docker build -t $1 "${BUILD_IMAGES[$1]}"
-		fi
-	fi
-}
-
 docker_pull() {
 docker_pull() {
 	for image in ${IMAGES[@]};do
 	for image in ${IMAGES[@]};do
 		[[ "$image" != "dockerbunker/${SERVICE_NAME}" ]] \
 		[[ "$image" != "dockerbunker/${SERVICE_NAME}" ]] \
@@ -83,7 +60,6 @@ pull_and_compare() {
 		echo ""
 		echo ""
 		docker-compose pull
 		docker-compose pull
 	else
 	else
-		docker_build
 		docker_pull
 		docker_pull
 	fi
 	fi
 
 
@@ -134,7 +110,7 @@ delete_old_images() {
 	fi
 	fi
 
 
 	[[ -z ${old_images_to_delete[0]} ]] \
 	[[ -z ${old_images_to_delete[0]} ]] \
-		&& echo -e "\n\e[1mImages did not change.\e[0m" \
+		&& echo -e "\n\e[1mImage(s) did not change.\e[0m" \
 		&& rm "${BASE_DIR}"/.image_shas.tmp \
 		&& rm "${BASE_DIR}"/.image_shas.tmp \
 		&& return
 		&& return
 
 
@@ -154,16 +130,6 @@ delete_old_images() {
 	rm "${BASE_DIR}"/.image_shas.tmp
 	rm "${BASE_DIR}"/.image_shas.tmp
 }
 }
 
 
-add_submodule() {
-	if [[ ${repoURL} && ! -d "${BASE_DIR}"/data/Dockerfiles/${SERVICE_NAME} ]];then
-		echo -n "Cloning "${PROPER_NAME}" repository into data/Dockerfiles/${SERVICE_NAME}"
-		git submodule add -f ${repoURL} data/Dockerfiles/${SERVICE_NAME} >/dev/null
-	elif [[ -d "${BASE_DIR}"/data/Dockerfiles/${SERVICE_NAME} ]];then
-		git submodule update --remote data/Dockerfiles/${SERVICE_NAME}
-	fi
-	echo ""
-}
-
 setup_nginx() {
 setup_nginx() {
 	[[ ! $(docker ps -q --filter name=^/${NGINX_CONTAINER}$) ]] && bash "${SERVICES_DIR}"/nginx/nginx.sh setup
 	[[ ! $(docker ps -q --filter name=^/${NGINX_CONTAINER}$) ]] && bash "${SERVICES_DIR}"/nginx/nginx.sh setup
 }
 }
@@ -178,8 +144,6 @@ initial_setup_routine() {
 		[[ ( $(docker inspect $container 2> /dev/null) &&  $? == 0 ) ]] && docker rm $container
 		[[ ( $(docker inspect $container 2> /dev/null) &&  $? == 0 ) ]] && docker rm $container
 	done
 	done
 
 
-	[[ $repoURL ]] && add_submodule
-	docker_build
 	docker_pull
 	docker_pull
 	
 	
 	if [[ ${volumes[@]} ]];then
 	if [[ ${volumes[@]} ]];then