{"id":23185781,"url":"https://github.com/hercules-ci/warp-systemd","last_synced_at":"2025-08-18T16:32:07.971Z","repository":{"id":55518818,"uuid":"97843920","full_name":"hercules-ci/warp-systemd","owner":"hercules-ci","description":"Socket activation and other systemd integration for the Warp web server (WAI)","archived":false,"fork":false,"pushed_at":"2025-08-04T07:56:15.000Z","size":49,"stargazers_count":21,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-16T14:32:40.055Z","etag":null,"topics":["haskell","heartbeat","socket-activation","systemd","wai","warp"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hercules-ci.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-20T14:18:16.000Z","updated_at":"2025-08-04T07:56:19.000Z","dependencies_parsed_at":"2025-06-03T23:37:06.823Z","dependency_job_id":"7ce656df-d954-41a1-b27d-ccf85a9c07e9","html_url":"https://github.com/hercules-ci/warp-systemd","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hercules-ci/warp-systemd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hercules-ci%2Fwarp-systemd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hercules-ci%2Fwarp-systemd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hercules-ci%2Fwarp-systemd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hercules-ci%2Fwarp-systemd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hercules-ci","download_url":"https://codeload.github.com/hercules-ci/warp-systemd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hercules-ci%2Fwarp-systemd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271026407,"owners_count":24687073,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["haskell","heartbeat","socket-activation","systemd","wai","warp"],"created_at":"2024-12-18T10:12:44.242Z","updated_at":"2025-08-18T16:32:07.628Z","avatar_url":"https://github.com/hercules-ci.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# warp-systemd\n\n[Systemd](https://systemd.io/) integration for the [Warp Web Server (WAI)](https://github.com/yesodweb/wai).\n\n## Features\n\n- [Socket Activation](http://0pointer.de/blog/projects/socket-activation.html)\n- [Watchdog](http://0pointer.de/blog/projects/watchdog.html)\n\n## Usage\n\nAll systemd integrations are off by default. For example, you can modify `SystemdSettings` to enable the watchdog:\n\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Data.Function                                 ((\u0026))\nimport qualified Network.Wai.Handler.Warp         as Warp\nimport qualified Network.Wai.Handler.Warp.Systemd as Systemd\nimport Network.Wai\nimport Network.HTTP.Types.Status                     (status200)\n\napp :: Application\napp _ respond =\n  respond $ responseLBS status200 [] \"Hello World\"\n\nmain :: IO ()\nmain =\n  Systemd.runSystemdWarp systemdSettings Warp.defaultSettings app\n  where\n    systemdSettings = Systemd.defaultSystemdSettings\n      \u0026 Systemd.setHeartbeatInterval (Just 5)\n```\n\n## Systemd Service Example\n\nLet's configure your app to run as a socket-activated systemd service. We'll be using the sample app in [example/Main.hs](example/Main.hs).\n\nIf these instructions look too manual, we also have an example [NixOS module](example-nixos/warp-systemd-example.nix) and test.\n\n1. Create a new service unit at `/etc/systemd/system/warp.service` that'll run your Haskell binary:\n\n   ```systemd\n   [Unit]\n   Description=Warp\n   [Service]\n   Type=notify\n   WatchdogSec=30\n   ExecStart=path-to-my-haskell-binary\n   ```\n\n2. Create the socket unit at `/etc/systemd/system/warp.socket` that'll listen on port 80:\n\n   ```systemd\n   [Unit]\n   Description=Warp\n   [Socket]\n   ListenStream=80\n   [Install]\n   WantedBy=sockets.target\n   ```\n\n3. Enable the socket unit:\n\n   ```bash\n   $ sudo systemctl enable --now warp.socket\n   ```\n\n4. Verify that the server is running:\n\n   ```bash\n   $ systemctl status warp.socket warp.service\n   ● warp.service - Warp\n        Loaded: loaded (/etc/systemd/system/warp.service; linked; preset: enabled)\n        Active: active (running) since Mon 2023-05-15 14:57:14 UTC; 19min ago\n   TriggeredBy: ● warp.socket\n      Main PID: 52528 (warp-systemd-ex)\n            IP: 0B in, 0B out\n            IO: 0B read, 0B written\n         Tasks: 1 (limit: 19081)\n        Memory: 2.1M\n           CPU: 503ms\n        CGroup: /system.slice/warp.service\n                └─52528 path-to-my-haskell-binary\n\n   May 15 14:57:14 nixos systemd[1]: Starting Warp...\n   May 15 14:57:14 nixos warp-systemd-example[52528]: Warp is socket-activated\n   May 15 14:57:14 nixos systemd[1]: Started Warp.\n\n   ● warp.socket - Warp\n        Loaded: loaded (/etc/systemd/system/warp.socket; enabled; preset: enabled)\n        Active: active (running) since Mon 2023-05-15 14:11:56 UTC; 1h 5min ago\n      Triggers: ● warp.service\n        Listen: [::]:80 (Stream)\n            IP: 796B in, 690B out\n            IO: 0B read, 0B written\n         Tasks: 0 (limit: 19081)\n        Memory: 8.0K\n           CPU: 563us\n        CGroup: /system.slice/warp.socket\n\n   May 15 14:11:56 nixos systemd[1]: Listening on warp.socket.\n   ```\n\n   ```bash\n   $ curl http://localhost\n   Hello World⏎\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhercules-ci%2Fwarp-systemd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhercules-ci%2Fwarp-systemd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhercules-ci%2Fwarp-systemd/lists"}