mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 08:44:04 +00:00
Merge branch 'master' into 1.23.14-to-2.0.0
# Conflicts: # src/lang/en.json # src/util.js # src/util.ts
This commit is contained in:
commit
cc52ee3feb
440 changed files with 26491 additions and 16428 deletions
|
@ -14,7 +14,8 @@
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"GitHub.copilot-chat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/.idea
|
/.idea
|
||||||
/node_modules
|
/node_modules
|
||||||
/data
|
/data*
|
||||||
/cypress
|
|
||||||
/out
|
/out
|
||||||
/test
|
/test
|
||||||
/kubernetes
|
/kubernetes
|
||||||
|
@ -30,7 +29,6 @@ SECURITY.md
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
.env
|
.env
|
||||||
/tmp
|
/tmp
|
||||||
/babel.config.js
|
|
||||||
/ecosystem.config.js
|
/ecosystem.config.js
|
||||||
/extra/healthcheck.exe
|
/extra/healthcheck.exe
|
||||||
/extra/healthcheck
|
/extra/healthcheck
|
||||||
|
|
74
.eslintrc.js
74
.eslintrc.js
|
@ -1,7 +1,7 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
ignorePatterns: [
|
ignorePatterns: [
|
||||||
"test/*",
|
"test/*.js",
|
||||||
"server/modules/apicache/*",
|
"server/modules/*",
|
||||||
"src/util.js"
|
"src/util.js"
|
||||||
],
|
],
|
||||||
root: true,
|
root: true,
|
||||||
|
@ -14,13 +14,18 @@ module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:vue/vue3-recommended",
|
"plugin:vue/vue3-recommended",
|
||||||
|
"plugin:jsdoc/recommended-error",
|
||||||
],
|
],
|
||||||
parser: "vue-eslint-parser",
|
parser: "vue-eslint-parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: "@babel/eslint-parser",
|
parser: "@typescript-eslint/parser",
|
||||||
sourceType: "module",
|
sourceType: "module",
|
||||||
requireConfigFile: false,
|
requireConfigFile: false,
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
"jsdoc",
|
||||||
|
"@typescript-eslint",
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
"yoda": "error",
|
"yoda": "error",
|
||||||
eqeqeq: [ "warn", "smart" ],
|
eqeqeq: [ "warn", "smart" ],
|
||||||
|
@ -71,7 +76,7 @@ module.exports = {
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"key-spacing": "warn",
|
"key-spacing": "warn",
|
||||||
"keyword-spacing": "warn",
|
"keyword-spacing": "warn",
|
||||||
"space-infix-ops": "warn",
|
"space-infix-ops": "error",
|
||||||
"arrow-spacing": "warn",
|
"arrow-spacing": "warn",
|
||||||
"no-trailing-spaces": "error",
|
"no-trailing-spaces": "error",
|
||||||
"no-constant-condition": [ "error", {
|
"no-constant-condition": [ "error", {
|
||||||
|
@ -98,7 +103,43 @@ module.exports = {
|
||||||
}],
|
}],
|
||||||
"no-control-regex": "off",
|
"no-control-regex": "off",
|
||||||
"one-var": [ "error", "never" ],
|
"one-var": [ "error", "never" ],
|
||||||
"max-statements-per-line": [ "error", { "max": 1 }]
|
"max-statements-per-line": [ "error", { "max": 1 }],
|
||||||
|
"jsdoc/check-tag-names": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"definedTags": [ "link" ]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jsdoc/no-undefined-types": "off",
|
||||||
|
"jsdoc/no-defaults": [
|
||||||
|
"error",
|
||||||
|
{ "noOptionalParamNames": true }
|
||||||
|
],
|
||||||
|
"jsdoc/require-throws": "warn",
|
||||||
|
"jsdoc/require-jsdoc": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"FunctionDeclaration": true,
|
||||||
|
"MethodDefinition": true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jsdoc/no-blank-block-descriptions": "error",
|
||||||
|
"jsdoc/require-returns-description": "warn",
|
||||||
|
"jsdoc/require-returns-check": [
|
||||||
|
"error",
|
||||||
|
{ "reportMissingReturnForUndefinedTypes": false }
|
||||||
|
],
|
||||||
|
"jsdoc/require-returns": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"forceRequireReturn": true,
|
||||||
|
"forceReturnsWithAsync": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"jsdoc/require-param-type": "warn",
|
||||||
|
"jsdoc/require-param-description": "warn"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
@ -108,21 +149,20 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Override for jest puppeteer
|
// Override for TypeScript
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"**/*.spec.js",
|
"**/*.ts",
|
||||||
"**/*.spec.jsx"
|
|
||||||
],
|
],
|
||||||
env: {
|
extends: [
|
||||||
jest: true,
|
"plugin:@typescript-eslint/recommended",
|
||||||
},
|
],
|
||||||
globals: {
|
"rules": {
|
||||||
page: true,
|
"jsdoc/require-returns-type": "off",
|
||||||
browser: true,
|
"jsdoc/require-param-type": "off",
|
||||||
context: true,
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
jestPuppeteer: true,
|
"prefer-const": "off",
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
33
.github/ISSUE_TEMPLATE/ask-for-help.yaml
vendored
33
.github/ISSUE_TEMPLATE/ask-for-help.yaml
vendored
|
@ -6,7 +6,7 @@ body:
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
id: no-duplicate-issues
|
id: no-duplicate-issues
|
||||||
attributes:
|
attributes:
|
||||||
label: "⚠️ Please verify that this bug has NOT been raised before."
|
label: "⚠️ Please verify that this question has NOT been raised before."
|
||||||
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
||||||
options:
|
options:
|
||||||
- label: "I checked and didn't find similar issue"
|
- label: "I checked and didn't find similar issue"
|
||||||
|
@ -24,7 +24,7 @@ body:
|
||||||
required: true
|
required: true
|
||||||
attributes:
|
attributes:
|
||||||
label: "📝 Describe your problem"
|
label: "📝 Describe your problem"
|
||||||
description: "Please walk us through it step by step."
|
description: "Please walk us through it step by step. Include all important details and add screenshots where appropriate"
|
||||||
placeholder: "Describe what are you asking for..."
|
placeholder: "Describe what are you asking for..."
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: error-msg
|
id: error-msg
|
||||||
|
@ -56,19 +56,20 @@ body:
|
||||||
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: textarea
|
||||||
id: docker-version
|
id: deployment-info
|
||||||
attributes:
|
attributes:
|
||||||
label: "🐋 Docker Version"
|
label: "🖥️ Deployment Environment"
|
||||||
description: "If running with Docker, which version are you running?"
|
description: |
|
||||||
placeholder: "Ex. Docker 20.10.9 / K8S / Podman"
|
examples:
|
||||||
|
- **Runtime**: Docker 20.10.9 / nodejs 14.18.0 / K8S via ... v1.3.3 / ..
|
||||||
|
- **Database**: sqlite/embedded mariadb/external mariadb
|
||||||
|
- **Filesystem used to store the database on**: Windows/ZFS/btrfs/NFSv3 on a SSD/HDD/eMMC
|
||||||
|
- **number of monitors**: 42
|
||||||
|
value: |
|
||||||
|
- Runtime:
|
||||||
|
- Database:
|
||||||
|
- Filesystem used to store the database on:
|
||||||
|
- number of monitors:
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: true
|
||||||
- type: input
|
|
||||||
id: nodejs-version
|
|
||||||
attributes:
|
|
||||||
label: "🟩 NodeJS Version"
|
|
||||||
description: "If running with Node.js? which version are you running?"
|
|
||||||
placeholder: "Ex. 14.18.0"
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
|
|
45
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
45
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
|
@ -3,14 +3,14 @@ description: "Submit a bug report to help us improve"
|
||||||
#title: "[Bug] "
|
#title: "[Bug] "
|
||||||
labels: [bug]
|
labels: [bug]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: textarea
|
||||||
id: no-duplicate-issues
|
id: related-issues
|
||||||
attributes:
|
validations:
|
||||||
label: "⚠️ Please verify that this bug has NOT been raised before."
|
|
||||||
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
|
||||||
options:
|
|
||||||
- label: "I checked and didn't find similar issue"
|
|
||||||
required: true
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: "📑 I have found these related issues/pull requests"
|
||||||
|
description: "Search related issues by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=) and explain what the difference between them or explain that you are unable to find any related issues"
|
||||||
|
placeholder: "Related to #1 by also touching the ... system. They should not be merged because ..."
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: "🛡️ Security Policy"
|
label: "🛡️ Security Policy"
|
||||||
|
@ -31,7 +31,7 @@ body:
|
||||||
required: true
|
required: true
|
||||||
attributes:
|
attributes:
|
||||||
label: "👟 Reproduction steps"
|
label: "👟 Reproduction steps"
|
||||||
description: "How do you trigger this bug? Please walk us through it step by step."
|
description: "How do you trigger this bug? Please walk us through it step by step. Include all important details and add screenshots where appropriate"
|
||||||
placeholder: "..."
|
placeholder: "..."
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: expected-behavior
|
id: expected-behavior
|
||||||
|
@ -73,22 +73,23 @@ body:
|
||||||
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: textarea
|
||||||
id: docker-version
|
id: deployment-info
|
||||||
attributes:
|
attributes:
|
||||||
label: "🐋 Docker Version"
|
label: "🖥️ Deployment Environment"
|
||||||
description: "If running with Docker, which version are you running?"
|
description: |
|
||||||
placeholder: "Ex. Docker 20.10.9 / K8S / Podman"
|
examples:
|
||||||
|
- **Runtime**: Docker 20.10.9 / nodejs 18.17.1 / K8S via ... v1.3.3 / ..
|
||||||
|
- **Database**: sqlite/embedded mariadb/external mariadb
|
||||||
|
- **Filesystem used to store the database on**: Windows/ZFS/btrfs/NFSv3 on a SSD/HDD/eMMC
|
||||||
|
- **number of monitors**: 42
|
||||||
|
value: |
|
||||||
|
- Runtime:
|
||||||
|
- Database:
|
||||||
|
- Filesystem used to store the database on:
|
||||||
|
- number of monitors:
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: true
|
||||||
- type: input
|
|
||||||
id: nodejs-version
|
|
||||||
attributes:
|
|
||||||
label: "🟩 NodeJS Version"
|
|
||||||
description: "If running with Node.js? which version are you running?"
|
|
||||||
placeholder: "Ex. 14.18.0"
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: logs
|
id: logs
|
||||||
attributes:
|
attributes:
|
||||||
|
|
29
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
29
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
|
@ -3,14 +3,14 @@ description: "Submit a proposal for a new feature"
|
||||||
#title: "[Feature] "
|
#title: "[Feature] "
|
||||||
labels: [feature-request]
|
labels: [feature-request]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: textarea
|
||||||
id: no-duplicate-issues
|
id: related-issues
|
||||||
attributes:
|
validations:
|
||||||
label: "⚠️ Please verify that this feature request has NOT been suggested before."
|
|
||||||
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
|
||||||
options:
|
|
||||||
- label: "I checked and didn't find similar feature request"
|
|
||||||
required: true
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: "📑 I have found these related issues/pull requests"
|
||||||
|
description: "Search related issues by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=) and explain what the difference between them or explain that you are unable to find any related issues"
|
||||||
|
placeholder: "Related to #1 by also touching the ... system. They should not be merged because ..."
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: feature-area
|
id: feature-area
|
||||||
attributes:
|
attributes:
|
||||||
|
@ -18,10 +18,17 @@ body:
|
||||||
description: "What kind of feature request is this?"
|
description: "What kind of feature request is this?"
|
||||||
multiple: true
|
multiple: true
|
||||||
options:
|
options:
|
||||||
- API
|
- API / automation options
|
||||||
- New Notification
|
- New notification-provider
|
||||||
- New Monitor
|
- Change to existing notification-provider
|
||||||
- UI Feature
|
- New monitor
|
||||||
|
- Change to existing monitor
|
||||||
|
- Dashboard
|
||||||
|
- Status-page
|
||||||
|
- Maintenance
|
||||||
|
- Deployment
|
||||||
|
- Certificate expiry
|
||||||
|
- Settings
|
||||||
- Other
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/security.md
vendored
2
.github/ISSUE_TEMPLATE/security.md
vendored
|
@ -12,8 +12,6 @@ labels:
|
||||||
|
|
||||||
DO NOT PROVIDE ANY DETAILS HERE. Please privately report to https://github.com/louislam/uptime-kuma/security/advisories/new.
|
DO NOT PROVIDE ANY DETAILS HERE. Please privately report to https://github.com/louislam/uptime-kuma/security/advisories/new.
|
||||||
|
|
||||||
|
|
||||||
Why need this issue? It is because GitHub Advisory do not send a notification to @louislam, it is a workaround to do so.
|
Why need this issue? It is because GitHub Advisory do not send a notification to @louislam, it is a workaround to do so.
|
||||||
|
|
||||||
Your GitHub Advisory URL:
|
Your GitHub Advisory URL:
|
||||||
|
|
||||||
|
|
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -15,7 +15,7 @@ Please delete any options that are not relevant.
|
||||||
- Bug fix (non-breaking change which fixes an issue)
|
- Bug fix (non-breaking change which fixes an issue)
|
||||||
- User interface (UI)
|
- User interface (UI)
|
||||||
- New feature (non-breaking change which adds functionality)
|
- New feature (non-breaking change which adds functionality)
|
||||||
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
- Breaking change (a fix or feature that would cause existing functionality to not work as expected)
|
||||||
- Other
|
- Other
|
||||||
- This change requires a documentation update
|
- This change requires a documentation update
|
||||||
|
|
||||||
|
@ -24,9 +24,8 @@ Please delete any options that are not relevant.
|
||||||
- [ ] My code follows the style guidelines of this project
|
- [ ] My code follows the style guidelines of this project
|
||||||
- [ ] I ran ESLint and other linters for modified files
|
- [ ] I ran ESLint and other linters for modified files
|
||||||
- [ ] I have performed a self-review of my own code and tested it
|
- [ ] I have performed a self-review of my own code and tested it
|
||||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
- [ ] I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
|
||||||
(including JSDoc for methods)
|
- [ ] My changes generates no new warnings
|
||||||
- [ ] My changes generate no new warnings
|
|
||||||
- [ ] My code needed automated testing. I have added them (this is optional task)
|
- [ ] My code needed automated testing. I have added them (this is optional task)
|
||||||
|
|
||||||
## Screenshots (if any)
|
## Screenshots (if any)
|
||||||
|
|
44
.github/workflows/auto-test.yml
vendored
44
.github/workflows/auto-test.yml
vendored
|
@ -15,14 +15,14 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
auto-test:
|
auto-test:
|
||||||
needs: [ check-linters ]
|
needs: [ check-linters, e2e-test ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-latest, windows-latest, ARM64]
|
os: [macos-latest, ubuntu-latest, windows-latest, ARM64]
|
||||||
node: [ 16, 20.5 ]
|
node: [ 18, 20.5 ]
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -33,9 +33,9 @@ jobs:
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- run: npm ci
|
- run: npm install
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm test
|
- run: npm run test-backend
|
||||||
env:
|
env:
|
||||||
HEADLESS_TEST: 1
|
HEADLESS_TEST: 1
|
||||||
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
|
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
|
||||||
|
@ -45,11 +45,11 @@ jobs:
|
||||||
needs: [ check-linters ]
|
needs: [ check-linters ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ARMv7 ]
|
os: [ ARMv7 ]
|
||||||
node: [ 16, 20.5 ]
|
node: [ 18, 20 ]
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -72,36 +72,22 @@ jobs:
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.5
|
node-version: 20
|
||||||
- run: npm ci
|
- run: npm install
|
||||||
- run: npm run lint:prod
|
- run: npm run lint:prod
|
||||||
|
|
||||||
e2e-tests:
|
e2e-test:
|
||||||
needs: [ check-linters ]
|
needs: [ check-linters ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ARM64
|
||||||
steps:
|
steps:
|
||||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 16
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
- run: npm ci
|
- run: npm install
|
||||||
|
- run: npx playwright install
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run cy:test
|
- run: npm run test-e2e
|
||||||
|
|
||||||
frontend-unit-tests:
|
|
||||||
needs: [ check-linters ]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Use Node.js 16
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run build
|
|
||||||
- run: npm run cy:run:unit
|
|
||||||
|
|
2
.github/workflows/close-incorrect-issue.yml
vendored
2
.github/workflows/close-incorrect-issue.yml
vendored
|
@ -11,7 +11,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
node-version: [16]
|
node-version: [18]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
43
.github/workflows/codeql-analysis.yml
vendored
Normal file
43
.github/workflows/codeql-analysis.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master", "1.23.X"]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master", "1.23.X"]
|
||||||
|
schedule:
|
||||||
|
- cron: '16 22 * * 0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 360
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go', 'javascript-typescript' ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
|
with:
|
||||||
|
category: "/language:${{matrix.language}}"
|
25
.github/workflows/conflict_labeler.yml
vendored
Normal file
25
.github/workflows/conflict_labeler.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
name: Merge Conflict Labeler
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request_target:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
types: [synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
label:
|
||||||
|
name: Labeling
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- name: Apply label
|
||||||
|
uses: eps1lon/actions-label-merge-conflict@v3
|
||||||
|
with:
|
||||||
|
dirtyLabel: 'needs:resolve-merge-conflict'
|
||||||
|
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
17
.github/workflows/prevent-file-change.yml
vendored
Normal file
17
.github/workflows/prevent-file-change.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: prevent-file-change
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-file-changes:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Prevent file change
|
||||||
|
uses: xalvarez/prevent-file-change-action@v1
|
||||||
|
with:
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# Regex, /src/lang/*.json is not allowed to be changed, except for /src/lang/en.json
|
||||||
|
pattern: '^(?!src/lang/en\.json$)src/lang/.*\.json$'
|
||||||
|
trustedAuthors: UptimeKumaBot
|
||||||
|
|
34
.github/workflows/stale-bot.yml
vendored
34
.github/workflows/stale-bot.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: 'Automatically close stale issues and PRs'
|
name: 'Automatically close stale issues'
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
|
@ -11,12 +11,32 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v8
|
- uses: actions/stale@v8
|
||||||
with:
|
with:
|
||||||
stale-issue-message: 'We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.'
|
stale-issue-message: |-
|
||||||
close-issue-message: 'This issue was closed because it has been stalled for 2 days with no activity.'
|
We are clearing up our old `help`-issues and your issue has been open for 60 days with no activity.
|
||||||
days-before-stale: 90
|
If no comment is made and the stale label is not removed, this issue will be closed in 7 days.
|
||||||
days-before-close: 2
|
days-before-stale: 60
|
||||||
days-before-pr-stale: 999999999
|
days-before-close: 7
|
||||||
days-before-pr-close: 1
|
days-before-pr-stale: -1
|
||||||
|
days-before-pr-close: -1
|
||||||
exempt-issue-labels: 'News,Medium,High,discussion,bug,doc,feature-request'
|
exempt-issue-labels: 'News,Medium,High,discussion,bug,doc,feature-request'
|
||||||
exempt-issue-assignees: 'louislam'
|
exempt-issue-assignees: 'louislam'
|
||||||
operations-per-run: 200
|
operations-per-run: 200
|
||||||
|
- uses: actions/stale@v8
|
||||||
|
with:
|
||||||
|
stale-issue-message: |-
|
||||||
|
This issue was marked as `cannot-reproduce` by a maintainer.
|
||||||
|
If an issue is non-reproducible, we cannot fix it, as we do not know what the underlying issue is.
|
||||||
|
If you have any ideas how we can reproduce this issue, we would love to hear them.
|
||||||
|
|
||||||
|
We don't have a good way to deal with truely unreproducible issues and are going to close this issue in a month.
|
||||||
|
If think there might be other differences in our environment or in how we tried to reproduce this, we would appreciate any ideas.
|
||||||
|
close-issue-message: |-
|
||||||
|
This issue will be closed as no way to reproduce it has been found.
|
||||||
|
If you/somebody finds a way how to (semi-reliably) reproduce this, we can reopen this issue. ^^
|
||||||
|
days-before-stale: 180
|
||||||
|
days-before-close: 30
|
||||||
|
days-before-pr-stale: -1
|
||||||
|
days-before-pr-close: -1
|
||||||
|
any-of-issue-labels: 'cannot-reproduce'
|
||||||
|
operations-per-run: 200
|
||||||
|
|
||||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -7,6 +7,7 @@ dist-ssr
|
||||||
|
|
||||||
/data
|
/data
|
||||||
!/data/.gitkeep
|
!/data/.gitkeep
|
||||||
|
/data*
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
/private
|
/private
|
||||||
|
@ -14,9 +15,6 @@ dist-ssr
|
||||||
/tmp
|
/tmp
|
||||||
.env
|
.env
|
||||||
|
|
||||||
cypress/videos
|
|
||||||
cypress/screenshots
|
|
||||||
|
|
||||||
/extra/healthcheck.exe
|
/extra/healthcheck.exe
|
||||||
/extra/healthcheck
|
/extra/healthcheck
|
||||||
/extra/healthcheck-armv7
|
/extra/healthcheck-armv7
|
||||||
|
|
476
CONTRIBUTING.md
476
CONTRIBUTING.md
|
@ -1,92 +1,216 @@
|
||||||
# Project Info
|
# Project Info
|
||||||
|
|
||||||
First of all, I want to thank everyone who made pull requests for Uptime Kuma. I never thought the GitHub Community would be so nice! Because of this, I also never thought that other people would actually read and edit my code. It is not very well structured or commented, sorry about that.
|
First of all, I want to thank everyone who have wrote issues or shared pull requests for Uptime Kuma.
|
||||||
|
I never thought the GitHub community would be so nice!
|
||||||
|
Because of this, I also never thought that other people would actually read and edit my code.
|
||||||
|
Parts of the code are not very well-structured or commented, sorry about that.
|
||||||
|
|
||||||
The project was created with vite.js (vue3). Then I created a subdirectory called "server" for the server part. Both frontend and backend share the same package.json.
|
The project was created with `vite.js` and is written in `vue3`.
|
||||||
|
Our backend lives in the `server`-directory and mostly communicates via websockets.
|
||||||
|
Both frontend and backend share the same `package.json`.
|
||||||
|
|
||||||
The frontend code builds into "dist" directory. The server (express.js) exposes the "dist" directory as the root of the endpoint. This is how production is working.
|
For production, the frontend is build into `dist`-directory and the server (`express.js`) exposes the `dist` directory as the root of the endpoint.
|
||||||
|
For development, we run vite in development mode on another port.
|
||||||
## Key Technical Skills
|
|
||||||
|
|
||||||
- Node.js (You should know about promise, async/await and arrow function etc.)
|
|
||||||
- Socket.io
|
|
||||||
- SCSS
|
|
||||||
- Vue.js
|
|
||||||
- Bootstrap
|
|
||||||
- SQLite
|
|
||||||
|
|
||||||
## Directories
|
## Directories
|
||||||
|
|
||||||
- config (dev config files)
|
- `config` (dev config files)
|
||||||
- data (App data)
|
- `data` (App data)
|
||||||
- db (Base database and migration scripts)
|
- `db` (Base database and migration scripts)
|
||||||
- dist (Frontend build)
|
- `dist` (Frontend build)
|
||||||
- docker (Dockerfiles)
|
- `docker` (Dockerfiles)
|
||||||
- extra (Extra useful scripts)
|
- `extra` (Extra useful scripts)
|
||||||
- public (Frontend resources for dev only)
|
- `public` (Frontend resources for dev only)
|
||||||
- server (Server source code)
|
- `server` (Server source code)
|
||||||
- src (Frontend source code)
|
- `src` (Frontend source code)
|
||||||
- test (unit test)
|
- `test` (unit test)
|
||||||
|
|
||||||
## Can I create a pull request for Uptime Kuma?
|
## Can I create a pull request for Uptime Kuma?
|
||||||
|
|
||||||
Yes or no, it depends on what you will try to do. Since I don't want to waste your time, be sure to **create an empty draft pull request or open an issue, so we can have a discussion first**. Especially for a large pull request or you don't know if it will be merged or not.
|
Yes or no, it depends on what you will try to do.
|
||||||
|
Both your and our maintainers time is precious, and we don't want to waste both time.
|
||||||
|
|
||||||
Here are some references:
|
If you have any questions about any process/.. is not clear, you are likely not alone => please ask them ^^
|
||||||
|
|
||||||
### ✅ Usually accepted:
|
Different guidelines exist for different types of pull requests (PRs):
|
||||||
- Bug fix
|
- <details><summary><b>security fixes</b></summary>
|
||||||
- Security fix
|
<p>
|
||||||
- Adding notification providers
|
|
||||||
- Adding new language files (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md))
|
|
||||||
- Adding new language keys: `$t("...")`
|
|
||||||
|
|
||||||
### ⚠️ Discussion required:
|
Submitting security fixes is something that may put the community at risk.
|
||||||
- Large pull requests
|
Please read through our [security policy](SECURITY.md) and submit vulnerabilities via an [advisory](https://github.com/louislam/uptime-kuma/security/advisories/new) + [issue](https://github.com/louislam/uptime-kuma/issues/new?assignees=&labels=help&template=security.md) instead.
|
||||||
- New features
|
We encourage you to submit how to fix a vulnerability if you know how to, this is not required.
|
||||||
|
Following the security policy allows us to properly test, fix bugs.
|
||||||
|
This review allows us to notice, if there are any changes necessary to unrelated parts like the documentation.
|
||||||
|
[**PLEASE SEE OUR SECURITY POLICY.**](SECURITY.md)
|
||||||
|
|
||||||
### ❌ Won't be merged:
|
</p>
|
||||||
- A dedicated PR for translating existing languages (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md))
|
</details>
|
||||||
- Do not pass the auto-test
|
- <details><summary><b>small, non-breaking bug fixes</b></summary>
|
||||||
- Any breaking changes
|
<p>
|
||||||
- Duplicated pull requests
|
|
||||||
- Buggy
|
|
||||||
- UI/UX is not close to Uptime Kuma
|
|
||||||
- Modifications or deletions of existing logic without a valid reason.
|
|
||||||
- Adding functions that is completely out of scope
|
|
||||||
- Converting existing code into other programming languages
|
|
||||||
- Unnecessarily large code changes that are hard to review and cause conflicts with other PRs.
|
|
||||||
|
|
||||||
The above cases may not cover all possible situations.
|
If you come across a bug and think you can solve, we appreciate your work.
|
||||||
|
Please make sure that you follow by these rules:
|
||||||
|
- keep the PR as small as possible, fix only one thing at a time => keeping it reviewable
|
||||||
|
- test that your code does what you came it does.
|
||||||
|
|
||||||
I (@louislam) have the final say. If your pull request does not meet my expectations, I will reject it, no matter how much time you spend on it. Therefore, it is essential to have a discussion beforehand.
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>translations / internationalisation (i18n)</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
We use weblate to localise this project into many languages.
|
||||||
|
If you are unhappy with a translation this is the best start.
|
||||||
|
On how to translate using weblate, please see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
|
||||||
|
|
||||||
|
There are two cases in which a change cannot be done in weblate and requires a PR:
|
||||||
|
- A text may not be currently localisable. In this case, **adding a new language key** via `$t("languageKey")` might be nessesary
|
||||||
|
- language keys need to be **added to `en.json`** to be visible in weblate. If this has not happened, a PR is appreciated.
|
||||||
|
- **Adding a new language** requires a new file see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md)
|
||||||
|
|
||||||
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>new notification providers</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
To set up a new notification provider these files need to be modified/created:
|
||||||
|
- `server/notification-providers/PROVIDER_NAME.js` is where the heart of the notification provider lives.
|
||||||
|
- Both `monitorJSON` and `heartbeatJSON` can be `null` for some events.
|
||||||
|
If both are `null`, this is a general testing message, but if just `heartbeatJSON` is `null` this is a certificate expiry.
|
||||||
|
- Please wrap the axios call into a
|
||||||
|
```js
|
||||||
|
try {
|
||||||
|
let result = await axios.post(...);
|
||||||
|
if (result.status === ...) ...
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- `server/notification.js` is where the backend of the notification provider needs to be registered.
|
||||||
|
*If you have an idea how we can skip this step, we would love to hear about it ^^*
|
||||||
|
- `src/components/NotificationDialog.vue` you need to decide if the provider is a regional or a global one and add it with a name to the respective list
|
||||||
|
- `src/components/notifications/PROVIDER_NAME.vue` is where the frontend of each provider lives.
|
||||||
|
Please make sure that you have:
|
||||||
|
- used `HiddenInput` for secret credentials
|
||||||
|
- included all the necessary helptexts/placeholder/.. to make sure the notification provider is simple to setup for new users.
|
||||||
|
- include all translations (`{{ $t("Translation key") }}`, [`i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html)) in `src/lang/en.json` to enable our translators to translate this
|
||||||
|
- `src/components/notifications/index.js` is where the frontend of the provider needs to be registered.
|
||||||
|
*If you have an idea how we can skip this step, we would love to hear about it ^^*
|
||||||
|
|
||||||
|
Offering notifications is close to the core of what we are as an uptime monitor.
|
||||||
|
Therefore, making sure that they work is also really important.
|
||||||
|
Because testing notification providers is quite time intensive, we mostly offload this onto the person contributing a notification provider.
|
||||||
|
|
||||||
|
To make shure you have tested the notification provider, please include screenshots of the following events in the pull-request description:
|
||||||
|
- `UP`/`DOWN`
|
||||||
|
- Certificate Expiry via https://expired.badssl.com/
|
||||||
|
- Testing (the test button on the notification provider setup page)
|
||||||
|
|
||||||
|
Using the following way to format this is encouraged:
|
||||||
|
```md
|
||||||
|
| Event | Before | After |
|
||||||
|
------------------
|
||||||
|
| `UP` | paste-image-here | paste-image-here |
|
||||||
|
| `DOWN` | paste-image-here | paste-image-here |
|
||||||
|
| Certificate-expiry | paste-image-here | paste-image-here |
|
||||||
|
| Testing | paste-image-here | paste-image-here |
|
||||||
|
```
|
||||||
|
|
||||||
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>new monitoring types</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
To set up a new notification provider these files need to be modified/created:
|
||||||
|
- `server/monitor-types/MONITORING_TYPE.js` is the core of each monitor.
|
||||||
|
the `async check(...)`-function should:
|
||||||
|
- throw an error for each fault that is detected with an actionable error message
|
||||||
|
- in the happy-path, you should set `heartbeat.msg` to a successfull message and set `heartbeat.status = UP`
|
||||||
|
- `server/uptime-kuma-server.js` is where the monitoring backend needs to be registered.
|
||||||
|
*If you have an idea how we can skip this step, we would love to hear about it ^^*
|
||||||
|
- `src/pages/EditMonitor.vue` is the shared frontend users interact with.
|
||||||
|
Please make sure that you have:
|
||||||
|
- used `HiddenInput` for secret credentials
|
||||||
|
- included all the necessary helptexts/placeholder/.. to make sure the notification provider is simple to setup for new users.
|
||||||
|
- include all translations (`{{ $t("Translation key") }}`, [`i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html)) in `src/lang/en.json` to enable our translators to translate this
|
||||||
|
-
|
||||||
|
|
||||||
|
|
||||||
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>new features/ major changes / breaking bugfixes</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
be sure to **create an empty draft pull request or open an issue, so we can have a discussion first**.
|
||||||
|
This is especially important for a large pull request or you don't know if it will be merged or not.
|
||||||
|
|
||||||
|
<sub>Because of the large impact of this work, only senior maintainers may merge PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
The following rules are essential for making your PR mergable:
|
||||||
|
- Merging multiple issues by a huge PR is more difficult to review and causes conflicts with other PRs. Please
|
||||||
|
- (if possible) **create one PR for one issue** or
|
||||||
|
- (if not possible) **explain which issues a PR addresses and why this PR should not be broken apart**
|
||||||
|
- Make sure your **PR passes our continuous integration**.
|
||||||
|
PRs will not be merged unless all CI-Checks are green.
|
||||||
|
- **Breaking changes** (unless for a good reason and discussed beforehand) will not get merged / not get merged quickly.
|
||||||
|
Such changes require a major version release.
|
||||||
|
- **Test your code** before submitting a PR.
|
||||||
|
Buggy PRs will not be merged.
|
||||||
|
- Make sure the **UI/UX is close to Uptime Kuma**.
|
||||||
|
- **Think about the maintainability**:
|
||||||
|
Don't add functionality that is completely **out of scope**.
|
||||||
|
Keep in mind that we need to be able to maintain the functionality.
|
||||||
|
- Don't modify or delete existing logic without a valid reason.
|
||||||
|
- Don't convert existing code into other programming languages for no reason.
|
||||||
|
|
||||||
|
I ([@louislam](https://github.com/louislam)) have the final say.
|
||||||
|
If your pull request does not meet my expectations, I will reject it, no matter how much time you spent on it.
|
||||||
|
Therefore, it is essential to have a discussion beforehand.
|
||||||
|
|
||||||
I will assign your pull request to a [milestone](https://github.com/louislam/uptime-kuma/milestones), if I plan to review and merge it.
|
I will assign your pull request to a [milestone](https://github.com/louislam/uptime-kuma/milestones), if I plan to review and merge it.
|
||||||
|
|
||||||
Also, please don't rush or ask for an ETA, because I have to understand the pull request, make sure it is no breaking changes and stick to my vision of this project, especially for large pull requests.
|
Please don't rush or ask for an ETA.
|
||||||
|
We have to understand the pull request, make sure it has no breaking changes and stick to the vision of this project, especially for large pull requests.
|
||||||
|
|
||||||
|
|
||||||
|
## I'd like to work on an issue. How do I do that?
|
||||||
|
|
||||||
|
We have found that assigning people to issues is management-overhead that we don't need.
|
||||||
|
A short comment that you want to try your hand at this issue is appreciated to save other devs time.
|
||||||
|
If you come across any problem during development, feel free to leave a comment with what you are stuck on.
|
||||||
|
|
||||||
### Recommended Pull Request Guideline
|
### Recommended Pull Request Guideline
|
||||||
|
|
||||||
Before deep into coding, discussion first is preferred. Creating an empty pull request for discussion would be recommended.
|
Before diving deep into coding, having a discussion first by creating an empty pull request for discussion is preferred.
|
||||||
|
The rationale behind this is that we can align the direction and scope of the feature to eliminate any conflicts with existing and planned work, and can help by pointing out any potential pitfalls.
|
||||||
|
|
||||||
1. Fork the project
|
1. Fork the project
|
||||||
1. Clone your fork repo to local
|
2. Clone your fork repo to local
|
||||||
1. Create a new branch
|
3. Create a new branch
|
||||||
1. Create an empty commit
|
4. Create an empty commit: `git commit -m "<YOUR TASK NAME>" --allow-empty`
|
||||||
`git commit -m "[empty commit] pull request for <YOUR TASK NAME>" --allow-empty`
|
5. Push to your fork repo
|
||||||
1. Push to your fork repo
|
6. Prepare a pull request: https://github.com/louislam/uptime-kuma/compare
|
||||||
1. Create a pull request: https://github.com/louislam/uptime-kuma/compare
|
7. Write a proper description. You can mention @louislam in it, so @louislam will get the notification.
|
||||||
1. Write a proper description
|
8. Create your pull request as a Draft
|
||||||
1. Click "Change to draft"
|
9. Wait for the discussion
|
||||||
1. Discussion
|
|
||||||
|
|
||||||
## Project Styles
|
## Project Styles
|
||||||
|
|
||||||
I personally do not like something that requires so many configurations before you can finally start the app. I hope Uptime Kuma installation will be as easy as like installing a mobile app.
|
I personally do not like something that requires so many configurations before you can finally start the app.
|
||||||
|
The goal is to make the Uptime Kuma installation as easy as installing a mobile app.
|
||||||
|
|
||||||
- Easy to install for non-Docker users, no native build dependency is needed (for x86_64/armv7/arm64), no extra config, and no extra effort required to get it running
|
- Easy to install for non-Docker users
|
||||||
- Single container for Docker users, no very complex docker-compose file. Just map the volume and expose the port, then good to go
|
- no native build dependency is needed (for `x86_64`/`armv7`/`arm64`)
|
||||||
|
- no extra configuration and
|
||||||
|
- no extra effort required to get it running
|
||||||
|
- Single container for Docker users
|
||||||
|
- no complex docker-compose file
|
||||||
|
- mapping the volume and exposing the port should be the only requirements
|
||||||
- Settings should be configurable in the frontend. Environment variables are discouraged, unless it is related to startup such as `DATA_DIR`
|
- Settings should be configurable in the frontend. Environment variables are discouraged, unless it is related to startup such as `DATA_DIR`
|
||||||
- Easy to use
|
- Easy to use
|
||||||
- The web UI styling should be consistent and nice
|
- The web UI styling should be consistent and nice
|
||||||
|
@ -106,12 +230,24 @@ I personally do not like something that requires so many configurations before y
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
- [`Node.js`](https://nodejs.org/) >= 14
|
- [`Node.js`](https://nodejs.org/) >= 18
|
||||||
- [`npm`](https://www.npmjs.com/) >= 8.5
|
- [`npm`](https://www.npmjs.com/) >= 9.3
|
||||||
- [`git`](https://git-scm.com/)
|
- [`git`](https://git-scm.com/)
|
||||||
- IDE that supports [`ESLint`](https://eslint.org/) and EditorConfig (I am using [`IntelliJ IDEA`](https://www.jetbrains.com/idea/))
|
- IDE that supports [`ESLint`](https://eslint.org/) and EditorConfig (I am using [`IntelliJ IDEA`](https://www.jetbrains.com/idea/))
|
||||||
- A SQLite GUI tool (f.ex. [`SQLite Expert Personal`](https://www.sqliteexpert.com/download.html) or [`DBeaver Community`](https://dbeaver.io/download/))
|
- A SQLite GUI tool (f.ex. [`SQLite Expert Personal`](https://www.sqliteexpert.com/download.html) or [`DBeaver Community`](https://dbeaver.io/download/))
|
||||||
|
|
||||||
|
### GitHub Codespaces
|
||||||
|
|
||||||
|
If you don't want to setup an local environment, you can now develop on GitHub Codespaces, read more:
|
||||||
|
|
||||||
|
https://github.com/louislam/uptime-kuma/tree/master/.devcontainer
|
||||||
|
|
||||||
|
## Git Branches
|
||||||
|
|
||||||
|
- `master`: 2.X.X development. If you want to add a new feature, your pull request should base on this.
|
||||||
|
- `1.23.X`: 1.23.X development. If you want to fix a bug for v1 and v2, your pull request should base on this.
|
||||||
|
- All other branches are unused, outdated or for dev.
|
||||||
|
|
||||||
## Install Dependencies for Development
|
## Install Dependencies for Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -131,7 +267,8 @@ npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
But sometimes, you would like to restart the server, but not the frontend, you can run these commands in two terminals:
|
But sometimes, you would like to restart the server, but not the frontend, you can run these commands in two terminals:
|
||||||
```
|
|
||||||
|
```bash
|
||||||
npm run start-frontend-dev
|
npm run start-frontend-dev
|
||||||
npm run start-server-dev
|
npm run start-server-dev
|
||||||
```
|
```
|
||||||
|
@ -140,26 +277,25 @@ npm run start-server-dev
|
||||||
|
|
||||||
It binds to `0.0.0.0:3001` by default.
|
It binds to `0.0.0.0:3001` by default.
|
||||||
|
|
||||||
|
The backend is an `express.js` server with `socket.io` integrated.
|
||||||
|
It uses `socket.io` to communicate with clients, and most server logic is encapsulated in the `socket.io` handlers.
|
||||||
|
`express.js` is also used to serve:
|
||||||
|
|
||||||
It is mainly a socket.io app + express.js.
|
- as an entry point for redirecting to a status page or the dashboard
|
||||||
|
- the frontend built files (`index.html`, `*.js`, `*.css`, etc.)
|
||||||
|
- internal APIs of the status page
|
||||||
|
|
||||||
express.js is used for:
|
### Structure in `/server/`
|
||||||
- entry point such as redirecting to a status page or the dashboard
|
|
||||||
- serving the frontend built files (index.html, .js and .css etc.)
|
|
||||||
- serving internal APIs of the status page
|
|
||||||
|
|
||||||
|
- `jobs/` (Jobs that are running in another process)
|
||||||
### Structure in /server/
|
- `model/` (Object model, auto-mapping to the database table name)
|
||||||
|
- `modules/` (Modified 3rd-party modules)
|
||||||
- jobs/ (Jobs that are running in another process)
|
- `monitor_types/` (Monitor Types)
|
||||||
- model/ (Object model, auto-mapping to the database table name)
|
- `notification-providers/` (individual notification logic)
|
||||||
- modules/ (Modified 3rd-party modules)
|
- `routers/` (Express Routers)
|
||||||
- monitor_types (Monitor Types)
|
- `socket-handler/` (Socket.io Handlers)
|
||||||
- notification-providers/ (individual notification logic)
|
- `server.js` (Server entry point)
|
||||||
- routers/ (Express Routers)
|
- `uptime-kuma-server.js` (UptimeKumaServer class, main logic should be here, but some still in `server.js`)
|
||||||
- socket-handler (Socket.io Handlers)
|
|
||||||
- server.js (Server entry point)
|
|
||||||
- uptime-kuma-server.js (UptimeKumaServer class, main logic should be here, but some still in `server.js`)
|
|
||||||
|
|
||||||
## Frontend Dev Server
|
## Frontend Dev Server
|
||||||
|
|
||||||
|
@ -187,8 +323,7 @@ The data and socket logic are in `src/mixins/socket.js`.
|
||||||
|
|
||||||
## Database Migration
|
## Database Migration
|
||||||
|
|
||||||
1. Create `patch-{name}.sql` in `./db/`
|
See: https://github.com/louislam/uptime-kuma/tree/master/db/knex_migrations
|
||||||
2. Add your patch filename in the `patchList` list in `./server/database.js`
|
|
||||||
|
|
||||||
## Unit Test
|
## Unit Test
|
||||||
|
|
||||||
|
@ -199,14 +334,15 @@ npm test
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
Both frontend and backend share the same package.json. However, the frontend dependencies are eventually not used in the production environment, because it is usually also baked into dist files. So:
|
Both frontend and backend share the same `package.json`.
|
||||||
|
However, the frontend dependencies are eventually not used in the production environment, because it is usually also baked into `dist` files. So:
|
||||||
|
|
||||||
- Frontend dependencies = "devDependencies"
|
- Frontend dependencies = "devDependencies"
|
||||||
- Examples: vue, chart.js
|
- Examples: `vue`, `chart.js`
|
||||||
- Backend dependencies = "dependencies"
|
- Backend dependencies = "dependencies"
|
||||||
- Examples: socket.io, sqlite3
|
- Examples: `socket.io`, `sqlite3`
|
||||||
- Development dependencies = "devDependencies"
|
- Development dependencies = "devDependencies"
|
||||||
- Examples: eslint, sass
|
- Examples: `eslint`, `sass`
|
||||||
|
|
||||||
### Update Dependencies
|
### Update Dependencies
|
||||||
|
|
||||||
|
@ -218,9 +354,9 @@ If for security / bug / other reasons, a library must be updated, breaking chang
|
||||||
|
|
||||||
## Translations
|
## Translations
|
||||||
|
|
||||||
Please add **all** the strings which are translatable to `src/lang/en.json` (If translation keys are omitted, they can not be translated).
|
Please add **all** the strings which are translatable to `src/lang/en.json` (if translation keys are omitted, they can not be translated.)
|
||||||
|
|
||||||
**Don't include any other languages in your initial Pull-Request** (even if this is your mother tongue), to avoid merge-conflicts between weblate and `master`.
|
**Don't include any other languages in your initial pull request** (even if this is your mother tongue), to avoid merge-conflicts between weblate and `master`.
|
||||||
The translations can then (after merging a PR into `master`) be translated by awesome people donating their language skills.
|
The translations can then (after merging a PR into `master`) be translated by awesome people donating their language skills.
|
||||||
|
|
||||||
If you want to help by translating Uptime Kuma into your language, please visit the [instructions on how to translate using weblate](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
|
If you want to help by translating Uptime Kuma into your language, please visit the [instructions on how to translate using weblate](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
|
||||||
|
@ -232,55 +368,151 @@ My mother language is not English and my grammar is not that great.
|
||||||
|
|
||||||
## Wiki
|
## Wiki
|
||||||
|
|
||||||
Since there is no way to make a pull request to wiki's repo, I have set up another repo to do that.
|
Since there is no way to make a pull request to the wiki, I have set up another repo to do that.
|
||||||
|
|
||||||
https://github.com/louislam/uptime-kuma-wiki
|
https://github.com/louislam/uptime-kuma-wiki
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
### Arch
|
||||||
|
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
- armv7
|
||||||
|
|
||||||
|
### Docker Tags
|
||||||
|
|
||||||
|
#### v2
|
||||||
|
|
||||||
|
- `2`, `latest-2`: v2 with full features such as Chromium and bundled MariaDB
|
||||||
|
- `2.x.x`
|
||||||
|
- `2-slim`: v2 with basic features
|
||||||
|
- `2.x.x-slim`
|
||||||
|
- `beta2`: Latest beta build
|
||||||
|
- `2.x.x-beta.x`
|
||||||
|
- `nightly2`: Dev build
|
||||||
|
- `base2`: Basic Debian setup without Uptime Kuma source code (Full features)
|
||||||
|
- `base2-slim`: Basic Debian setup without Uptime Kuma source code
|
||||||
|
- `pr-test2`: For testing pull request without setting up a local environment
|
||||||
|
|
||||||
|
#### v1
|
||||||
|
|
||||||
|
- `1`, `latest`, `1-debian`, `debian`: Latest version of v1
|
||||||
|
- `1.x.x`, `1.x.x-debian`
|
||||||
|
- `1.x.x-beta.x`: Beta build
|
||||||
|
- `beta`: Latest beta build
|
||||||
|
- `nightly`: Dev build
|
||||||
|
- `base-debian`: Basic Debian setup without Uptime Kuma source code
|
||||||
|
- `pr-test`: For testing pull request without setting up a local environment
|
||||||
|
- `base-alpine`: (Deprecated) Basic Alpine setup without Uptime Kuma source code
|
||||||
|
- `1-alpine`, `alpine`: (Deprecated)
|
||||||
|
- `1.x.x-alpine`: (Deprecated)
|
||||||
|
|
||||||
## Maintainer
|
## Maintainer
|
||||||
|
|
||||||
Check the latest issues and pull requests:
|
Check the latest issues and pull requests:
|
||||||
https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc
|
https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc
|
||||||
|
|
||||||
### Release Procedures
|
### What is a maintainer and what are their roles?
|
||||||
|
|
||||||
1. Draft a release note
|
This project has multiple maintainers which specialise in different areas.
|
||||||
2. Make sure the repo is cleared
|
Currently, there are 3 maintainers:
|
||||||
3. If the healthcheck is updated, remember to re-compile it: `npm run build-docker-builder-go`
|
|
||||||
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. Deploy to the demo server: `npm run deploy-demo-server`
|
|
||||||
|
|
||||||
Checking:
|
| Person | Role | Main Area |
|
||||||
|
|-------------------|-------------------|------------------|
|
||||||
|
| `@louislam` | senior maintainer | major features |
|
||||||
|
| `@chakflying` | junior maintainer | fixing bugs |
|
||||||
|
| `@commanderstorm` | junior maintainer | issue-management |
|
||||||
|
|
||||||
- Check all tags is fine on https://hub.docker.com/r/louislam/uptime-kuma/tags
|
### Procedures
|
||||||
- Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 / armv7)
|
|
||||||
- Try clean installation with Node.js
|
|
||||||
|
|
||||||
### Release Beta Procedures
|
We have a few procedures we follow. These are documented here:
|
||||||
|
- <details><summary>Set up a Docker Builder</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
1. Draft a release note, check "This is a pre-release"
|
- amd64, armv7 using local.
|
||||||
2. Make sure the repo is cleared
|
- arm64 using remote arm64 cpu, as the emulator is too slow and can no longer pass the `npm ci` command.
|
||||||
3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN`
|
1. Add the public key to the remote server.
|
||||||
4. Wait until the `Press any key to continue`
|
2. Add the remote context. The remote machine must be arm64 and installed Docker CE.
|
||||||
5. Publish the release note as 1.X.X-beta.X
|
```
|
||||||
6. Press any key to continue
|
docker context create oracle-arm64-jp --docker "host=ssh://root@100.107.174.88"
|
||||||
|
```
|
||||||
|
3. Create a new builder.
|
||||||
|
```
|
||||||
|
docker buildx create --name kuma-builder --platform linux/amd64,linux/arm/v7
|
||||||
|
docker buildx use kuma-builder
|
||||||
|
docker buildx inspect --bootstrap
|
||||||
|
```
|
||||||
|
4. Append the remote context to the builder.
|
||||||
|
```
|
||||||
|
docker buildx create --append --name kuma-builder --platform linux/arm64 oracle-arm64-jp
|
||||||
|
```
|
||||||
|
5. Verify the builder and check if the builder is using `kuma-builder`.
|
||||||
|
```
|
||||||
|
docker buildx inspect kuma-builder
|
||||||
|
docker buildx ls
|
||||||
|
```
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Release</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
### Release Wiki
|
1. Draft a release note
|
||||||
|
2. Make sure the repo is cleared
|
||||||
|
3. If the healthcheck is updated, remember to re-compile it: `npm run build-docker-builder-go`
|
||||||
|
4. `npm run release-final` with env vars: `VERSION` and `GITHUB_TOKEN`
|
||||||
|
5. Wait until the `Press any key to continue`
|
||||||
|
6. `git push`
|
||||||
|
7. Publish the release note as `1.X.X`
|
||||||
|
8. Press any key to continue
|
||||||
|
9. Deploy to the demo server: `npm run deploy-demo-server`
|
||||||
|
|
||||||
#### Setup Repo
|
These Items need to be checked:
|
||||||
|
|
||||||
```bash
|
- [ ] Check all tags is fine on https://hub.docker.com/r/louislam/uptime-kuma/tags
|
||||||
git clone https://github.com/louislam/uptime-kuma-wiki.git
|
- [ ] Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 / armv7)
|
||||||
cd uptime-kuma-wiki
|
- [ ] Try clean installation with Node.js
|
||||||
git remote add production https://github.com/louislam/uptime-kuma.wiki.git
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Push to Production Wiki
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Release Beta</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
```bash
|
1. Draft a release note, check `This is a pre-release`
|
||||||
git pull
|
2. Make sure the repo is cleared
|
||||||
git push production master
|
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
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Release Wiki</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
**Setup Repo**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/louislam/uptime-kuma-wiki.git
|
||||||
|
cd uptime-kuma-wiki
|
||||||
|
git remote add production https://github.com/louislam/uptime-kuma.wiki.git
|
||||||
|
```
|
||||||
|
|
||||||
|
**Push to Production Wiki**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git pull
|
||||||
|
git push production master
|
||||||
|
```
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Change the base of a pull request such as <code>master</code> to <code>1.23.X</code></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git rebase --onto <new parent> <old parent>
|
||||||
|
```
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
|
98
README.md
98
README.md
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
||||||
|
|
||||||
<a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/stars/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/pulls/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/v/louislam/uptime-kuma/latest?label=docker%20image%20ver." /></a> <a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/last-commit/louislam/uptime-kuma" /></a> <a target="_blank" href="https://opencollective.com/uptime-kuma"><img src="https://opencollective.com/uptime-kuma/total/badge.svg?label=Open%20Collective%20Backers&color=brightgreen" /></a>
|
<a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/stars/louislam/uptime-kuma?style=flat" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/pulls/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/v/louislam/uptime-kuma/latest?label=docker%20image%20ver." /></a> <a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/last-commit/louislam/uptime-kuma" /></a> <a target="_blank" href="https://opencollective.com/uptime-kuma"><img src="https://opencollective.com/uptime-kuma/total/badge.svg?label=Open%20Collective%20Backers&color=brightgreen" /></a>
|
||||||
[![GitHub Sponsors](https://img.shields.io/github/sponsors/louislam?label=GitHub%20Sponsors)](https://github.com/sponsors/louislam) <a href="https://weblate.kuma.pet/projects/uptime-kuma/uptime-kuma/">
|
[![GitHub Sponsors](https://img.shields.io/github/sponsors/louislam?label=GitHub%20Sponsors)](https://github.com/sponsors/louislam) <a href="https://weblate.kuma.pet/projects/uptime-kuma/uptime-kuma/">
|
||||||
<img src="https://weblate.kuma.pet/widgets/uptime-kuma/-/svg-badge.svg" alt="Translation status" />
|
<img src="https://weblate.kuma.pet/widgets/uptime-kuma/-/svg-badge.svg" alt="Translation status" />
|
||||||
</a>
|
</a>
|
||||||
|
@ -17,23 +17,23 @@ Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
||||||
|
|
||||||
Try it!
|
Try it!
|
||||||
|
|
||||||
- Tokyo Demo Server: https://demo.uptime.kuma.pet (Sponsored by [Uptime Kuma Sponsors](https://github.com/louislam/uptime-kuma#%EF%B8%8F-sponsors))
|
Demo Server (Location: Frankfurt - Germany): https://demo.kuma.pet/start-demo
|
||||||
|
|
||||||
It is a temporary live demo, all data will be deleted after 10 minutes. Use the one that is closer to you, but I suggest that you should install and try it out for the best demo experience.
|
It is a temporary live demo, all data will be deleted after 10 minutes. Sponsored by [Uptime Kuma Sponsors](https://github.com/louislam/uptime-kuma#%EF%B8%8F-sponsors).
|
||||||
|
|
||||||
## ⭐ Features
|
## ⭐ Features
|
||||||
|
|
||||||
* Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers
|
- Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers
|
||||||
* Fancy, Reactive, Fast UI/UX
|
- Fancy, Reactive, Fast UI/UX
|
||||||
* Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications)
|
- Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications)
|
||||||
* 20-second intervals
|
- 20-second intervals
|
||||||
* [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang)
|
- [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang)
|
||||||
* Multiple status pages
|
- Multiple status pages
|
||||||
* Map status pages to specific domains
|
- Map status pages to specific domains
|
||||||
* Ping chart
|
- Ping chart
|
||||||
* Certificate info
|
- Certificate info
|
||||||
* Proxy support
|
- Proxy support
|
||||||
* 2FA support
|
- 2FA support
|
||||||
|
|
||||||
## 🔧 How to Install
|
## 🔧 How to Install
|
||||||
|
|
||||||
|
@ -43,26 +43,32 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the
|
||||||
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
|
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
|
||||||
```
|
```
|
||||||
|
|
||||||
⚠️ Please use a **local volume** only. Other types such as NFS are not supported.
|
Uptime Kuma is now running on <http://0.0.0.0:3001>.
|
||||||
|
|
||||||
Uptime Kuma is now running on http://localhost:3001
|
> [!WARNING]
|
||||||
|
> File Systems like **NFS** (Network File System) are **NOT** supported. Please map to a local directory or volume.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> If you want to limit exposure to localhost (without exposing port for other users or to use a [reverse proxy](https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy)), you can expose the port like this:
|
||||||
|
>
|
||||||
|
> ```bash
|
||||||
|
> docker run -d --restart=always -p 127.0.0.1:3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
|
||||||
|
> ```
|
||||||
|
|
||||||
### 💪🏻 Non-Docker
|
### 💪🏻 Non-Docker
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
- Platform
|
- Platform
|
||||||
- ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc.
|
- ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc.
|
||||||
- ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher
|
- ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher
|
||||||
- ❌ Replit / Heroku
|
- ❌ Replit / Heroku
|
||||||
- [Node.js](https://nodejs.org/en/download/) 14 / 16 / 18 / 20.4
|
- [Node.js](https://nodejs.org/en/download/) 18 / 20.4
|
||||||
- [npm](https://docs.npmjs.com/cli/) >= 7
|
- [npm](https://docs.npmjs.com/cli/) 9
|
||||||
- [Git](https://git-scm.com/downloads)
|
- [Git](https://git-scm.com/downloads)
|
||||||
- [pm2](https://pm2.keymetrics.io/) - For running Uptime Kuma in the background
|
- [pm2](https://pm2.keymetrics.io/) - For running Uptime Kuma in the background
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Update your npm to the latest version
|
|
||||||
npm install npm -g
|
|
||||||
|
|
||||||
git clone https://github.com/louislam/uptime-kuma.git
|
git clone https://github.com/louislam/uptime-kuma.git
|
||||||
cd uptime-kuma
|
cd uptime-kuma
|
||||||
npm run setup
|
npm run setup
|
||||||
|
@ -76,9 +82,8 @@ npm install pm2 -g && pm2 install pm2-logrotate
|
||||||
|
|
||||||
# Start Server
|
# Start Server
|
||||||
pm2 start server/server.js --name uptime-kuma
|
pm2 start server/server.js --name uptime-kuma
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Uptime Kuma is now running on http://localhost:3001
|
Uptime Kuma is now running on http://localhost:3001
|
||||||
|
|
||||||
More useful PM2 Commands
|
More useful PM2 Commands
|
||||||
|
@ -91,10 +96,6 @@ pm2 monit
|
||||||
pm2 save && pm2 startup
|
pm2 save && pm2 startup
|
||||||
```
|
```
|
||||||
|
|
||||||
### Windows Portable (x64)
|
|
||||||
|
|
||||||
https://github.com/louislam/uptime-kuma/releases/download/1.23.1/uptime-kuma-windows-x64-portable-1.23.1.zip
|
|
||||||
|
|
||||||
### Advanced Installation
|
### Advanced Installation
|
||||||
|
|
||||||
If you need more options or need to browse via a reverse proxy, please read:
|
If you need more options or need to browse via a reverse proxy, please read:
|
||||||
|
@ -113,10 +114,6 @@ I will assign requests/issues to the next milestone.
|
||||||
|
|
||||||
https://github.com/louislam/uptime-kuma/milestones
|
https://github.com/louislam/uptime-kuma/milestones
|
||||||
|
|
||||||
Project Plan:
|
|
||||||
|
|
||||||
https://github.com/users/louislam/projects/4/views/1
|
|
||||||
|
|
||||||
## ❤️ Sponsors
|
## ❤️ Sponsors
|
||||||
|
|
||||||
Thank you so much! (GitHub Sponsors will be updated manually. OpenCollective sponsors will be updated automatically, the list will be cached by GitHub though. It may need some time to be updated)
|
Thank you so much! (GitHub Sponsors will be updated manually. OpenCollective sponsors will be updated automatically, the list will be cached by GitHub though. It may need some time to be updated)
|
||||||
|
@ -143,29 +140,33 @@ Telegram Notification Sample:
|
||||||
|
|
||||||
## Motivation
|
## 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 no longer maintained.
|
- I was looking for a self-hosted monitoring tool like "Uptime Robot", but it is hard to find a suitable one. One of the closest ones is statping. Unfortunately, it is not stable and no longer maintained.
|
||||||
* Want to build a fancy UI.
|
- Wanted to build a fancy UI.
|
||||||
* Learn Vue 3 and vite.js.
|
- Learn Vue 3 and vite.js.
|
||||||
* Show the power of Bootstrap 5.
|
- Show the power of Bootstrap 5.
|
||||||
* Try to use WebSocket with SPA instead of REST API.
|
- Try to use WebSocket with SPA instead of a REST API.
|
||||||
* Deploy my first Docker image to Docker Hub.
|
- Deploy my first Docker image to Docker Hub.
|
||||||
|
|
||||||
If you love this project, please consider giving me a ⭐.
|
If you love this project, please consider giving it a ⭐.
|
||||||
|
|
||||||
## 🗣️ Discussion / Ask for Help
|
## 🗣️ Discussion / Ask for Help
|
||||||
|
|
||||||
⚠️ For any general or technical questions, please don't send me an email, as I am unable to provide support in that manner. I will not response if you asked such questions.
|
⚠️ For any general or technical questions, please don't send me an email, as I am unable to provide support in that manner. I will not respond if you ask questions there.
|
||||||
|
|
||||||
I recommend using Google, GitHub Issues, or Uptime Kuma's Subreddit for finding answers to your question. If you cannot find the information you need, feel free to ask:
|
I recommend using Google, GitHub Issues, or Uptime Kuma's subreddit for finding answers to your question. If you cannot find the information you need, feel free to ask:
|
||||||
|
|
||||||
- [GitHub Issues](https://github.com/louislam/uptime-kuma/issues)
|
- [GitHub Issues](https://github.com/louislam/uptime-kuma/issues)
|
||||||
- [Subreddit r/Uptime kuma](https://www.reddit.com/r/UptimeKuma/)
|
- [Subreddit (r/UptimeKuma)](https://www.reddit.com/r/UptimeKuma/)
|
||||||
|
|
||||||
My Reddit account: [u/louislamlam](https://reddit.com/u/louislamlam).
|
My Reddit account: [u/louislamlam](https://reddit.com/u/louislamlam)
|
||||||
You can mention me if you ask a question on Reddit.
|
You can mention me if you ask a question on the subreddit.
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
## Contribute
|
### Create Pull Requests
|
||||||
|
|
||||||
|
We DO NOT accept all types of pull requests and do not want to waste your time. Please be sure that you have read and follow pull request rules:
|
||||||
|
[CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma](https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma)
|
||||||
|
|
||||||
### Test Pull Requests
|
### Test Pull Requests
|
||||||
|
|
||||||
|
@ -179,15 +180,16 @@ https://github.com/louislam/uptime-kuma/wiki/Test-Pull-Requests
|
||||||
Check out the latest beta release here: https://github.com/louislam/uptime-kuma/releases
|
Check out the latest beta release here: https://github.com/louislam/uptime-kuma/releases
|
||||||
|
|
||||||
### Bug Reports / Feature Requests
|
### Bug Reports / Feature Requests
|
||||||
|
|
||||||
If you want to report a bug or request a new feature, feel free to open a [new issue](https://github.com/louislam/uptime-kuma/issues).
|
If you want to report a bug or request a new feature, feel free to open a [new issue](https://github.com/louislam/uptime-kuma/issues).
|
||||||
|
|
||||||
### Translations
|
### Translations
|
||||||
|
|
||||||
If you want to translate Uptime Kuma into your language, please visit [Weblate Readme](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
|
If you want to translate Uptime Kuma into your language, please visit [Weblate Readme](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
|
||||||
|
|
||||||
## Spelling & Grammar
|
### Spelling & Grammar
|
||||||
|
|
||||||
Feel free to correct the grammar in the documentation or code.
|
Feel free to correct the grammar in the documentation or code.
|
||||||
My mother language is not english and my grammar is not that great.
|
My mother language is not English and my grammar is not that great.
|
||||||
|
|
||||||
|
|
||||||
### Create Pull Requests
|
|
||||||
If you want to modify Uptime Kuma, please read this guide and follow the rules here: https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
1. Please report security issues to https://github.com/louislam/uptime-kuma/security/advisories/new.
|
1. Please report security issues to https://github.com/louislam/uptime-kuma/security/advisories/new.
|
||||||
1. Please also create an empty security issue to alert me, as GitHub Advisories do not send a notification, I probably will miss it without this. https://github.com/louislam/uptime-kuma/issues/new?assignees=&labels=help&template=security.md
|
2. Please also create an empty security issue to alert me, as GitHub Advisories do not send a notification, I probably will miss it without this. https://github.com/louislam/uptime-kuma/issues/new?assignees=&labels=help&template=security.md
|
||||||
|
|
||||||
Do not use the public issue tracker or discuss it in public as it will cause more damage.
|
Do not use the public issue tracker or discuss it in public as it will cause more damage.
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ You should use or upgrade to the latest version of Uptime Kuma. All `1.X.X` vers
|
||||||
### Upgradable Docker Tags
|
### Upgradable Docker Tags
|
||||||
|
|
||||||
| Tag | Supported |
|
| Tag | Supported |
|
||||||
| ------- | ------------------ |
|
|-|-|
|
||||||
| 1 | :white_check_mark: |
|
| 1 | :white_check_mark: |
|
||||||
| 1-debian | :white_check_mark: |
|
| 1-debian | :white_check_mark: |
|
||||||
| latest | :white_check_mark: |
|
| latest | :white_check_mark: |
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
const config = {};
|
|
||||||
|
|
||||||
if (process.env.TEST_FRONTEND) {
|
|
||||||
config.presets = [ "@babel/preset-env" ];
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = config;
|
|
9
compose.yaml
Normal file
9
compose.yaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
services:
|
||||||
|
uptime-kuma:
|
||||||
|
image: louislam/uptime-kuma:1
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/data
|
||||||
|
ports:
|
||||||
|
# <Host Port>:<Container Port>
|
||||||
|
- 3001:3001
|
||||||
|
restart: unless-stopped
|
|
@ -1,28 +0,0 @@
|
||||||
const { defineConfig } = require("cypress");
|
|
||||||
|
|
||||||
module.exports = defineConfig({
|
|
||||||
projectId: "vyjuem",
|
|
||||||
e2e: {
|
|
||||||
experimentalStudio: true,
|
|
||||||
setupNodeEvents(on, config) {
|
|
||||||
|
|
||||||
},
|
|
||||||
fixturesFolder: "test/cypress/fixtures",
|
|
||||||
screenshotsFolder: "test/cypress/screenshots",
|
|
||||||
videosFolder: "test/cypress/videos",
|
|
||||||
downloadsFolder: "test/cypress/downloads",
|
|
||||||
supportFile: "test/cypress/support/e2e.js",
|
|
||||||
baseUrl: "http://localhost:3002",
|
|
||||||
defaultCommandTimeout: 10000,
|
|
||||||
pageLoadTimeout: 60000,
|
|
||||||
viewportWidth: 1920,
|
|
||||||
viewportHeight: 1080,
|
|
||||||
specPattern: [
|
|
||||||
"test/cypress/e2e/setup.cy.js",
|
|
||||||
"test/cypress/e2e/**/*.js"
|
|
||||||
],
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
baseUrl: "http://localhost:3002",
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,10 +0,0 @@
|
||||||
const { defineConfig } = require("cypress");
|
|
||||||
|
|
||||||
module.exports = defineConfig({
|
|
||||||
e2e: {
|
|
||||||
supportFile: false,
|
|
||||||
specPattern: [
|
|
||||||
"test/cypress/unit/**/*.js"
|
|
||||||
],
|
|
||||||
}
|
|
||||||
});
|
|
60
config/playwright.config.js
Normal file
60
config/playwright.config.js
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
import { defineConfig, devices } from "@playwright/test";
|
||||||
|
|
||||||
|
const port = 30001;
|
||||||
|
const url = `http://localhost:${port}`;
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
// Look for test files in the "tests" directory, relative to this configuration file.
|
||||||
|
testDir: "../test/e2e",
|
||||||
|
outputDir: "../private/playwright-test-results",
|
||||||
|
fullyParallel: false,
|
||||||
|
locale: "en-US",
|
||||||
|
|
||||||
|
// Fail the build on CI if you accidentally left test.only in the source code.
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
|
||||||
|
// Retry on CI only.
|
||||||
|
retries: process.env.CI ? 2 : 0,
|
||||||
|
|
||||||
|
// Opt out of parallel tests on CI.
|
||||||
|
workers: 1,
|
||||||
|
|
||||||
|
// Reporter to use
|
||||||
|
reporter: [
|
||||||
|
[
|
||||||
|
"html", {
|
||||||
|
outputFolder: "../private/playwright-report",
|
||||||
|
open: "never",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
use: {
|
||||||
|
// Base URL to use in actions like `await page.goto('/')`.
|
||||||
|
baseURL: url,
|
||||||
|
|
||||||
|
// Collect trace when retrying the failed test.
|
||||||
|
trace: "on-first-retry",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Configure projects for major browsers.
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: "chromium",
|
||||||
|
use: { ...devices["Desktop Chrome"] },
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
name: "firefox",
|
||||||
|
use: { browserName: "firefox" }
|
||||||
|
},*/
|
||||||
|
],
|
||||||
|
|
||||||
|
// Run your local dev server before starting the tests.
|
||||||
|
webServer: {
|
||||||
|
command: `node extra/remove-playwright-test-data.js && node server/server.js --port=${port} --data-dir=./data/playwright-test`,
|
||||||
|
url,
|
||||||
|
reuseExistingServer: false,
|
||||||
|
cwd: "../",
|
||||||
|
},
|
||||||
|
});
|
|
@ -1,8 +1,8 @@
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import visualizer from "rollup-plugin-visualizer";
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
import viteCompression from "vite-plugin-compression";
|
import viteCompression from "vite-plugin-compression";
|
||||||
|
import VueDevTools from "vite-plugin-vue-devtools";
|
||||||
|
|
||||||
const postCssScss = require("postcss-scss");
|
const postCssScss = require("postcss-scss");
|
||||||
const postcssRTLCSS = require("postcss-rtlcss");
|
const postcssRTLCSS = require("postcss-rtlcss");
|
||||||
|
@ -22,9 +22,6 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
legacy({
|
|
||||||
targets: [ "since 2015" ],
|
|
||||||
}),
|
|
||||||
visualizer({
|
visualizer({
|
||||||
filename: "tmp/dist-stats.html"
|
filename: "tmp/dist-stats.html"
|
||||||
}),
|
}),
|
||||||
|
@ -36,6 +33,7 @@ export default defineConfig({
|
||||||
algorithm: "brotliCompress",
|
algorithm: "brotliCompress",
|
||||||
filter: viteCompressionFilter,
|
filter: viteCompressionFilter,
|
||||||
}),
|
}),
|
||||||
|
VueDevTools(),
|
||||||
],
|
],
|
||||||
css: {
|
css: {
|
||||||
postcss: {
|
postcss: {
|
||||||
|
|
565
db/knex_init_db.js
Normal file
565
db/knex_init_db.js
Normal file
|
@ -0,0 +1,565 @@
|
||||||
|
const { R } = require("redbean-node");
|
||||||
|
const { log } = require("../src/util");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ⚠️⚠️⚠️⚠️⚠️⚠️ DO NOT ADD ANYTHING HERE!
|
||||||
|
* IF YOU NEED TO ADD FIELDS, ADD IT TO ./db/knex_migrations
|
||||||
|
* See ./db/knex_migrations/README.md for more information
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function createTables() {
|
||||||
|
log.info("mariadb", "Creating basic tables for MariaDB");
|
||||||
|
const knex = R.knex;
|
||||||
|
|
||||||
|
// TODO: Should check later if it is really the final patch sql file.
|
||||||
|
|
||||||
|
// docker_host
|
||||||
|
await knex.schema.createTable("docker_host", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("user_id").unsigned().notNullable();
|
||||||
|
table.string("docker_daemon", 255);
|
||||||
|
table.string("docker_type", 255);
|
||||||
|
table.string("name", 255);
|
||||||
|
});
|
||||||
|
|
||||||
|
// group
|
||||||
|
await knex.schema.createTable("group", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("name", 255).notNullable();
|
||||||
|
table.datetime("created_date").notNullable().defaultTo(knex.fn.now());
|
||||||
|
table.boolean("public").notNullable().defaultTo(false);
|
||||||
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
|
table.integer("weight").notNullable().defaultTo(1000);
|
||||||
|
table.integer("status_page_id").unsigned();
|
||||||
|
});
|
||||||
|
|
||||||
|
// proxy
|
||||||
|
await knex.schema.createTable("proxy", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("user_id").unsigned().notNullable();
|
||||||
|
table.string("protocol", 10).notNullable();
|
||||||
|
table.string("host", 255).notNullable();
|
||||||
|
table.smallint("port").notNullable(); // TODO: Maybe a issue with MariaDB, need migration to int
|
||||||
|
table.boolean("auth").notNullable();
|
||||||
|
table.string("username", 255).nullable();
|
||||||
|
table.string("password", 255).nullable();
|
||||||
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
|
table.boolean("default").notNullable().defaultTo(false);
|
||||||
|
table.datetime("created_date").notNullable().defaultTo(knex.fn.now());
|
||||||
|
|
||||||
|
table.index("user_id", "proxy_user_id");
|
||||||
|
});
|
||||||
|
|
||||||
|
// user
|
||||||
|
await knex.schema.createTable("user", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("username", 255).notNullable().unique().collate("utf8_general_ci");
|
||||||
|
table.string("password", 255);
|
||||||
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
|
table.string("timezone", 150);
|
||||||
|
table.string("twofa_secret", 64);
|
||||||
|
table.boolean("twofa_status").notNullable().defaultTo(false);
|
||||||
|
table.string("twofa_last_token", 6);
|
||||||
|
});
|
||||||
|
|
||||||
|
// monitor
|
||||||
|
await knex.schema.createTable("monitor", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("name", 150);
|
||||||
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
|
table.integer("user_id").unsigned()
|
||||||
|
.references("id").inTable("user")
|
||||||
|
.onDelete("SET NULL")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("interval").notNullable().defaultTo(20);
|
||||||
|
table.text("url");
|
||||||
|
table.string("type", 20);
|
||||||
|
table.integer("weight").defaultTo(2000);
|
||||||
|
table.string("hostname", 255);
|
||||||
|
table.integer("port");
|
||||||
|
table.datetime("created_date").notNullable().defaultTo(knex.fn.now());
|
||||||
|
table.string("keyword", 255);
|
||||||
|
table.integer("maxretries").notNullable().defaultTo(0);
|
||||||
|
table.boolean("ignore_tls").notNullable().defaultTo(false);
|
||||||
|
table.boolean("upside_down").notNullable().defaultTo(false);
|
||||||
|
table.integer("maxredirects").notNullable().defaultTo(10);
|
||||||
|
table.text("accepted_statuscodes_json").notNullable().defaultTo("[\"200-299\"]");
|
||||||
|
table.string("dns_resolve_type", 5);
|
||||||
|
table.string("dns_resolve_server", 255);
|
||||||
|
table.string("dns_last_result", 255);
|
||||||
|
table.integer("retry_interval").notNullable().defaultTo(0);
|
||||||
|
table.string("push_token", 20).defaultTo(null);
|
||||||
|
table.text("method").notNullable().defaultTo("GET");
|
||||||
|
table.text("body").defaultTo(null);
|
||||||
|
table.text("headers").defaultTo(null);
|
||||||
|
table.text("basic_auth_user").defaultTo(null);
|
||||||
|
table.text("basic_auth_pass").defaultTo(null);
|
||||||
|
table.integer("docker_host").unsigned()
|
||||||
|
.references("id").inTable("docker_host");
|
||||||
|
table.string("docker_container", 255);
|
||||||
|
table.integer("proxy_id").unsigned()
|
||||||
|
.references("id").inTable("proxy");
|
||||||
|
table.boolean("expiry_notification").defaultTo(true);
|
||||||
|
table.text("mqtt_topic");
|
||||||
|
table.string("mqtt_success_message", 255);
|
||||||
|
table.string("mqtt_username", 255);
|
||||||
|
table.string("mqtt_password", 255);
|
||||||
|
table.string("database_connection_string", 2000);
|
||||||
|
table.text("database_query");
|
||||||
|
table.string("auth_method", 250);
|
||||||
|
table.text("auth_domain");
|
||||||
|
table.text("auth_workstation");
|
||||||
|
table.string("grpc_url", 255).defaultTo(null);
|
||||||
|
table.text("grpc_protobuf").defaultTo(null);
|
||||||
|
table.text("grpc_body").defaultTo(null);
|
||||||
|
table.text("grpc_metadata").defaultTo(null);
|
||||||
|
table.text("grpc_method").defaultTo(null);
|
||||||
|
table.text("grpc_service_name").defaultTo(null);
|
||||||
|
table.boolean("grpc_enable_tls").notNullable().defaultTo(false);
|
||||||
|
table.string("radius_username", 255);
|
||||||
|
table.string("radius_password", 255);
|
||||||
|
table.string("radius_calling_station_id", 50);
|
||||||
|
table.string("radius_called_station_id", 50);
|
||||||
|
table.string("radius_secret", 255);
|
||||||
|
table.integer("resend_interval").notNullable().defaultTo(0);
|
||||||
|
table.integer("packet_size").notNullable().defaultTo(56);
|
||||||
|
table.string("game", 255);
|
||||||
|
});
|
||||||
|
|
||||||
|
// heartbeat
|
||||||
|
await knex.schema.createTable("heartbeat", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.boolean("important").notNullable().defaultTo(false);
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.smallint("status").notNullable();
|
||||||
|
|
||||||
|
table.text("msg");
|
||||||
|
table.datetime("time").notNullable();
|
||||||
|
table.integer("ping");
|
||||||
|
table.integer("duration").notNullable().defaultTo(0);
|
||||||
|
table.integer("down_count").notNullable().defaultTo(0);
|
||||||
|
|
||||||
|
table.index("important");
|
||||||
|
table.index([ "monitor_id", "time" ], "monitor_time_index");
|
||||||
|
table.index("monitor_id");
|
||||||
|
table.index([ "monitor_id", "important", "time" ], "monitor_important_time_index");
|
||||||
|
});
|
||||||
|
|
||||||
|
// incident
|
||||||
|
await knex.schema.createTable("incident", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("title", 255).notNullable();
|
||||||
|
table.text("content", 255).notNullable();
|
||||||
|
table.string("style", 30).notNullable().defaultTo("warning");
|
||||||
|
table.datetime("created_date").notNullable().defaultTo(knex.fn.now());
|
||||||
|
table.datetime("last_updated_date");
|
||||||
|
table.boolean("pin").notNullable().defaultTo(true);
|
||||||
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
|
table.integer("status_page_id").unsigned();
|
||||||
|
});
|
||||||
|
|
||||||
|
// maintenance
|
||||||
|
await knex.schema.createTable("maintenance", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("title", 150).notNullable();
|
||||||
|
table.text("description").notNullable();
|
||||||
|
table.integer("user_id").unsigned()
|
||||||
|
.references("id").inTable("user")
|
||||||
|
.onDelete("SET NULL")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
|
table.string("strategy", 50).notNullable().defaultTo("single");
|
||||||
|
table.datetime("start_date");
|
||||||
|
table.datetime("end_date");
|
||||||
|
table.time("start_time");
|
||||||
|
table.time("end_time");
|
||||||
|
table.string("weekdays", 250).defaultTo("[]");
|
||||||
|
table.text("days_of_month").defaultTo("[]");
|
||||||
|
table.integer("interval_day");
|
||||||
|
|
||||||
|
table.index("active");
|
||||||
|
table.index([ "strategy", "active" ], "manual_active");
|
||||||
|
table.index("user_id", "maintenance_user_id");
|
||||||
|
});
|
||||||
|
|
||||||
|
// status_page
|
||||||
|
await knex.schema.createTable("status_page", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("slug", 255).notNullable().unique().collate("utf8_general_ci");
|
||||||
|
table.string("title", 255).notNullable();
|
||||||
|
table.text("description");
|
||||||
|
table.string("icon", 255).notNullable();
|
||||||
|
table.string("theme", 30).notNullable();
|
||||||
|
table.boolean("published").notNullable().defaultTo(true);
|
||||||
|
table.boolean("search_engine_index").notNullable().defaultTo(true);
|
||||||
|
table.boolean("show_tags").notNullable().defaultTo(false);
|
||||||
|
table.string("password");
|
||||||
|
table.datetime("created_date").notNullable().defaultTo(knex.fn.now());
|
||||||
|
table.datetime("modified_date").notNullable().defaultTo(knex.fn.now());
|
||||||
|
table.text("footer_text");
|
||||||
|
table.text("custom_css");
|
||||||
|
table.boolean("show_powered_by").notNullable().defaultTo(true);
|
||||||
|
table.string("google_analytics_tag_id");
|
||||||
|
});
|
||||||
|
|
||||||
|
// maintenance_status_page
|
||||||
|
await knex.schema.createTable("maintenance_status_page", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
|
||||||
|
table.integer("status_page_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("status_page")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
|
||||||
|
table.integer("maintenance_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("maintenance")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
});
|
||||||
|
|
||||||
|
// maintenance_timeslot
|
||||||
|
await knex.schema.createTable("maintenance_timeslot", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("maintenance_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("maintenance")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.datetime("start_date").notNullable();
|
||||||
|
table.datetime("end_date");
|
||||||
|
table.boolean("generated_next").defaultTo(false);
|
||||||
|
|
||||||
|
table.index("maintenance_id");
|
||||||
|
table.index([ "maintenance_id", "start_date", "end_date" ], "active_timeslot_index");
|
||||||
|
table.index("generated_next", "generated_next_index");
|
||||||
|
});
|
||||||
|
|
||||||
|
// monitor_group
|
||||||
|
await knex.schema.createTable("monitor_group", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("group_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("group")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("weight").notNullable().defaultTo(1000);
|
||||||
|
table.boolean("send_url").notNullable().defaultTo(false);
|
||||||
|
|
||||||
|
table.index([ "monitor_id", "group_id" ], "fk");
|
||||||
|
});
|
||||||
|
// monitor_maintenance
|
||||||
|
await knex.schema.createTable("monitor_maintenance", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("maintenance_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("maintenance")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
|
||||||
|
table.index("maintenance_id", "maintenance_id_index2");
|
||||||
|
table.index("monitor_id", "monitor_id_index");
|
||||||
|
});
|
||||||
|
|
||||||
|
// notification
|
||||||
|
await knex.schema.createTable("notification", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("name", 255);
|
||||||
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
|
table.integer("user_id").unsigned();
|
||||||
|
table.boolean("is_default").notNullable().defaultTo(false);
|
||||||
|
table.text("config", "longtext");
|
||||||
|
});
|
||||||
|
|
||||||
|
// monitor_notification
|
||||||
|
await knex.schema.createTable("monitor_notification", (table) => {
|
||||||
|
table.increments("id").unsigned(); // TODO: no auto increment????
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("notification_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("notification")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
|
||||||
|
table.index([ "monitor_id", "notification_id" ], "monitor_notification_index");
|
||||||
|
});
|
||||||
|
|
||||||
|
// tag
|
||||||
|
await knex.schema.createTable("tag", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("name", 255).notNullable();
|
||||||
|
table.string("color", 255).notNullable();
|
||||||
|
table.datetime("created_date").notNullable().defaultTo(knex.fn.now());
|
||||||
|
});
|
||||||
|
|
||||||
|
// monitor_tag
|
||||||
|
await knex.schema.createTable("monitor_tag", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("tag_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("tag")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.text("value");
|
||||||
|
});
|
||||||
|
|
||||||
|
// monitor_tls_info
|
||||||
|
await knex.schema.createTable("monitor_tls_info", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.text("info_json");
|
||||||
|
});
|
||||||
|
|
||||||
|
// notification_sent_history
|
||||||
|
await knex.schema.createTable("notification_sent_history", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("type", 50).notNullable();
|
||||||
|
table.integer("monitor_id").unsigned().notNullable();
|
||||||
|
table.integer("days").notNullable();
|
||||||
|
table.unique([ "type", "monitor_id", "days" ]);
|
||||||
|
table.index([ "type", "monitor_id", "days" ], "good_index");
|
||||||
|
});
|
||||||
|
|
||||||
|
// setting
|
||||||
|
await knex.schema.createTable("setting", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("key", 200).notNullable().unique().collate("utf8_general_ci");
|
||||||
|
table.text("value");
|
||||||
|
table.string("type", 20);
|
||||||
|
});
|
||||||
|
|
||||||
|
// status_page_cname
|
||||||
|
await knex.schema.createTable("status_page_cname", (table) => {
|
||||||
|
table.increments("id");
|
||||||
|
table.integer("status_page_id").unsigned()
|
||||||
|
.references("id").inTable("status_page")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.string("domain").notNullable().unique().collate("utf8_general_ci");
|
||||||
|
});
|
||||||
|
|
||||||
|
/*********************
|
||||||
|
* Converted Patch here
|
||||||
|
*********************/
|
||||||
|
|
||||||
|
// 2023-06-30-1348-http-body-encoding.js
|
||||||
|
// ALTER TABLE monitor ADD http_body_encoding VARCHAR(25);
|
||||||
|
// UPDATE monitor SET http_body_encoding = 'json' WHERE (type = 'http' or type = 'keyword') AND http_body_encoding IS NULL;
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.string("http_body_encoding", 25);
|
||||||
|
});
|
||||||
|
|
||||||
|
await knex("monitor")
|
||||||
|
.where(function () {
|
||||||
|
this.where("type", "http").orWhere("type", "keyword");
|
||||||
|
})
|
||||||
|
.whereNull("http_body_encoding")
|
||||||
|
.update({
|
||||||
|
http_body_encoding: "json",
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2023-06-30-1354-add-description-monitor.js
|
||||||
|
// ALTER TABLE monitor ADD description TEXT default null;
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.text("description").defaultTo(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2023-06-30-1357-api-key-table.js
|
||||||
|
/*
|
||||||
|
CREATE TABLE [api_key] (
|
||||||
|
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
|
[key] VARCHAR(255) NOT NULL,
|
||||||
|
[name] VARCHAR(255) NOT NULL,
|
||||||
|
[user_id] INTEGER NOT NULL,
|
||||||
|
[created_date] DATETIME DEFAULT (DATETIME('now')) NOT NULL,
|
||||||
|
[active] BOOLEAN DEFAULT 1 NOT NULL,
|
||||||
|
[expires] DATETIME DEFAULT NULL,
|
||||||
|
CONSTRAINT FK_user FOREIGN KEY ([user_id]) REFERENCES [user]([id]) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
await knex.schema.createTable("api_key", function (table) {
|
||||||
|
table.increments("id").primary();
|
||||||
|
table.string("key", 255).notNullable();
|
||||||
|
table.string("name", 255).notNullable();
|
||||||
|
table.integer("user_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("user")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.dateTime("created_date").defaultTo(knex.fn.now()).notNullable();
|
||||||
|
table.boolean("active").defaultTo(1).notNullable();
|
||||||
|
table.dateTime("expires").defaultTo(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2023-06-30-1400-monitor-tls.js
|
||||||
|
/*
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD tls_ca TEXT default null;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD tls_cert TEXT default null;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD tls_key TEXT default null;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.text("tls_ca").defaultTo(null);
|
||||||
|
table.text("tls_cert").defaultTo(null);
|
||||||
|
table.text("tls_key").defaultTo(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2023-06-30-1401-maintenance-cron.js
|
||||||
|
/*
|
||||||
|
-- 999 characters. https://stackoverflow.com/questions/46134830/maximum-length-for-cron-job
|
||||||
|
DROP TABLE maintenance_timeslot;
|
||||||
|
ALTER TABLE maintenance ADD cron TEXT;
|
||||||
|
ALTER TABLE maintenance ADD timezone VARCHAR(255);
|
||||||
|
ALTER TABLE maintenance ADD duration INTEGER;
|
||||||
|
*/
|
||||||
|
await knex.schema
|
||||||
|
.dropTableIfExists("maintenance_timeslot")
|
||||||
|
.table("maintenance", function (table) {
|
||||||
|
table.text("cron");
|
||||||
|
table.string("timezone", 255);
|
||||||
|
table.integer("duration");
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2023-06-30-1413-add-parent-monitor.js.
|
||||||
|
/*
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.integer("parent").unsigned()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("SET NULL")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
patch-add-invert-keyword.sql
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD invert_keyword BOOLEAN default 0 not null;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.boolean("invert_keyword").defaultTo(0).notNullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
patch-added-json-query.sql
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD json_path TEXT;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD expected_value VARCHAR(255);
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.text("json_path");
|
||||||
|
table.string("expected_value", 255);
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
patch-added-kafka-producer.sql
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD kafka_producer_topic VARCHAR(255);
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD kafka_producer_brokers TEXT;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD kafka_producer_ssl INTEGER;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD kafka_producer_allow_auto_topic_creation VARCHAR(255);
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD kafka_producer_sasl_options TEXT;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD kafka_producer_message TEXT;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.string("kafka_producer_topic", 255);
|
||||||
|
table.text("kafka_producer_brokers");
|
||||||
|
|
||||||
|
// patch-fix-kafka-producer-booleans.sql
|
||||||
|
table.boolean("kafka_producer_ssl").defaultTo(0).notNullable();
|
||||||
|
table.boolean("kafka_producer_allow_auto_topic_creation").defaultTo(0).notNullable();
|
||||||
|
|
||||||
|
table.text("kafka_producer_sasl_options");
|
||||||
|
table.text("kafka_producer_message");
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
patch-add-certificate-expiry-status-page.sql
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD show_certificate_expiry BOOLEAN default 0 NOT NULL;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("status_page", function (table) {
|
||||||
|
table.boolean("show_certificate_expiry").defaultTo(0).notNullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
patch-monitor-oauth-cc.sql
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD oauth_client_id TEXT default null;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD oauth_client_secret TEXT default null;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD oauth_token_url TEXT default null;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD oauth_scopes TEXT default null;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD oauth_auth_method TEXT default null;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.text("oauth_client_id").defaultTo(null);
|
||||||
|
table.text("oauth_client_secret").defaultTo(null);
|
||||||
|
table.text("oauth_token_url").defaultTo(null);
|
||||||
|
table.text("oauth_scopes").defaultTo(null);
|
||||||
|
table.text("oauth_auth_method").defaultTo(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
patch-add-timeout-monitor.sql
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD timeout DOUBLE default 0 not null;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.double("timeout").defaultTo(0).notNullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
patch-add-gamedig-given-port.sql
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD gamedig_given_port_only BOOLEAN default 1 not null;
|
||||||
|
*/
|
||||||
|
await knex.schema.table("monitor", function (table) {
|
||||||
|
table.boolean("gamedig_given_port_only").defaultTo(1).notNullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info("mariadb", "Created basic tables for MariaDB");
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
createTables,
|
||||||
|
};
|
41
db/knex_migrations/2023-08-16-0000-create-uptime.js
Normal file
41
db/knex_migrations/2023-08-16-0000-create-uptime.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.createTable("stat_minutely", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.comment("This table contains the minutely aggregate statistics for each monitor");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("timestamp")
|
||||||
|
.notNullable()
|
||||||
|
.comment("Unix timestamp rounded down to the nearest minute");
|
||||||
|
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||||
|
table.smallint("up").notNullable();
|
||||||
|
table.smallint("down").notNullable();
|
||||||
|
|
||||||
|
table.unique([ "monitor_id", "timestamp" ]);
|
||||||
|
})
|
||||||
|
.createTable("stat_daily", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.comment("This table contains the daily aggregate statistics for each monitor");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("timestamp")
|
||||||
|
.notNullable()
|
||||||
|
.comment("Unix timestamp rounded down to the nearest day");
|
||||||
|
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||||
|
table.smallint("up").notNullable();
|
||||||
|
table.smallint("down").notNullable();
|
||||||
|
|
||||||
|
table.unique([ "monitor_id", "timestamp" ]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.dropTable("stat_minutely")
|
||||||
|
.dropTable("stat_daily");
|
||||||
|
};
|
16
db/knex_migrations/2023-08-18-0301-heartbeat.js
Normal file
16
db/knex_migrations/2023-08-18-0301-heartbeat.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new column heartbeat.end_time
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.datetime("end_time").nullable().defaultTo(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
// Rename heartbeat.start_time to heartbeat.time
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.dropColumn("end_time");
|
||||||
|
});
|
||||||
|
};
|
15
db/knex_migrations/2023-09-29-0000-heartbeat-retires.js
Normal file
15
db/knex_migrations/2023-09-29-0000-heartbeat-retires.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new column heartbeat.retries
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.integer("retries").notNullable().defaultTo(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.dropColumn("retries");
|
||||||
|
});
|
||||||
|
};
|
16
db/knex_migrations/2023-10-08-0000-mqtt-query.js
Normal file
16
db/knex_migrations/2023-10-08-0000-mqtt-query.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new column monitor.mqtt_check_type
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.string("mqtt_check_type", 255).notNullable().defaultTo("keyword");
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
// Drop column monitor.mqtt_check_type
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.dropColumn("mqtt_check_type");
|
||||||
|
});
|
||||||
|
};
|
14
db/knex_migrations/2023-10-11-1915-push-token-to-32.js
Normal file
14
db/knex_migrations/2023-10-11-1915-push-token-to-32.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
// update monitor.push_token to 32 length
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.string("push_token", 32).alter();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.string("push_token", 20).alter();
|
||||||
|
});
|
||||||
|
};
|
21
db/knex_migrations/2023-10-16-0000-create-remote-browsers.js
Normal file
21
db/knex_migrations/2023-10-16-0000-create-remote-browsers.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.createTable("remote_browser", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("name", 255).notNullable();
|
||||||
|
table.string("url", 255).notNullable();
|
||||||
|
table.integer("user_id").unsigned();
|
||||||
|
}).alterTable("monitor", function (table) {
|
||||||
|
// Add new column monitor.remote_browser
|
||||||
|
table.integer("remote_browser").nullable().defaultTo(null).unsigned()
|
||||||
|
.index()
|
||||||
|
.references("id")
|
||||||
|
.inTable("remote_browser");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema.dropTable("remote_browser").alterTable("monitor", function (table) {
|
||||||
|
table.dropColumn("remote_browser");
|
||||||
|
});
|
||||||
|
};
|
12
db/knex_migrations/2023-12-20-0000-alter-status-page.js
Normal file
12
db/knex_migrations/2023-12-20-0000-alter-status-page.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("status_page", function (table) {
|
||||||
|
table.integer("auto_refresh_interval").defaultTo(300).unsigned();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema.alterTable("status_page", function (table) {
|
||||||
|
table.dropColumn("auto_refresh_interval");
|
||||||
|
});
|
||||||
|
};
|
24
db/knex_migrations/2023-12-21-0000-stat-ping-min-max.js
Normal file
24
db/knex_migrations/2023-12-21-0000-stat-ping-min-max.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||||
|
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||||
|
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.dropColumn("ping_min");
|
||||||
|
table.dropColumn("ping_max");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.dropColumn("ping_min");
|
||||||
|
table.dropColumn("ping_max");
|
||||||
|
});
|
||||||
|
};
|
26
db/knex_migrations/2023-12-22-0000-hourly-uptime.js
Normal file
26
db/knex_migrations/2023-12-22-0000-hourly-uptime.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.createTable("stat_hourly", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.comment("This table contains the hourly aggregate statistics for each monitor");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("timestamp")
|
||||||
|
.notNullable()
|
||||||
|
.comment("Unix timestamp rounded down to the nearest hour");
|
||||||
|
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||||
|
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||||
|
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||||
|
table.smallint("up").notNullable();
|
||||||
|
table.smallint("down").notNullable();
|
||||||
|
|
||||||
|
table.unique([ "monitor_id", "timestamp" ]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.dropTable("stat_hourly");
|
||||||
|
};
|
26
db/knex_migrations/2024-01-22-0000-stats-extras.js
Normal file
26
db/knex_migrations/2024-01-22-0000-stats-extras.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.text("extras").defaultTo(null).comment("Extra statistics during this time period");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.text("extras").defaultTo(null).comment("Extra statistics during this time period");
|
||||||
|
})
|
||||||
|
.alterTable("stat_hourly", function (table) {
|
||||||
|
table.text("extras").defaultTo(null).comment("Extra statistics during this time period");
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.dropColumn("extras");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.dropColumn("extras");
|
||||||
|
})
|
||||||
|
.alterTable("stat_hourly", function (table) {
|
||||||
|
table.dropColumn("extras");
|
||||||
|
});
|
||||||
|
};
|
56
db/knex_migrations/README.md
Normal file
56
db/knex_migrations/README.md
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
# Info
|
||||||
|
|
||||||
|
https://knexjs.org/guide/migrations.html#knexfile-in-other-languages
|
||||||
|
|
||||||
|
## Basic rules
|
||||||
|
|
||||||
|
- All tables must have a primary key named `id`
|
||||||
|
- Filename format: `YYYY-MM-DD-HHMM-patch-name.js`
|
||||||
|
- Avoid native SQL syntax, use knex methods, because Uptime Kuma supports SQLite and MariaDB.
|
||||||
|
|
||||||
|
## Template
|
||||||
|
|
||||||
|
```js
|
||||||
|
exports.up = function(knex) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function(knex) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// exports.config = { transaction: false };
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Filename: 2023-06-30-1348-create-user-and-product.js
|
||||||
|
|
||||||
|
```js
|
||||||
|
exports.up = function(knex) {
|
||||||
|
return knex.schema
|
||||||
|
.createTable('user', function (table) {
|
||||||
|
table.increments('id');
|
||||||
|
table.string('first_name', 255).notNullable();
|
||||||
|
table.string('last_name', 255).notNullable();
|
||||||
|
})
|
||||||
|
.createTable('product', function (table) {
|
||||||
|
table.increments('id');
|
||||||
|
table.decimal('price').notNullable();
|
||||||
|
table.string('name', 1000).notNullable();
|
||||||
|
}).then(() => {
|
||||||
|
knex("products").insert([
|
||||||
|
{ price: 10, name: "Apple" },
|
||||||
|
{ price: 20, name: "Orange" },
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function(knex) {
|
||||||
|
return knex.schema
|
||||||
|
.dropTable("product")
|
||||||
|
.dropTable("user");
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
https://knexjs.org/guide/migrations.html#transactions-in-migrations
|
3
db/old_migrations/README.md
Normal file
3
db/old_migrations/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Don't create a new migration file here
|
||||||
|
|
||||||
|
Please go to ./db/knex_migrations/README.md
|
|
@ -1,5 +1,7 @@
|
||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor_group
|
ALTER TABLE monitor_group
|
||||||
ADD send_url BOOLEAN DEFAULT 0 NOT NULL;
|
ADD send_url BOOLEAN DEFAULT 0 NOT NULL;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
|
@ -1,4 +1,7 @@
|
||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
ALTER TABLE status_page ADD google_analytics_tag_id VARCHAR;
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD game VARCHAR(255);
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD google_analytics_tag_id VARCHAR;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -1,6 +1,7 @@
|
||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
COMMIT
|
COMMIT;
|
|
@ -1,3 +1,4 @@
|
||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
|
@ -15,4 +16,4 @@ ALTER TABLE monitor
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD radius_secret VARCHAR(255);
|
ADD radius_secret VARCHAR(255);
|
||||||
|
|
||||||
COMMIT
|
COMMIT;
|
|
@ -3,4 +3,5 @@ BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD timeout DOUBLE default 0 not null;
|
ADD timeout DOUBLE default 0 not null;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
|
@ -1,5 +1,6 @@
|
||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
CREATE TABLE [api_key] (
|
CREATE TABLE [api_key] (
|
||||||
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
[key] VARCHAR(255) NOT NULL,
|
[key] VARCHAR(255) NOT NULL,
|
||||||
|
@ -10,4 +11,5 @@ CREATE TABLE [api_key] (
|
||||||
[expires] DATETIME DEFAULT NULL,
|
[expires] DATETIME DEFAULT NULL,
|
||||||
CONSTRAINT FK_user FOREIGN KEY ([user_id]) REFERENCES [user]([id]) ON DELETE CASCADE ON UPDATE CASCADE
|
CONSTRAINT FK_user FOREIGN KEY ([user_id]) REFERENCES [user]([id]) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
18
db/old_migrations/patch-monitor-tls-info-add-fk.sql
Normal file
18
db/old_migrations/patch-monitor-tls-info-add-fk.sql
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
PRAGMA writable_schema = TRUE;
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
SQLITE_MASTER
|
||||||
|
SET
|
||||||
|
sql = replace(sql,
|
||||||
|
'monitor_id INTEGER NOT NULL',
|
||||||
|
'monitor_id INTEGER NOT NULL REFERENCES [monitor] ([id]) ON DELETE CASCADE ON UPDATE CASCADE'
|
||||||
|
)
|
||||||
|
WHERE
|
||||||
|
name = 'monitor_tls_info'
|
||||||
|
AND type = 'table';
|
||||||
|
|
||||||
|
PRAGMA writable_schema = RESET;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -1,5 +1,7 @@
|
||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD packet_size INTEGER DEFAULT 56 NOT NULL;
|
ADD packet_size INTEGER DEFAULT 56 NOT NULL;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
|
@ -18,5 +18,4 @@ drop table setting;
|
||||||
|
|
||||||
alter table setting_dg_tmp rename to setting;
|
alter table setting_dg_tmp rename to setting;
|
||||||
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
11
db/old_migrations/patch-status-page-footer-css.sql
Normal file
11
db/old_migrations/patch-status-page-footer-css.sql
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD footer_text TEXT;
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD custom_css TEXT;
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD show_powered_by BOOLEAN NOT NULL DEFAULT 1;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -1,3 +1,4 @@
|
||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
CREATE TABLE monitor_tls_info (
|
CREATE TABLE monitor_tls_info (
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
ALTER TABLE monitor
|
|
||||||
ADD game VARCHAR(255);
|
|
||||||
COMMIT
|
|
|
@ -1,6 +0,0 @@
|
||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
ALTER TABLE status_page ADD footer_text TEXT;
|
|
||||||
ALTER TABLE status_page ADD custom_css TEXT;
|
|
||||||
ALTER TABLE status_page ADD show_powered_by BOOLEAN NOT NULL DEFAULT 1;
|
|
||||||
COMMIT;
|
|
|
@ -1,8 +0,0 @@
|
||||||
# DON'T UPDATE TO alpine3.13, 1.14, see #41.
|
|
||||||
FROM node:16-alpine3.12
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install apprise, iputils for non-root ping, setpriv
|
|
||||||
RUN apk add --no-cache iputils setpriv dumb-init python3 py3-cryptography py3-pip py3-six py3-yaml py3-click py3-markdown py3-requests py3-requests-oauthlib git && \
|
|
||||||
pip3 --no-cache-dir install apprise==1.4.0 && \
|
|
||||||
rm -rf /root/.cache
|
|
|
@ -1,12 +1,8 @@
|
||||||
# DON'T UPDATE TO bullseye-slim, see #372.
|
# If the image changed, the second stage image should be changed too
|
||||||
# There is no 20-buster-slim for armv7 unfortunately, 18-buster-slim is the last one for Uptime Kuma v1.
|
FROM node:20-bookworm-slim AS base2-slim
|
||||||
FROM node:18-buster-slim
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Specify --no-install-recommends to skip unused dependencies, make the base much smaller!
|
# Specify --no-install-recommends to skip unused dependencies, make the base much smaller!
|
||||||
# python3* = apprise's dependencies
|
|
||||||
# sqlite3 = for debugging
|
# sqlite3 = for debugging
|
||||||
# iputils-ping = for ping
|
# iputils-ping = for ping
|
||||||
# util-linux = for setpriv (Should be dropped in 2.0.0?)
|
# util-linux = for setpriv (Should be dropped in 2.0.0?)
|
||||||
|
@ -15,29 +11,34 @@ WORKDIR /app
|
||||||
# ca-certificates = keep the cert up-to-date
|
# ca-certificates = keep the cert up-to-date
|
||||||
# sudo = for start service nscd with non-root user
|
# sudo = for start service nscd with non-root user
|
||||||
# nscd = for better DNS caching
|
# nscd = for better DNS caching
|
||||||
# (pip) apprise = for notifications
|
RUN apt update && \
|
||||||
RUN apt-get update && \
|
apt --yes --no-install-recommends install \
|
||||||
apt-get --yes --no-install-recommends install \
|
|
||||||
python3 python3-pip python3-cryptography python3-six python3-yaml python3-click python3-markdown python3-requests python3-requests-oauthlib \
|
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
|
ca-certificates \
|
||||||
iputils-ping \
|
iputils-ping \
|
||||||
util-linux \
|
util-linux \
|
||||||
dumb-init \
|
dumb-init \
|
||||||
curl \
|
curl \
|
||||||
ca-certificates \
|
|
||||||
sudo \
|
sudo \
|
||||||
nscd && \
|
nscd && \
|
||||||
pip3 --no-cache-dir install apprise==1.6.0 && \
|
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
apt --yes autoremove
|
apt --yes autoremove
|
||||||
|
|
||||||
|
# apprise = for notifications (Install from the deb package, as the stable one is too old) (workaround for #4867)
|
||||||
|
# Switching to testing repo is no longer working, as the testing repo is not bookworm anymore.
|
||||||
|
# python3-paho-mqtt (#4859)
|
||||||
|
RUN curl http://ftp.debian.org/debian/pool/main/a/apprise/apprise_1.8.0-2_all.deb --output apprise.deb && \
|
||||||
|
apt update && \
|
||||||
|
apt --yes --no-install-recommends install ./apprise.deb python3-paho-mqtt && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
rm -f apprise.deb && \
|
||||||
|
apt --yes autoremove
|
||||||
|
|
||||||
# Install cloudflared
|
# Install cloudflared
|
||||||
RUN set -eux && \
|
RUN curl https://pkg.cloudflare.com/cloudflare-main.gpg --output /usr/share/keyrings/cloudflare-main.gpg && \
|
||||||
mkdir -p --mode=0755 /usr/share/keyrings && \
|
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared bullseye main' | tee /etc/apt/sources.list.d/cloudflared.list && \
|
||||||
curl --fail --show-error --silent --location --insecure https://pkg.cloudflare.com/cloudflare-main.gpg --output /usr/share/keyrings/cloudflare-main.gpg && \
|
apt update && \
|
||||||
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared buster main' | tee /etc/apt/sources.list.d/cloudflared.list && \
|
apt install --yes --no-install-recommends -t stable cloudflared && \
|
||||||
apt-get update && \
|
|
||||||
apt-get install --yes --no-install-recommends cloudflared && \
|
|
||||||
cloudflared version && \
|
cloudflared version && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
apt --yes autoremove
|
apt --yes autoremove
|
||||||
|
@ -46,3 +47,15 @@ RUN set -eux && \
|
||||||
COPY ./docker/etc/nscd.conf /etc/nscd.conf
|
COPY ./docker/etc/nscd.conf /etc/nscd.conf
|
||||||
COPY ./docker/etc/sudoers /etc/sudoers
|
COPY ./docker/etc/sudoers /etc/sudoers
|
||||||
|
|
||||||
|
|
||||||
|
# Full Base Image
|
||||||
|
# MariaDB, Chromium and fonts
|
||||||
|
# Make sure to reuse the slim image here. Uncomment the above line if you want to build it from scratch.
|
||||||
|
# FROM base2-slim AS base2
|
||||||
|
FROM louislam/uptime-kuma:base2-slim AS base2
|
||||||
|
ENV UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB=1
|
||||||
|
RUN apt update && \
|
||||||
|
apt --yes --no-install-recommends install chromium fonts-indic fonts-noto fonts-noto-cjk mariadb-server && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
apt --yes autoremove && \
|
||||||
|
chown -R node:node /var/lib/mysql
|
||||||
|
|
14
docker/docker-compose-dev.yml
Normal file
14
docker/docker-compose-dev.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
uptime-kuma:
|
||||||
|
container_name: uptime-kuma-dev
|
||||||
|
image: louislam/uptime-kuma:nightly2
|
||||||
|
volumes:
|
||||||
|
#- ./data:/app/data
|
||||||
|
- ../server:/app/server
|
||||||
|
- ../db:/app/db
|
||||||
|
ports:
|
||||||
|
- "3001:3001" # <Host Port>:<Container Port>
|
||||||
|
- "3307:3306"
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
# Simple docker-compose.yml
|
|
||||||
# You can change your port or volume location
|
|
||||||
|
|
||||||
version: '3.3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
uptime-kuma:
|
|
||||||
image: louislam/uptime-kuma:1
|
|
||||||
container_name: uptime-kuma
|
|
||||||
volumes:
|
|
||||||
- ./uptime-kuma-data:/app/data
|
|
||||||
ports:
|
|
||||||
- 3001:3001 # <Host Port>:<Container Port>
|
|
||||||
restart: always
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
ARG BASE_IMAGE=louislam/uptime-kuma:base2
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# Build in Golang
|
# Build in Golang
|
||||||
# Run npm run build-healthcheck-armv7 in the host first, another it will be super slow where it is building the armv7 healthcheck
|
# Run npm run build-healthcheck-armv7 in the host first, otherwise it will be super slow where it is building the armv7 healthcheck
|
||||||
# Check file: builder-go.dockerfile
|
# Check file: builder-go.dockerfile
|
||||||
############################################
|
############################################
|
||||||
FROM louislam/uptime-kuma:builder-go AS build_healthcheck
|
FROM louislam/uptime-kuma:builder-go AS build_healthcheck
|
||||||
|
@ -8,49 +10,57 @@ FROM louislam/uptime-kuma:builder-go AS build_healthcheck
|
||||||
############################################
|
############################################
|
||||||
# Build in Node.js
|
# Build in Node.js
|
||||||
############################################
|
############################################
|
||||||
FROM louislam/uptime-kuma:base-debian AS build
|
FROM louislam/uptime-kuma:base2 AS build
|
||||||
|
USER node
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
||||||
COPY .npmrc .npmrc
|
COPY --chown=node:node .npmrc .npmrc
|
||||||
COPY package.json package.json
|
COPY --chown=node:node package.json package.json
|
||||||
COPY package-lock.json package-lock.json
|
COPY --chown=node:node package-lock.json package-lock.json
|
||||||
RUN npm ci --omit=dev
|
RUN npm ci --omit=dev
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
|
COPY --chown=node:node --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
|
||||||
RUN chmod +x /app/extra/entrypoint.sh
|
RUN mkdir ./data
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# ⭐ Main Image
|
# ⭐ Main Image
|
||||||
############################################
|
############################################
|
||||||
FROM louislam/uptime-kuma:base-debian AS release
|
FROM $BASE_IMAGE AS release
|
||||||
|
USER node
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/louislam/uptime-kuma"
|
||||||
|
|
||||||
ENV UPTIME_KUMA_IS_CONTAINER=1
|
ENV UPTIME_KUMA_IS_CONTAINER=1
|
||||||
|
|
||||||
# Copy app files from build layer
|
# Copy app files from build layer
|
||||||
COPY --from=build /app /app
|
COPY --chown=node:node --from=build /app /app
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
VOLUME ["/app/data"]
|
|
||||||
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD extra/healthcheck
|
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD extra/healthcheck
|
||||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "extra/entrypoint.sh"]
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||||
CMD ["node", "server/server.js"]
|
CMD ["node", "server/server.js"]
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Rootless Image
|
||||||
|
############################################
|
||||||
|
FROM release AS rootless
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# Mark as Nightly
|
# Mark as Nightly
|
||||||
############################################
|
############################################
|
||||||
FROM release AS nightly
|
FROM release AS nightly
|
||||||
RUN npm run mark-as-nightly
|
RUN npm run mark-as-nightly
|
||||||
|
|
||||||
|
FROM nightly AS nightly-rootless
|
||||||
|
USER node
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# Build an image for testing pr
|
# Build an image for testing pr
|
||||||
############################################
|
############################################
|
||||||
FROM louislam/uptime-kuma:base-debian AS pr-test
|
FROM louislam/uptime-kuma:base2 AS pr-test2
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
||||||
|
|
||||||
## Install Git
|
## Install Git
|
||||||
|
@ -78,7 +88,7 @@ CMD ["npm", "run", "start-pr-test"]
|
||||||
############################################
|
############################################
|
||||||
# Upload the artifact to Github
|
# Upload the artifact to Github
|
||||||
############################################
|
############################################
|
||||||
FROM louislam/uptime-kuma:base-debian AS upload-artifact
|
FROM louislam/uptime-kuma:base2 AS upload-artifact
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt --yes install curl file
|
apt --yes install curl file
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
FROM louislam/uptime-kuma:base-alpine AS build
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
|
||||||
|
|
||||||
COPY .npmrc .npmrc
|
|
||||||
COPY package.json package.json
|
|
||||||
COPY package-lock.json package-lock.json
|
|
||||||
RUN npm ci --omit=dev
|
|
||||||
COPY . .
|
|
||||||
RUN chmod +x /app/extra/entrypoint.sh
|
|
||||||
|
|
||||||
FROM louislam/uptime-kuma:base-alpine AS release
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy app files from build layer
|
|
||||||
COPY --from=build /app /app
|
|
||||||
|
|
||||||
EXPOSE 3001
|
|
||||||
VOLUME ["/app/data"]
|
|
||||||
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD node extra/healthcheck.js
|
|
||||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "extra/entrypoint.sh"]
|
|
||||||
CMD ["node", "server/server.js"]
|
|
||||||
|
|
||||||
|
|
||||||
FROM release AS nightly
|
|
||||||
RUN npm run mark-as-nightly
|
|
|
@ -36,6 +36,8 @@ if (! exists) {
|
||||||
/**
|
/**
|
||||||
* Commit updated files
|
* Commit updated files
|
||||||
* @param {string} version Version to update to
|
* @param {string} version Version to update to
|
||||||
|
* @returns {void}
|
||||||
|
* @throws Error committing files
|
||||||
*/
|
*/
|
||||||
function commit(version) {
|
function commit(version) {
|
||||||
let msg = "Update to " + version;
|
let msg = "Update to " + version;
|
||||||
|
@ -55,6 +57,7 @@ function commit(version) {
|
||||||
/**
|
/**
|
||||||
* Create a tag with the specified version
|
* Create a tag with the specified version
|
||||||
* @param {string} version Tag to create
|
* @param {string} version Tag to create
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function tag(version) {
|
function tag(version) {
|
||||||
let res = childProcess.spawnSync("git", [ "tag", version ]);
|
let res = childProcess.spawnSync("git", [ "tag", version ]);
|
||||||
|
@ -68,6 +71,7 @@ function tag(version) {
|
||||||
* Check if a tag exists for the specified version
|
* Check if a tag exists for the specified version
|
||||||
* @param {string} version Version to check
|
* @param {string} version Version to check
|
||||||
* @returns {boolean} Does the tag already exist
|
* @returns {boolean} Does the tag already exist
|
||||||
|
* @throws Version is not valid
|
||||||
*/
|
*/
|
||||||
function tagExists(version) {
|
function tagExists(version) {
|
||||||
if (! version) {
|
if (! version) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue