wip: implementing install script

pull/228/head
LouisLam 3 years ago
parent 29a89df524
commit d218661f3d

@ -1 +1,2 @@
# Must enable File Sharing in Docker Desktop
docker run -it --rm -v ${pwd}:/app louislam/batsh /usr/bin/batsh bash --output ./install.sh ./extra/install.batsh

@ -0,0 +1,69 @@
println("=====================");
println("Uptime Kuma Installer");
println("=====================");
println("");
println("---------------------------------------");
println("This script is designed for Linux and basic usage.");
println("For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation");
println("---------------------------------------");
println("");
println("Local - Install Uptime Kuma in your current machine with git, Node.js 14 and pm2");
println("Docker - Install Uptime Kuma Docker container");
println("");
if ("$1" != "") {
type = "$1";
} else {
call("read", "-p", "Which installation method do you prefer? [DOCKER/local]: ", "type");
}
if (type == "local") {
if ("$1" != "") {
port = "$3";
} else {
call("read", "-p", "Listening Port [3001]: ", "port");
}
if (exists("/etc/redhat-release")) {
os = call("cat", "/etc/redhat-release");
distribution = "rhel";
}
bash("arch=$(uname -i)");
println("Your OS: " ++ os);
println("Distribution: " ++ distribution);
println("Arch: " ++ arch);
if (distribution == "rhel") {
bash("nodePath=$(command -v node)");
if (nodePath != "") {
bash("nodeVersion=$(node -e 'console.log(process.versions.node.split(`.`)[0])')");
println("Node Version: " ++ nodeVersion);
if (nodeVersion < "12") {
println("Error: Required Node.js 14");
call("exit", "1");
} else {
if (nodeVersion == "12") {
println("Warning: NodeJS " ++ nodeVersion ++ " is not tested.");
}
println("OK");
}
} else {
}
call("yum", "install", "git", "-y");
}
} else {
call("read", "-p", "Expose Port [3001]: ", "port");
call("read", "-p", "Volume Name [uptime-kuma]: ", "volume");
}

@ -0,0 +1,52 @@
"echo" "-e" "====================="
"echo" "-e" "Uptime Kuma Installer"
"echo" "-e" "====================="
"echo" "-e" ""
"echo" "-e" "---------------------------------------"
"echo" "-e" "This script is designed for Linux and basic usage."
"echo" "-e" "For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation"
"echo" "-e" "---------------------------------------"
"echo" "-e" ""
"echo" "-e" "Local - Install Uptime Kuma in your current machine with git, Node.js 14 and pm2"
"echo" "-e" "Docker - Install Uptime Kuma Docker container"
"echo" "-e" ""
"echo" "-e" "$1"
if [ "$1" != "" ]; then
type="$1"
else
"read" "-p" "Which installation method do you prefer? [DOCKER/local]: " "type"
fi
if [ "$type" == "local" ]; then
"read" "-p" "Listening Port [3001]: " "port"
if [ -e "/etc/redhat-release" ]; then
os=$("cat" "/etc/redhat-release")
distribution="rhel"
fi
arch=$(uname -i)
"echo" "-e" "Your OS: ""$os"
"echo" "-e" "Distribution: ""$distribution"
"echo" "-e" "Arch: ""$arch"
if [ "$distribution" == "rhel" ]; then
nodePath=$(command -v node)
if [ "$nodePath" != "" ]; then
nodeVersion=$(node -e 'console.log(process.versions.node.split(`.`)[0])')
"echo" "-e" "Node Version: ""$nodeVersion"
_0="12"
if [ $(($nodeVersion < $_0)) == 1 ]; then
"echo" "-e" "Error: Required Node.js 14"
"exit" "1"
else
if [ "$nodeVersion" == "12" ]; then
"echo" "-e" "Warning: NodeJS ""$nodeVersion"" is not tested."
fi
"echo" "-e" "OK"
fi
else
-
fi
"yum" "install" "git" "-y"
fi
else
"read" "-p" "Expose Port [3001]: " "port"
"read" "-p" "Volume Name [uptime-kuma]: " "volume"
fi

@ -24,7 +24,8 @@
"update-version": "node extra/update-version.js",
"mark-as-nightly": "node extra/mark-as-nightly.js",
"reset-password": "node extra/reset-password.js",
"compile-install-script": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./extra/compile-install-script.ps1"
"compile-install-script": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./extra/compile-install-script.ps1",
"test-install-script": "docker build --no-cache -f test/test_install_script/centos7.dockerfile ."
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",

@ -0,0 +1,9 @@
FROM centos:7
RUN useradd -ms /bin/bash test_user
USER test_user
WORKDIR /home/test_user
COPY ./install.sh .
RUN ls
RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0
Loading…
Cancel
Save