{"id":13754149,"url":"https://github.com/php-comrade/comrade-dev","last_synced_at":"2026-01-23T08:09:17.363Z","repository":{"id":139448288,"uuid":"105005279","full_name":"php-comrade/comrade-dev","owner":"php-comrade","description":"Comrade is a job scheduler\u0026manager service.","archived":false,"fork":false,"pushed_at":"2018-12-20T14:37:24.000Z","size":5525,"stargazers_count":70,"open_issues_count":6,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-09T22:34:14.487Z","etag":null,"topics":["job","job-manager","job-queue","job-scheduler","microservice","service"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-comrade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-09-27T10:32:05.000Z","updated_at":"2024-11-06T15:00:14.000Z","dependencies_parsed_at":"2024-01-17T15:03:38.955Z","dependency_job_id":"79246b25-1542-4e95-8837-e717f17efb64","html_url":"https://github.com/php-comrade/comrade-dev","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/php-comrade/comrade-dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-comrade%2Fcomrade-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-comrade%2Fcomrade-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-comrade%2Fcomrade-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-comrade%2Fcomrade-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-comrade","download_url":"https://codeload.github.com/php-comrade/comrade-dev/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-comrade%2Fcomrade-dev/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28684010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["job","job-manager","job-queue","job-scheduler","microservice","service"],"created_at":"2024-08-03T09:01:44.799Z","updated_at":"2026-01-23T08:09:17.329Z","avatar_url":"https://github.com/php-comrade.png","language":"PHP","readme":"# Comrade\n\nComrade is a job scheduler\u0026manager service.\n\n## Features\n\n* Exclusive jobs\n* Dependent jobs\n* Sub jobs execution\n* Cron triggers\n* Simple triggers\n* Worker execution grace period (i.e. timeout)\n* Queue and HTTP runners\n* Hybrid API. Supports HTTP and MQ API\n* JSON Schemas for everything\n* Real-time, WEB based UI\n* Write worker in any language\n* Standalone service\n* Containerized, easy to deploy\n* Work with any [Queue Interop](https://github.com/queue-interop/queue-interop) compatible queue\n* A client for PHP.\n\n## Online Demo\n\nThe Comrade UI is available at [http://demo.comrade.forma-pro.com](http://demo.comrade.forma-pro.com/?apiBaseUrl=http%3A%2F%2Fdemo.comrade.forma-pro.com:81) and the service itself is at http://demo.comrade.forma-pro.com:81.\n\n\n## Installation\n\nThe best way to run Comrade in production is to use pre-build Docker containers.\n\n1. Create an empty directory\n2. Inside, create an `.env` file with content:\n\n    ```\n    APP_ENV=prod\n    APP_DEBUG=0\n    APP_SECRET=45402ed3d65de420f63e1546c322968c\n    ENQUEUE_DSN=amqp+bunny://comrade:comrade123@rabbitmq:5672/comrade?receive_method=basic_consume\u0026lazy=1\u0026qos_prefetch_count=3\u0026persisted=1\u0026connection_timeout\u0026connection_timeout=20\n    MONGO_DSN=mongodb://mongo:27017/comrade\n    WAMP_DSN=ws://jms:9090\n    WAMP_REALM=realm1\n    WAMP_SERVER_HOST=0.0.0.0\n    WAMP_SERVER_PORT=9090\n    ```\n\n3. Create `docker-compose.yml` file with next content:\n \n    ```yaml\n    version: '3'\n    \n    services:\n      jm:\n        image: 'formapro/comrade:latest'\n        ports:\n          - \"81:80\"\n        depends_on:\n          - 'rabbitmq'\n          - 'mongo'\n        env_file: '/.env'\n    \n      jmc:\n        image: 'formapro/comrade:latest'\n        entrypoint: 'php bin/console enqueue:consume --setup-broker --receive-timeout=10000 --memory-limit=100 -vvv'\n        depends_on:\n          - 'rabbitmq'\n          - 'mongo'\n        env_file: '/.env'\n    \n      jmq:\n        image: 'formapro/comrade:latest'\n        entrypoint: 'php bin/console quartz:scheduler -vvv'\n        depends_on:\n          - 'rabbitmq'\n          - 'mongo'\n        env_file: '/.env'\n        deploy:\n          mode: 'global'\n          \n      jmw:\n        image: 'formapro/comrade:latest'\n        entrypoint: 'php bin/wamp_server.php'\n        depends_on:\n          - 'rabbitmq'\n          - 'mongo'\n        env_file: '/.env'\n        ports:\n          - '9090:9090'\n    \n      ui:\n        image: 'formapro/comrade-ui:latest'\n        ports:\n          - \"80:80\"\n    \n      rabbitmq:\n        image: 'rabbitmq:latest'\n        environment:\n          - 'RABBITMQ_DEFAULT_USER=comrade'\n          - 'RABBITMQ_DEFAULT_PASS=comrade123'\n          - 'RABBITMQ_DEFAULT_VHOST=comrade'\n    \n      mongo: { image: 'mongo:3' }\n    ```\n    \n4. Run `docker-compose up`. Now you have the comrade server available at `localhost:81`, UI at `localhost:80`, websocket server at `localhost:9090`.\n\nIf you'd like to build and run Comrade from source code, do next:\n\n```bash\n$ git clone git@github.com:php-comrade/comrade-dev.git;\n$ (cd comrade-dev/apps/jm; composer install);\n$ (cd comrade-dev/apps/demo; composer install);\n$ (cd comrade-dev/apps/ui; npm install);\n$ echo '127.0.0.1 jm.loc' \u003e\u003e /etc/hosts\n$ echo '127.0.0.1 ui.jm.loc' \u003e\u003e /etc/hosts\n$ bin/dup\n```\n\nThe Comrade service will be available at `jm.loc` host and its UI at `ui.jm.loc`.\n\n## PHP client.\n\nThe Comrade exposes for various things like create job, add trigger, query jobs operations. They are available through HTTP as well as message queue. Same format.\nIt is possible to create job from any programming language as well as run it later. For PHP we provide a simple client\n\n```\ncomposer require comrade/client:*@dev \n```\n\nWith the client you can create a job by doing:\n\n```php\n\u003c?php\nuse Comrade\\Shared\\Model\\JobTemplate;\nuse Comrade\\Shared\\Model\\QueueRunner;\nuse Comrade\\Shared\\Model\\GracePeriodPolicy;\nuse Comrade\\Shared\\Message\\CreateJob;\nuse Comrade\\Shared\\Model\\CronTrigger;\nuse Enqueue\\Util\\UUID;\nuse Enqueue\\Util\\JSON;\nuse function Enqueue\\dsn_to_context;\nuse function Makasim\\Values\\register_cast_hooks;\nuse function Makasim\\Values\\register_object_hooks;\nuse Interop\\Queue\\PsrContext;\n\nrequire_once __DIR__.'/vendor/autoload.php';\n\nregister_cast_hooks();\nregister_object_hooks();\n\n/** @var PsrContext $queueContext */\n$context = dsn_to_context(getenv('ENQUEUE_DSN'));\n\n$template = JobTemplate::create();\n$template-\u003esetName('demo_success_job');\n$template-\u003esetTemplateId(Uuid::generate());\n$template-\u003esetRunner(QueueRunner::createFor('demo_success_job'));\n\n$policy = GracePeriodPolicy::create();\n$policy-\u003esetPeriod(20);\n$template-\u003esetGracePeriodPolicy($policy);\n\n$trigger = CronTrigger::create();\n$trigger-\u003esetTemplateId($template-\u003egetTemplateId());\n$trigger-\u003esetStartAt(new \\DateTime('now'));\n$trigger-\u003esetMisfireInstruction(CronTrigger::MISFIRE_INSTRUCTION_FIRE_ONCE_NOW);\n$trigger-\u003esetExpression('*/5 * * * *');\n\n$createJob = CreateJob::createFor($template);\n$createJob-\u003eaddTrigger($trigger);\n\n$queue = $context-\u003ecreateQueue('comrade_create_job');\n$message = $context-\u003ecreateMessage(JSON::encode($createJob));\n$context-\u003ecreateProducer()-\u003esend($queue, $message);\n```\n\nJob has `QueueRunner`. It means that when it is time to run the job it is sent to `demo_success_job` queue. \nJob has `GracePeriodPolicy`. It means that if the job is not finished within 20 seconds it is marked as failed.\nJob has `CronTrigger`. It means the job should be run every five minutes.\n\nThere is possibility to set other polices, triggers or another runner.\nThe job worker could look like this:\n\n```php\n\u003c?php\n\nuse Comrade\\Shared\\Message\\RunJob;\nuse Comrade\\Shared\\Model\\JobAction;\nuse Comrade\\Client\\ClientQueueRunner;\nuse Interop\\Queue\\PsrContext;\nuse Interop\\Queue\\PsrMessage;\nuse function Enqueue\\dsn_to_context;\nuse Enqueue\\Consumption\\QueueConsumer;\nuse Enqueue\\Consumption\\Result;\nuse function Makasim\\Values\\register_cast_hooks;\nuse function Makasim\\Values\\register_object_hooks;\n\nregister_cast_hooks();\nregister_object_hooks();\n\n/** @var PsrContext $c */\n$c = dsn_to_context(getenv('ENQUEUE_DSN'));\n\n$runner = new ClientQueueRunner($c);\n\n$queueConsumer = new QueueConsumer($c);\n\n$queueConsumer-\u003ebind('demo_success_job', function(PsrMessage $message) use ($runner) {\n    $runner-\u003erun($message, function(RunJob $runJob) {\n        // do your stuff here. \n\n        return JobAction::COMPLETE;\n    });\n\n    return Result::ACK;\n});\n\n$queueConsumer-\u003econsume();\n```\n\n## Developed by Forma-Pro\n\nForma-Pro is a full stack development company which interests also spread to open source development. \nBeing a team of strong professionals we have an aim an ability to help community by developing cutting edge solutions in the areas of e-commerce, docker \u0026 microservice oriented architecture where we have accumulated a huge many-years experience. \nOur main specialization is Symfony framework based solution, but we are always looking to the technologies that allow us to do our job the best way. We are committed to creating solutions that revolutionize the way how things are developed in aspects of architecture \u0026 scalability.\n\nIf you have any questions and inquires about our open source development, this product particularly or any other matter feel free to contact at opensource@forma-pro.com\n\n## License\n\nIt is released under the [MIT License](LICENSE).   \n","funding_links":[],"categories":["service"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-comrade%2Fcomrade-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-comrade%2Fcomrade-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-comrade%2Fcomrade-dev/lists"}