Traefik: Difference between revisions

Dander (talk | contribs)
m edited for clarity
m moved a closing bracket in the config example, previous example does not build because "log" and "certificateResolvers" are listed under "entryPoints", rather than "staticConigOptions"
 
(4 intermediate revisions by 2 users not shown)
Line 8: Line 8:
== Configuration ==
== Configuration ==


==== Using Nixlang (Nix the language) ====
==== Using Nix ====
<syntaxhighlight lang="nixos">
<syntaxhighlight lang="nixos">
   services.traefik = {
   services.traefik = {
Line 29: Line 29:
           http.tls.certResolver = "letsencrypt";
           http.tls.certResolver = "letsencrypt";
         };
         };
      };


        log = {
      log = {
          level = "INFO";
        level = "INFO";
          filePath = "${config.services.traefik.dataDir}/traefik.log";
        filePath = "${config.services.traefik.dataDir}/traefik.log";
          format = "json";
        format = "json";
        };
      };


        certificatesResolvers.letsencrypt.acme = {
      certificatesResolvers.letsencrypt.acme = {
          email = "postmaster@YOUR.DOMAIN";
        email = "postmaster@YOUR.DOMAIN";
          storage = "${config.services.traefik.dataDir}/acme.json";
        storage = "${config.services.traefik.dataDir}/acme.json";
          httpChallenge.entryPoint = "web";
        httpChallenge.entryPoint = "web";
        };
       };
       };


Line 55: Line 55:
</syntaxhighlight>
</syntaxhighlight>


==== Using files ====
==== Using non-Nix configuration files ====
If you are migrating from a Non-NixOS system, you might be interested in the <code>staticConfigFile</code> and <code>dynamicConfigFile</code> options.
If you are migrating from a Non-NixOS system, you might be interested in the <code>staticConfigFile</code> and <code>dynamicConfigFile</code> options.


Line 79: Line 79:
};
};
</syntaxhighlight>Additionally, you can not use a <code>...ConfigFile</code> option and a <code>...ConfigOptions</code> for either static or dynamic configuration. The file options always take precedence over the options options, which are ignored.
</syntaxhighlight>Additionally, you can not use a <code>...ConfigFile</code> option and a <code>...ConfigOptions</code> for either static or dynamic configuration. The file options always take precedence over the options options, which are ignored.
[[Category:Applications]]
[[Category:Server]]
[[Category:Networking]]