NixOS 服务器在几分钟内启动! • gvolpe 的博客

  • Introduction: Garnix enables quick NixOS server deployment by defining on flake.nix and git push. Their blog post explains deployment steps. The author uses this to set up a web analytics server for the blog.
  • Web Analytics: Chose Plausible, an open-source self-hosted analytics solution. Set up with NixOS using specific configurations in hosts/default.nix, including proxying through nginx and using a PostgreSQL instance. Also uses agenix for secrets.
  • Secrets: Plausible service requires admin password and keybase secret. Set up safely with agenix as documented in Garnix docs. Requires importing agenix NixOS module and setting up secrets manually.
  • Garnix Configuration: Can choose continuous deployment on main branch with on-branch type in garnix.yaml. Also deploy on pull requests. Configuration name web corresponds to exposed NixOS configuration.
  • See it live!: After a few hours of traffic, active metrics can be seen. Live at https://analytics.gvolpe.com/gvolpe.com, but signing up via web is disabled by default.
  • Persistence: Important aspect of server deployments is state. By default, a new server is provisioned on every commit. Garnix supports persistence via NixOS configuration to keep data available on new deployments. Can consider using Borg for backups.
  • Machine: Comes with a FREE NixOS machine accessible via SSH. Has an Intel Xeon CPU with 2 cores and 4Gb RAM, and 40Gb of disk space. Services like Clickhouse and Postgres are running.
  • Final words: Garnix is featured again. Considers hosting and continuous deployment simple. It's in beta, so report issues. The author is not affiliated.
  • Addendum: Blog-post shared on Hacker News, and metrics increased greatly, a good test for the Plausible server.
阅读 14
0 条评论