{"id":17684681,"url":"https://github.com/tarampampam/laravel-roadrunner-in-docker","last_synced_at":"2025-03-29T06:31:12.990Z","repository":{"id":38011819,"uuid":"356553692","full_name":"tarampampam/laravel-roadrunner-in-docker","owner":"tarampampam","description":":rocket: An example of Laravel app that runs in a docker container with RoadRunner","archived":true,"fork":false,"pushed_at":"2023-11-01T06:24:51.000Z","size":406,"stargazers_count":183,"open_issues_count":3,"forks_count":36,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-20T17:09:12.999Z","etag":null,"topics":["docker","laravel","php","roadrunner"],"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/tarampampam.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}},"created_at":"2021-04-10T10:57:28.000Z","updated_at":"2025-02-14T23:33:24.000Z","dependencies_parsed_at":"2023-10-05T10:04:42.347Z","dependency_job_id":"17118560-4aca-47f8-97e3-d8c881798708","html_url":"https://github.com/tarampampam/laravel-roadrunner-in-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarampampam%2Flaravel-roadrunner-in-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarampampam%2Flaravel-roadrunner-in-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarampampam%2Flaravel-roadrunner-in-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarampampam%2Flaravel-roadrunner-in-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarampampam","download_url":"https://codeload.github.com/tarampampam/laravel-roadrunner-in-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246150269,"owners_count":20731414,"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":["docker","laravel","php","roadrunner"],"created_at":"2024-10-24T10:24:43.441Z","updated_at":"2025-03-29T06:31:12.512Z","avatar_url":"https://github.com/tarampampam.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://habrastorage.org/webt/zm/nm/pr/zmnmprsvbuxifiuo2dcdb6z1vle.png\" alt=\"Logo\" /\u003e\n\u003c/p\u003e\n\nThis repository contains an example of [Laravel][laravel] _(PHP Framework)_ application that runs in a docker container with [RoadRunner][roadrunner] _(high-performance PHP application server)_ as a web server.\n\n## :fire: Features list\n\n- For local application running, you need just two dependencies - installed `docker` and `docker-compose` (`make` is optional, but strongly recommended)\n- [PostgreSQL][postgresql] as a **database** and [Redis][redis] as a **cache** \u0026 **queue** driver already configured\n- One `Dockerfile` for local application development and running on production\n- All used images are based on [Alpine][alpine] (lightweight and security-oriented linux distributive)\n- Lightweight final docker image _(compressed size ~65 Mb, ~16 downloadable layers)_\n- **Unprivileged** user is used by default\n- Easy to update PHP and dependencies\n- Ready to run Laravel [task scheduling][laravel_scheduling], [queue workers][laravel_queue], and many others on your choice\n- Without file permission problems\n- For [cron][cron] jobs running [supercronic][supercronic] is used _(crontab-compatible job runner, designed specifically to run in containers)_\n- Self-signed SSL certificate for HTTPS support\n- Enabled `opcache` and `jit` compiler for the performance of your application\n- [Composer][composer] dependencies caching using separate docker image layer\n- Well-documented code\n- HTTP server doesn't need to be restarted on source code changes\n- Works much faster than `php-fpm` + `nginx` and easy to deploy\n- Provided `Makefile` allows to perform familiar operations easy and fast\n- Ready to run [phpunit][phpunit] _(with code coverage)_ and [phpstan][phpstan] _(static analysis tool for source code)_\n- [GitHub actions](.github/workflows) for tests running, image building, etc.\n\n# How to use\n\nIf you want to integrate Docker + RoadRunner into an **existing** application, take a look at [pull requests with the special label][pr_step_by_step] in the current repository - you can repeat these steps.\n\nAnother way is repository cloning, forking or [usage this repository as a template][use_repo_template] for your application.\n\n\u003e Don't forget to remove `TestJob`, `TestController`, and routes, that are declared for this controller in the `routes/web.php` file - it is used for internal application working tests.\n\n## First steps\n\nLet's dive deeper and watch how to start application development, based on this template. First, we need to get the sources:\n\n```shell\n$ git clone https://github.com/tarampampam/laravel-roadrunner-in-docker.git\n$ cd ./laravel-roadrunner-in-docker\n```\n\nAfter that - build image with our application and install composer dependencies:\n\n```shell\n$ make install\n...\n  - Installing spatie/laravel-ignition (2.0.0): Extracting archive\n  - Installing symfony/psr-http-message-bridge (v2.1.4): Extracting archive\n  - Installing spiral/goridge (v3.2.0): Extracting archive\n  - Installing spiral/roadrunner-worker (v2.3.0): Extracting archive\n  - Installing spiral/roadrunner-http (v2.2.0): Extracting archive\n  - Installing nyholm/psr7 (1.5.1): Extracting archive\n  - Installing spiral/roadrunner-laravel (v5.11.1): Extracting archive\nGenerating optimized autoload files\n\u003e Illuminate\\Foundation\\ComposerScripts::postAutoloadDump\n\u003e @php artisan package:discover --ansi\n\n   INFO  Discovering packages.\n\n  laravel/sail ...................................................... DONE\n  laravel/sanctum ................................................... DONE\n  laravel/tinker .................................................... DONE\n  nesbot/carbon ..................................................... DONE\n  nunomaduro/collision .............................................. DONE\n  nunomaduro/termwind ............................................... DONE\n  spatie/laravel-ignition ........................................... DONE\n  spiral/roadrunner-laravel ......................................... DONE\n```\n\nMake full application initialization:\n\n```shell\n$ make init\n...\n   INFO  Preparing database.\n\n  Creating migration table ..................................... 15ms DONE\n\n   INFO  Running migrations.\n\n  2014_10_12_000000_create_users_table ......................... 27ms DONE\n  2014_10_12_100000_create_password_resets_table ............... 21ms DONE\n  2019_08_19_000000_create_failed_jobs_table ................... 17ms DONE\n  2019_12_14_000001_create_personal_access_tokens_table ........ 30ms DONE\n\n   INFO  Seeding database.\n...\n```\n\nStart the application:\n\n```shell\n$ make up\n...\n\n    Navigate your browser to ⇒ http://127.0.0.1:8080 or https://127.0.0.1:8443\n```\n\nVoila! You can open \u003chttp://127.0.0.1:8080\u003e (or \u003chttps://127.0.0.1:8443\u003e) in your browser and source code in your favorite IDE.\n\n\u003e For watching all supported `make` commands execute `make` without parameters inside the project directory:\n\u003e ```\n\u003e $ make\n\u003e\n\u003e Available commands:\n\u003e help               Show this help\n\u003e install            Install all app dependencies\n\u003e shell              Start shell into app container\n\u003e init               Make full application initialization\n\u003e ...\n\u003e ```\n\n## How to\n\n### Open the shell in the application container?\n\nExecute in your terminal:\n\n```shell\n$ make shell\n```\n\nIn this shell, you can use `composer`, `php`, and any other tools, which are installed into a docker image.\n\n### Watch logs?\n\n```shell\n$ docker-compose logs -f\n```\n\nAll messages from all containers output will be listed here.\n\n### Install composer dependency?\n\nAs it was told above - execute `make shell` and after that `composer require %needed/package%`.\n\n### Add my own `make` command?\n\nAppend into `Makefile` something like:\n\n```makefile\nyour-command: ## Your command help\n\t/bin/your/app -goes -here\n```\n\n\u003e Tab character in front of your command is mandatory!\n\nRead more about makefiles [here](https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents).\n\n## To Do\n\n- [ ] Describe front-end development/building\n\n### Useful links\n\n- \u003chttps://habr.com/ru/post/461687/\u003e \u003csup\u003eru\u003c/sup\u003e\n- \u003chttps://pythonspeed.com/articles/faster-multi-stage-builds/\u003e\n\n## Troubleshooting\n\n### MacOS Unprivileged User\n\nThis repo was created for Linux users. It maps `/etc/passwd` in `docker-compose.yml` to [set the current host user for the Docker containers](https://faun.pub/set-current-host-user-for-docker-container-4e521cef9ffc).\n\nMacOS doesn't use `/etc/passwd` unless it's operating in single-user mode. Instead, it uses a system called [Open Directory](https://superuser.com/questions/191330/users-dont-appear-in-etc-passwd-on-mac-os-x/191333#191333).\n\nIf you do `make shell; whoami` and get user errors, then you can fix by running `./scripts/fix_mac_user.sh`. This script will create a `mac_passwd` file that plays nice with `/etc/passwd` used by `docker-compose.yml` under the volumes mapping section.\n\n```bash\n#!/bin/sh\n// File: ./scripts/fix_mac_user.sh\n\nSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" \u0026\u003e /dev/null \u0026\u0026 pwd )\"\ncd $SCRIPT_DIR/../\necho \"$USER:x:$(id -u):$(id -g):ns,,,:$HOME:/bin/bash\" \u003e mac_passwd\nsed -i.backup 's~/etc/passwd:/etc/passwd:ro~./mac_passwd:/etc/passwd:ro~' docker-compose.yml\n```\n\n## Support\n\n[![Issues][badge_issues]][link_issues]\n[![Issues][badge_pulls]][link_pulls]\n\nIf you find any package errors, please, [make an issue][link_create_issue] in current repository.\n\n## License\n\nThis project is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n\n[laravel]:https://laravel.com/\n[roadrunner]:https://roadrunner.dev/\n[postgresql]:https://www.postgresql.org/\n[redis]:https://redis.io/\n[alpine]:https://alpinelinux.org/\n[laravel_scheduling]:https://laravel.com/docs/8.x/scheduling\n[laravel_queue]:https://laravel.com/docs/8.x/queues\n[cron]:https://en.wikipedia.org/wiki/Cron\n[supercronic]:https://github.com/aptible/supercronic\n[composer]:https://getcomposer.org/\n[phpunit]:https://phpunit.de/\n[phpstan]:https://phpstan.org/\n\n[pr_step_by_step]:https://github.com/tarampampam/laravel-roadrunner-in-docker/pulls?q=is%3Apr+label%3Astep-by-step+sort%3Acreated-asc\n[use_repo_template]:https://github.com/tarampampam/laravel-roadrunner-in-docker/generate\n\n[badge_issues]:https://img.shields.io/github/issues/tarampampam/laravel-roadrunner-in-docker.svg?maxAge=45\n[badge_pulls]:https://img.shields.io/github/issues-pr/tarampampam/laravel-roadrunner-in-docker.svg?maxAge=45\n[link_issues]:https://github.com/tarampampam/laravel-roadrunner-in-docker/issues\n[link_pulls]:https://github.com/tarampampam/laravel-roadrunner-in-docker/pulls\n[link_create_issue]:https://github.com/tarampampam/laravel-roadrunner-in-docker/issues/new/choose\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarampampam%2Flaravel-roadrunner-in-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarampampam%2Flaravel-roadrunner-in-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarampampam%2Flaravel-roadrunner-in-docker/lists"}