{"id":19839257,"url":"https://github.com/gsmlg-dev/elixir_caddy","last_synced_at":"2026-03-10T12:31:29.670Z","repository":{"id":108891169,"uuid":"605906642","full_name":"gsmlg-dev/elixir_caddy","owner":"gsmlg-dev","description":"Run caddy server in elixir's process tree","archived":false,"fork":false,"pushed_at":"2026-02-13T06:16:40.000Z","size":460,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-03T12:13:50.211Z","etag":null,"topics":["caddy","elixir","phoenix","phoenix-framework","reverse-proxy"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/caddy","language":"Elixir","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/gsmlg-dev.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-24T06:42:55.000Z","updated_at":"2026-02-13T06:14:53.000Z","dependencies_parsed_at":"2025-01-09T11:20:54.305Z","dependency_job_id":"be804d8e-e580-4b51-91d6-ba293f7e6541","html_url":"https://github.com/gsmlg-dev/elixir_caddy","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/gsmlg-dev/elixir_caddy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsmlg-dev%2Felixir_caddy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsmlg-dev%2Felixir_caddy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsmlg-dev%2Felixir_caddy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsmlg-dev%2Felixir_caddy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gsmlg-dev","download_url":"https://codeload.github.com/gsmlg-dev/elixir_caddy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gsmlg-dev%2Felixir_caddy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30333444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["caddy","elixir","phoenix","phoenix-framework","reverse-proxy"],"created_at":"2024-11-12T12:21:22.963Z","updated_at":"2026-03-10T12:31:29.601Z","avatar_url":"https://github.com/gsmlg-dev.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elixir Caddy\n\n[![release](https://github.com/gsmlg-dev/elixir_caddy/actions/workflows/release.yml/badge.svg)](https://github.com/gsmlg-dev/elixir_caddy/actions/workflows/release.yml) [![Hex.pm](https://img.shields.io/hexpm/v/caddy.svg)](https://hex.pm/packages/caddy) [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/caddy)\n\nStart `Caddy` reverse proxy server in `Elixir` project.\n\nManage caddy configuration in `Elixir`.\n\nAdd this in `deps` in `mix.exs` to install\n\n```elixir\n{:caddy, \"~\u003e 2.0\"}\n```\n\nIf caddy bin is set, caddy server will automate start when application start.\n\n\nStart in extra_applications\n\n```elixir\ndef application do\n  [\n    extra_applications: [Caddy.Application]\n  ]\nend\n```\n\n* Notice\n\nIf caddy_bin is not specifiy, Caddy.Server will not start.\n\n## Set `Caddy` binary when needed.\n\nSet `caddy_bin` to the path of Caddy binary file and start `Caddy.Server`.\n\n```elixir\nCaddy.Config.set_bin(\"/usr/bin/caddy\")\nCaddy.restart_server()\n```\n\nThis will restart server automatically\n\n```elixir\nCaddy.Config.set_bin!(\"/usr/bin/caddy\")\n```\n\n## Config\n\n```elixir\nimport Config\n\n# dump caddy server log to stdout\nconfig :caddy, dump_log: false\n\n# caddy server will not start, this is useful for testing\nconfig :caddy, start: false\n\n# configure caddy paths\nconfig :caddy, :base_path, \"/custom/caddy/path\"\nconfig :caddy, :etc_path, \"/custom/etc/path\"\nconfig :caddy, :run_path, \"/custom/run/path\"\nconfig :caddy, :tmp_path, \"/custom/tmp/path\"\nconfig :caddy, :env_file, \"/custom/path/envfile\"\nconfig :caddy, :pid_file, \"/custom/path/caddy.pid\"\n```\n\n## Telemetry\n\nThe library includes comprehensive telemetry support for monitoring Caddy operations. Telemetry events are emitted for:\n\n- **Configuration changes**: `[:caddy, :config, :set]`, `[:caddy, :config, :get]`, etc.\n- **Server lifecycle**: `[:caddy, :server, :start]`, `[:caddy, :server, :stop]`\n- **API operations**: `[:caddy, :api, :request]`, `[:caddy, :api, :response]`\n- **File operations**: `[:caddy, :file, :read]`, `[:caddy, :file, :write]`\n- **Validation**: `[:caddy, :validation, :success]`, `[:caddy, :validation, :error]`\n- **Adaptation**: `[:caddy, :adapt, :success]`, `[:caddy, :adapt, :error]`\n- **Logging operations**: `[:caddy, :log, :debug]`, `[:caddy, :log, :info]`, `[:caddy, :log, :warning]`, `[:caddy, :log, :error]`\n- **Log buffer/store**: `[:caddy, :log, :received]`, `[:caddy, :log, :buffered]`, `[:caddy, :log, :buffer_flush]`, `[:caddy, :log, :stored]`, `[:caddy, :log, :retrieved]`\n\n### Logging with Telemetry\n\nAll logging operations emit telemetry events. By default, a handler automatically forwards log events to Elixir's Logger:\n\n```elixir\n# Use telemetry-based logging (instead of Logger directly)\nCaddy.Telemetry.log_debug(\"Server starting\", module: MyApp)\nCaddy.Telemetry.log_info(\"Configuration loaded\", config_id: 123)\nCaddy.Telemetry.log_warning(\"Deprecation warning\", function: \"old_api\")\nCaddy.Telemetry.log_error(\"Failed to connect\", reason: :timeout)\n```\n\nConfigure logging behavior:\n\n```elixir\nconfig :caddy,\n  attach_default_handler: true,  # Auto-forward logs to Logger (default: true)\n  log_level: :info               # Minimum level to log (default: :debug)\n```\n\n### Custom Telemetry Handlers\n\nAttach custom handlers to process log events:\n\n```elixir\n# Send errors to external monitoring service\n:telemetry.attach(\"error_reporter\", [:caddy, :log, :error],\n  fn _event, _measurements, metadata, _config -\u003e\n    MyApp.ErrorReporter.report(metadata.message, metadata)\n  end, %{})\n\n# Monitor log buffer performance\n:telemetry.attach(\"buffer_monitor\", [:caddy, :log, :buffered],\n  fn _event, measurements, _metadata, _config -\u003e\n    MyApp.Metrics.track_buffer_size(measurements.buffer_size)\n  end, %{})\n```\n\n### Usage Example\n\n```elixir\n# Attach telemetry handler\n:telemetry.attach_many(\"caddy_handler\", [\n  [:caddy, :config, :set],\n  [:caddy, :server, :start],\n  [:caddy, :log, :error]\n], fn event_name, measurements, metadata, _config -\u003e\n  IO.inspect({event_name, measurements, metadata})\nend, %{})\n\n# Start telemetry poller for system metrics\nCaddy.Telemetry.start_poller(30_000)\n```\n\n### Available Functions\n\n- `Caddy.Telemetry.log_debug/2` - Emit debug log event\n- `Caddy.Telemetry.log_info/2` - Emit info log event\n- `Caddy.Telemetry.log_warning/2` - Emit warning log event\n- `Caddy.Telemetry.log_error/2` - Emit error log event\n- `Caddy.Telemetry.emit_config_change/3` - Configuration change events\n- `Caddy.Telemetry.emit_server_event/3` - Server lifecycle events\n- `Caddy.Telemetry.emit_api_event/3` - API operation events\n- `Caddy.Telemetry.list_events/0` - List all available events\n- `Caddy.Telemetry.attach_handler/3` - Attach telemetry handler\n- `Caddy.Telemetry.detach_handler/1` - Detach telemetry handler\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsmlg-dev%2Felixir_caddy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgsmlg-dev%2Felixir_caddy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgsmlg-dev%2Felixir_caddy/lists"}