Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why 3 separate apps? #1

Closed
vansante opened this issue Jan 28, 2025 · 5 comments
Closed

Why 3 separate apps? #1

vansante opened this issue Jan 28, 2025 · 5 comments

Comments

@vansante
Copy link

Hello! Thanks for your work on creating a Symfony with Temporal sample, it is exactly what Ive been trying to setup last week. I just keep wondering when browsing through the code:

Why do you use 3 separate apps? I see a lot of common code and especially when not dealing with examples, a lot of things (think: entities, logic, etc) would have to be duplicated over 3 apps.

This left me wondering, is this a mandatory split, or can I also build all of it into one combined Symfony app? And if so, how would I go about doing that?

@feuzeu
Copy link
Owner

feuzeu commented Jan 28, 2025

Hi,

It is absolutely not necessary to have 3 separate apps.
The goal here was to highlight what each part of the app (api, workflow and activity) needs to be able to operate, and thus have a better understanding of the whole system.

[Edit] For example, there is no database package installed in the workflow worker, because there is no need for data access there.
The workflow api can be started other web servers than RoadRunner, meaning that you can implement your workflow api endpoints in an existing Symfony app.

Depending on your particular use case, you can implement your features in one, two, three or even more apps. You can also choose to have separate apps for different features, with the workflows and activities implemented in the same app.

Please note that you will need a specific configuration in RoadRunner if you want to process both HTTP and Temporal requests in the same app.
Check the dispatcher example here for how to achieve that.
https://docs.roadrunner.dev/docs/php-worker/worker

@vansante
Copy link
Author

Thanks a lot for your answer, that clears up some of the questions that I had!

I have been toying with a single App doing all 3 things by moving things into a single app (some code clashes because the class/file names are the same with different contents), but I managed to merge most of it.

However I am now stuck with spawning new workflows (the examples), it throws the exception Calling facade methods can only be made from the currently running process. I am not quite sure what the problem is there.

I will try to separate out a reproducible repository without my own code on Monday if more debugging doesn't bring me any results 😅.

@feuzeu
Copy link
Owner

feuzeu commented Feb 1, 2025

Hi,

I've renamed some files to make it a bit more clear what they do.
Check the commit on the repo.

There's also a new Docker Compose file in the docker/all-in-one dir, which will run a single Symfony app with both an api and a Temporal worker.

@vansante
Copy link
Author

vansante commented Feb 3, 2025

Wow, that is amazingly helpful! Thanks so much!

It works like a charm. 😄

@feuzeu
Copy link
Owner

feuzeu commented Feb 3, 2025

You are welcome.
Happy coding!!

@vansante vansante closed this as completed Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants