Skip to content

Commit

Permalink
Merge pull request #392 from lanedirt/391-download-letsencrypt-docker…
Browse files Browse the repository at this point in the history
…-compose-yml-file-for-quick-install

Update install.sh
  • Loading branch information
lanedirt authored Nov 20, 2024
2 parents 48b96b4 + ca17759 commit 06d7666
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,35 @@ initialize_workspace() {

# Function to handle docker-compose.yml
handle_docker_compose() {
printf "${CYAN}> Checking docker-compose.yml...${NC}\n"
printf "${CYAN}> Checking docker-compose files...${NC}\n"

if [ -f "docker-compose.yml" ]; then
# Check and download main docker-compose.yml
if [ ! -f "docker-compose.yml" ]; then
printf " ${CYAN}> Downloading docker-compose.yml...${NC}"
if curl -sSf "${GITHUB_RAW_URL}/docker-compose.yml" -o "docker-compose.yml" > /dev/null 2>&1; then
printf "\n ${GREEN}> docker-compose.yml downloaded successfully.${NC}\n"
else
printf "\n ${YELLOW}> Failed to download docker-compose.yml, please check your internet connection and try again. Alternatively, you can download it manually from https://github.com/${REPO_OWNER}/${REPO_NAME}/blob/main/docker-compose.yml and place it in the root directory of AliasVault.${NC}\n"
exit 1
fi
else
printf " ${GREEN}> docker-compose.yml already exists.${NC}\n"
return 0
fi

printf " ${CYAN}> Downloading docker-compose.yml...${NC}"
if curl -sSf "${GITHUB_RAW_URL}/docker-compose.yml" -o "docker-compose.yml" > /dev/null 2>&1; then
printf "\n ${GREEN}> docker-compose.yml downloaded successfully.${NC}\n"
return 0
# Check and download docker-compose.letsencrypt.yml
if [ ! -f "docker-compose.letsencrypt.yml" ]; then
printf " ${CYAN}> Downloading docker-compose.letsencrypt.yml...${NC}"
if curl -sSf "${GITHUB_RAW_URL}/docker-compose.letsencrypt.yml" -o "docker-compose.letsencrypt.yml" > /dev/null 2>&1; then
printf "\n ${GREEN}> docker-compose.letsencrypt.yml downloaded successfully.${NC}\n"
else
printf "\n ${YELLOW}> Failed to download docker-compose.letsencrypt.yml, please check your internet connection and try again. Alternatively, you can download it manually from https://github.com/${REPO_OWNER}/${REPO_NAME}/blob/main/docker-compose.letsencrypt.yml and place it in the root directory of AliasVault.${NC}\n"
exit 1
fi
else
printf "\n ${YELLOW}> Failed to download docker-compose.yml, please check your internet connection and try again. Alternatively, you can download it manually from https://github.com/${REPO_OWNER}/${REPO_NAME}/blob/main/docker-compose.yml and place it in the root directory of AliasVault.${NC}\n"
exit 1
printf " ${GREEN}> docker-compose.letsencrypt.yml already exists.${NC}\n"
fi

return 0
}

# Function to print the logo
Expand Down Expand Up @@ -776,7 +790,7 @@ configure_letsencrypt() {

# Restart only the reverse proxy with new configuration so it loads the new certificate
printf "${CYAN}> Restarting reverse proxy with Let's Encrypt configuration...${NC}\n"
$(get_docker_compose_command) up -d reverse-proxy
$(get_docker_compose_command) up -d reverse-proxy --force-recreate

printf "${GREEN}> Let's Encrypt SSL certificate has been configured successfully!${NC}\n"
}
Expand Down

0 comments on commit 06d7666

Please sign in to comment.