From bce784232b2807a8015ec1a95274e300b8fe62df Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 15 Nov 2024 21:43:21 +0200 Subject: [PATCH 1/2] chore: configure project name --- .env.example | 4 +- .github/.release-please-config.json | 2 +- .github/.release-please-manifest.json | 2 +- .github/ISSUE_TEMPLATE/1-bug-report.yml | 4 +- .github/ISSUE_TEMPLATE/2-feature-request.yml | 4 +- .github/ISSUE_TEMPLATE/3-failing-test.yml | 4 +- .github/ISSUE_TEMPLATE/4-docs-bug-report.yml | 4 +- .github/ISSUE_TEMPLATE/5-security-report.yml | 2 +- .github/SECURITY.md | 8 +-- CHANGELOG.md | 56 -------------------- Makefile | 4 +- README.md | 36 ++++++------- app/composer.json | 10 ++-- 13 files changed, 42 insertions(+), 98 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/.env.example b/.env.example index 96c9754..b2ea386 100644 --- a/.env.example +++ b/.env.example @@ -13,7 +13,7 @@ SHARED_SERVICES_NAMESPACE=ss # in Docker network for current project # More info: # https://docs.docker.com/compose/reference/envvars/#compose_project_name -COMPOSE_PROJECT_NAME=spiral-starter-tpl +COMPOSE_PROJECT_NAME=spiral-app-temporal-demo # You can disable logging for containers by setting "none" as log driver DOCKER_APP_LOG_DRIVER=json-file @@ -69,7 +69,7 @@ DB_LOG_QUERY_PARAMETERS=false DB_WITH_DATETIME_MICROSECONDS=false DB_FORWARD_PORT=5445 DB_PASSWORD=spiral -DB_DATABASE=spiral-starter-tpl +DB_DATABASE=spiral-app-temporal-demo DB_USERNAME=spiral CYCLE_SCHEMA_CACHE=false diff --git a/.github/.release-please-config.json b/.github/.release-please-config.json index ff2bdd3..a9415be 100644 --- a/.github/.release-please-config.json +++ b/.github/.release-please-config.json @@ -3,7 +3,7 @@ "release-type": "php", "packages": { ".": { - "package-name": "spiral-starter-tpl", + "package-name": "spiral-app-temporal-demo", "changelog-path": "/CHANGELOG.md" } }, diff --git a/.github/.release-please-manifest.json b/.github/.release-please-manifest.json index 3eb51cf..1772e6f 100644 --- a/.github/.release-please-manifest.json +++ b/.github/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.0" + ".": "1.0.0" } diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yml b/.github/ISSUE_TEMPLATE/1-bug-report.yml index 20c49a3..bc1babb 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yml @@ -96,8 +96,8 @@ body: value: | 📛 To ensure a smooth issue processing, please check if a similar bug report has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/ISSUE_TEMPLATE/2-feature-request.yml b/.github/ISSUE_TEMPLATE/2-feature-request.yml index 52b00cf..e8b1201 100644 --- a/.github/ISSUE_TEMPLATE/2-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/2-feature-request.yml @@ -66,8 +66,8 @@ body: value: | 📛 To ensure a smooth issue processing, please check if a similar feature request has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/ISSUE_TEMPLATE/3-failing-test.yml b/.github/ISSUE_TEMPLATE/3-failing-test.yml index c4636e2..d7047a5 100644 --- a/.github/ISSUE_TEMPLATE/3-failing-test.yml +++ b/.github/ISSUE_TEMPLATE/3-failing-test.yml @@ -54,8 +54,8 @@ body: value: | 📛 To ensure a smooth issue processing, please check if a similar bug report has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml b/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml index ae7acdc..69df5af 100644 --- a/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml @@ -70,8 +70,8 @@ body: value: | 📛 To ensure a smooth issue processing, please check if a similar bug report has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/ISSUE_TEMPLATE/5-security-report.yml b/.github/ISSUE_TEMPLATE/5-security-report.yml index a1a1624..43d0665 100644 --- a/.github/ISSUE_TEMPLATE/5-security-report.yml +++ b/.github/ISSUE_TEMPLATE/5-security-report.yml @@ -21,7 +21,7 @@ body: - type: markdown attributes: - value: 'To create a new advisory, go to: [Create Security Advisory](https://github.com/wayofdev/spiral-starter-tpl/security/advisories/new)' + value: 'To create a new advisory, go to: [Create Security Advisory](https://github.com/wayofdev/spiral-app-temporal-demo/security/advisories/new)' - type: textarea id: github-advisory-url diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 988da2b..c7611b4 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -1,18 +1,18 @@ # Security Policy -Thank you for helping keep `wayofdev/spiral-starter-tpl` and its users safe. We greatly appreciate your efforts to disclose security vulnerabilities responsibly. +Thank you for helping keep `wayofdev/spiral-app-temporal-demo` and its users safe. We greatly appreciate your efforts to disclose security vulnerabilities responsibly.
## 🚨 Reporting a Vulnerability -We take all security bugs in `wayofdev/spiral-starter-tpl` seriously. Please follow the instructions below to report security vulnerabilities. +We take all security bugs in `wayofdev/spiral-app-temporal-demo` seriously. Please follow the instructions below to report security vulnerabilities. ### → How to Report a Vulnerability -1. **GitHub Security Advisories**: Please report security issues directly through our GitHub Security Advisories page: [https://github.com/wayofdev/spiral-starter-tpl/security/advisories/new](https://github.com/wayofdev/spiral-starter-tpl/security/advisories/new). This ensures that sensitive information is handled confidentially. +1. **GitHub Security Advisories**: Please report security issues directly through our GitHub Security Advisories page: [https://github.com/wayofdev/spiral-app-temporal-demo/security/advisories/new](https://github.com/wayofdev/spiral-app-temporal-demo/security/advisories/new). This ensures that sensitive information is handled confidentially. -2. **Empty Security Issue**: After submitting through GitHub Security Advisories, please also create an empty security issue to alert us, as GitHub Advisories do not send automatic notifications. This can be done [here](https://github.com/wayofdev/spiral-starter-tpl/issues/new?assignees=&labels=type%3A+bug%2Cpriority%3A+high%2Ctype%3A+security&projects=&template=5-security-report.yml&title=%5BSecurity%5D%3A+). +2. **Empty Security Issue**: After submitting through GitHub Security Advisories, please also create an empty security issue to alert us, as GitHub Advisories do not send automatic notifications. This can be done [here](https://github.com/wayofdev/spiral-app-temporal-demo/issues/new?assignees=&labels=type%3A+bug%2Cpriority%3A+high%2Ctype%3A+security&projects=&template=5-security-report.yml&title=%5BSecurity%5D%3A+). 3. **Direct Contact**: For highly sensitive information, in addition to the GitHub Security Advisories, please email us directly at `the@wayof.dev` with the subject line "SECURITY - Vulnerability Report". This will be treated with the highest priority. diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 39d2934..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,56 +0,0 @@ -# Changelog - -## [2.0.0](https://github.com/wayofdev/spiral-starter-tpl/compare/v1.0.0...v2.0.0) (2024-07-30) - - -### ⚠ BREAKING CHANGES - -* bump version with a complete ground-up rewrite of the template - -### Features - -* add sample temporal workflows ([b1ec98e](https://github.com/wayofdev/spiral-starter-tpl/commit/b1ec98e592b760b0d9ca8268498121b47856a9ed)) -* bump version with a complete ground-up rewrite of the template ([58f362b](https://github.com/wayofdev/spiral-starter-tpl/commit/58f362ba24221d7acd7e9ddd9569831532b6a1fc)) -* initial commit with default project structure ([ef5ede4](https://github.com/wayofdev/spiral-starter-tpl/commit/ef5ede4983bf1e15a249295d1839f28f2b4af422)) - - -### Bug Fixes - -* traefik router name conflict ([03cf72e](https://github.com/wayofdev/spiral-starter-tpl/commit/03cf72e04dec5ea1fe5b8b7bb7d155ed1a19138d)) -* update local docker environment ([b06f7ce](https://github.com/wayofdev/spiral-starter-tpl/commit/b06f7ce23f1ec094f1706c2272285d8c90a0830f)) - - -### Documentation - -* add CoC ([7ef248d](https://github.com/wayofdev/spiral-starter-tpl/commit/7ef248d367471184f1ffa1eaced061f7a2825fc1)) -* add MIT LICENSE ([44ed4c1](https://github.com/wayofdev/spiral-starter-tpl/commit/44ed4c14593c004f0881881a4fbb7ab55089ce90)) -* add readme assets ([4f9f4aa](https://github.com/wayofdev/spiral-starter-tpl/commit/4f9f4aac749ef1c1432a45b093eb05138db192d2)) -* move readme into root folder ([0d8a5bc](https://github.com/wayofdev/spiral-starter-tpl/commit/0d8a5bc8d06566c03ff3618370b4ecf5012d67d7)) - - -### Dependencies - -* **deps:** update dependency spiral/temporal-bridge to v3 ([e49eb83](https://github.com/wayofdev/spiral-starter-tpl/commit/e49eb8387dd8077459b3e4bd41ef239f8258085b)) - - -### Code Refactoring - -* **docker-compose:** remove deprecated version param ([55ba8b7](https://github.com/wayofdev/spiral-starter-tpl/commit/55ba8b7ab701f2280628a874d2997beb08992a38)) -* split temporal and app docker compose files ([5931d40](https://github.com/wayofdev/spiral-starter-tpl/commit/5931d4083eeb0adeef3e6a02ba3a5c0173b7c3e6)) - - -### Continuous Integration - -* add base gitignore file ([bffc56b](https://github.com/wayofdev/spiral-starter-tpl/commit/bffc56b22087eebef51f2444e2f748a5dadde521)) -* add docker health checks ([578b34d](https://github.com/wayofdev/spiral-starter-tpl/commit/578b34dbf9846c9f6f9a6421b8a54198cff6a897)) -* add github files ([ab08fd0](https://github.com/wayofdev/spiral-starter-tpl/commit/ab08fd029c45183a4ccbf7d66843f2842f015283)) -* add issue templates ([0a5e9a0](https://github.com/wayofdev/spiral-starter-tpl/commit/0a5e9a0e4f4aa2eb6b8bbbcdceb0f4e4ce8a5630)) -* add local linter configs ([232c3f2](https://github.com/wayofdev/spiral-starter-tpl/commit/232c3f2de1e7200e122472dcf24cff16e22ef6bb)) -* add phive support ([d1e691d](https://github.com/wayofdev/spiral-starter-tpl/commit/d1e691d00a5af1d15c64408f4f62672fa7a23c86)) -* add release-please ([840b985](https://github.com/wayofdev/spiral-starter-tpl/commit/840b9856ecb3f372a68b464d9adde598da3b5a5c)) -* add renovatebot config ([cccce5e](https://github.com/wayofdev/spiral-starter-tpl/commit/cccce5e716a3cf2bddb5782df6bcb66466c3b4a7)) -* add workflows ([659f597](https://github.com/wayofdev/spiral-starter-tpl/commit/659f59791f59b3d66fbab886b5253c0a1524a4b6)) -* change in-app .gitignore ([ee3f688](https://github.com/wayofdev/spiral-starter-tpl/commit/ee3f688eed9801d360aa45dccfeaaab8c2d64394)) -* lint composer json ([1528215](https://github.com/wayofdev/spiral-starter-tpl/commit/1528215d5bfee9e24e2d72891fafd05b89289487)) -* move .env file out of app folder ([459992b](https://github.com/wayofdev/spiral-starter-tpl/commit/459992b4a1409c08164943c2045c21e9fd057cea)) -* update composer json dependencies, add basic scripts ([da7a0ae](https://github.com/wayofdev/spiral-starter-tpl/commit/da7a0ae5b2366948bf2102424755fbf4c5c4403d)) diff --git a/Makefile b/Makefile index 8ee4ca0..d51da11 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ else WHITE := "" RST := "" endif -MAKE_LOGFILE = /tmp/wayofdev-spiral-starter-tpl.log +MAKE_LOGFILE = /tmp/wayofdev-spiral-app-temporal-demo.log MAKE_CMD_COLOR := $(BLUE) default: all @@ -102,7 +102,7 @@ help: ## Show this menu @echo @echo ' 📑 Logs are stored in $(MAKE_LOGFILE)' @echo - @echo ' 📦 Project spiral-starter-tpl (https://github.com/wayofdev/spiral-starter-tpl)' + @echo ' 📦 Project spiral-app-temporal-demo (https://github.com/wayofdev/spiral-app-temporal-demo)' @echo ' 🤠 Makefile Author Andrij Orlenko (https://github.com/lotyp)' @echo ' 🏢 ${YELLOW}Org wayofdev (https://github.com/wayofdev)${RST}' @echo diff --git a/README.md b/README.md index 673e5df..0ebe4ab 100644 --- a/README.md +++ b/README.md @@ -11,20 +11,20 @@

