From afc9fb98bb934e21288785c4ba8242332bababa2 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Thu, 26 May 2022 18:27:36 +0200 Subject: [PATCH 1/3] Try install script for Arch linux --- docker-compose.dev.yml | 1 + docker-compose.rc.yml | 1 + scripts/configure.sh | 3 +++ 3 files changed, 5 insertions(+) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 8d94a46dc1cbea50c0319a8eed46cb45289321b3..3f54b78585a9d055ccdb1dd08a38b7ab0c1b436a 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -19,6 +19,7 @@ services: - TIPI_VERSION=${TIPI_VERSION} - JWT_SECRET=${JWT_SECRET} - ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST} + - NGINX_PORT=${NGINX_PORT} networks: - tipi_main_network diff --git a/docker-compose.rc.yml b/docker-compose.rc.yml index ed93e464c35504ea47e00fd634d323efa61e5096..23695980cd73eb4243f0d559f3efd96a5a227145 100644 --- a/docker-compose.rc.yml +++ b/docker-compose.rc.yml @@ -29,6 +29,7 @@ services: - TIPI_VERSION=${TIPI_VERSION} - JWT_SECRET=${JWT_SECRET} - ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST} + - NGINX_PORT=${NGINX_PORT} networks: - tipi_main_network diff --git a/scripts/configure.sh b/scripts/configure.sh index 8b64d31297d1c4c463a6301ae44e11c8af5c54be..ef828333c8eb8142f8a376afa7cefac1e990b703 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -19,5 +19,8 @@ sudo chmod 755 "${ROOT_FOLDER}"/scripts/pacapt sudo "${ROOT_FOLDER}"/scripts/pacapt -Sy sudo "${ROOT_FOLDER}"/scripts/pacapt -S docker docker-compose jq coreutils curl -y +systemctl start docker.service +systemctl enable docker.service + # Create configured status touch "${ROOT_FOLDER}/state/configured" From 6112e7e69b024cb434a5b212c014cd5887110ad4 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Thu, 26 May 2022 18:33:15 +0200 Subject: [PATCH 2/3] Add systemctl docker --- scripts/configure.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/configure.sh b/scripts/configure.sh index ef828333c8eb8142f8a376afa7cefac1e990b703..e6257f0cf88290d6b20d100cacafe38ff8479573 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -17,10 +17,16 @@ echo sudo wget -O "${ROOT_FOLDER}"/scripts/pacapt https://github.com/icy/pacapt/raw/ng/pacapt sudo chmod 755 "${ROOT_FOLDER}"/scripts/pacapt sudo "${ROOT_FOLDER}"/scripts/pacapt -Sy -sudo "${ROOT_FOLDER}"/scripts/pacapt -S docker docker-compose jq coreutils curl -y +sudo "${ROOT_FOLDER}"/scripts/pacapt -S docker docker-compose jq coreutils curl lsb-release -y + +LSB="$(lsb_release -is)" systemctl start docker.service systemctl enable docker.service +# If we are on Arch +# if [[ "${LSB}" == "Arch" ]]; then +# fi + # Create configured status touch "${ROOT_FOLDER}/state/configured" From cf7d4f80501e326f44e223c955a9fe8762586576 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Thu, 26 May 2022 22:22:07 +0200 Subject: [PATCH 3/3] Universal way of detecting internal ip --- scripts/configure.sh | 2 +- scripts/start.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/configure.sh b/scripts/configure.sh index e6257f0cf88290d6b20d100cacafe38ff8479573..7811aded8867d9e2d085f574987b9b6b25be1abe 100755 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -24,8 +24,8 @@ LSB="$(lsb_release -is)" systemctl start docker.service systemctl enable docker.service -# If we are on Arch # if [[ "${LSB}" == "Arch" ]]; then +# sudo "${ROOT_FOLDER}"/scripts/pacapt -S hostname -y # fi # Create configured status diff --git a/scripts/start.sh b/scripts/start.sh index fe3fe34d22d34578be921db83fc1c70f157434fd..b771d0d5fe0d48c372dd768a5c7135f18459cc90 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -55,7 +55,10 @@ fi ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)" STATE_FOLDER="${ROOT_FOLDER}/state" SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')" -INTERNAL_IP="$(hostname -I | awk '{print $1}')" + +NETWORK_INTERFACE="$(ip route | grep default | awk '{print $5}')" +INTERNAL_IP="$(ip addr show "${NETWORK_INTERFACE}" | grep "inet " | awk '{print $2}' | cut -d/ -f1)" +# INTERNAL_IP="$(hostname -I | awk '{print $1}')" DNS_IP=9.9.9.9 # Default to Quad9 DNS ARCHITECTURE="$(uname -m)" @@ -159,7 +162,10 @@ echo "Running system-info.sh..." bash "${ROOT_FOLDER}/scripts/system-info.sh" # Add crontab to run system-info.sh every minute -! (crontab -l | grep -q "${ROOT_FOLDER}/scripts/system-info.sh") && (crontab -l; echo "* * * * * ${ROOT_FOLDER}/scripts/system-info.sh") | crontab - +! (crontab -l | grep -q "${ROOT_FOLDER}/scripts/system-info.sh") && ( + crontab -l + echo "* * * * * ${ROOT_FOLDER}/scripts/system-info.sh" +) | crontab - ## Don't run if config-only if [[ ! $ci == "true" ]]; then