[{"data":1,"prerenderedAt":513},["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":508,"_id":509,"_source":510,"_file":511,"_extension":512},"/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":503},"root",[16,24,30,69,76,162,168,185,476,482,487,497],{"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 Laravel will start the Horizon process.",{"type":17,"tag":31,"props":32,"children":34},"code-panel",{"label":33},"Usual Laravel Horizon Command",[35],{"type":17,"tag":36,"props":37,"children":41},"pre",{"className":38,"code":39,"language":40,"meta":7,"style":7},"language-sh shiki shiki-themes github-dark github-dark monokai","php artisan horizon\n","sh",[42],{"type":17,"tag":43,"props":44,"children":45},"code",{"__ignoreMap":7},[46],{"type":17,"tag":47,"props":48,"children":51},"span",{"class":49,"line":50},"line",1,[52,58,64],{"type":17,"tag":47,"props":53,"children":55},{"style":54},"--shiki-default:#B392F0;--shiki-dark:#B392F0;--shiki-sepia:#A6E22E",[56],{"type":23,"value":57},"php",{"type":17,"tag":47,"props":59,"children":61},{"style":60},"--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF;--shiki-sepia:#E6DB74",[62],{"type":23,"value":63}," artisan",{"type":17,"tag":47,"props":65,"children":66},{"style":60},[67],{"type":23,"value":68}," horizon\n",{"type":17,"tag":70,"props":71,"children":73},"h2",{"id":72},"important-concepts",[74],{"type":23,"value":75},"Important concepts",{"type":17,"tag":77,"props":78,"children":79},"ol",{},[80,86,126,131,144,149],{"type":17,"tag":81,"props":82,"children":83},"li",{},[84],{"type":23,"value":85},"In most cases, you probably want to run this as a separate container from your web container",{"type":17,"tag":81,"props":87,"children":88},{},[89,91,97,99,105,107,113,115,124],{"type":23,"value":90},"If you're using ",{"type":17,"tag":43,"props":92,"children":94},{"className":93},[],[95],{"type":23,"value":96},"fpm-apache",{"type":23,"value":98}," or ",{"type":17,"tag":43,"props":100,"children":102},{"className":101},[],[103],{"type":23,"value":104},"fpm-nginx",{"type":23,"value":106},", might need to set the stop signal to ",{"type":17,"tag":43,"props":108,"children":110},{"className":109},[],[111],{"type":23,"value":112},"SIGTERM",{"type":23,"value":114}," for a graceful shutdown (see this ",{"type":17,"tag":116,"props":117,"children":121},"a",{"href":118,"rel":119},"https://github.com/serversideup/docker-php/pull/437",[120],"nofollow",[122],{"type":23,"value":123},"PR",{"type":23,"value":125}," for more details why)",{"type":17,"tag":81,"props":127,"children":128},{},[129],{"type":23,"value":130},"Be sure to set the health check",{"type":17,"tag":81,"props":132,"children":133},{},[134,136,142],{"type":23,"value":135},"Ensure that you have your ",{"type":17,"tag":43,"props":137,"children":139},{"className":138},[],[140],{"type":23,"value":141},".env",{"type":23,"value":143}," configured correctly to authenticate with Redis",{"type":17,"tag":81,"props":145,"children":146},{},[147],{"type":23,"value":148},"Ensure Redis is running before you attempt to connect Horizon to Redis",{"type":17,"tag":81,"props":150,"children":151},{},[152,154,160],{"type":23,"value":153},"If you need to run horizon in the same container, you might want to look into ",{"type":17,"tag":116,"props":155,"children":157},{"href":156},"/docs/guide/using-s6-overlay#customizing-the-initialization-process",[158],{"type":23,"value":159},"writing your own S6 Overlay script",{"type":23,"value":161}," to manage and monitor multiple processes in one container.",{"type":17,"tag":70,"props":163,"children":165},{"id":164},"run-it-with-docker",[166],{"type":23,"value":167},"Run it with Docker",{"type":17,"tag":169,"props":170,"children":171},"note",{},[172],{"type":17,"tag":25,"props":173,"children":174},{},[175,177,183],{"type":23,"value":176},"Notice we're calling the artisan command explicitly with the full path (",{"type":17,"tag":43,"props":178,"children":180},{"className":179},[],[181],{"type":23,"value":182},"/var/www/html/artisan",{"type":23,"value":184},"). This is because we need to run the command from the context of the container.",{"type":17,"tag":31,"props":186,"children":188},{"label":187},"Example Docker Compose File",[189],{"type":17,"tag":36,"props":190,"children":194},{"className":191,"code":192,"language":193,"meta":7,"style":7},"language-yaml shiki shiki-themes github-dark github-dark monokai","services:\n  php:\n    image: my/laravel-app\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    stop_signal: SIGTERM # Set this for graceful shutdown if you're using fpm-apache or fpm-nginx\n    healthcheck:\n      # This is our native healthcheck script for Horizon\n      test: [\"CMD\", \"healthcheck-horizon\"]\n      start_period: 10s\n","yaml",[195],{"type":17,"tag":43,"props":196,"children":197},{"__ignoreMap":7},[198,213,226,245,255,268,285,303,311,324,340,382,405,418,427,458],{"type":17,"tag":47,"props":199,"children":200},{"class":49,"line":50},[201,207],{"type":17,"tag":47,"props":202,"children":204},{"style":203},"--shiki-default:#85E89D;--shiki-dark:#85E89D;--shiki-sepia:#F92672",[205],{"type":23,"value":206},"services",{"type":17,"tag":47,"props":208,"children":210},{"style":209},"--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8;--shiki-sepia:#F8F8F2",[211],{"type":23,"value":212},":\n",{"type":17,"tag":47,"props":214,"children":216},{"class":49,"line":215},2,[217,222],{"type":17,"tag":47,"props":218,"children":219},{"style":203},[220],{"type":23,"value":221},"  php",{"type":17,"tag":47,"props":223,"children":224},{"style":209},[225],{"type":23,"value":212},{"type":17,"tag":47,"props":227,"children":229},{"class":49,"line":228},3,[230,235,240],{"type":17,"tag":47,"props":231,"children":232},{"style":203},[233],{"type":23,"value":234},"    image",{"type":17,"tag":47,"props":236,"children":237},{"style":209},[238],{"type":23,"value":239},": ",{"type":17,"tag":47,"props":241,"children":242},{"style":60},[243],{"type":23,"value":244},"my/laravel-app\n",{"type":17,"tag":47,"props":246,"children":248},{"class":49,"line":247},4,[249],{"type":17,"tag":47,"props":250,"children":252},{"emptyLinePlaceholder":251},true,[253],{"type":23,"value":254},"\n",{"type":17,"tag":47,"props":256,"children":258},{"class":49,"line":257},5,[259,264],{"type":17,"tag":47,"props":260,"children":261},{"style":203},[262],{"type":23,"value":263},"  redis",{"type":17,"tag":47,"props":265,"children":266},{"style":209},[267],{"type":23,"value":212},{"type":17,"tag":47,"props":269,"children":271},{"class":49,"line":270},6,[272,276,280],{"type":17,"tag":47,"props":273,"children":274},{"style":203},[275],{"type":23,"value":234},{"type":17,"tag":47,"props":277,"children":278},{"style":209},[279],{"type":23,"value":239},{"type":17,"tag":47,"props":281,"children":282},{"style":60},[283],{"type":23,"value":284},"redis:6\n",{"type":17,"tag":47,"props":286,"children":288},{"class":49,"line":287},7,[289,294,298],{"type":17,"tag":47,"props":290,"children":291},{"style":203},[292],{"type":23,"value":293},"    command",{"type":17,"tag":47,"props":295,"children":296},{"style":209},[297],{"type":23,"value":239},{"type":17,"tag":47,"props":299,"children":300},{"style":60},[301],{"type":23,"value":302},"\"redis-server --appendonly yes --requirepass redispassword\"\n",{"type":17,"tag":47,"props":304,"children":306},{"class":49,"line":305},8,[307],{"type":17,"tag":47,"props":308,"children":309},{"emptyLinePlaceholder":251},[310],{"type":23,"value":254},{"type":17,"tag":47,"props":312,"children":314},{"class":49,"line":313},9,[315,320],{"type":17,"tag":47,"props":316,"children":317},{"style":203},[318],{"type":23,"value":319},"  horizon",{"type":17,"tag":47,"props":321,"children":322},{"style":209},[323],{"type":23,"value":212},{"type":17,"tag":47,"props":325,"children":327},{"class":49,"line":326},10,[328,332,336],{"type":17,"tag":47,"props":329,"children":330},{"style":203},[331],{"type":23,"value":234},{"type":17,"tag":47,"props":333,"children":334},{"style":209},[335],{"type":23,"value":239},{"type":17,"tag":47,"props":337,"children":338},{"style":60},[339],{"type":23,"value":244},{"type":17,"tag":47,"props":341,"children":343},{"class":49,"line":342},11,[344,348,353,358,363,368,372,377],{"type":17,"tag":47,"props":345,"children":346},{"style":203},[347],{"type":23,"value":293},{"type":17,"tag":47,"props":349,"children":350},{"style":209},[351],{"type":23,"value":352},": [",{"type":17,"tag":47,"props":354,"children":355},{"style":60},[356],{"type":23,"value":357},"\"php\"",{"type":17,"tag":47,"props":359,"children":360},{"style":209},[361],{"type":23,"value":362},", ",{"type":17,"tag":47,"props":364,"children":365},{"style":60},[366],{"type":23,"value":367},"\"/var/www/html/artisan\"",{"type":17,"tag":47,"props":369,"children":370},{"style":209},[371],{"type":23,"value":362},{"type":17,"tag":47,"props":373,"children":374},{"style":60},[375],{"type":23,"value":376},"\"horizon\"",{"type":17,"tag":47,"props":378,"children":379},{"style":209},[380],{"type":23,"value":381},"]\n",{"type":17,"tag":47,"props":383,"children":385},{"class":49,"line":384},12,[386,391,395,399],{"type":17,"tag":47,"props":387,"children":388},{"style":203},[389],{"type":23,"value":390},"    stop_signal",{"type":17,"tag":47,"props":392,"children":393},{"style":209},[394],{"type":23,"value":239},{"type":17,"tag":47,"props":396,"children":397},{"style":60},[398],{"type":23,"value":112},{"type":17,"tag":47,"props":400,"children":402},{"style":401},"--shiki-default:#6A737D;--shiki-dark:#6A737D;--shiki-sepia:#88846F",[403],{"type":23,"value":404}," # Set this for graceful shutdown if you're using fpm-apache or fpm-nginx\n",{"type":17,"tag":47,"props":406,"children":408},{"class":49,"line":407},13,[409,414],{"type":17,"tag":47,"props":410,"children":411},{"style":203},[412],{"type":23,"value":413},"    healthcheck",{"type":17,"tag":47,"props":415,"children":416},{"style":209},[417],{"type":23,"value":212},{"type":17,"tag":47,"props":419,"children":421},{"class":49,"line":420},14,[422],{"type":17,"tag":47,"props":423,"children":424},{"style":401},[425],{"type":23,"value":426},"      # This is our native healthcheck script for Horizon\n",{"type":17,"tag":47,"props":428,"children":430},{"class":49,"line":429},15,[431,436,440,445,449,454],{"type":17,"tag":47,"props":432,"children":433},{"style":203},[434],{"type":23,"value":435},"      test",{"type":17,"tag":47,"props":437,"children":438},{"style":209},[439],{"type":23,"value":352},{"type":17,"tag":47,"props":441,"children":442},{"style":60},[443],{"type":23,"value":444},"\"CMD\"",{"type":17,"tag":47,"props":446,"children":447},{"style":209},[448],{"type":23,"value":362},{"type":17,"tag":47,"props":450,"children":451},{"style":60},[452],{"type":23,"value":453},"\"healthcheck-horizon\"",{"type":17,"tag":47,"props":455,"children":456},{"style":209},[457],{"type":23,"value":381},{"type":17,"tag":47,"props":459,"children":461},{"class":49,"line":460},16,[462,467,471],{"type":17,"tag":47,"props":463,"children":464},{"style":203},[465],{"type":23,"value":466},"      start_period",{"type":17,"tag":47,"props":468,"children":469},{"style":209},[470],{"type":23,"value":239},{"type":17,"tag":47,"props":472,"children":473},{"style":60},[474],{"type":23,"value":475},"10s\n",{"type":17,"tag":70,"props":477,"children":479},{"id":478},"get-up-and-running-the-easy-way",[480],{"type":23,"value":481},"Get Up and Running The Easy Way",{"type":17,"tag":25,"props":483,"children":484},{},[485],{"type":23,"value":486},"We do all the heavy lifting for you with Spin Pro. It's as easy as selecting it in a menu and we'll configure everything else for you. Learn how easy it is to get up and running with Horizon on Spin Pro.",{"type":17,"tag":25,"props":488,"children":489},{},[490],{"type":17,"tag":116,"props":491,"children":494},{"href":492,"rel":493},"https://getspin.pro/docs/services/laravel-horizon",[120],[495],{"type":23,"value":496},"Learn more about Laravel Horizon + Spin Pro →",{"type":17,"tag":498,"props":499,"children":500},"style",{},[501],{"type":23,"value":502},"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":215,"depth":215,"links":504},[505,506,507],{"id":72,"depth":215,"text":75},{"id":164,"depth":215,"text":167},{"id":478,"depth":215,"text":481},"markdown","content:docs:4.laravel:4.laravel-horizon.md","content","docs/4.laravel/4.laravel-horizon.md","md",1727889428274]