[{"data":1,"prerenderedAt":420},["Reactive",2],{"content-query-uFKg42P5bs":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"head":10,"layout":12,"body":13,"_type":415,"_id":416,"_source":417,"_file":418,"_extension":419},"/docs/laravel/laravel-horizon","laravel",false,"","Laravel Horizon with Docker","Learn how to configure Laravel Horizon with Docker.",{"title":11},"Laravel Horizon with Docker - Docker PHP - Server Side Up","docs",{"type":14,"children":15,"toc":412},"root",[16,24,30,37,93,131,406],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"laravel-horizon-with-docker",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"p",{},[28],{"type":23,"value":29},"We simply pass the command to the Docker container and let S6 Overlay monitor the process.",{"type":17,"tag":31,"props":32,"children":34},"h2",{"id":33},"important-concepts",[35],{"type":23,"value":36},"Important concepts",{"type":17,"tag":38,"props":39,"children":40},"ol",{},[41,47,61,66,79],{"type":17,"tag":42,"props":43,"children":44},"li",{},[45],{"type":23,"value":46},"In most cases, you probably want to run this as a separate container from your web container",{"type":17,"tag":42,"props":48,"children":49},{},[50,52,59],{"type":23,"value":51},"Ensure that you have your ",{"type":17,"tag":53,"props":54,"children":56},"code",{"className":55},[],[57],{"type":23,"value":58},".env",{"type":23,"value":60}," configured correctly to authenticate with Redis",{"type":17,"tag":42,"props":62,"children":63},{},[64],{"type":23,"value":65},"Ensure Redis is running before you attempt to connect Horizon to Redis",{"type":17,"tag":42,"props":67,"children":68},{},[69,71,77],{"type":23,"value":70},"You can do cool things with ",{"type":17,"tag":53,"props":72,"children":74},{"className":73},[],[75],{"type":23,"value":76},"PHP_FPM_POOL_NAME",{"type":23,"value":78}," to separate the task from the main PHP pool. This is helpful when debugging or monitoring the task.",{"type":17,"tag":42,"props":80,"children":81},{},[82,84,91],{"type":23,"value":83},"If you need to run horizon in the same container, you might want to look into ",{"type":17,"tag":85,"props":86,"children":88},"a",{"href":87},"/docs/guide/using-s6-overlay#customizing-the-initialization-process",[89],{"type":23,"value":90},"writing your own S6 Overlay script",{"type":23,"value":92}," to manage and monitor multiple processes in one container.",{"type":17,"tag":94,"props":95,"children":97},"code-panel",{"label":96},"Task Command",[98],{"type":17,"tag":99,"props":100,"children":104},"pre",{"className":101,"code":102,"language":103,"meta":7,"style":7},"language-sh shiki shiki-themes github-dark github-dark monokai","php artisan horizon\n","sh",[105],{"type":17,"tag":53,"props":106,"children":107},{"__ignoreMap":7},[108],{"type":17,"tag":109,"props":110,"children":113},"span",{"class":111,"line":112},"line",1,[114,120,126],{"type":17,"tag":109,"props":115,"children":117},{"style":116},"--shiki-default:#B392F0;--shiki-dark:#B392F0;--shiki-sepia:#A6E22E",[118],{"type":23,"value":119},"php",{"type":17,"tag":109,"props":121,"children":123},{"style":122},"--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF;--shiki-sepia:#E6DB74",[124],{"type":23,"value":125}," artisan",{"type":17,"tag":109,"props":127,"children":128},{"style":122},[129],{"type":23,"value":130}," horizon\n",{"type":17,"tag":94,"props":132,"children":134},{"label":133},"Example Docker Compose File",[135],{"type":17,"tag":99,"props":136,"children":140},{"className":137,"code":138,"language":139,"meta":7,"style":7},"language-yaml shiki shiki-themes github-dark github-dark monokai","version: '3'\nservices:\n  php:\n    image: my/laravel-app\n    environment:\n      PHP_FPM_POOL_NAME: \"my-app_php\"\n\n  redis:\n    image: redis:6\n    command: \"redis-server --appendonly yes --requirepass redispassword\"\n\n  horizon:\n    image: my/laravel-app\n    command: [\"php\", \"/var/www/html/artisan\", \"horizon\"]\n    environment:\n      PHP_FPM_POOL_NAME: \"my-app_horizon\"\n","yaml",[141],{"type":17,"tag":53,"props":142,"children":143},{"__ignoreMap":7},[144,164,178,191,209,222,240,250,263,280,298,306,319,335,377,389],{"type":17,"tag":109,"props":145,"children":146},{"class":111,"line":112},[147,153,159],{"type":17,"tag":109,"props":148,"children":150},{"style":149},"--shiki-default:#85E89D;--shiki-dark:#85E89D;--shiki-sepia:#F92672",[151],{"type":23,"value":152},"version",{"type":17,"tag":109,"props":154,"children":156},{"style":155},"--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8;--shiki-sepia:#F8F8F2",[157],{"type":23,"value":158},": ",{"type":17,"tag":109,"props":160,"children":161},{"style":122},[162],{"type":23,"value":163},"'3'\n",{"type":17,"tag":109,"props":165,"children":167},{"class":111,"line":166},2,[168,173],{"type":17,"tag":109,"props":169,"children":170},{"style":149},[171],{"type":23,"value":172},"services",{"type":17,"tag":109,"props":174,"children":175},{"style":155},[176],{"type":23,"value":177},":\n",{"type":17,"tag":109,"props":179,"children":181},{"class":111,"line":180},3,[182,187],{"type":17,"tag":109,"props":183,"children":184},{"style":149},[185],{"type":23,"value":186},"  php",{"type":17,"tag":109,"props":188,"children":189},{"style":155},[190],{"type":23,"value":177},{"type":17,"tag":109,"props":192,"children":194},{"class":111,"line":193},4,[195,200,204],{"type":17,"tag":109,"props":196,"children":197},{"style":149},[198],{"type":23,"value":199},"    image",{"type":17,"tag":109,"props":201,"children":202},{"style":155},[203],{"type":23,"value":158},{"type":17,"tag":109,"props":205,"children":206},{"style":122},[207],{"type":23,"value":208},"my/laravel-app\n",{"type":17,"tag":109,"props":210,"children":212},{"class":111,"line":211},5,[213,218],{"type":17,"tag":109,"props":214,"children":215},{"style":149},[216],{"type":23,"value":217},"    environment",{"type":17,"tag":109,"props":219,"children":220},{"style":155},[221],{"type":23,"value":177},{"type":17,"tag":109,"props":223,"children":225},{"class":111,"line":224},6,[226,231,235],{"type":17,"tag":109,"props":227,"children":228},{"style":149},[229],{"type":23,"value":230},"      PHP_FPM_POOL_NAME",{"type":17,"tag":109,"props":232,"children":233},{"style":155},[234],{"type":23,"value":158},{"type":17,"tag":109,"props":236,"children":237},{"style":122},[238],{"type":23,"value":239},"\"my-app_php\"\n",{"type":17,"tag":109,"props":241,"children":243},{"class":111,"line":242},7,[244],{"type":17,"tag":109,"props":245,"children":247},{"emptyLinePlaceholder":246},true,[248],{"type":23,"value":249},"\n",{"type":17,"tag":109,"props":251,"children":253},{"class":111,"line":252},8,[254,259],{"type":17,"tag":109,"props":255,"children":256},{"style":149},[257],{"type":23,"value":258},"  redis",{"type":17,"tag":109,"props":260,"children":261},{"style":155},[262],{"type":23,"value":177},{"type":17,"tag":109,"props":264,"children":266},{"class":111,"line":265},9,[267,271,275],{"type":17,"tag":109,"props":268,"children":269},{"style":149},[270],{"type":23,"value":199},{"type":17,"tag":109,"props":272,"children":273},{"style":155},[274],{"type":23,"value":158},{"type":17,"tag":109,"props":276,"children":277},{"style":122},[278],{"type":23,"value":279},"redis:6\n",{"type":17,"tag":109,"props":281,"children":283},{"class":111,"line":282},10,[284,289,293],{"type":17,"tag":109,"props":285,"children":286},{"style":149},[287],{"type":23,"value":288},"    command",{"type":17,"tag":109,"props":290,"children":291},{"style":155},[292],{"type":23,"value":158},{"type":17,"tag":109,"props":294,"children":295},{"style":122},[296],{"type":23,"value":297},"\"redis-server --appendonly yes --requirepass redispassword\"\n",{"type":17,"tag":109,"props":299,"children":301},{"class":111,"line":300},11,[302],{"type":17,"tag":109,"props":303,"children":304},{"emptyLinePlaceholder":246},[305],{"type":23,"value":249},{"type":17,"tag":109,"props":307,"children":309},{"class":111,"line":308},12,[310,315],{"type":17,"tag":109,"props":311,"children":312},{"style":149},[313],{"type":23,"value":314},"  horizon",{"type":17,"tag":109,"props":316,"children":317},{"style":155},[318],{"type":23,"value":177},{"type":17,"tag":109,"props":320,"children":322},{"class":111,"line":321},13,[323,327,331],{"type":17,"tag":109,"props":324,"children":325},{"style":149},[326],{"type":23,"value":199},{"type":17,"tag":109,"props":328,"children":329},{"style":155},[330],{"type":23,"value":158},{"type":17,"tag":109,"props":332,"children":333},{"style":122},[334],{"type":23,"value":208},{"type":17,"tag":109,"props":336,"children":338},{"class":111,"line":337},14,[339,343,348,353,358,363,367,372],{"type":17,"tag":109,"props":340,"children":341},{"style":149},[342],{"type":23,"value":288},{"type":17,"tag":109,"props":344,"children":345},{"style":155},[346],{"type":23,"value":347},": [",{"type":17,"tag":109,"props":349,"children":350},{"style":122},[351],{"type":23,"value":352},"\"php\"",{"type":17,"tag":109,"props":354,"children":355},{"style":155},[356],{"type":23,"value":357},", ",{"type":17,"tag":109,"props":359,"children":360},{"style":122},[361],{"type":23,"value":362},"\"/var/www/html/artisan\"",{"type":17,"tag":109,"props":364,"children":365},{"style":155},[366],{"type":23,"value":357},{"type":17,"tag":109,"props":368,"children":369},{"style":122},[370],{"type":23,"value":371},"\"horizon\"",{"type":17,"tag":109,"props":373,"children":374},{"style":155},[375],{"type":23,"value":376},"]\n",{"type":17,"tag":109,"props":378,"children":380},{"class":111,"line":379},15,[381,385],{"type":17,"tag":109,"props":382,"children":383},{"style":149},[384],{"type":23,"value":217},{"type":17,"tag":109,"props":386,"children":387},{"style":155},[388],{"type":23,"value":177},{"type":17,"tag":109,"props":390,"children":392},{"class":111,"line":391},16,[393,397,401],{"type":17,"tag":109,"props":394,"children":395},{"style":149},[396],{"type":23,"value":230},{"type":17,"tag":109,"props":398,"children":399},{"style":155},[400],{"type":23,"value":158},{"type":17,"tag":109,"props":402,"children":403},{"style":122},[404],{"type":23,"value":405},"\"my-app_horizon\"\n",{"type":17,"tag":407,"props":408,"children":409},"style",{},[410],{"type":23,"value":411},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html.sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}",{"title":7,"searchDepth":166,"depth":166,"links":413},[414],{"id":33,"depth":166,"text":36},"markdown","content:docs:4.laravel:4.laravel-horizon.md","content","docs/4.laravel/4.laravel-horizon.md","md",1727367946682]