Giter Club home page Giter Club logo

Comments (6)

dusterio avatar dusterio commented on July 22, 2024

@Andreyco it's actually done on purpose - to protect production (public) websites from users calling /worker/queue or /worker/schedule directly. The idea is to set worker environments (APP_ENV) to something like production-worker instead. I will put this in the README.

If you have a better idea of how to isolate these 2 special routes from public - share :))

from laravel-aws-worker.

dusterio avatar dusterio commented on July 22, 2024

I added this in README

Alternative implementation could be an extra environment variable (eg. REGISTER_ROUTES). If it's set - routes are added.

I just don't like the idea of registering the routes by default - you don't want normal users to run your jobs ;)

from laravel-aws-worker.

Andreyco avatar Andreyco commented on July 22, 2024

How I reason about Laravel worker app

  • it processes long running tasks.
  • it runs in its very own container/environment.
  • it's not accessible from outside - only AWS daemon pushes POST requests to worker. Based on this, I don't see any reason to worry about URLs being registered in any environment. They are not accessible from outside.

Is there any possibility anyone would use this package outside of AWS Worker environment? Is it event possible/reasonable?

Also, I would not rely on env name to decide whether to register routes or not. I like REGISTER_ROUTES flag more :) But as noted above, we should be not worried about this at all (let me know if I am mistaken here).

These are my assumptions and findings, I might be wrong. I am, often :)

PS: don't take any of these notes wrong, I am so thankful for this package, it's very good! I hope we figure something out.

from laravel-aws-worker.

dusterio avatar dusterio commented on July 22, 2024

You are right, but very often people run the same application in both web and worker environments. Moreover, Laravel actually assumes that you are doing so - jobs are serialized on one end, and they are supposed to correctly desereliaze and run (read - have all the same classes and methods available) on another end.

Therefore, people would add this package and it would go to both worker and web environments. Hence the protection measure - to ensure extra routes don't land in public web :)

If you worker is a separate application, then there is no problem of course.

Having said all that, an environment variable seems like a more comfortable and clear way to do this. I will put this into next version!

from laravel-aws-worker.

dusterio avatar dusterio commented on July 22, 2024

https://github.com/dusterio/laravel-aws-worker/releases/tag/v0.1.8

I added REGISTER_WORKER_ROUTES variable and currently it's set to true by default (to avoid service interruption for existing users)

from laravel-aws-worker.

Andreyco avatar Andreyco commented on July 22, 2024

Yep, you are correct.

I have jobs with empty "handle" method on public facing app + very same job with "handle" implemented on worker app.

One one side it leads to (very low) duplications but on the other side responsibilities are clear here.

Seems line env variable + major version bump (no to break existing code) would be best solution here.

Sent from my iPhone

On 21 Oct 2016, at 01:56, Denis Mysenko [email protected] wrote:

You are right, but very often people run the same application in both web and worker environments. Moreover, Laravel actually assumes that you are doing so - jobs are serialized on one end, and they are supposed to correctly desereliaze and run (read - have all the same classes and methods available) on another end.

Therefore, people would add this package and it would go to both worker and web environments. Hence the protection measure - to ensure extra routes don't land in public web :)

If you worker is a separate application, then there is no problem of course.

Having said all that, an environment variable seems like a more comfortable and clear way to do this. I will put this into next version!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

from laravel-aws-worker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.