-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmlflow-server.nix
71 lines (62 loc) · 1.91 KB
/
mlflow-server.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
# special NixOps config
network = {
description = "MLflow server";
enableRollback = true;
};
# end special NixOps config
# from https://gist.github.com/nh2/28bce850755cf14bd7749ea78e4238ab
/* boot.kernelModules = [ "tcp_bbr" ]; # faster tcp kernel support
# Enable BBR congestion control
boot.kernel.sysctl."net.ipv4.tcp_congestion_control" = "bbr"; */
mlflow-server = { config, pkgs, ... }: let
server_config = import ./secrets/server_config.nix;
in {
networking.firewall.enable = true;
# Reject instead of drop.
networking.firewall.rejectPackets = true;
networking.firewall.allowedTCPPorts = [
22
80 # nginx
443 # nginx
];
environment.etc."boto.cfg" = {
source = ./secrets/boto.cfg;
};
environment.systemPackages = with pkgs; [
libmysqlclient
mlflow-server
mysql-client
];
services.fail2ban.enable = true;
services.nginx = {
enable = true;
virtualHosts = {
"${server_config.hostname}" = {
locations."/".proxyPass = "http://0.0.0.0:5000/";
default = true;
basicAuth = import ./secrets/basicauth.nix;
forceSSL = true;
enableACME = true;
};
};
};
security.acme = {
email = "mlflow@tylerbenster.com";
acceptTerms = true;
};
systemd.services.mlflowServer = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
description = "Start the mlflow server.";
serviceConfig = {
Type = "exec";
Restart = "on-failure";
RestartSec = "30";
StandardOutput = "/var/log/mlflow-stdout.log";
StandardError = "/var/log/mlflow-stderr.log";
ExecStart = ''${pkgs.mlflow-server}/bin/mlflow server --backend-store-uri ${server_config.store_uri} --default-artifact-root ${server_config.artifact_root} --host 0.0.0.0'';
};
};
};
}