phoenix-ops by bobmatnyc/claude-mpm-skills
npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill phoenix-ops生产就绪的 Phoenix 应用依赖于发布包、运行时配置、遥测、集群和安全端点。当正确配置时,BEAM 能够实现滚动重启和监督容错。
MIX_ENV=prod PHX_SERVER=true mix assets.deploy
MIX_ENV=prod mix release
_build/prod/rel/my_app/bin/my_app eval "IO.puts(:os.type())"
_build/prod/rel/my_app/bin/my_app start
config/runtime.exs 用于环境变量驱动的设置:
config :my_app, MyApp.Repo,
url: System.fetch_env!("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
ssl: true
config :my_app, MyAppWeb.Endpoint,
url: [host: System.fetch_env!("PHX_HOST"), port: 443, scheme: "https"],
http: [ip: {0,0,0,0}, port: String.to_integer(System.get_env("PORT", "4000"))],
secret_key_base: System.fetch_env!("SECRET_KEY_BASE"),
server: true
密钥管理
mix phx.gen.secret 生成 。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
SECRET_KEY_BASE添加 libcluster 以实现自动节点发现:
# mix.exs deps
{:libcluster, "~> 3.3"},
{:phoenix_pubsub, "~> 2.1"},
# application.ex
topologies = [
dns_poll: [
strategy: Cluster.Strategy.DNSPoll,
config: [poll_interval: 5_000, query: "my-app.internal"],
connect: {:net_adm, :ping}
]
]
children = [
{Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]},
{Phoenix.PubSub, name: MyApp.PubSub},
MyAppWeb.Endpoint
]
指导原则
secret_key_base 以确保会话签名的一致性。opentelemetry_phoenix 和 opentelemetry_ecto 以获取追踪和指标。Plug.Telemetry 和 LoggerJSON 或结构化日志。:telemetry_poller 导出 VM 指标(Prometheus/OpenTelemetry)以监控 VM 状态(reductions、内存、调度器)。LOGGER_LEVEL=info;仅在故障排查时使用 :debug。force_ssl),启用 HSTS,配置安全 Cookie (same_site, secure),并设置正确的 content_security_policy。cors_plug。:max_request_line_length, :max_header_value_length)。mix assets.deploy 会运行 npm/tailwind/esbuild 并对资源文件进行摘要处理。cache-control 响应头。application.ex 中进行监督。mix deps.get --only prod、mix compile、mix assets.deploy,然后执行 mix release。Environment= 设置密钥;添加 Restart=on-failure。/health 和 /ready 端点(检查 Repo + PubSub/在线状态)。:telemetry_poller 以监控调度器利用率和内存。PHX_SERVER=true(端点将无法启动)。config/runtime.exs 中的运行时配置;依赖编译时配置来管理密钥。secret_key_base 或使用每节点独立的密钥 → 部署后会话失效。每周安装次数
69
代码仓库
GitHub 星标数
18
首次出现
2026年1月23日
安全审计
安装于
gemini-cli54
opencode53
claude-code53
codex52
github-copilot49
cursor48
Production-ready Phoenix apps rely on releases, runtime configuration, telemetry, clustering, and secure endpoints. The BEAM enables rolling restarts and supervision resilience when configured correctly.
MIX_ENV=prod PHX_SERVER=true mix assets.deploy
MIX_ENV=prod mix release
_build/prod/rel/my_app/bin/my_app eval "IO.puts(:os.type())"
_build/prod/rel/my_app/bin/my_app start
config/runtime.exs for env-driven settings:
config :my_app, MyApp.Repo,
url: System.fetch_env!("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
ssl: true
config :my_app, MyAppWeb.Endpoint,
url: [host: System.fetch_env!("PHX_HOST"), port: 443, scheme: "https"],
http: [ip: {0,0,0,0}, port: String.to_integer(System.get_env("PORT", "4000"))],
secret_key_base: System.fetch_env!("SECRET_KEY_BASE"),
server: true
Secrets
SECRET_KEY_BASE with mix phx.gen.secret.Add libcluster for automatic node discovery:
# mix.exs deps
{:libcluster, "~> 3.3"},
{:phoenix_pubsub, "~> 2.1"},
# application.ex
topologies = [
dns_poll: [
strategy: Cluster.Strategy.DNSPoll,
config: [poll_interval: 5_000, query: "my-app.internal"],
connect: {:net_adm, :ping}
]
]
children = [
{Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]},
{Phoenix.PubSub, name: MyApp.PubSub},
MyAppWeb.Endpoint
]
Guidelines
secret_key_base across nodes for consistent session signing.opentelemetry_phoenix and opentelemetry_ecto for traces/metrics.Plug.Telemetry and LoggerJSON or structured logging.:telemetry_poller for VM stats (reductions, memory, schedulers).LOGGER_LEVEL=info in prod; use :debug only for troubleshooting.force_ssl), HSTS, secure cookies (same_site, secure), and proper content_security_policy.cors_plug for API origins.:max_request_line_length, :max_header_value_length).mix assets.deploy runs npm/tailwind/esbuild and digests assets.cache-control headers set in Endpoint.application.ex.mix deps.get --only prod, mix compile, mix assets.deploy, then mix release.Environment= secrets; add Restart=on-failure./health and /ready endpoints (Repo check + PubSub/Presence check).:telemetry_poller for scheduler utilization and memory.PHX_SERVER=true (endpoint won’t start).config/runtime.exs; relying on compile-time config for secrets.secret_key_base or per-node keys → invalid sessions after deploy.Weekly Installs
69
Repository
GitHub Stars
18
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
gemini-cli54
opencode53
claude-code53
codex52
github-copilot49
cursor48
Azure 升级评估与自动化工具 - 轻松迁移 Functions 计划、托管层级和 SKU
99,100 周安装