Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnAngela authored Mar 27, 2022
2 parents 88a7987 + be88351 commit 742c6bc
Show file tree
Hide file tree
Showing 81 changed files with 12,660 additions and 7,839 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/stale-bot.yml

This file was deleted.

24 changes: 16 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,29 @@ https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc
### Release Procedures
1. Draft a release note
1. Make sure the repo is cleared
1. `npm run update-version 1.X.X`
1. `npm run build`
1. `npm run build-docker`
1. `git push`
1. Publish the release note as 1.X.X
1. `npm run upload-artifacts` with env vars VERSION=1.X.X;GITHUB_TOKEN=XXXX
1. SSH to demo site server and update to 1.X.X
2. Make sure the repo is cleared
3. `npm run release-final with env vars: `VERSION` and `GITHUB_TOKEN`
4. Wait until the `Press any key to continue`
5. `git push`
6. Publish the release note as 1.X.X
7. Press any key to continue
8. SSH to demo site server and update to 1.X.X
Checking:
- Check all tags is fine on https://hub.docker.com/r/louislam/uptime-kuma/tags
- Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 / armv7)
- Try clean installation with Node.js
### Release Beta Procedures
1. Draft a release note, check "This is a pre-release"
2. Make sure the repo is cleared
3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN`
4. Wait until the `Press any key to continue`
5. Publish the release note as 1.X.X-beta.X
6. Press any key to continue
### Release Wiki
#### Setup Repo
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ npm run setup
node server/server.js

# (Recommended) Option 2. Run in background using PM2
# Install PM2 if you don't have it: npm install pm2 -g
# Install PM2 if you don't have it:
npm install pm2 -g && pm2 install pm2-logrotate

# Start Server
pm2 start server/server.js --name uptime-kuma

