diff --git a/extra/install.batsh b/extra/install.batsh deleted file mode 100644 index e2f9a7511..000000000 --- a/extra/install.batsh +++ /dev/null @@ -1,276 +0,0 @@ -// install.sh is generated by ./extra/install.batsh, do not modify it directly. -// "npm run compile-install-script" to compile install.sh -// The command is working on Windows PowerShell and Docker for Windows only. - - -// curl -o kuma_install.sh https://raw.githubusercontent.com/louislam/uptime-kuma/master/install.sh && sudo bash kuma_install.sh -println("====================="); -println("Uptime Kuma Install Script"); -println("====================="); -println("Supported OS: Ubuntu >= 16.04, Debian and CentOS/RHEL 7/8"); -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 on your current machine with git, Node.js 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"); -} - -defaultPort = "3001"; - -function checkNode() { - 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"); - } -} - -function deb() { - bash("nodeCheck=$(node -v)"); - bash("apt --yes update"); - - if (nodeCheck != "") { - checkNode(); - } else { - - // Old nodejs binary name is "nodejs" - bash("check=$(nodejs --version)"); - if (check != "") { - println("Error: 'node' command is not found, but 'nodejs' command is found. Your NodeJS should be too old."); - bash("exit 1"); - } - - bash("curlCheck=$(curl --version)"); - if (curlCheck == "") { - println("Installing Curl"); - bash("apt --yes install curl"); - } - - println("Installing Node.js 16"); - bash("curl -sL https://deb.nodesource.com/setup_16.x | bash - > log.txt"); - bash("apt --yes install nodejs"); - bash("node -v"); - - bash("nodeCheckAgain=$(node -v)"); - - if (nodeCheckAgain == "") { - println("Error during Node.js installation"); - bash("exit 1"); - } - } - - bash("check=$(git --version)"); - if (check == "") { - println("Installing Git"); - bash("apt --yes install git"); - } -} - -if (type == "local") { - defaultInstallPath = "/opt/uptime-kuma"; - - if (exists("/etc/redhat-release")) { - os = call("cat", "/etc/redhat-release"); - distribution = "rhel"; - - } else if (exists("/etc/issue")) { - bash("os=$(head -n1 /etc/issue | cut -f 1 -d ' ')"); - if (os == "Ubuntu") { - distribution = "ubuntu"; - - // Get ubuntu version - bash(". /etc/lsb-release"); - version = DISTRIB_RELEASE; - } - if (os == "Debian") { - distribution = "debian"; - } - } - - bash("arch=$(uname -i)"); - - println("Your OS: " ++ os); - println("Distribution: " ++ distribution); - println("Version: " ++ version); - println("Arch: " ++ arch); - - if ("$3" != "") { - port = "$3"; - } else { - call("read", "-p", "Listening Port [$defaultPort]: ", "port"); - - if (port == "") { - port = defaultPort; - } - } - - if ("$2" != "") { - installPath = "$2"; - } else { - call("read", "-p", "Installation Path [$defaultInstallPath]: ", "installPath"); - - if (installPath == "") { - installPath = defaultInstallPath; - } - } - - // CentOS - if (distribution == "rhel") { - bash("nodeCheck=$(node -v)"); - - if (nodeCheck != "") { - checkNode(); - } else { - - bash("dnfCheck=$(dnf --version)"); - - // Use yum - if (dnfCheck == "") { - bash("curlCheck=$(curl --version)"); - if (curlCheck == "") { - println("Installing Curl"); - bash("yum -y -q install curl"); - } - - println("Installing Node.js 16"); - bash("curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt"); - bash("yum install -y -q nodejs"); - } else { - bash("curlCheck=$(curl --version)"); - if (curlCheck == "") { - println("Installing Curl"); - bash("dnf -y install curl"); - } - - println("Installing Node.js 16"); - bash("curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt"); - bash("dnf install -y nodejs"); - } - - - bash("node -v"); - - bash("nodeCheckAgain=$(node -v)"); - - if (nodeCheckAgain == "") { - println("Error during Node.js installation"); - bash("exit 1"); - } - } - - bash("check=$(git --version)"); - if (check == "") { - println("Installing Git"); - bash("yum -y -q install git"); - } - - // Ubuntu - } else if (distribution == "ubuntu") { - deb(); - - // Debian - } else if (distribution == "debian") { - deb(); - - } else { - // Unknown distribution - error = 0; - - bash("check=$(git --version)"); - if (check == "") { - error = 1; - println("Error: git is not found!"); - println("help: an installation guide is available at https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"); - } - - bash("check=$(node -v)"); - if (check == "") { - error = 1; - println("Error: node is not found"); - println("help: an installation guide is available at https://nodejs.org/en/download"); - } - - if (error > 0) { - println("Please install above missing software"); - bash("exit 1"); - } - } - - bash("check=$(pm2 --version)"); - if (check == "") { - println("Installing PM2"); - bash("npm install pm2 -g && pm2 install pm2-logrotate"); - bash("pm2 startup"); - } - - - // Check again - bash("check=$(pm2 --version)"); - if (check == "") { - println("Error: pm2 is not found!"); - println("help: an installation guide is available at https://pm2.keymetrics.io/docs/usage/quick-start/"); - bash("exit 1"); - } - - bash("mkdir -p $installPath"); - bash("cd $installPath"); - bash("git clone https://github.com/louislam/uptime-kuma.git ."); - bash("npm run setup"); - - bash("pm2 start server/server.js --name uptime-kuma -- --port=$port"); - -} else { - defaultVolume = "uptime-kuma"; - - bash("check=$(docker -v)"); - if (check == "") { - println("Error: docker is not found!"); - println("help: an installation guide is available at https://docs.docker.com/desktop/"); - bash("exit 1"); - } - - bash("check=$(docker info)"); - - bash("if [[ \"$check\" == *\"Is the docker daemon running\"* ]]; then - \"echo\" \"Error: docker is not running\" - \"echo\" \"help: a troubleshooting guide is available at https://docs.docker.com/config/daemon/troubleshoot/\" - \"exit\" \"1\" - fi"); - - if ("$3" != "") { - port = "$3"; - } else { - call("read", "-p", "Expose Port [$defaultPort]: ", "port"); - - if (port == "") { - port = defaultPort; - } - } - - if ("$2" != "") { - volume = "$2"; - } else { - call("read", "-p", "Volume Name [$defaultVolume]: ", "volume"); - - if (volume == "") { - volume = defaultVolume; - } - } - - println("Port: $port"); - println("Volume: $volume"); - bash("docker volume create $volume"); - bash("docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1"); -} - -println("http://localhost:$port"); diff --git a/install.sh b/install.sh deleted file mode 100644 index d965867cb..000000000 --- a/install.sh +++ /dev/null @@ -1,228 +0,0 @@ -# install.sh is generated by ./extra/install.batsh, do not modify it directly. -# "npm run compile-install-script" to compile install.sh -# The command is working on Windows PowerShell and Docker for Windows only. -# curl -o kuma_install.sh https://raw.githubusercontent.com/louislam/uptime-kuma/master/install.sh && sudo bash kuma_install.sh -"echo" "-e" "=====================" -"echo" "-e" "Uptime Kuma Install Script" -"echo" "-e" "=====================" -"echo" "-e" "Supported OS: Ubuntu >= 16.04, Debian and CentOS/RHEL 7/8" -"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 on your current machine with git, Node.js and pm2" -"echo" "-e" "Docker - Install Uptime Kuma Docker container" -"echo" "-e" "" -if [ "$1" != "" ]; then - type="$1" -else - "read" "-p" "Which installation method do you prefer? [DOCKER/local]: " "type" -fi -defaultPort="3001" -function checkNode { - local _0 - 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" -fi -} -function deb { - nodeCheck=$(node -v) - apt --yes update - if [ "$nodeCheck" != "" ]; then - "checkNode" - else - # Old nodejs binary name is "nodejs" - check=$(nodejs --version) - if [ "$check" != "" ]; then - "echo" "-e" "Error: 'node' command is not found, but 'nodejs' command is found. Your NodeJS should be too old." - exit 1 -fi - curlCheck=$(curl --version) - if [ "$curlCheck" == "" ]; then - "echo" "-e" "Installing Curl" - apt --yes install curl -fi - "echo" "-e" "Installing Node.js 16" - curl -sL https://deb.nodesource.com/setup_16.x | bash - > log.txt - apt --yes install nodejs - node -v - nodeCheckAgain=$(node -v) - if [ "$nodeCheckAgain" == "" ]; then - "echo" "-e" "Error during Node.js installation" - exit 1 -fi - fi - check=$(git --version) - if [ "$check" == "" ]; then - "echo" "-e" "Installing Git" - apt --yes install git -fi -} -if [ "$type" == "local" ]; then - defaultInstallPath="/opt/uptime-kuma" - if [ -e "/etc/redhat-release" ]; then - os=$("cat" "/etc/redhat-release") - distribution="rhel" - else - if [ -e "/etc/issue" ]; then - os=$(head -n1 /etc/issue | cut -f 1 -d ' ') - if [ "$os" == "Ubuntu" ]; then - distribution="ubuntu" - # Get ubuntu version - . /etc/lsb-release - version="$DISTRIB_RELEASE" -fi - if [ "$os" == "Debian" ]; then - distribution="debian" -fi -fi - fi - arch=$(uname -i) - "echo" "-e" "Your OS: ""$os" - "echo" "-e" "Distribution: ""$distribution" - "echo" "-e" "Version: ""$version" - "echo" "-e" "Arch: ""$arch" - if [ "$3" != "" ]; then - port="$3" - else - "read" "-p" "Listening Port [$defaultPort]: " "port" - if [ "$port" == "" ]; then - port="$defaultPort" -fi - fi - if [ "$2" != "" ]; then - installPath="$2" - else - "read" "-p" "Installation Path [$defaultInstallPath]: " "installPath" - if [ "$installPath" == "" ]; then - installPath="$defaultInstallPath" -fi - fi - # CentOS - if [ "$distribution" == "rhel" ]; then - nodeCheck=$(node -v) - if [ "$nodeCheck" != "" ]; then - "checkNode" - else - dnfCheck=$(dnf --version) - # Use yum - if [ "$dnfCheck" == "" ]; then - curlCheck=$(curl --version) - if [ "$curlCheck" == "" ]; then - "echo" "-e" "Installing Curl" - yum -y -q install curl -fi - "echo" "-e" "Installing Node.js 16" - curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt - yum install -y -q nodejs - else - curlCheck=$(curl --version) - if [ "$curlCheck" == "" ]; then - "echo" "-e" "Installing Curl" - dnf -y install curl -fi - "echo" "-e" "Installing Node.js 16" - curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt - dnf install -y nodejs - fi - node -v - nodeCheckAgain=$(node -v) - if [ "$nodeCheckAgain" == "" ]; then - "echo" "-e" "Error during Node.js installation" - exit 1 -fi - fi - check=$(git --version) - if [ "$check" == "" ]; then - "echo" "-e" "Installing Git" - yum -y -q install git -fi - # Ubuntu - else - if [ "$distribution" == "ubuntu" ]; then - "deb" - # Debian - else - if [ "$distribution" == "debian" ]; then - "deb" - else - # Unknown distribution - error=$((0)) - check=$(git --version) - if [ "$check" == "" ]; then - error=$((1)) - "echo" "-e" "Error: git is not found!" - "echo" "-e" "help: an installation guide is available at https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" -fi - check=$(node -v) - if [ "$check" == "" ]; then - error=$((1)) - "echo" "-e" "Error: node is not found" - "echo" "-e" "help: an installation guide is available at https://nodejs.org/en/download" -fi - if [ $(($error > 0)) == 1 ]; then - "echo" "-e" "Please install above missing software" - exit 1 -fi - fi - fi - fi - check=$(pm2 --version) - if [ "$check" == "" ]; then - "echo" "-e" "Installing PM2" - npm install pm2 -g && pm2 install pm2-logrotate - pm2 startup -fi - # Check again - check=$(pm2 --version) - if [ "$check" == "" ]; then - "echo" "-e" "Error: pm2 is not found!" - "echo" "-e" "help: an installation guide is available at https://pm2.keymetrics.io/docs/usage/quick-start/" - exit 1 -fi - mkdir -p $installPath - cd $installPath - git clone https://github.com/louislam/uptime-kuma.git . - npm run setup - pm2 start server/server.js --name uptime-kuma -- --port=$port -else - defaultVolume="uptime-kuma" - check=$(docker -v) - if [ "$check" == "" ]; then - "echo" "-e" "Error: docker is not found!" - "echo" "-e" "help: an installation guide is available at https://docs.docker.com/desktop/" - exit 1 -fi - check=$(docker info) - if [[ "$check" == *"Is the docker daemon running"* ]]; then - "echo" "Error: docker is not running" - "echo" "help: a troubleshooting guide is available at https://docs.docker.com/config/daemon/troubleshoot/" - "exit" "1" - fi - if [ "$3" != "" ]; then - port="$3" - else - "read" "-p" "Expose Port [$defaultPort]: " "port" - if [ "$port" == "" ]; then - port="$defaultPort" -fi - fi - if [ "$2" != "" ]; then - volume="$2" - else - "read" "-p" "Volume Name [$defaultVolume]: " "volume" - if [ "$volume" == "" ]; then - volume="$defaultVolume" -fi - fi - "echo" "-e" "Port: $port" - "echo" "-e" "Volume: $volume" - docker volume create $volume - docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1 -fi -"echo" "-e" "http://localhost:$port" diff --git a/package.json b/package.json index c0fe6e26b..f11712658 100644 --- a/package.json +++ b/package.json @@ -46,14 +46,6 @@ "mark-as-nightly": "node extra/mark-as-nightly.js", "reset-password": "node extra/reset-password.js", "remove-2fa": "node extra/remove-2fa.js", - "compile-install-script": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./extra/compile-install-script.ps1", - "test-install-script-rockylinux": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/rockylinux.dockerfile .", - "test-install-script-centos7": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/centos7.dockerfile .", - "test-install-script-debian": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/debian.dockerfile .", - "test-install-script-debian-buster": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/debian-buster.dockerfile .", - "test-install-script-ubuntu": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu.dockerfile .", - "test-install-script-ubuntu1804": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1804.dockerfile .", - "test-install-script-ubuntu1604": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1604.dockerfile .", "simple-dns-server": "node extra/simple-dns-server.js", "simple-mqtt-server": "node extra/simple-mqtt-server.js", "simple-mongo": "docker run --rm -p 27017:27017 mongo", diff --git a/test/test_install_script/alpine3.dockerfile b/test/test_install_script/alpine3.dockerfile deleted file mode 100644 index c42782779..000000000 --- a/test/test_install_script/alpine3.dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM alpine:3 -RUN apk add --update nodejs npm git -COPY ./install.sh . -RUN /bin/sh install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/alpine3.dockerfile.dockerignore b/test/test_install_script/alpine3.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test_install_script/centos7.dockerfile b/test/test_install_script/centos7.dockerfile deleted file mode 100644 index 6e50b9192..000000000 --- a/test/test_install_script/centos7.dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM centos:7 - -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/centos7.dockerfile.dockerignore b/test/test_install_script/centos7.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test_install_script/debian-buster.dockerfile b/test/test_install_script/debian-buster.dockerfile deleted file mode 100644 index cd5e8abb4..000000000 --- a/test/test_install_script/debian-buster.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM debian:buster-slim - -# Test invalid node version, these commands install nodejs 10 -# RUN apt-get update -# RUN apt --yes install nodejs -# RUN ln -s /usr/bin/nodejs /usr/bin/node -# RUN node -v - -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/debian-buster.dockerfile.dockerignore b/test/test_install_script/debian-buster.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test_install_script/debian.dockerfile b/test/test_install_script/debian.dockerfile deleted file mode 100644 index 6e1d172ec..000000000 --- a/test/test_install_script/debian.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM debian:bookworm-slim - -# Test invalid node version, these commands install nodejs 10 -# RUN apt-get update -# RUN apt --yes install nodejs -# RUN ln -s /usr/bin/nodejs /usr/bin/node -# RUN node -v - -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/debian.dockerfile.dockerignore b/test/test_install_script/debian.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test_install_script/rockylinux.dockerfile b/test/test_install_script/rockylinux.dockerfile deleted file mode 100644 index 884ec473a..000000000 --- a/test/test_install_script/rockylinux.dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM rockylinux:9 - -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/rockylinux.dockerfile.dockerignore b/test/test_install_script/rockylinux.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test_install_script/ubuntu.dockerfile b/test/test_install_script/ubuntu.dockerfile deleted file mode 100644 index 07d8a25a4..000000000 --- a/test/test_install_script/ubuntu.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu - -# Test invalid node version, these commands install nodejs 10 -# RUN apt-get update -# RUN apt --yes install nodejs -# RUN ln -s /usr/bin/nodejs /usr/bin/node -# RUN node -v - -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/ubuntu.dockerfile.dockerignore b/test/test_install_script/ubuntu.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test_install_script/ubuntu1604.dockerfile b/test/test_install_script/ubuntu1604.dockerfile deleted file mode 100644 index c6b529abe..000000000 --- a/test/test_install_script/ubuntu1604.dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:16.04 - -# Test invalid node version, these commands install nodejs 10 -#RUN apt --yes install nodejs -# RUN ln -s /usr/bin/nodejs /usr/bin/node -# RUN node -v - -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/ubuntu1604.dockerfile.dockerignore b/test/test_install_script/ubuntu1604.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/test_install_script/ubuntu1804.dockerfile b/test/test_install_script/ubuntu1804.dockerfile deleted file mode 100644 index d41f67ede..000000000 --- a/test/test_install_script/ubuntu1804.dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM ubuntu:18.04 - -COPY ./install.sh . -RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0 diff --git a/test/test_install_script/ubuntu1804.dockerfile.dockerignore b/test/test_install_script/ubuntu1804.dockerfile.dockerignore deleted file mode 100644 index e69de29bb..000000000