Build
- Build Status - Deploy to Staging Status - Deploy to Production Status + Build Status + Deploy to Staging Status + Deploy to Production Status

Project
- Latest Stable Version - Commits since latest release - PHP Version Require + Latest Stable Version + Commits since latest release + PHP Version Require

Quality
- Codecov - Mutation testing badge + Codecov + Mutation testing badge PHP Stan Level 8 of 9

@@ -172,13 +172,13 @@ Check full instructions in [docker-shared-services](https://github.com/wayofdev/ 1. **Clone** repository: - After forking or creating generating repository from template, you can clone it to your local machine. In this example we will use `spiral-starter-tpl` repository as starting point. + After forking or creating generating repository from template, you can clone it to your local machine. In this example we will use `spiral-app-temporal-demo` repository as starting point. ```bash git clone \ - git@github.com:wayofdev/spiral-starter-tpl.git \ - ~/projects/spiral-starter-tpl && \ - cd ~/projects/spiral-starter-tpl + git@github.com:wayofdev/spiral-app-temporal-demo.git \ + ~/projects/spiral-app-temporal-demo && \ + cd ~/projects/spiral-app-temporal-demo ``` 2. **Generate** `.env` file @@ -188,7 +188,7 @@ Check full instructions in [docker-shared-services](https://github.com/wayofdev/ ```bash $ make env \ SHARED_SERVICES_NAMESPACE=ss \ - COMPOSE_PROJECT_NAME=spiral-starter-tpl + COMPOSE_PROJECT_NAME=spiral-app-temporal-demo ``` **Change** generated `.env` file to match your needs, if needed. @@ -198,7 +198,7 @@ Check full instructions in [docker-shared-services](https://github.com/wayofdev/ ```bash $ make env \ SHARED_SERVICES_NAMESPACE=ss \ - COMPOSE_PROJECT_NAME=spiral-starter-tpl \ + COMPOSE_PROJECT_NAME=spiral-app-temporal-demo \ FORCE=true ``` @@ -215,13 +215,13 @@ Check full instructions in [docker-shared-services](https://github.com/wayofdev/ $ make up ``` -4. **Open** your browser and navigate to `https://api.spiral-starter-tpl.docker` to see Laravel welcome page. +4. **Open** your browser and navigate to `https://api.spiral-app-temporal-demo.docker` to see Laravel welcome page.
## 🧰 Project Architecture -The project architecture of `wayofdev/spiral-starter-tpl` follows a structured approach with distinct layers: +The project architecture of `wayofdev/spiral-app-temporal-demo` follows a structured approach with distinct layers: * **Domain:** Contains core business logic and entities. * **Bridge:** Connects the domain layer with external systems or services. @@ -233,13 +233,13 @@ The project architecture of `wayofdev/spiral-starter-tpl` follows a structured a Each layer has defined dependencies, ensuring a clear separation of concerns and facilitating maintainability and scalability. -For more information check [deptrac.yaml](https://github.com/wayofdev/spiral-starter-tpl/blob/develop/app/deptrac.yaml) located in repository `app` folder. +For more information check [deptrac.yaml](https://github.com/wayofdev/spiral-app-temporal-demo/blob/develop/app/deptrac.yaml) located in repository `app` folder.
## 🪄 Template -This project was generated from the [spiral/app](https://github.com/spiral/app) repository using the command: `composer create-project spiral/app spiral-starter-tpl` with the following selected options: +This project was generated from the [spiral/app](https://github.com/spiral/app) repository using the command: `composer create-project spiral/app spiral-app-temporal-demo` with the following selected options:

View Setup Options diff --git a/app/composer.json b/app/composer.json index a99aff0..c13f1cb 100644 --- a/app/composer.json +++ b/app/composer.json @@ -1,6 +1,6 @@ { - "name": "wayofdev/spiral-starter-tpl", - "description": "🚀 Pre-configured Spiral Framework Project Template. Includes PHPUnit, Pest PHP, PHPStan, PHP CS Fixer, and CI tools. Supports OpenAPI, DDD, Deptrac, Deployer, PHP 8.3, Docker, local SSL, and DNS. Enhance development with advanced features and maintain high code quality.", + "name": "wayofdev/spiral-app-temporal-demo", + "description": "🚀 Spiral Framework application with Temporal integration to demonstrate Workflow Engine.", "license": "MIT", "type": "project", "keywords": [ @@ -29,9 +29,9 @@ ], "homepage": "https://wayof.dev", "support": { - "issues": "https://github.com/wayofdev/spiral-starter-tpl/issues", - "source": "https://github.com/wayofdev/spiral-starter-tpl", - "security": "https://github.com/wayofdev/spiral-starter-tpl/blob/master/.github/SECURITY.md" + "issues": "https://github.com/wayofdev/spiral-app-temporal-demo/issues", + "source": "https://github.com/wayofdev/spiral-app-temporal-demo", + "security": "https://github.com/wayofdev/spiral-app-temporal-demo/blob/master/.github/SECURITY.md" }, "require": { "php": "^8.3", From 3db4a20cf9afe4cce953ae7039b41205d999a4da Mon Sep 17 00:00:00 2001 From: lotyp Date: Wed, 20 Nov 2024 20:28:49 +0200 Subject: [PATCH 2/2] feat: workflow example --- .github/workflows/coding-standards.yml | 4 +- .github/workflows/dependency-analysis.yml | 4 +- .github/workflows/refactoring.yml | 2 +- .github/workflows/security-analysis.yml | 2 +- .github/workflows/static-analysis.yml | 4 +- .github/workflows/testing.yml | 6 +- app/composer-require-checker.json | 3 +- app/composer.json | 3 + app/composer.lock | 175 ++++++++++++++++-- .../Transfer/DTO/TransferDetails.php | 39 ++++ .../Bridge/Spiral/Console/TransferCommand.php | 33 ++++ .../TransferWebsiteWorkflowInterface.php | 16 ++ .../Destination/AllocateSpaceActivity.php | 22 +++ .../Destination/AttachDomainActivity.php | 22 +++ .../Destination/DestinationStub.php | 74 ++++++++ .../ReConfigureWebsiteActivity.php | 22 +++ .../Destination/RestoreDatabaseActivity.php | 22 +++ .../Destination/RestoreFilesActivity.php | 22 +++ .../Source/InitiateDatabaseBackupActivity.php | 22 +++ .../Source/InitiateFilesBackupActivity.php | 22 +++ .../Source/ReleaseDomainActivity.php | 22 +++ .../Transfer/Activities/Source/SourceStub.php | 62 +++++++ .../Source/TransferBackupActivity.php | 23 +++ .../Workflows/TransferWebsiteWorkflow.php | 40 ++++ .../Workflows/TransferWebsiteWorkflowStub.php | 23 +++ docker-compose.temporal.yaml | 4 +- docker-compose.yaml | 2 +- 27 files changed, 664 insertions(+), 31 deletions(-) create mode 100644 app/src/Application/Transfer/DTO/TransferDetails.php create mode 100644 app/src/Bridge/Spiral/Console/TransferCommand.php create mode 100644 app/src/Domain/Transfer/Contracts/TransferWebsiteWorkflowInterface.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Destination/AllocateSpaceActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Destination/AttachDomainActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Destination/DestinationStub.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Destination/ReConfigureWebsiteActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreDatabaseActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreFilesActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateDatabaseBackupActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateFilesBackupActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Source/ReleaseDomainActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Source/SourceStub.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Activities/Source/TransferBackupActivity.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflow.php create mode 100644 app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflowStub.php diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index b5241af..b2444f0 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -95,7 +95,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: none tools: phive @@ -165,7 +165,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, decimal, grpc ini-values: error_reporting=E_ALL coverage: none diff --git a/.github/workflows/dependency-analysis.yml b/.github/workflows/dependency-analysis.yml index 52931a5..3ce27d5 100644 --- a/.github/workflows/dependency-analysis.yml +++ b/.github/workflows/dependency-analysis.yml @@ -46,7 +46,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: none tools: phive @@ -109,7 +109,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: none tools: phive diff --git a/.github/workflows/refactoring.yml b/.github/workflows/refactoring.yml index cad970e..0b70d10 100644 --- a/.github/workflows/refactoring.yml +++ b/.github/workflows/refactoring.yml @@ -41,7 +41,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: none diff --git a/.github/workflows/security-analysis.yml b/.github/workflows/security-analysis.yml index 56dee7d..9033fdc 100644 --- a/.github/workflows/security-analysis.yml +++ b/.github/workflows/security-analysis.yml @@ -36,7 +36,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: none diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index dcaf5ff..c9be01d 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -35,7 +35,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, opcache, pcntl, posix, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, opcache, pcntl, posix, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: none @@ -89,7 +89,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, pdo_mysql, curl, fileinfo, opcache, pcntl, posix, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, pdo_mysql, curl, fileinfo, opcache, pcntl, posix, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: xdebug diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9e1e995..029f4ea 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -42,7 +42,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, pdo_mysql, pdo_sqlite, curl, fileinfo, opcache, pcntl, posix, sockets, decimal + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, pdo_mysql, pdo_sqlite, curl, fileinfo, opcache, pcntl, posix, sockets, decimal, grpc ini-values: error_reporting=E_ALL coverage: xdebug @@ -115,7 +115,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: mbstring, pdo, pdo_sqlite, decimal + extensions: mbstring, pdo, pdo_sqlite, decimal, grpc ini-values: error_reporting=E_ALL coverage: xdebug @@ -179,7 +179,7 @@ jobs: uses: shivammathur/setup-php@2.31.1 with: php-version: ${{ matrix.php-version }} - extensions: mbstring, pdo, pdo_sqlite, decimal + extensions: mbstring, pdo, pdo_sqlite, decimal, grpc ini-values: error_reporting=E_ALL coverage: xdebug diff --git a/app/composer-require-checker.json b/app/composer-require-checker.json index 2d1d026..937902b 100644 --- a/app/composer-require-checker.json +++ b/app/composer-require-checker.json @@ -5,6 +5,7 @@ "Spiral\\DatabaseSeeder\\Attribute\\Seeder", "Spiral\\DatabaseSeeder\\Bootloader\\DatabaseSeederBootloader", "Spiral\\DatabaseSeeder\\Factory\\AbstractFactory", - "Spiral\\DatabaseSeeder\\Seeder\\AbstractSeeder" + "Spiral\\DatabaseSeeder\\Seeder\\AbstractSeeder", + "OpenApi\\Attributes\\Property" ] } diff --git a/app/composer.json b/app/composer.json index c13f1cb..fe5aaaa 100644 --- a/app/composer.json +++ b/app/composer.json @@ -36,6 +36,7 @@ "require": { "php": "^8.3", "ext-decimal": "*", + "ext-grpc": "*", "ext-mbstring": "*", "ext-pdo": "*", "ext-sockets": "*", @@ -48,10 +49,12 @@ "eventsauce/eventsauce": "^3.6", "illuminate/collections": "^9.52", "monolog/monolog": "^3.8", + "nesbot/carbon": "^2.72", "ramsey/uuid": "^4.7", "spiral-packages/laravel-validator": "^1.1", "spiral-packages/league-event": "^1.0", "spiral-packages/scheduler": "^2.3", + "spiral-packages/swagger-php": "^1.0", "spiral-packages/yii-error-handler-bridge": "^1.1", "spiral/cycle-bridge": "^2.10", "spiral/data-grid-bridge": "^3.0", diff --git a/app/composer.lock b/app/composer.lock index e5f07bb..b6324e0 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "81f7ab1a7c43ac05dcb05cbdb638f900", + "content-hash": "b0471a7b188594f743b3321e8e82c7ad", "packages": [ { "name": "alexkart/curl-builder", @@ -2649,28 +2649,28 @@ }, { "name": "jean85/pretty-package-versions", - "version": "2.0.6", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4" + "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/f9fdd29ad8e6d024f52678b570e5593759b550b4", - "reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", + "reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10", "shasum": "" }, "require": { - "composer-runtime-api": "^2.0.0", - "php": "^7.1|^8.0" + "composer-runtime-api": "^2.1.0", + "php": "^7.4|^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.2", "jean85/composer-provided-replaced-stub-package": "^1.0", "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^7.5|^8.5|^9.4", - "vimeo/psalm": "^4.3" + "phpunit/phpunit": "^7.5|^8.5|^9.6", + "vimeo/psalm": "^4.3 || ^5.0" }, "type": "library", "extra": { @@ -2702,9 +2702,9 @@ ], "support": { "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.6" + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.0" }, - "time": "2024-03-08T09:58:59+00:00" + "time": "2024-11-18T16:19:46+00:00" }, { "name": "league/event", @@ -5514,6 +5514,67 @@ }, "time": "2024-09-30T12:03:29+00:00" }, + { + "name": "spiral-packages/swagger-php", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/spiral-packages/swagger-php.git", + "reference": "82f937da325579f9adc55bb74ccd38ef69c77d4f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spiral-packages/swagger-php/zipball/82f937da325579f9adc55bb74ccd38ef69c77d4f", + "reference": "82f937da325579f9adc55bb74ccd38ef69c77d4f", + "shasum": "" + }, + "require": { + "php": "^8.1", + "spiral/boot": "^3.5", + "spiral/cache": "^3.5", + "spiral/config": "^3.5", + "spiral/core": "^3.5", + "spiral/http": "^3.5", + "spiral/views": "^3.5", + "zircote/swagger-php": "^4.8" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.42", + "phpunit/phpunit": "^10.5", + "roave/security-advisories": "dev-latest", + "spiral/testing": "^2.6", + "vimeo/psalm": "^5.18" + }, + "type": "library", + "extra": { + "spiral": { + "bootloaders": [ + "Spiral\\OpenApi\\Bootloader\\SwaggerBootloader" + ] + } + }, + "autoload": { + "psr-4": { + "Spiral\\OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Swagger-php integration package for Spiral Framework.", + "homepage": "https://github.com/spiral-packages/swagger-php", + "keywords": [ + "Swagger-PHP", + "api", + "spiral" + ], + "support": { + "issues": "https://github.com/spiral-packages/swagger-php/issues", + "source": "https://github.com/spiral-packages/swagger-php/tree/v1.0.0" + }, + "time": "2024-02-27T16:14:50+00:00" + }, { "name": "spiral-packages/yii-error-handler-bridge", "version": "1.1.2", @@ -9988,6 +10049,87 @@ } ], "time": "2023-12-22T07:29:39+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "4.11.1", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7df10e8ec47db07c031db317a25bef962b4e5de1", + "reference": "7df10e8ec47db07c031db317a25bef962b4e5de1", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.2", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "symfony/deprecation-contracts": "^2 || ^3", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.7 || ^2.0", + "friendsofphp/php-cs-fixer": "^2.17 || 3.62.0", + "phpstan/phpstan": "^1.6", + "phpunit/phpunit": ">=8", + "vimeo/psalm": "^4.23" + }, + "suggest": { + "doctrine/annotations": "^1.7 || ^2.0" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "https://bfanger.nl" + }, + { + "name": "Martin Rademacher", + "email": "mano@radebatz.net", + "homepage": "https://radebatz.net" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "support": { + "issues": "https://github.com/zircote/swagger-php/issues", + "source": "https://github.com/zircote/swagger-php/tree/4.11.1" + }, + "time": "2024-10-15T19:20:02+00:00" } ], "packages-dev": [ @@ -12972,16 +13114,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.10", + "version": "1.12.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "fc463b5d0fe906dcf19689be692c65c50406a071" + "reference": "0d1fc20a962a91be578bcfe7cf939e6e1a2ff733" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fc463b5d0fe906dcf19689be692c65c50406a071", - "reference": "fc463b5d0fe906dcf19689be692c65c50406a071", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d1fc20a962a91be578bcfe7cf939e6e1a2ff733", + "reference": "0d1fc20a962a91be578bcfe7cf939e6e1a2ff733", "shasum": "" }, "require": { @@ -13026,7 +13168,7 @@ "type": "github" } ], - "time": "2024-11-11T15:37:09+00:00" + "time": "2024-11-17T14:08:01+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -16273,6 +16415,7 @@ "platform": { "php": "^8.3", "ext-decimal": "*", + "ext-grpc": "*", "ext-mbstring": "*", "ext-pdo": "*", "ext-sockets": "*" diff --git a/app/src/Application/Transfer/DTO/TransferDetails.php b/app/src/Application/Transfer/DTO/TransferDetails.php new file mode 100644 index 0000000..e735f5c --- /dev/null +++ b/app/src/Application/Transfer/DTO/TransferDetails.php @@ -0,0 +1,39 @@ +transferId = $transferId; + $this->fromUserId = $fromUserId; + $this->toUserId = $toUserId; + $this->fromDomain = $fromDomain; + $this->toDomain = $toDomain; + } +} diff --git a/app/src/Bridge/Spiral/Console/TransferCommand.php b/app/src/Bridge/Spiral/Console/TransferCommand.php new file mode 100644 index 0000000..236be8c --- /dev/null +++ b/app/src/Bridge/Spiral/Console/TransferCommand.php @@ -0,0 +1,33 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/AttachDomainActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/AttachDomainActivity.php new file mode 100644 index 0000000..745939c --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/AttachDomainActivity.php @@ -0,0 +1,22 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/DestinationStub.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/DestinationStub.php new file mode 100644 index 0000000..7c3b83f --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/DestinationStub.php @@ -0,0 +1,74 @@ +withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } + + public static function restoreFiles(): ActivityProxy|RestoreFilesActivity + { + return Workflow::newActivityStub( + RestoreFilesActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } + + public static function allocateSpace(): ActivityProxy|AllocateSpaceActivity + { + return Workflow::newActivityStub( + AllocateSpaceActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } + + public static function attachDomain(): ActivityProxy|AttachDomainActivity + { + return Workflow::newActivityStub( + AttachDomainActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } + + public static function reConfigureWebsite(): ActivityProxy|ReConfigureWebsiteActivity + { + return Workflow::newActivityStub( + ReConfigureWebsiteActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/ReConfigureWebsiteActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/ReConfigureWebsiteActivity.php new file mode 100644 index 0000000..db9c811 --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/ReConfigureWebsiteActivity.php @@ -0,0 +1,22 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreDatabaseActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreDatabaseActivity.php new file mode 100644 index 0000000..1f3c7e1 --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreDatabaseActivity.php @@ -0,0 +1,22 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreFilesActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreFilesActivity.php new file mode 100644 index 0000000..aecfe37 --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Destination/RestoreFilesActivity.php @@ -0,0 +1,22 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateDatabaseBackupActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateDatabaseBackupActivity.php new file mode 100644 index 0000000..4d0c5b6 --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateDatabaseBackupActivity.php @@ -0,0 +1,22 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateFilesBackupActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateFilesBackupActivity.php new file mode 100644 index 0000000..2c4684b --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/InitiateFilesBackupActivity.php @@ -0,0 +1,22 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Source/ReleaseDomainActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/ReleaseDomainActivity.php new file mode 100644 index 0000000..c2bb7e8 --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/ReleaseDomainActivity.php @@ -0,0 +1,22 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Source/SourceStub.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/SourceStub.php new file mode 100644 index 0000000..9da80c0 --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/SourceStub.php @@ -0,0 +1,62 @@ +withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } + + public static function initiateDatabaseBackup(): ActivityProxy|InitiateDatabaseBackupActivity + { + return Workflow::newActivityStub( + InitiateDatabaseBackupActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } + + public static function releaseDomain(): ActivityProxy|ReleaseDomainActivity + { + return Workflow::newActivityStub( + ReleaseDomainActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } + + public static function transferBackup(): ActivityProxy|TransferBackupActivity + { + return Workflow::newActivityStub( + TransferBackupActivity::class, + ActivityOptions::new() + ->withStartToCloseTimeout(CarbonInterval::minute()) + ->withRetryOptions( + RetryOptions::new()->withMaximumAttempts(1), + ), + ); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Activities/Source/TransferBackupActivity.php b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/TransferBackupActivity.php new file mode 100644 index 0000000..91893fb --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Activities/Source/TransferBackupActivity.php @@ -0,0 +1,23 @@ +toString(); + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflow.php b/app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflow.php new file mode 100644 index 0000000..9254c8f --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflow.php @@ -0,0 +1,40 @@ +actions[] = SourceStub::initiateFilesBackup(); + $this->actions[] = SourceStub::releaseDomain(); + $this->actions[] = SourceStub::initiateDatabaseBackup(); + $this->actions[] = SourceStub::transferBackup(); + $this->actions[] = DestinationStub::allocateSpace(); + $this->actions[] = DestinationStub::restoreDatabase(); + $this->actions[] = DestinationStub::restoreFiles(); + $this->actions[] = DestinationStub::attachDomain(); + } + + public function handle(TransferDetails $transferDetails) + { + foreach ($this->actions as $action) { + try { + yield $action->handle($transferDetails); // Execute each activity sequentially + } catch (Throwable $e) { + // Handle or log the error + // todo: Log error + } + } + } +} diff --git a/app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflowStub.php b/app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflowStub.php new file mode 100644 index 0000000..9e6e28e --- /dev/null +++ b/app/src/Infrastructure/Temporal/Transfer/Workflows/TransferWebsiteWorkflowStub.php @@ -0,0 +1,23 @@ +newWorkflowStub( + TransferWebsiteWorkflow::class, + ); + + return $client->start($workflow, $transferDetails); + } +} diff --git a/docker-compose.temporal.yaml b/docker-compose.temporal.yaml index 24b9d4d..0eae7d0 100644 --- a/docker-compose.temporal.yaml +++ b/docker-compose.temporal.yaml @@ -25,7 +25,7 @@ services: driver: ${DOCKER_TEMPORAL_DATABASE_LOG_DRIVER:-json-file} temporal: - image: temporalio/auto-setup:1.24.2 + image: temporalio/auto-setup:1.25.2 container_name: ${COMPOSE_PROJECT_NAME}-temporal restart: on-failure networks: @@ -54,7 +54,7 @@ services: driver: ${DOCKER_TEMPORAL_LOG_DRIVER:-json-file} temporal-ui: - image: temporalio/ui:2.29.2 + image: temporalio/ui:2.31.2 container_name: ${COMPOSE_PROJECT_NAME}-temporal-ui restart: on-failure networks: diff --git a/docker-compose.yaml b/docker-compose.yaml index e52f018..c517756 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,7 +2,7 @@ services: app: - image: wayofdev/php-dev:8.3-cli-alpine-latest + image: ghcr.io/wayofdev/docker-php-dev:8.3-cli-alpine-latest container_name: ${COMPOSE_PROJECT_NAME}-app restart: on-failure networks: