From 493ea3e4750f9a3c13d22b07982c0c8c20e9a68f Mon Sep 17 00:00:00 2001 From: kubbot <3293172751ysy@gmail.com> Date: Fri, 14 Jul 2023 21:39:30 +0800 Subject: [PATCH] fix: script v3.0 Signed-off-by: kubbot <3293172751ysy@gmail.com> Signed-off-by: BanTanger <88583317+BanTanger@users.noreply.github.com> --- install_im_compose.sh | 21 +++++++++++++++++++++ install_im_server.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 install_im_compose.sh create mode 100644 install_im_server.sh diff --git a/install_im_compose.sh b/install_im_compose.sh new file mode 100644 index 000000000..687a827d1 --- /dev/null +++ b/install_im_compose.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +internet_ip=`curl ifconfig.me -s` +echo $internet_ip + +source .env +echo $MINIO_ENDPOINT +if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then + sed -i "s/127.0.0.1/${internet_ip}/" .env + +fi + +cd scripts ; +chmod +x *.sh ; +./init_pwd.sh +./env_check.sh; +cd .. ; +docker-compose -f im-compose.yaml up -d +docker ps + + + diff --git a/install_im_server.sh b/install_im_server.sh new file mode 100644 index 000000000..c526d43db --- /dev/null +++ b/install_im_server.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# Get the public internet IP address +internet_ip=$(curl ifconfig.me -s) +echo $internet_ip + +# Load environment variables from .env file +source .env +echo $MINIO_ENDPOINT + +# Replace local IP address with the public IP address in .env file +if [ $API_URL == "http://127.0.0.1:10002/object/" ]; then + sed -i "s/127.0.0.1/${internet_ip}/" .env +fi + +if [ $MINIO_ENDPOINT == "http://127.0.0.1:10005" ]; then + sed -i "s/127.0.0.1/${internet_ip}/" .env +fi + +# Change directory to scripts folder +cd scripts +chmod +x *.sh + +# Execute necessary scripts +./init_pwd.sh +./env_check.sh + +# Go back to the previous directory +cd .. + +# Check if docker-compose command is available +if command -v docker-compose &> /dev/null +then + docker-compose up -d +else + docker compose up -d +fi + +# Change directory to scripts folder again +cd scripts + +# Check docker services +./docker_check_service.sh \ No newline at end of file