From ed15689409ddb56c7e0e6b3be8fb6bee2290070b Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 22 Nov 2023 00:15:51 +0800 Subject: [PATCH 1/7] Copy workflows, templates and docs from Uptime Kuma --- .github/ISSUE_TEMPLATE/ask-for-help.yaml | 15 + .github/ISSUE_TEMPLATE/bug_report.yaml | 99 +++++++ .github/ISSUE_TEMPLATE/feature_request.yaml | 15 + .github/ISSUE_TEMPLATE/security.md | 19 ++ .github/PULL_REQUEST_TEMPLATE.md | 34 +++ .github/workflows/close-incorrect-issue.yml | 25 ++ .github/workflows/json-yaml-validate.yml | 27 ++ CONTRIBUTING.md | 286 ++++++++++++++++++++ SECURITY.md | 12 + extra/close-incorrect-issue.js | 57 ++++ 10 files changed, 589 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/ask-for-help.yaml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yaml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yaml create mode 100644 .github/ISSUE_TEMPLATE/security.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/close-incorrect-issue.yml create mode 100644 .github/workflows/json-yaml-validate.yml create mode 100644 CONTRIBUTING.md create mode 100644 SECURITY.md create mode 100644 extra/close-incorrect-issue.js diff --git a/.github/ISSUE_TEMPLATE/ask-for-help.yaml b/.github/ISSUE_TEMPLATE/ask-for-help.yaml new file mode 100644 index 00000000..a818d87d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ask-for-help.yaml @@ -0,0 +1,15 @@ +name: "❓ Ask for help" +description: "Please go to the Discussions tab" +body: + - type: markdown + attributes: + value: | + Please go to https://github.com/louislam/dockge/discussions + - type: checkboxes + id: no-duplicate-issues + attributes: + label: "Please go to https://github.com/louislam/dockge/discussions, here is for bug report only" + description: "" + options: + - label: "I understand" + required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 00000000..07244420 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,99 @@ +name: "🐛 Bug Report" +description: "Submit a bug report to help us improve" +#title: "[Bug] " +labels: [bug] +body: + - type: checkboxes + id: no-duplicate-issues + attributes: + 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 + - type: checkboxes + attributes: + label: "🛡️ Security Policy" + description: Please review the security policy before reporting security related issues/bugs. + options: + - label: I agree to have read this project [Security Policy](https://github.com/louislam/uptime-kuma/security/policy) + required: true + - type: textarea + id: description + validations: + required: false + attributes: + label: "Description" + description: "You could also upload screenshots" + - type: textarea + id: steps-to-reproduce + validations: + required: true + attributes: + label: "👟 Reproduction steps" + description: "How do you trigger this bug? Please walk us through it step by step." + placeholder: "..." + - type: textarea + id: expected-behavior + validations: + required: true + attributes: + label: "👀 Expected behavior" + description: "What did you think would happen?" + placeholder: "..." + - type: textarea + id: actual-behavior + validations: + required: true + attributes: + label: "😓 Actual Behavior" + description: "What actually happen?" + placeholder: "..." + - type: input + id: uptime-kuma-version + attributes: + label: "🐻 Uptime-Kuma Version" + description: "Which version of Uptime-Kuma are you running? Please do NOT provide the docker tag such as latest or 1" + placeholder: "Ex. 1.10.0" + validations: + required: true + - type: input + id: operating-system + attributes: + label: "💻 Operating System and Arch" + 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 + id: browser-vendor + attributes: + label: "🌐 Browser" + description: "Which browser are you running on?" + placeholder: "Ex. Google Chrome 95.0.4638.69" + validations: + required: true + - type: input + id: docker-version + attributes: + label: "🐋 Docker Version" + description: "If running with Docker, which version are you running?" + placeholder: "Ex. Docker 20.10.9 / K8S / Podman" + validations: + required: false + - 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 + id: logs + attributes: + label: "📝 Relevant log output" + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 00000000..4a511b2e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,15 @@ +name: 🚀 Feature Request +description: "Please go to the Discussions tab" +body: + - type: markdown + attributes: + value: | + Please go to https://github.com/louislam/dockge/discussions + - type: checkboxes + id: no-duplicate-issues + attributes: + label: "Please go to https://github.com/louislam/dockge/discussions, here is for bug report only" + description: "" + options: + - label: "I understand" + required: true diff --git a/.github/ISSUE_TEMPLATE/security.md b/.github/ISSUE_TEMPLATE/security.md new file mode 100644 index 00000000..26450ed3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/security.md @@ -0,0 +1,19 @@ +--- + +name: "Security Issue" +about: "Just for alerting @louislam, do not provide any details here" +title: "Security Issue" +ref: "main" +labels: + +- security + +--- + +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. + +Your GitHub Advisory URL: + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..87e7f5ff --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ +⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules: +https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma + +Tick the checkbox if you understand [x]: +- [ ] I have read and understand the pull request rules. + +# Description + +Fixes #(issue) + +## Type of change + +Please delete any options that are not relevant. + +- Bug fix (non-breaking change which fixes an issue) +- User interface (UI) +- New feature (non-breaking change which adds functionality) +- Breaking change (fix or feature that would cause existing functionality to not work as expected) +- Other +- This change requires a documentation update + +## Checklist + +- [ ] My code follows the style guidelines of this project +- [ ] I ran ESLint and other linters for modified files +- [ ] I have performed a self-review of my own code and tested it +- [ ] I have commented my code, particularly in hard-to-understand areas + (including JSDoc for methods) +- [ ] My changes generate no new warnings +- [ ] My code needed automated testing. I have added them (this is optional task) + +## Screenshots (if any) + +Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically. diff --git a/.github/workflows/close-incorrect-issue.yml b/.github/workflows/close-incorrect-issue.yml new file mode 100644 index 00000000..762bc968 --- /dev/null +++ b/.github/workflows/close-incorrect-issue.yml @@ -0,0 +1,25 @@ +name: Close Incorrect Issue + +on: + issues: + types: [opened] + +jobs: + close-incorrect-issue: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [16] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: node extra/close-incorrect-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.issue.number }} ${{ github.event.issue.user.login }} diff --git a/.github/workflows/json-yaml-validate.yml b/.github/workflows/json-yaml-validate.yml new file mode 100644 index 00000000..104e37a1 --- /dev/null +++ b/.github/workflows/json-yaml-validate.yml @@ -0,0 +1,27 @@ +name: json-yaml-validate +on: + push: + branches: + - master + pull_request: + branches: + - master + - 2.0.X + 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/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d94eb71d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,286 @@ +# 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. + +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 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. + +## Key Technical Skills + +- Node.js (You should know about promise, async/await and arrow function etc.) +- Socket.io +- SCSS +- Vue.js +- Bootstrap +- SQLite + +## Directories + +- config (dev config files) +- data (App data) +- db (Base database and migration scripts) +- dist (Frontend build) +- docker (Dockerfiles) +- extra (Extra useful scripts) +- public (Frontend resources for dev only) +- server (Server source code) +- src (Frontend source code) +- test (unit test) + +## 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. + +Here are some references: + +### ✅ Usually accepted: +- Bug fix +- Security fix +- 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: +- Large pull requests +- New features + +### ❌ 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 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. + +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. + +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. + + +### Recommended Pull Request Guideline + +Before deep into coding, discussion first is preferred. Creating an empty pull request for discussion would be recommended. + +1. Fork the project +1. Clone your fork repo to local +1. Create a new branch +1. Create an empty commit + `git commit -m "[empty commit] pull request for " --allow-empty` +1. Push to your fork repo +1. Create a pull request: https://github.com/louislam/uptime-kuma/compare +1. Write a proper description +1. Click "Change to draft" +1. Discussion + +## 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. + +- 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 +- Single container for Docker users, no very complex docker-compose file. Just map the volume and expose the port, then good to go +- Settings should be configurable in the frontend. Environment variables are discouraged, unless it is related to startup such as `DATA_DIR` +- Easy to use +- The web UI styling should be consistent and nice + +## Coding Styles + +- 4 spaces indentation +- Follow `.editorconfig` +- Follow ESLint +- Methods and functions should be documented with JSDoc + +## Name Conventions + +- Javascript/Typescript: camelCaseType +- SQLite: snake_case (Underscore) +- CSS/SCSS: kebab-case (Dash) + +## Tools + +- [`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 + +```bash +npm ci +``` + +## Dev Server + +(2022-04-26 Update) + +We can start the frontend dev server and the backend dev server in one command. + +Port `3000` and port `3001` will be used. + +```bash +npm run dev +``` + +But sometimes, you would like to restart the server, but not the frontend, you can run these commands in two terminals: +``` +npm run start-frontend-dev +npm run start-server-dev +``` + +## Backend Server + +It binds to `0.0.0.0:3001` by default. + + +It is mainly a socket.io app + express.js. + +express.js is used for: +- 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 + + +### Structure in /server/ + +- jobs/ (Jobs that are running in another process) +- model/ (Object model, auto-mapping to the database table name) +- modules/ (Modified 3rd-party modules) +- monitor_types (Monitor Types) +- notification-providers/ (individual notification logic) +- routers/ (Express Routers) +- 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 + +It binds to `0.0.0.0:3000` by default. The frontend dev server is used for development only. + +For production, it is not used. It will be compiled to `dist` directory instead. + +You can use Vue.js devtools Chrome extension for debugging. + +### Build the frontend + +```bash +npm run build +``` + +### Frontend Details + +Uptime Kuma Frontend is a single page application (SPA). Most paths are handled by Vue Router. + +The router is in `src/router.js` + +As you can see, most data in the frontend is stored at the root level, even though you changed the current router to any other pages. + +The data and socket logic are in `src/mixins/socket.js`. + +## Database Migration + +1. Create `patch-{name}.sql` in `./db/` +2. Add your patch filename in the `patchList` list in `./server/database.js` + +## Unit Test + +```bash +npm run build +npm test +``` + +## 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: + +- Frontend dependencies = "devDependencies" + - Examples: vue, chart.js +- Backend dependencies = "dependencies" + - Examples: socket.io, sqlite3 +- Development dependencies = "devDependencies" + - Examples: eslint, sass + +### Update Dependencies + +Since previously updating Vite 2.5.10 to 2.6.0 broke the application completely, from now on, it should update the patch release version only. + +Patch release = the third digit ([Semantic Versioning](https://semver.org/)) + +If for security / bug / other reasons, a library must be updated, breaking changes need to be checked by the person proposing the change. + +## Translations + +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`. +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 + +Since there is no way to make a pull request to wiki's repo, I have set up another repo to do that. + +https://github.com/louislam/uptime-kuma-wiki + +## Maintainer + +Check the latest issues and pull requests: +https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc + +### Release Procedures + +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` +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: + +- Check all tags is fine on https://hub.docker.com/r/louislam/uptime-kuma/tags +- Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 / armv7) +- Try clean installation with Node.js + +### Release Beta Procedures + +1. Draft a release note, check "This is a pre-release" +2. Make sure the repo is cleared +3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN` +4. Wait until the `Press any key to continue` +5. Publish the release note as 1.X.X-beta.X +6. Press any key to continue + +### Release Wiki + +#### Setup Repo + +```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 +``` diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..a0a632a8 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,12 @@ +# Security Policy + +## Reporting a Vulnerability + +1. Please report security issues to https://github.com/louislam/dockge/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/dockge/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 you accept other 3rd-party bug bounty platforms? + +At this moment, I DO NOT accept other bug bounty platforms, because I am not familiar with these platforms and someone has tried to send a phishing link to me by doing this already. To minimize my own risk, please report through GitHub Advisories only. I will ignore all 3rd-party bug bounty platforms emails. diff --git a/extra/close-incorrect-issue.js b/extra/close-incorrect-issue.js new file mode 100644 index 00000000..ae38bccc --- /dev/null +++ b/extra/close-incorrect-issue.js @@ -0,0 +1,57 @@ +const github = require("@actions/github"); + +(async () => { + try { + const token = process.argv[2]; + const issueNumber = process.argv[3]; + const username = process.argv[4]; + + const client = github.getOctokit(token).rest; + + const issue = { + owner: "louislam", + repo: "uptime-kuma", + number: issueNumber, + }; + + const labels = ( + await client.issues.listLabelsOnIssue({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number + }) + ).data.map(({ name }) => name); + + if (labels.length === 0) { + console.log("Bad format here"); + + await client.issues.addLabels({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number, + labels: [ "invalid-format" ] + }); + + // Add the issue closing comment + await client.issues.createComment({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number, + body: `@${username}: Hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template. Please DO NOT open a blank issue.` + }); + + // Close the issue + await client.issues.update({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number, + state: "closed" + }); + } else { + console.log("Pass!"); + } + } catch (e) { + console.log(e); + } + +})(); From c2b5814142af8877f147edf21d5b7e459cc81026 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 22 Nov 2023 00:22:18 +0800 Subject: [PATCH 2/7] Update bug report template --- .github/ISSUE_TEMPLATE/bug_report.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 07244420..a5acf3d8 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -6,8 +6,8 @@ body: - type: checkboxes id: no-duplicate-issues attributes: - 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=)" + label: "⚠️ Please verify that this bug has NOT been reported before." + description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/dockge/issues?q=)" options: - label: "I checked and didn't find similar issue" required: true @@ -16,7 +16,7 @@ body: label: "🛡️ Security Policy" description: Please review the security policy before reporting security related issues/bugs. options: - - label: I agree to have read this project [Security Policy](https://github.com/louislam/uptime-kuma/security/policy) + - label: I agree to have read this project [Security Policy](https://github.com/louislam/dockge/security/policy) required: true - type: textarea id: description @@ -50,18 +50,18 @@ body: description: "What actually happen?" placeholder: "..." - type: input - id: uptime-kuma-version + id: dockge-version attributes: - label: "🐻 Uptime-Kuma Version" - description: "Which version of Uptime-Kuma are you running? Please do NOT provide the docker tag such as latest or 1" - placeholder: "Ex. 1.10.0" + label: "Dockge Version" + description: "Which version of Dockge are you running? Please do NOT provide the docker tag such as latest or 1" + placeholder: "Ex. 1.1.1" validations: required: true - type: input id: operating-system attributes: label: "💻 Operating System and Arch" - description: "Which OS is your server/device running on? (For Replit, please do not report this bug)" + description: "Which OS is your server/device running on?" placeholder: "Ex. Ubuntu 20.04 x64 " validations: required: true From 94abfd19755b94e5c6720b90cee78a6096257d13 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 22 Nov 2023 00:23:01 +0800 Subject: [PATCH 3/7] Add exclude.txt --- .github/config/exclude.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/config/exclude.txt diff --git a/.github/config/exclude.txt b/.github/config/exclude.txt new file mode 100644 index 00000000..25325885 --- /dev/null +++ b/.github/config/exclude.txt @@ -0,0 +1 @@ +# This is a .gitignore style file for 'GrantBirki/json-yaml-validate' Action workflow From 12532ab0495d1faae3f5948d03ade7b98c74f4ee Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 22 Nov 2023 00:28:52 +0800 Subject: [PATCH 4/7] Fix tsconfig.json --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index e7e38fb2..335a60d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,5 +8,5 @@ }, "include": [ "backend/**/*" - ], + ] } From 5967198a30a6d36be15174e5dced460f5f3ca9d9 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 22 Nov 2023 00:47:35 +0800 Subject: [PATCH 5/7] Update CONTRIBUTING.md --- CONTRIBUTING.md | 205 +++++++----------------------------------------- 1 file changed, 29 insertions(+), 176 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d94eb71d..313a029f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,57 +1,24 @@ -# Project Info +## Can I create a pull request for Dockge? -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. - -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 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. - -## Key Technical Skills - -- Node.js (You should know about promise, async/await and arrow function etc.) -- Socket.io -- SCSS -- Vue.js -- Bootstrap -- SQLite - -## Directories - -- config (dev config files) -- data (App data) -- db (Base database and migration scripts) -- dist (Frontend build) -- docker (Dockerfiles) -- extra (Extra useful scripts) -- public (Frontend resources for dev only) -- server (Server source code) -- src (Frontend source code) -- test (unit test) - -## 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. Since I don't want to waste your time, be sure to **create open a discussion, 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. Here are some references: ### ✅ Usually accepted: - Bug fix - Security fix -- 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("...")` +- Translation ### ⚠️ Discussion required: - Large pull requests - New features ### ❌ 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 requests - Buggy -- UI/UX is not close to Uptime Kuma +- UI/UX is not close to Dockge - 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 @@ -61,35 +28,18 @@ 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. -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/dockge/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. - -### Recommended Pull Request Guideline - -Before deep into coding, discussion first is preferred. Creating an empty pull request for discussion would be recommended. - -1. Fork the project -1. Clone your fork repo to local -1. Create a new branch -1. Create an empty commit - `git commit -m "[empty commit] pull request for " --allow-empty` -1. Push to your fork repo -1. Create a pull request: https://github.com/louislam/uptime-kuma/compare -1. Write a proper description -1. Click "Change to draft" -1. Discussion - ## 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. -- 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 -- Single container for Docker users, no very complex docker-compose file. Just map the volume and expose the port, then good to go -- 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 `DOCKGE_STACKS_DIR` - Easy to use - The web UI styling should be consistent and nice +- No native build dependency ## Coding Styles @@ -106,8 +56,8 @@ I personally do not like something that requires so many configurations before y ## Tools -- [`Node.js`](https://nodejs.org/) >= 14 -- [`npm`](https://www.npmjs.com/) >= 8.5 +- [`Node.js`](https://nodejs.org/) >= 20 +- [`pnpm`](https://pnpm.io/) - [`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/)) @@ -115,102 +65,60 @@ I personally do not like something that requires so many configurations before y ## Install Dependencies for Development ```bash -npm ci +pnpm install ``` ## Dev Server -(2022-04-26 Update) - -We can start the frontend dev server and the backend dev server in one command. - -Port `3000` and port `3001` will be used. - -```bash -npm run dev -``` - -But sometimes, you would like to restart the server, but not the frontend, you can run these commands in two terminals: ``` -npm run start-frontend-dev -npm run start-server-dev +pnpm run dev:frontend +pnpm run dev:backend ``` -## Backend Server - -It binds to `0.0.0.0:3001` by default. +## Backend Dev Server +It binds to `0.0.0.0:5001` by default. It is mainly a socket.io app + express.js. -express.js is used for: -- 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 - - -### Structure in /server/ - -- jobs/ (Jobs that are running in another process) -- model/ (Object model, auto-mapping to the database table name) -- modules/ (Modified 3rd-party modules) -- monitor_types (Monitor Types) -- notification-providers/ (individual notification logic) -- routers/ (Express Routers) -- 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 -It binds to `0.0.0.0:3000` by default. The frontend dev server is used for development only. +It binds to `0.0.0.0:5000` by default. The frontend dev server is used for development only. -For production, it is not used. It will be compiled to `dist` directory instead. +For production, it is not used. It will be compiled to `frontend-dist` directory instead. You can use Vue.js devtools Chrome extension for debugging. ### Build the frontend ```bash -npm run build +pnpm run build ``` -### Frontend Details - -Uptime Kuma Frontend is a single page application (SPA). Most paths are handled by Vue Router. - -The router is in `src/router.js` - -As you can see, most data in the frontend is stored at the root level, even though you changed the current router to any other pages. - -The data and socket logic are in `src/mixins/socket.js`. - ## Database Migration -1. Create `patch-{name}.sql` in `./db/` -2. Add your patch filename in the `patchList` list in `./server/database.js` - -## Unit Test - -```bash -npm run build -npm test -``` +TODO ## 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: - Frontend dependencies = "devDependencies" - - Examples: vue, chart.js + - Examples: vue, chart.js - Backend dependencies = "dependencies" - - Examples: socket.io, sqlite3 + - Examples: socket.io, sqlite3 - Development dependencies = "devDependencies" - - Examples: eslint, sass + - Examples: eslint, sass ### Update Dependencies -Since previously updating Vite 2.5.10 to 2.6.0 broke the application completely, from now on, it should update the patch release version only. +Should only be done by the maintainer. + +```bash +pnpm update +```` + +It should update the patch release version only. Patch release = the third digit ([Semantic Versioning](https://semver.org/)) @@ -229,58 +137,3 @@ If you want to help by translating Uptime Kuma into your language, please visit 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 - -Since there is no way to make a pull request to wiki's repo, I have set up another repo to do that. - -https://github.com/louislam/uptime-kuma-wiki - -## Maintainer - -Check the latest issues and pull requests: -https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc - -### Release Procedures - -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` -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: - -- Check all tags is fine on https://hub.docker.com/r/louislam/uptime-kuma/tags -- Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 / armv7) -- Try clean installation with Node.js - -### Release Beta Procedures - -1. Draft a release note, check "This is a pre-release" -2. Make sure the repo is cleared -3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN` -4. Wait until the `Press any key to continue` -5. Publish the release note as 1.X.X-beta.X -6. Press any key to continue - -### Release Wiki - -#### Setup Repo - -```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 -``` From c7184612b428564f8b34316435b4484f1e7bc023 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 22 Nov 2023 00:51:51 +0800 Subject: [PATCH 6/7] Update --- .github/ISSUE_TEMPLATE/security.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/json-yaml-validate.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/security.md b/.github/ISSUE_TEMPLATE/security.md index 26450ed3..ab03b450 100644 --- a/.github/ISSUE_TEMPLATE/security.md +++ b/.github/ISSUE_TEMPLATE/security.md @@ -10,7 +10,7 @@ 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/dockge/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. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 87e7f5ff..c820f960 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ ⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules: -https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma +https://github.com/louislam/dockge/blob/master/CONTRIBUTING.md Tick the checkbox if you understand [x]: - [ ] I have read and understand the pull request rules. diff --git a/.github/workflows/json-yaml-validate.yml b/.github/workflows/json-yaml-validate.yml index 104e37a1..365a1f1f 100644 --- a/.github/workflows/json-yaml-validate.yml +++ b/.github/workflows/json-yaml-validate.yml @@ -23,5 +23,5 @@ jobs: id: json-yaml-validate uses: GrantBirki/json-yaml-validate@v1.3.0 with: - comment: "true" # enable comment mode + comment: "false" # enable comment mode exclude_file: ".github/config/exclude.txt" # gitignore style file for exclusions From fc240f56408a4ec8cbd2ba6d97eca1b679591acc Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 22 Nov 2023 00:52:54 +0800 Subject: [PATCH 7/7] Update --- extra/close-incorrect-issue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/close-incorrect-issue.js b/extra/close-incorrect-issue.js index ae38bccc..f781b067 100644 --- a/extra/close-incorrect-issue.js +++ b/extra/close-incorrect-issue.js @@ -10,7 +10,7 @@ const github = require("@actions/github"); const issue = { owner: "louislam", - repo: "uptime-kuma", + repo: "dockge", number: issueNumber, };