remove redundant logic, simplify way Docker deployment files are handled

This commit is contained in:
alicethorne-ab
2020-05-12 15:10:39 -04:00
parent 0bbf186f4d
commit 430ca617f0
2 changed files with 9 additions and 8 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
scimsession
scim.env
*.deploy
*.bak

View File

@@ -16,7 +16,7 @@ run_docker_compose() {
SESSION=$(cat $scimsession_file | base64 | tr -d "\n")
echo "OP_SESSION=$SESSION" > $docker_path/$docker_type/scim.env
if ! docker-compose -f $docker_deploy_file up --build -d
if ! docker-compose -f $docker_file up --build -d
then
echo " "
echo "Failed to run docker-compose, please investigate the error"
@@ -31,7 +31,7 @@ run_docker_compose() {
echo " "
echo "Press Ctrl+C to quit out of the log view."
sleep 2
docker-compose -f $docker_deploy_file logs -f 2>/dev/null
docker-compose -f $docker_file logs -f 2>/dev/null
else
echo "Skipping logs..."
echo "You can view the logs manually by running: docker-compose logs -f"
@@ -54,7 +54,7 @@ run_docker_swarm() {
exit 1
fi
if ! docker stack deploy -c $docker_deploy_file op-scim
if ! docker stack deploy -c $docker_file op-scim
then
echo " "
echo "Failed to deploy to Docker Swarm, please investigate the error"
@@ -118,7 +118,7 @@ echo "Deployment type:" $docker_type
echo "scimsession file path:" $scimsession_file
echo "Domain name:" $domain_name
while ! [[ "$proceed" =~ ^([yY][eE][sS]|[yY])$ || "$proceed" =~ ^([nN][oO][nN]) ]]; do
while ! [[ "$proceed" =~ ^([yY][eE][sS]|[yY])$ ]]; do
read -p "Does this look correct? [Y/n]: " proceed
if [[ "$proceed" =~ ^([nN][oO][nN])$ ]]
then
@@ -129,9 +129,10 @@ done
# place the domain name into the deployment file, in a backup
docker_file_path=$docker_path/$docker_type
docker_original_file=$docker_file_path/docker-compose.yml
docker_deploy_file=$docker_file_path/docker-compose.yml.deploy
sed s/{YOUR-DOMAIN-HERE}/$domain_name/g $docker_original_file > $docker_deploy_file
docker_file=$docker_file_path/docker-compose.yml
docker_backup_file=$docker_file_path/docker-compose.yml.bak
cp $docker_file $docker_backup_file
sed s/{YOUR-DOMAIN-HERE}/$domain_name/g $docker_backup_file > $docker_file
# run the function associated with the Docker type selected
if [[ "$docker_type" == "compose" ]]
@@ -147,4 +148,3 @@ echo "Deployment of the 1Password SCIM Bridge is complete!"
echo " "
echo "If you have any issues deploying the SCIM Bridge, please either reach out to 1Password Business Support, or look through our helpful discussion forums: https://discussions.agilebits.com/categories/scim-bridge"
echo " "
echo "Back up of deployment docker-compose.yml file saved to" $docker_deploy_file