diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 000000000..4a34b2115 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,28 @@ +# Codespaces + +You can modifiy Uptime Kuma in your browser without setting up a local development. + +![image](https://github.com/louislam/uptime-kuma/assets/1336778/31d9f06d-dd0b-4405-8e0d-a96586ee4595) + +1. Click `Code` -> `Create codespace on master` +2. Wait a few minutes until you see there are two exposed ports +3. Go to the `3000` url, see if it is working + +![image](https://github.com/louislam/uptime-kuma/assets/1336778/909b2eb4-4c5e-44e4-ac26-6d20ed856e7f) + +## Frontend + +Since the frontend is using [Vite.js](https://vitejs.dev/), all changes in this area will be hot-reloaded. +You don't need to restart the frontend, unless you try to add a new frontend dependency. + +## Backend + +The backend does not automatically hot-reload. +You will need to restart the backend after changing something using these steps: + +1. Click `Terminal` +2. Click `Codespaces: server-dev` in the right panel +3. Press `Ctrl + C` to stop the server +4. Press `Up` to run `npm run start-server-dev` + +![image](https://github.com/louislam/uptime-kuma/assets/1336778/e0c0a350-fe46-4588-9f37-e053c85834d1) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..5b3ceabc8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + "image": "mcr.microsoft.com/devcontainers/javascript-node:dev-18-bookworm", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + "updateContentCommand": "npm ci", + "postCreateCommand": "", + "postAttachCommand": { + "frontend-dev": "npm run start-frontend-devcontainer", + "server-dev": "npm run start-server-dev", + "open-port": "gh codespace ports visibility 3001:public -c $CODESPACE_NAME" + }, + "customizations": { + "vscode": { + "extensions": [ + "streetsidesoftware.code-spell-checker", + "dbaeumer.vscode-eslint" + ] + } + }, + "forwardPorts": [3000, 3001] +} diff --git a/.dockerignore b/.dockerignore index 47e82a105..00ee58159 100644 --- a/.dockerignore +++ b/.dockerignore @@ -33,7 +33,7 @@ tsconfig.json /ecosystem.config.js /extra/healthcheck.exe /extra/healthcheck - +extra/exe-builder ### .gitignore content (commented rules are duplicated) @@ -48,6 +48,4 @@ dist-ssr #!/data/.gitkeep #.vscode - - ### End of .gitignore content diff --git a/.github/ISSUE_TEMPLATE/ask-for-help.yaml b/.github/ISSUE_TEMPLATE/ask-for-help.yaml index 3442e8b73..c082b2e34 100644 --- a/.github/ISSUE_TEMPLATE/ask-for-help.yaml +++ b/.github/ISSUE_TEMPLATE/ask-for-help.yaml @@ -26,6 +26,12 @@ body: label: "📝 Describe your problem" description: "Please walk us through it step by step." placeholder: "Describe what are you asking for..." + - type: textarea + id: error-msg + validations: + required: false + attributes: + label: "📝 Error Message(s) or Log" - type: input id: uptime-kuma-version attributes: @@ -38,7 +44,7 @@ body: id: operating-system attributes: label: "💻 Operating System and Arch" - description: "Which OS is your server/device running on?" + description: "Which OS is your server/device running on? (For Replit, please do not report this bug)" placeholder: "Ex. Ubuntu 20.04 x86" validations: required: true @@ -46,7 +52,7 @@ body: id: browser-vendor attributes: label: "🌐 Browser" - description: "Which browser are you running on?" + description: "Which browser are you running on? (For Replit, please do not report this bug)" placeholder: "Ex. Google Chrome 95.0.4638.69" validations: required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 2dca1556a..072444205 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -61,8 +61,8 @@ body: id: operating-system attributes: label: "💻 Operating System and Arch" - description: "Which OS is your server/device running on?" - placeholder: "Ex. Ubuntu 20.04 x86" + description: "Which OS is your server/device running on? (For Replit, please do not report this bug)" + placeholder: "Ex. Ubuntu 20.04 x64 " validations: required: true - type: input diff --git a/.github/config/exclude.txt b/.github/config/exclude.txt new file mode 100644 index 000000000..253258856 --- /dev/null +++ b/.github/config/exclude.txt @@ -0,0 +1 @@ +# This is a .gitignore style file for 'GrantBirki/json-yaml-validate' Action workflow diff --git a/.github/workflows/auto-test.yml b/.github/workflows/auto-test.yml index 944627127..161c5bc57 100644 --- a/.github/workflows/auto-test.yml +++ b/.github/workflows/auto-test.yml @@ -1,4 +1,4 @@ -# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions name: Auto Test @@ -21,8 +21,8 @@ jobs: strategy: matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - node: [ 14, 16, 18, 19 ] + os: [macos-latest, ubuntu-latest, windows-latest, ARM64] + node: [ 14, 20 ] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -33,7 +33,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - cache: 'npm' + - run: npm install npm@latest -g - run: npm install - run: npm run build - run: npm test @@ -41,6 +41,29 @@ jobs: HEADLESS_TEST: 1 JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }} + # As a lot of dev dependencies are not supported on ARMv7, we have to test it separately and just test if `npm ci --production` works + armv7-simple-test: + needs: [ check-linters ] + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + + strategy: + matrix: + os: [ ARMv7 ] + node: [ 14.21.3, 20.5.0 ] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - run: git config --global core.autocrlf false # Mainly for Windows + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + - run: npm install npm@latest -g + - run: npm ci --production + check-linters: runs-on: ubuntu-latest @@ -52,7 +75,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 14 - cache: 'npm' - run: npm install - run: npm run lint @@ -67,7 +89,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 14 - cache: 'npm' - run: npm install - run: npm run build - run: npm run cy:test @@ -83,7 +104,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: 14 - cache: 'npm' - run: npm install - run: npm run build - run: npm run cy:run:unit diff --git a/.github/workflows/json-yaml-validate.yml b/.github/workflows/json-yaml-validate.yml new file mode 100644 index 000000000..b8249818d --- /dev/null +++ b/.github/workflows/json-yaml-validate.yml @@ -0,0 +1,26 @@ +name: json-yaml-validate +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +permissions: + contents: read + pull-requests: write # enable write permissions for pull request comments + +jobs: + json-yaml-validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: json-yaml-validate + id: json-yaml-validate + uses: GrantBirki/json-yaml-validate@v1.3.0 + with: + comment: "true" # enable comment mode + exclude_file: ".github/config/exclude.txt" # gitignore style file for exclusions diff --git a/.gitignore b/.gitignore index 06dca04b4..009b15f10 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,9 @@ cypress/screenshots /extra/healthcheck.exe /extra/healthcheck /extra/healthcheck-armv7 + +extra/exe-builder/bin +extra/exe-builder/obj + +.vs +.vscode diff --git a/.stylelintrc b/.stylelintrc index e590c98ca..0bcdb7c27 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -10,5 +10,7 @@ "color-function-notation": "legacy", "shorthand-property-no-redundant-values": null, "color-hex-length": null, + "declaration-block-no-redundant-longhand-properties": null, + "at-rule-no-unknown": null } } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 09c94e713..c91a483bb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,30 +34,30 @@ Yes or no, it depends on what you will try to do. Since I don't want to waste yo Here are some references: -✅ Usually Accept: +### ✅ Usually accepted: - Bug fix - Security fix - Adding notification providers -- Adding new language files (You should go to https://weblate.kuma.pet for existing languages) +- 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 First +### ⚠️ Discussion required: - Large pull requests - New features -❌ Won't Merge -- A dedicated pr for translating existing languages (You can now translate on https://weblate.kuma.pet) -- Do not pass auto test +### ❌ Won't be merged: +- A dedicated pr for translating existing languages (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md)) +- Do not pass the auto test - Any breaking changes -- Duplicated pull request +- Duplicated pull requests - Buggy - UI/UX is not close to Uptime Kuma -- Existing logic is completely modified or deleted for no reason -- A function that is completely out of scope -- Convert existing code into other programming languages -- Unnecessary large code changes (Hard to review, causes code conflicts to other pull requests) +- 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 cannot cover all situations. +The above cases may not cover all possible situations. 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. @@ -106,11 +106,11 @@ I personally do not like something that requires so many configurations before y ## Tools -- Node.js >= 14 -- NPM >= 8.5 -- Git -- IDE that supports ESLint and EditorConfig (I am using IntelliJ IDEA) -- A SQLite GUI tool (SQLite Expert Personal is suggested) +- [`Node.js`](https://nodejs.org/) >= 14 +- [`npm`](https://www.npmjs.com/) >= 8.5 +- [`git`](https://git-scm.com/) +- 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/)) ## Install Dependencies for Development @@ -218,7 +218,17 @@ If for maybe security reasons, a library must be updated. Then you must need to ## Translations -Please read: https://github.com/louislam/uptime-kuma/tree/master/src/languages +Please add **all** the strings which are translatable to `src/lang/en.json` (If translation keys are ommited, they can not be translated). + +**Don't include any other languages in your inital Pull-Request** (even if this is your mother tounge), 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. + +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). + +## Spelling & Grammar + +Feel free to correct the grammar in the documentation or code. +My mother language is not english and my grammar is not that great. ## Wiki @@ -235,6 +245,7 @@ https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc 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` 3. `npm run release-final with env vars: `VERSION` and `GITHUB_TOKEN` 4. Wait until the `Press any key to continue` 5. `git push` diff --git a/README.md b/README.md index a67007ce6..151e9a6e0 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ +
+ +
+ # Uptime Kuma +Uptime Kuma is an easy-to-use self-hosted monitoring tool. + [![GitHub Sponsors](https://img.shields.io/github/sponsors/louislam?label=GitHub%20Sponsors)](https://github.com/sponsors/louislam) Translation status -
- -
- -Uptime Kuma is an easy-to-use self-hosted monitoring tool. - ## 🥔 Live Demo @@ -23,7 +23,7 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the ## ⭐ Features -* Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / 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 * 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 @@ -49,10 +49,14 @@ Uptime Kuma is now running on http://localhost:3001 ### 💪🏻 Non-Docker -Required Tools: -- [Node.js](https://nodejs.org/en/download/) >= 14 +Requirements: +- Platform + - ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc. + - ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher + - ❌ Replit / Heroku +- [Node.js](https://nodejs.org/en/download/) 14 / 16 / 18 / 20.4 - [npm](https://docs.npmjs.com/cli/) >= 7 -- [Git](https://git-scm.com/downloads) +- [Git](https://git-scm.com/downloads) - [pm2](https://pm2.keymetrics.io/) - For running Uptime Kuma in the background ```bash @@ -67,7 +71,7 @@ npm run setup node server/server.js # (Recommended) Option 2. Run in background using PM2 -# Install PM2 if you don't have it: +# Install PM2 if you don't have it: npm install pm2 -g && pm2 install pm2-logrotate # Start Server @@ -87,6 +91,10 @@ pm2 monit pm2 save && pm2 startup ``` +### Windows Portable (x64) + +https://github.com/louislam/uptime-kuma/files/11886108/uptime-kuma-win64-portable-1.0.1.zip + ### Advanced Installation If you need more options or need to browse via a reverse proxy, please read: @@ -144,17 +152,18 @@ Telegram Notification Sample: If you love this project, please consider giving me a ⭐. -## 🗣️ Discussion +## 🗣️ Discussion / Ask for Help -### Issues Page +⚠️ 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. -You can discuss or ask for help in [issues](https://github.com/louislam/uptime-kuma/issues). +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: -### Subreddit +- [GitHub Issues](https://github.com/louislam/uptime-kuma/issues) +- [Subreddit r/Uptime kuma](https://www.reddit.com/r/UptimeKuma/) My Reddit account: [u/louislamlam](https://reddit.com/u/louislamlam). You can mention me if you ask a question on Reddit. -[r/Uptime kuma](https://www.reddit.com/r/UptimeKuma/) + ## Contribute @@ -175,7 +184,10 @@ If you want to report a bug or request a new feature, feel free to open a [new i ### 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). -Feel free to correct my grammar in this README, source code, or wiki, as my mother language is not English and my grammar is not that great. +## Spelling & Grammar + +Feel free to correct the grammar in the documentation or code. +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 diff --git a/babel.config.js b/babel.config.js index 6bb8a01a5..d4c895475 100644 --- a/babel.config.js +++ b/babel.config.js @@ -4,8 +4,4 @@ if (process.env.TEST_FRONTEND) { config.presets = [ "@babel/preset-env" ]; } -if (process.env.TEST_BACKEND) { - config.plugins = [ "babel-plugin-rewire" ]; -} - module.exports = config; diff --git a/config/vite.config.js b/config/vite.config.js index 6e9ebbde8..11c610066 100644 --- a/config/vite.config.js +++ b/config/vite.config.js @@ -3,6 +3,7 @@ import vue from "@vitejs/plugin-vue"; import { defineConfig } from "vite"; import visualizer from "rollup-plugin-visualizer"; import viteCompression from "vite-plugin-compression"; +import commonjs from "vite-plugin-commonjs"; const postCssScss = require("postcss-scss"); const postcssRTLCSS = require("postcss-rtlcss"); @@ -16,8 +17,12 @@ export default defineConfig({ }, define: { "FRONTEND_VERSION": JSON.stringify(process.env.npm_package_version), + "DEVCONTAINER": JSON.stringify(process.env.DEVCONTAINER), + "GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN": JSON.stringify(process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN), + "CODESPACE_NAME": JSON.stringify(process.env.CODESPACE_NAME), }, plugins: [ + commonjs(), vue(), legacy({ targets: [ "since 2015" ], @@ -42,6 +47,9 @@ export default defineConfig({ } }, build: { + commonjsOptions: { + include: [ /.js$/ ], + }, rollupOptions: { output: { manualChunks(id, { getModuleInfo, getModuleIds }) { diff --git a/db/patch-add-certificate-expiry-status-page.sql b/db/patch-add-certificate-expiry-status-page.sql new file mode 100644 index 000000000..63a20105b --- /dev/null +++ b/db/patch-add-certificate-expiry-status-page.sql @@ -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 show_certificate_expiry BOOLEAN default 0 NOT NULL; + +COMMIT; diff --git a/db/patch-add-description-monitor.sql b/db/patch-add-description-monitor.sql new file mode 100644 index 000000000..da1aa55bc --- /dev/null +++ b/db/patch-add-description-monitor.sql @@ -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 monitor + ADD description TEXT default null; + +COMMIT; diff --git a/db/patch-add-invert-keyword.sql b/db/patch-add-invert-keyword.sql new file mode 100644 index 000000000..8ca199eed --- /dev/null +++ b/db/patch-add-invert-keyword.sql @@ -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 monitor + ADD invert_keyword BOOLEAN default 0 not null; + +COMMIT; diff --git a/db/patch-add-parent-monitor.sql b/db/patch-add-parent-monitor.sql new file mode 100644 index 000000000..756ac5be2 --- /dev/null +++ b/db/patch-add-parent-monitor.sql @@ -0,0 +1,6 @@ +BEGIN TRANSACTION; + +ALTER TABLE monitor + ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE; + +COMMIT diff --git a/db/patch-added-json-query.sql b/db/patch-added-json-query.sql new file mode 100644 index 000000000..d5b7f1a8f --- /dev/null +++ b/db/patch-added-json-query.sql @@ -0,0 +1,10 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +ALTER TABLE monitor + ADD json_path TEXT; + +ALTER TABLE monitor + ADD expected_value VARCHAR(255); + +COMMIT; diff --git a/db/patch-added-kafka-producer.sql b/db/patch-added-kafka-producer.sql new file mode 100644 index 000000000..933d30b8f --- /dev/null +++ b/db/patch-added-kafka-producer.sql @@ -0,0 +1,22 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +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; + +COMMIT; diff --git a/db/patch-api-key-table.sql b/db/patch-api-key-table.sql new file mode 100644 index 000000000..fc3a405bf --- /dev/null +++ b/db/patch-api-key-table.sql @@ -0,0 +1,13 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; +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 +); +COMMIT; diff --git a/db/patch-http-body-encoding.sql b/db/patch-http-body-encoding.sql new file mode 100644 index 000000000..322c8b893 --- /dev/null +++ b/db/patch-http-body-encoding.sql @@ -0,0 +1,12 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +ALTER TABLE monitor ADD http_body_encoding VARCHAR(25); + +COMMIT; + +BEGIN TRANSACTION; + +UPDATE monitor SET http_body_encoding = 'json' WHERE (type = 'http' or type = 'keyword') AND http_body_encoding IS NULL; + +COMMIT; diff --git a/db/patch-maintenance-cron.sql b/db/patch-maintenance-cron.sql new file mode 100644 index 000000000..bc51b881b --- /dev/null +++ b/db/patch-maintenance-cron.sql @@ -0,0 +1,11 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +DROP TABLE maintenance_timeslot; + +-- 999 characters. https://stackoverflow.com/questions/46134830/maximum-length-for-cron-job +ALTER TABLE maintenance ADD cron TEXT; +ALTER TABLE maintenance ADD timezone VARCHAR(255); +ALTER TABLE maintenance ADD duration INTEGER; + +COMMIT; diff --git a/db/patch-monitor-oauth-cc.sql b/db/patch-monitor-oauth-cc.sql new file mode 100644 index 000000000..f33e95298 --- /dev/null +++ b/db/patch-monitor-oauth-cc.sql @@ -0,0 +1,19 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +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; + +COMMIT; diff --git a/db/patch-monitor-tls.sql b/db/patch-monitor-tls.sql new file mode 100644 index 000000000..ac4edb798 --- /dev/null +++ b/db/patch-monitor-tls.sql @@ -0,0 +1,13 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +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; + +COMMIT; diff --git a/docker/alpine-base.dockerfile b/docker/alpine-base.dockerfile index 276d6e450..ee2090257 100644 --- a/docker/alpine-base.dockerfile +++ b/docker/alpine-base.dockerfile @@ -4,5 +4,5 @@ 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.2.1 && \ + pip3 --no-cache-dir install apprise==1.4.0 && \ rm -rf /root/.cache diff --git a/docker/debian-base.dockerfile b/docker/debian-base.dockerfile index 026189c47..244e6c5fb 100644 --- a/docker/debian-base.dockerfile +++ b/docker/debian-base.dockerfile @@ -5,24 +5,44 @@ ARG TARGETPLATFORM WORKDIR /app -# Install Curl -# Install Apprise, add sqlite3 cli for debugging in the future, iputils-ping for ping, util-linux for setpriv -# Stupid python3 and python3-pip actually install a lot of useless things into Debian, specify --no-install-recommends to skip them, make the base even smaller than alpine! -RUN apt update && \ - apt --yes --no-install-recommends install python3 python3-pip python3-cryptography python3-six python3-yaml python3-click python3-markdown python3-requests python3-requests-oauthlib \ - sqlite3 iputils-ping util-linux dumb-init git && \ - pip3 --no-cache-dir install apprise==1.2.1 && \ +# Specify --no-install-recommends to skip unused dependencies, make the base much smaller! +# python3* = apprise's dependencies +# sqlite3 = for debugging +# iputils-ping = for ping +# util-linux = for setpriv (Should be dropped in 2.0.0?) +# dumb-init = avoid zombie processes (#480) +# curl = for debugging +# ca-certificates = keep the cert up-to-date +# sudo = for start service nscd with non-root user +# nscd = for better DNS caching +# (pip) apprise = for notifications +RUN apt-get update && \ + 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 \ + iputils-ping \ + util-linux \ + dumb-init \ + curl \ + ca-certificates \ + sudo \ + nscd && \ + pip3 --no-cache-dir install apprise==1.4.5 && \ rm -rf /var/lib/apt/lists/* && \ apt --yes autoremove # Install cloudflared -# dpkg --add-architecture arm: cloudflared do not provide armhf, this is workaround. Read more: https://github.com/cloudflare/cloudflared/issues/583 -COPY extra/download-cloudflared.js ./extra/download-cloudflared.js -RUN node ./extra/download-cloudflared.js $TARGETPLATFORM && \ - dpkg --add-architecture arm && \ - apt update && \ - apt --yes --no-install-recommends install ./cloudflared.deb && \ +RUN set -eux && \ + mkdir -p --mode=0755 /usr/share/keyrings && \ + curl --fail --show-error --silent --location --insecure https://pkg.cloudflare.com/cloudflare-main.gpg --output /usr/share/keyrings/cloudflare-main.gpg && \ + 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-get update && \ + apt-get install --yes --no-install-recommends cloudflared && \ + cloudflared version && \ rm -rf /var/lib/apt/lists/* && \ - rm -f cloudflared.deb && \ apt --yes autoremove +# For nscd +COPY ./docker/etc/nscd.conf /etc/nscd.conf +COPY ./docker/etc/sudoers /etc/sudoers + diff --git a/docker/dockerfile b/docker/dockerfile index 1799044af..1bc90f929 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -26,6 +26,8 @@ RUN chmod +x /app/extra/entrypoint.sh FROM louislam/uptime-kuma:base-debian AS release WORKDIR /app +ENV UPTIME_KUMA_IS_CONTAINER=1 + # Copy app files from build layer COPY --from=build /app /app @@ -70,7 +72,6 @@ RUN git clone https://github.com/louislam/uptime-kuma.git . RUN npm ci EXPOSE 3000 3001 -VOLUME ["/app/data"] HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD extra/healthcheck CMD ["npm", "run", "start-pr-test"] diff --git a/docker/etc/nscd.conf b/docker/etc/nscd.conf new file mode 100644 index 000000000..18b92bfee --- /dev/null +++ b/docker/etc/nscd.conf @@ -0,0 +1,90 @@ +# +# /etc/nscd.conf +# +# An example Name Service Cache config file. This file is needed by nscd. +# +# Legal entries are: +# +# logfile +# debug-level +# threads +# max-threads +# server-user +# server-user is ignored if nscd is started with -S parameters +# stat-user +# reload-count unlimited| +# paranoia +# restart-interval