From 9b9f3f353004f1cd81c92595cb0ce770e8502ada Mon Sep 17 00:00:00 2001 From: Levente Orban Date: Wed, 23 Aug 2023 12:54:58 +0200 Subject: [PATCH 1/2] ci: remove hardcoded values and small changes --- .github/workflows/deploy_external.yaml | 6 ++- CONTRIBUTING.md | 55 ++++++++++++++++++-------- GETTING_STARTED.md | 1 + MAINTAINERS.md | 13 +++--- SECURITY.md | 20 +++++----- 5 files changed, 61 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy_external.yaml b/.github/workflows/deploy_external.yaml index 73e3376d68..cdf5af9471 100644 --- a/.github/workflows/deploy_external.yaml +++ b/.github/workflows/deploy_external.yaml @@ -19,4 +19,8 @@ jobs: steps: - name: Execute dedicated Sunilium instance webhook run: | - curl -X POST -H 'Authorization: Bearer ${{secrets.SUN_DYO_WEBHOOK_TOKEN}}' https://app.dyrectorio.com/api/deployments/8322f763-e611-40c7-a29b-bb21f2fd4822/start + if curl -s -X POST --fail --head'Authorization: Bearer ${{secrets.SUN_DYO_WEBHOOK_TOKEN}}' ${{secrets.SUN_DYO_WEBHOOK_API_URL}}; then + echo "Deployment successful." + else + exit 1 + fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a19524013b..aaf902b698 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,16 +13,24 @@ If you're worried or don’t know where to start, check out our next section exp ## Development 1. Run `make upd` in the repo's root folder. - - Save your `DATABASE_URL=` environment variable for later. + +- Save your `DATABASE_URL=` environment variable for later. + 2. Go to the `web/crux` directory: `cd web/crux` 3. Install dependencies `npm ci` 4. Copy the _env.example_ file as _.env_ `cp .env.example .env` - - Paste `DATABASE_URL=` variable from step 1 to _.env_ + +- Paste `DATABASE_URL=` variable from step 1 to _.env_ + 5. On Linux: - - Uncomment the `DNS_DEFAULT_RESULT_ORDER=ipv4first` line in the _.env_ file - - Change the `CRUX_AGENT_ADDRESS` variable's value to `172.17.0.1:5000` + +- Uncomment the `DNS_DEFAULT_RESULT_ORDER=ipv4first` line in the _.env_ file +- Change the `CRUX_AGENT_ADDRESS` variable's value to `172.17.0.1:5000` + 6. On Mac / Windows you may have to edit your OS's hosts file to be sure the `host.docker.internal` domain resolves to docker's bridge network. - - Alternatively you can use your machine's LAN IP. + +- Alternatively you can use your machine's LAN IP. + 7. Deploy the database with `npm run prisma:migrate` 8. Start the backend with `npm run start` 9. Go to the `web/crux-ui` directory: `cd web/crux-ui` @@ -38,37 +46,50 @@ If you're worried or don’t know where to start, check out our next section exp Read more about the CLI in the [documentation](https://docs.dyrector.io/get-started/cli). ## Testing + Unit tests: -- In the `web/crux` or `web/crux-ui` folder respectively: + +- In the `web/crux` or `web/crux-ui` folder respectively: + 1. Run `npm ci`. 2. Start the tests with `npm run test`. End-to-end tests: + 1. Run `make upd` in the repo's root folder. - - Save your `DATABASE_URL=` environment variable for later. + +- Save your `DATABASE_URL=` environment variable for later. + 2. Go to the `web/crux` directory: `cd web/crux` 3. Install dependencies `npm ci` 4. Build the package `npm run build` 5. Copy the _env.example_ file as _.env_ `cp .env.example .env` 6. On Linux: - - Uncomment the `DNS_DEFAULT_RESULT_ORDER=ipv4first` line in the _.env_ file - - Change the `CRUX_AGENT_ADDRESS` variable's value to `172.17.0.1:5000` + +- Uncomment the `DNS_DEFAULT_RESULT_ORDER=ipv4first` line in the _.env_ file +- Change the `CRUX_AGENT_ADDRESS` variable's value to `172.17.0.1:5000` + 6. On Mac / Windows you may have to edit your OS's hosts file to be sure the `host.docker.internal` domain resolves to docker's bridge network. - - Alternatively you can use your machine's LAN IP. + +- Alternatively you can use your machine's LAN IP. + 7. Deploy the database with `npm run prisma:migrate` 8. Start the backend in production mode with `npm run start:prod` 9. Repeat steps 3-5 in the `web/crux-ui` folder in a different terminal 10. Start the frontend in production mode with `npm run start:prod` 11. Be sure that `chromium` is installed on your system - - You may have to run `npx playwright install-deps` - - More info: https://playwright.dev/docs/intro - - Additional note: On some systems like Manjaro, `npx playwright install-deps` does not work + +- You may have to run `npx playwright install-deps` +- More info: https://playwright.dev/docs/intro +- Additional note: On some systems like Manjaro, `npx playwright install-deps` does not work (warning message: "your OS is not officially supported by Playwright"). In this case, you can run `npm init playwright@latest` and when prompted with the question "Install Playwright operating system dependencies", choose "No". After that, for Manjaro, you need to separately install Playwright from the AUR repository with the package manager and everything works just fine. + 12. In a different terminal go to the `web/crux-ui` folder and run `npm run test:e2e` - - If you want to run a specific test file from the `web/crux-ui/e2e` folder you can do it with `DEBUG=1 npx playwright test ` - - If you want to open the inspector to see the tests running you can do it with `PWDEBUG=1 npx playwright test ` + +- If you want to run a specific test file from the `web/crux-ui/e2e` folder you can do it with `DEBUG=1 npx playwright test ` +- If you want to open the inspector to see the tests running you can do it with `PWDEBUG=1 npx playwright test ` ## Changelog @@ -80,13 +101,13 @@ make release ## Git branching strategy -We have two persistent branches: main, develop. +We have two persistent branches: main, develop. PRs are going into develop. The develop branch is always fast-forward mergable to main. PR titles must follow the conventional commit guidelines. Release: a release commit is made to develop, package versions are bumped, develop is fast-forward merged into main. -Hotfix: in rare occassions, a hotfix/** branch is created from main and the PR targets the main branch, +Hotfix: in rare occassions, a hotfix/\*\* branch is created from main and the PR targets the main branch, develop must be rebased to main -- using rebase-onto. ## Submit a Pull Request diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 78549c66c6..294522f6bd 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -3,6 +3,7 @@ Our CLI tool lets you run and manage the entire, fully functional stack for development purposes. Stack: + - UI Service (crux-ui) - Backend Service (crux) - PostgreSQL database diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 09df72c97e..316cfcd8dd 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,11 +1,12 @@ # dyrector.io platform maintainers -| Name | GitHub ID | Scope | -| ----------------- | -------------- | -------------------------- | -| Mate Vago | @m8vago | Web (crux and crux-ui) | -| Nandor Magyar | @nandor-magyar | Golang releated components | -| Szilveszter Liszy | @c3ppc3pp | CLI and CI pipelines | -| Levente Orban | @polaroi8d | Releases & Issues | +| Name | GitHub ID | Scope | +| ---------- | -------------- | -------------------------- | +| Mate | @m8vago | Web components | +| Bence | @robot9706 | Web components | +| Nandor | @nandor-magyar | Golang releated components | +| @core-team | @core-team | CLI and CI pipelines | +| Levente | @polaroi8d | Releases & Issues | Please use [GitHub Issues](https://github.com/dyrector-io/dyrectorio/issues) for reporting non-security issues, and [GitHub Discussions](https://github.com/dyrector-io/dyrectorio/discussions) diff --git a/SECURITY.md b/SECURITY.md index 3258e35053..ba5efddcc5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,19 +6,19 @@ If you discover a vulnerability, we would like to know about it so we can take s Please do the following: -- E-mail your findings to hello@dyrector.io. -- Do not take advantage of the vulnerability or problem you have discovered, for example by downloading more data than necessary to demonstrate the vulnerability or deleting or modifying other people's data, -- Do not reveal the problem to others until it has been resolved, -- Do not use attacks on physical security, social engineering, distributed denial of service, spam or applications of third parties, and -- Do provide sufficient information to reproduce the problem, so we will be able to resolve it as quickly as possible. Usually, the IP address or the URL of the affected system and a description of the vulnerability will be sufficient, but complex vulnerabilities may require further explanation. +- E-mail your findings to hello@dyrector.io. +- Do not take advantage of the vulnerability or problem you have discovered, for example by downloading more data than necessary to demonstrate the vulnerability or deleting or modifying other people's data, +- Do not reveal the problem to others until it has been resolved, +- Do not use attacks on physical security, social engineering, distributed denial of service, spam or applications of third parties, and +- Do provide sufficient information to reproduce the problem, so we will be able to resolve it as quickly as possible. Usually, the IP address or the URL of the affected system and a description of the vulnerability will be sufficient, but complex vulnerabilities may require further explanation. What we promise: -- We will respond to your report within 3 business days with our evaluation of the report and an expected resolution date, -- If you have followed the instructions above, we will not take any legal action against you in regard to the report, -- We will handle your report with strict confidentiality, and not pass on your personal details to third parties without your permission, -- We will keep you informed of the progress towards resolving the problem, -- In the public information concerning the problem reported, we will give your name as the discoverer of the problem (unless you desire otherwise) +- We will respond to your report within 3 business days with our evaluation of the report and an expected resolution date, +- If you have followed the instructions above, we will not take any legal action against you in regard to the report, +- We will handle your report with strict confidentiality, and not pass on your personal details to third parties without your permission, +- We will keep you informed of the progress towards resolving the problem, +- In the public information concerning the problem reported, we will give your name as the discoverer of the problem (unless you desire otherwise) We strive to resolve all problems as quickly as possible, and we would like to play an active role in the ultimate publication on the problem after it is resolved. From 42973326df93ab0e4f01e35644f3362794b58e4c Mon Sep 17 00:00:00 2001 From: Levente Orban Date: Mon, 28 Aug 2023 10:15:15 +0200 Subject: [PATCH 2/2] ci: remove hardcoded values and small changes --- .github/workflows/deploy_external.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_external.yaml b/.github/workflows/deploy_external.yaml index cdf5af9471..d670e19966 100644 --- a/.github/workflows/deploy_external.yaml +++ b/.github/workflows/deploy_external.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Execute dedicated Sunilium instance webhook run: | - if curl -s -X POST --fail --head'Authorization: Bearer ${{secrets.SUN_DYO_WEBHOOK_TOKEN}}' ${{secrets.SUN_DYO_WEBHOOK_API_URL}}; then + if curl -s -X POST --fail --head' Authorization: Bearer ${{secrets.SUN_DYO_WEBHOOK_TOKEN}}' ${{secrets.SUN_DYO_WEBHOOK_API_URL}}; then echo "Deployment successful." else exit 1