Traefik: Difference between revisions

Dander (talk | contribs)
m replace nixlang with nix the language
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"
 
(2 intermediate revisions by one other user not shown)
Line 8: Line 8:
== Configuration ==
== Configuration ==


==== Using 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.