{"id":20701434,"url":"https://github.com/lukewaite/laravel-queue-aws-batch","last_synced_at":"2025-04-22T23:13:12.075Z","repository":{"id":19359037,"uuid":"86871200","full_name":"lukewaite/laravel-queue-aws-batch","owner":"lukewaite","description":"A Laravel queue connector for AWS Batch","archived":false,"fork":false,"pushed_at":"2022-12-14T02:41:26.000Z","size":66,"stargazers_count":9,"open_issues_count":3,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-22T23:13:06.034Z","etag":null,"topics":["aws","aws-batch","laravel","php","queue"],"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/lukewaite.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-01T00:48:18.000Z","updated_at":"2024-10-15T21:15:31.000Z","dependencies_parsed_at":"2023-01-13T20:19:42.303Z","dependency_job_id":null,"html_url":"https://github.com/lukewaite/laravel-queue-aws-batch","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Flaravel-queue-aws-batch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Flaravel-queue-aws-batch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Flaravel-queue-aws-batch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewaite%2Flaravel-queue-aws-batch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukewaite","download_url":"https://codeload.github.com/lukewaite/laravel-queue-aws-batch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337948,"owners_count":21414104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["aws","aws-batch","laravel","php","queue"],"created_at":"2024-11-17T00:41:47.200Z","updated_at":"2025-04-22T23:13:12.062Z","avatar_url":"https://github.com/lukewaite.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Laravel Queue for AWS Batch\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-github]][link-github]\n[![Code Coverage][ico-coverage]][link-coverage]\n\n### Supported Versions\n| Laravel Version | Package Tag | Supported |\n|-----------------|-------------|-----------|\n| 8.x   | unreleased  | yes       |\n| 5.4.x | 2.0.x       | no        |\n| 5.3.x | 1.0.x       | no        |\n| 5.2.x | 1.0.x       | no        |\n| 5.1.x | 1.0.x       | no        |\n\n### Installation\nSee the table above for package version information, and change the version below accordingly.\n\nUsing `composer`, run:\n\n    composer require lukewaite/laravel-queue-aws-batch ~2.0\n\n\n### Usage\n1. Your Laravel application will need to be dockerized and pushed into a container registry of your choice. The `ENTRYPOINT`\n   should be set to `artisan`. \n\n2. Add a new queue to your `config/queues.php` config file's `connections` array:\n```\n    [\n        'batch' =\u003e [\n            'driver' =\u003e 'batch',\n            'table' =\u003e 'jobs',\n            'queue' =\u003e 'first-run-job-queue',\n            'jobDefinition' =\u003e 'my-job-definition',\n            'expire' =\u003e 60,\n            'region' =\u003e 'us-east-1'\n        ]\n    ]\n```\nThis queue transport depends on being able to write it's queue jobs to a database queue. In this example, it writes it's\njobs to the `jobs` table. You'll need to use the `artisan queue:table` to create a migration to create this table.\n\n3. Create an AWS Batch job queue with the same name as the `queue` config setting. This is where the Batch connector\nwill push your jobs into Batch. In this case, my queue name would be `first-run-job-queue`.\n\n4. Create a AWS Batch job definition for each queue you define that looks something like this:\n```json\n{\n    \"jobDefinitionName\": \"my-laravel-application\",\n    \"type\": \"container\",\n    \"parameters\": {},\n    \"retryStrategy\": {\n        \"attempts\": 10\n    },\n    \"containerProperties\": {\n        \"image\": \"\u003cyour docker image\u003e\",\n        \"vcpus\": 1,\n        \"memory\": 256,\n        \"command\": [\n            \"queue:work-batch\",\n            \"Ref::jobId\",\n            \"--tries=3\"\n        ],\n        \"volumes\": [],\n        \"environment\": [],\n        \"mountPoints\": [],\n        \"ulimits\": []\n    }\n}\n```\nHere, you configure your container to start, run the `queue:work-batch` command (assuming `artisan` is your entrypoint)\nand pass in the name of the queue, `first-run-job-queue` as well as the `Ref::jobId` param, which is passed in when\nthe Batch connector creates the job.\n\nIt is important that you configure a retryStrategy with more \"attempts\" than you are running `tries` if you provide that\nargument. Otherwise, Batch will not retry your job if it fails. Laravel 5.1 does not write to the failed job queue until\nthe _next_ run after tries has been exceeded by jobs failing. Newer versions will write to the queue in the same run, so\nthis requirement can be relaxed later.\n\n6. Add the Service Provider to your application:\n    * In `config/app.php` add to the `providers` array: `LukeWaite\\LaravelQueueAwsBatch\\BatchQueueServiceProvider::class`\n    \n    \n### Limitations\n\n#### Delayed Jobs\nAWS Batch has no method to delay a job and as it's our runner, we don't have an easy work around. If you require delayed\njobs for your use case, at this point my recommendation would be to use a regular DB queue, and to fire a job into it\nwhich will fire your batch job at the correct time.\n\n[ico-version]: https://img.shields.io/packagist/v/lukewaite/laravel-queue-aws-batch.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-github]: https://img.shields.io/github/workflow/status/lukewaite/laravel-queue-aws-batch/Tests/main.svg?style=flat-square\n[ico-coverage]: https://img.shields.io/scrutinizer/coverage/g/lukewaite/laravel-queue-aws-batch/main.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/lukewaite/laravel-queue-aws-batch\n[link-github]: https://github.com/lukewaite/laravel-queue-aws-batch/actions/workflows/tests.yml?query=branch%3Amain++\n[link-coverage]: https://scrutinizer-ci.com/g/lukewaite/laravel-queue-aws-batch/?branch=main\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewaite%2Flaravel-queue-aws-batch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukewaite%2Flaravel-queue-aws-batch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewaite%2Flaravel-queue-aws-batch/lists"}