wa0x6e / Cake-Resque

Resque plugin for CakePHP : for creating background jobs that can be processed offline later
MIT License
159 stars 56 forks source link

Run in foreground? #110

Open jeremymcjunkin opened 5 years ago

jeremymcjunkin commented 5 years ago

Is it possible to run this in the foreground? I'm trying to run this in a docker container. I'm also wondering if it's possible to direct the logging to stdout so that the docker logs will capture the output.

Kamforka commented 5 years ago

Is there any easy solution for this?

I also tried to tweak the CakeResque config and using the StreamHandler but no matter what target I specify I just can't see the logs in the docker logs.

This the relevant part of my configuration:

...
    'Log' => array(
        'handler' => 'Stream',
        'target' => 'php://stdout',
    ),
...

I also tried the following ones as targets: php://output, php://stderr, /dev/stdout, /dev/stderr and some others without any luck.

Some help would be appreciated!

jeremymcjunkin commented 5 years ago

Here's my fork where I have the output going to stdout and it not running in daemon mode. https://github.com/jeremymcjunkin/Cake-Resque

And what I have in cakeresque.php Set the handler to Console

    'Log' => array(
        'handler' => 'Console',
        'target' => TMP . 'logs' . DS . 'resque.log'
        ),
Kamforka commented 5 years ago

@jeremymcjunkin and you didn't modifiy the target at all, you just left it pointing to the original log file?

jeremymcjunkin commented 5 years ago

@Kamforka correct, it must be ignored when the handler is Console.

coolacid commented 4 years ago

Can you make your fork available on Packagist?

jeremymcjunkin commented 4 years ago

I remember going to do that when I first create it, however, they recommended using a VCS Repository. Check out this link: https://getcomposer.org/doc/05-repositories.md#vcs

coolacid commented 4 years ago

Maybe a PR, see if it's pulled, if not then fork and push out? I think this is an important requirement.

Re VCS, since you changed the name already: Also note that the override will not work if you change the name property in your forked repository's composer.json file as this needs to match the original for the override to work.

coolacid commented 4 years ago

For those following along, this should work?:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/jeremymcjunkin/Cake-Resque"
        }
    ],
    "require": {
        "kamisama/cake-resque": "dev-foreground"
    }
}
coolacid commented 4 years ago

And.... back to suggesting a fork and add to Packagist - Doing VCS against github crokes unless you add a github token (60 requests / hour / ip for public API requests)

https://github.com/composer/composer/issues/7611#issuecomment-418285145