chore(docker-compose): Use docker-compose folder as it's the project

name

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
rjshrjndrn 2023-12-05 15:07:14 +01:00
parent 6122066b49
commit 67dd118c80

View file

@ -12,42 +12,42 @@ NC='\033[0m' # No Color
# --- Helper functions for logs ---
info() {
echo -e "${GREEN}[INFO] $1 ${NC} 👍"
echo -e "${GREEN}[INFO] $1 ${NC} 👍"
}
warn() {
echo -e "${YELLOW}[WARN] $1 ${NC} ⚠️"
echo -e "${YELLOW}[WARN] $1 ${NC} ⚠️"
}
fatal() {
echo -e "${RED}[FATAL] $1 ${NC} 🔥"
exit 1
echo -e "${RED}[FATAL] $1 ${NC} 🔥"
exit 1
}
# Function to check if a command exists
function exists() {
type "$1" &> /dev/null
type "$1" &>/dev/null
}
# Generate a random password using openssl
randomPass() {
exists openssl || {
info "Installing openssl... 🔐"
sudo apt update &> /dev/null
sudo apt install openssl -y &> /dev/null
}
openssl rand -hex 10
exists openssl || {
info "Installing openssl... 🔐"
sudo apt update &>/dev/null
sudo apt install openssl -y &>/dev/null
}
openssl rand -hex 10
}
# Create dynamic passwords and update the environment file
function create_passwords() {
info "Creating dynamic passwords..."
sed -i "s/change_me_domain/${DOMAIN_NAME}/g" common.env
sed -i "s/change_me_jwt/$(randomPass)/g" common.env
sed -i "s/change_me_s3_key/$(randomPass)/g" common.env
sed -i "s/change_me_s3_secret/$(randomPass)/g" common.env
sed -i "s/change_me_pg_password/$(randomPass)/g" common.env
info "Passwords created and updated in common.env file."
info "Creating dynamic passwords..."
sed -i "s/change_me_domain/${DOMAIN_NAME}/g" common.env
sed -i "s/change_me_jwt/$(randomPass)/g" common.env
sed -i "s/change_me_s3_key/$(randomPass)/g" common.env
sed -i "s/change_me_s3_secret/$(randomPass)/g" common.env
sed -i "s/change_me_pg_password/$(randomPass)/g" common.env
info "Passwords created and updated in common.env file."
}
# update apt cache
@ -72,7 +72,7 @@ echo -e "${GREEN}"
read -rp "Enter DOMAIN_NAME: " DOMAIN_NAME
echo -e "${NC}"
if [[ -z $DOMAIN_NAME ]]; then
fatal "DOMAIN_NAME variable is empty. Please provide a valid domain name to proceed."
fatal "DOMAIN_NAME variable is empty. Please provide a valid domain name to proceed."
fi
info "Using domain name: $DOMAIN_NAME 🌐"
@ -81,7 +81,7 @@ create_passwords
info "Starting the application with Docker... 🐳"
# Load variables from common.env into the current shell's environment
set -a # automatically export all variables
set -a # automatically export all variables
source common.env
set +a
@ -91,7 +91,7 @@ sudo -E docker-compose pull --no-parallel
sudo -E docker-compose up -d
echo "🎉🎉🎉 Done! 🎉🎉🎉"
cp -rf ../docker-compose ~/openreplay-docker-compose
cp -rf ../docker-compose ~/docker-compose
rm -rf "$(git rev-parse --show-toplevel)"
info "Installation complete!! open https://${DOMAIN_NAME} 🐳"
info "${HOME}/openreplay-docker-compose have the docker-compose file. you can use docker-compose stop/start"
info "${HOME}/docker-compose have the docker-compose file. you can use docker-compose stop/start"