# If you want to see the current console output
pm2 monit
```

Browse to http://localhost:3001 after starting.
Expand Down Expand Up @@ -115,7 +121,7 @@ Telegram Notification Sample:

## Motivation

* I was looking for a self-hosted monitoring tool like "Uptime Robot", but it is hard to find a suitable one. One of the close ones is statping. Unfortunately, it is not stable and unmaintained.
* I was looking for a self-hosted monitoring tool like "Uptime Robot", but it is hard to find a suitable one. One of the close ones is statping. Unfortunately, it is not stable and no longer maintained.
* Want to build a fancy UI.
* Learn Vue 3 and vite.js.
* Show the power of Bootstrap 5.
Expand Down Expand Up @@ -144,4 +150,4 @@ If you want to translate Uptime Kuma into your language, please read: https://gi

If you want to modify Uptime Kuma, this guideline may be useful for you: https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md

English proofreading is needed too because my grammar is not that great, sadly. Feel free to correct my grammar in this README, source code, or wiki.
Unfortunately, English proofreading is needed too because my grammar is not that great. Feel free to correct my grammar in this README, source code, or wiki.
31 changes: 31 additions & 0 deletions db/patch-status-page.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
BEGIN TRANSACTION;

CREATE TABLE [status_page](
[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
[slug] VARCHAR(255) NOT NULL UNIQUE,
[title] VARCHAR(255) NOT NULL,
[description] TEXT,
[icon] VARCHAR(255) NOT NULL,
[theme] VARCHAR(30) NOT NULL,
[published] BOOLEAN NOT NULL DEFAULT 1,
[search_engine_index] BOOLEAN NOT NULL DEFAULT 1,
[show_tags] BOOLEAN NOT NULL DEFAULT 0,
[password] VARCHAR,
[created_date] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
[modified_date] DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE UNIQUE INDEX [slug] ON [status_page]([slug]);


CREATE TABLE [status_page_cname](
[id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
[status_page_id] INTEGER NOT NULL REFERENCES [status_page]([id]) ON DELETE CASCADE ON UPDATE CASCADE,
[domain] VARCHAR NOT NULL UNIQUE
);

ALTER TABLE incident ADD status_page_id INTEGER;
ALTER TABLE [group] ADD status_page_id INTEGER;

COMMIT;
2 changes: 1 addition & 1 deletion docker/alpine-base.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# DON'T UPDATE TO alpine3.13, 1.14, see #41.
FROM node:14-alpine3.12
FROM node:16-alpine3.12
WORKDIR /app

# Install apprise, iputils for non-root ping, setpriv
Expand Down
2 changes: 1 addition & 1 deletion docker/debian-base.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DON'T UPDATE TO node:14-bullseye-slim, see #372.
# If the image changed, the second stage image should be changed too
FROM node:14-buster-slim
FROM node:16-buster-slim
WORKDIR /app

# Install Apprise, add sqlite3 cli for debugging in the future, iputils-ping for ping, util-linux for setpriv
Expand Down
76 changes: 76 additions & 0 deletions extra/beta/update-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const pkg = require("../../package.json");
const fs = require("fs");
const child_process = require("child_process");
const util = require("../../src/util");

util.polyfill();

const oldVersion = pkg.version;
const version = process.env.VERSION;

console.log("Beta Version: " + version);

if (!oldVersion || oldVersion.includes("-beta.")) {
console.error("Error: old version should not be a beta version?");
process.exit(1);
}

if (!version || !version.includes("-beta.")) {
console.error("invalid version, beta version only");
process.exit(1);
}

const exists = tagExists(version);

if (! exists) {
// Process package.json
pkg.version = version;
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 4) + "\n");
commit(version);
tag(version);

} else {
console.log("version tag exists, please delete the tag or use another tag");
process.exit(1);
}

function commit(version) {
let msg = "Update to " + version;

let res = child_process.spawnSync("git", ["commit", "-m", msg, "-a"]);
let stdout = res.stdout.toString().trim();
console.log(stdout);

if (stdout.includes("no changes added to commit")) {
throw new Error("commit error");
}

res = child_process.spawnSync("git", ["push", "origin", "master"]);
console.log(res.stdout.toString().trim());
}

function tag(version) {
let res = child_process.spawnSync("git", ["tag", version]);
console.log(res.stdout.toString().trim());

res = child_process.spawnSync("git", ["push", "origin", version]);
console.log(res.stdout.toString().trim());
}

function tagExists(version) {
if (! version) {
throw new Error("invalid version");
}

let res = child_process.spawnSync("git", ["tag", "-l", version]);

return res.stdout.toString().trim() === version;
}

function safeDelete(dir) {
if (fs.existsSync(dir)) {
fs.rmdirSync(dir, {
recursive: true,
});
}
}
19 changes: 19 additions & 0 deletions extra/env2arg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env node

const childProcess = require("child_process");
let env = process.env;

let cmd = process.argv[2];
let args = process.argv.slice(3);
let replacedArgs = [];

for (let arg of args) {
for (let key in env) {
arg = arg.replaceAll(`$${key}`, env[key]);
}
replacedArgs.push(arg);
}

let child = childProcess.spawn(cmd, replacedArgs);
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
2 changes: 1 addition & 1 deletion extra/install.batsh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ if (type == "local") {
bash("check=$(pm2 --version)");
if (check == "") {
println("Installing PM2");
bash("npm install pm2 -g");
bash("npm install pm2 -g && pm2 install pm2-logrotate");
bash("pm2 startup");
}

Expand Down
6 changes: 6 additions & 0 deletions extra/press-any-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
console.log("Git Push and Publish the release note on github, then press any key to continue");

process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on("data", process.exit.bind(process, 0));

17 changes: 6 additions & 11 deletions extra/update-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ const util = require("../src/util");

util.polyfill();

const oldVersion = pkg.version;
const newVersion = process.argv[2];
const newVersion = process.env.VERSION;

console.log("Old Version: " + oldVersion);
console.log("New Version: " + newVersion);

if (!newVersion) {
Expand All @@ -23,23 +21,20 @@ if (!exists) {

// Process package.json
pkg.version = newVersion;
pkg.scripts.setup = pkg.scripts.setup.replaceAll(oldVersion, newVersion);
pkg.scripts["build-docker"] = pkg.scripts["build-docker"].replaceAll(oldVersion, newVersion);
pkg.scripts["build-docker-alpine"] = pkg.scripts["build-docker-alpine"].replaceAll(oldVersion, newVersion);
pkg.scripts["build-docker-debian"] = pkg.scripts["build-docker-debian"].replaceAll(oldVersion, newVersion);

// Replace the version: https://regex101.com/r/hmj2Bc/1
pkg.scripts.setup = pkg.scripts.setup.replace(/(git checkout )([^\s]+)/, `$1${newVersion}`);
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 4) + "\n");

commit(newVersion);
tag(newVersion);

updateWiki(oldVersion, newVersion);

} else {
console.log("version exists");
}

function commit(version) {
let msg = "update to " + version;
let msg = "Update to " + version;

let res = child_process.spawnSync("git", ["commit", "-m", msg, "-a"]);
let stdout = res.stdout.toString().trim();
Expand Down Expand Up @@ -98,4 +93,4 @@ function safeDelete(dir) {
recursive: true,
});
}
}
}
48 changes: 48 additions & 0 deletions extra/update-wiki-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const child_process = require("child_process");
const fs = require("fs");

const newVersion = process.env.VERSION;

if (!newVersion) {
console.log("Missing version");
process.exit(1);
}

updateWiki(newVersion);

function updateWiki(newVersion) {
const wikiDir = "./tmp/wiki";
const howToUpdateFilename = "./tmp/wiki/🆙-How-to-Update.md";

safeDelete(wikiDir);

child_process.spawnSync("git", ["clone", "https://github.com/louislam/uptime-kuma.wiki.git", wikiDir]);
let content = fs.readFileSync(howToUpdateFilename).toString();

// Replace the version: https://regex101.com/r/hmj2Bc/1
content = content.replace(/(git checkout )([^\s]+)/, `$1${newVersion}`);
fs.writeFileSync(howToUpdateFilename, content);

child_process.spawnSync("git", ["add", "-A"], {
cwd: wikiDir,
});

child_process.spawnSync("git", ["commit", "-m", `Update to ${newVersion}`], {
cwd: wikiDir,
});

console.log("Pushing to Github");
child_process.spawnSync("git", ["push"], {
cwd: wikiDir,
});

safeDelete(wikiDir);
}

function safeDelete(dir) {
if (fs.existsSync(dir)) {
fs.rmdirSync(dir, {
recursive: true,
});
}
}
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ fi
check=$(pm2 --version)
if [ "$check" == "" ]; then
"echo" "-e" "Installing PM2"
npm install pm2 -g
npm install pm2 -g && pm2 install pm2-logrotate
pm2 startup
fi
mkdir -p $installPath
Expand Down
Loading

0 comments on commit 742c6bc

Please sign in to comment.