Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
tja
Browse files Browse the repository at this point in the history
  • Loading branch information
pilz0 committed Nov 20, 2024
1 parent d49881f commit 64f9422
Show file tree
Hide file tree
Showing 5 changed files with 294 additions and 115 deletions.
48 changes: 48 additions & 0 deletions loki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
auth_enabled: false

server:
http_listen_port: 3100

ingester:
lifecycler:
address: 0.0.0.0
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 1h # Any chunk not receiving new logs in this time will be flushed
max_chunk_age: 1h # All chunks will be flushed when they hit this age, default is 1h
chunk_target_size: 1048576 # Loki will attempt to build chunks up to 1.5MB, flushing first if chunk_idle_period or max_chunk_age is reached first
chunk_retain_period: 30s # Must be greater than index read cache TTL if using an index cache (Default index read cache TTL is 5m)
max_transfer_retries: 0 # Chunk transfers disabled

schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h

storage_config:
boltdb_shipper:
active_index_directory: /var/lib/loki/boltdb-shipper-active
cache_location: /var/lib/loki/boltdb-shipper-cache
cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space
shared_store: filesystem
filesystem:
directory: /var/lib/loki/chunks

limits_config:
reject_old_samples: true
reject_old_samples_max_age: 168h

chunk_store_config:
max_look_back_period: 0s

table_manager:
retention_deletes_enabled: false
retention_period: 0s
86 changes: 7 additions & 79 deletions monitoring.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{
name = "Loki";
type = "loki";
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}";
url = "http://127.0.0.1:3100";
uid = "180d3e53-be75-4a6a-bb71-bdf437aec085";
}
];
Expand Down Expand Up @@ -118,13 +118,12 @@
group = "grafana";
user = "grafana";
};
};
"grafana-dashboards/unpoller.json" = {
source = ./grafana-dashboards/unpoller.json;
group = "grafana";
user = "grafana";
};

};
services.prometheus = {
scrapeConfigs = [
{
Expand Down Expand Up @@ -231,83 +230,12 @@
};
services.loki = {
enable = true;
configuration = {
server.http_listen_port = 3030;
auth_enabled = false;

ingester = {
lifecycler = {
address = "127.0.0.1";
ring = {
kvstore = {
store = "inmemory";
};
replication_factor = 1;
};
};
chunk_idle_period = "1h";
max_chunk_age = "1h";
chunk_target_size = 999999;
chunk_retain_period = "30s";
max_transfer_retries = 0;
};

schema_config = {
configs = [
{
from = "2022-06-06";
store = "boltdb-shipper";
object_store = "filesystem";
schema = "v11";
index = {
prefix = "index_";
period = "24h";
};
}
];
};

storage_config = {
boltdb_shipper = {
active_index_directory = "/var/lib/loki/boltdb-shipper-active";
cache_location = "/var/lib/loki/boltdb-shipper-cache";
cache_ttl = "24h";
shared_store = "filesystem";
};

filesystem = {
directory = "/var/lib/loki/chunks";
};
};

limits_config = {
reject_old_samples = true;
reject_old_samples_max_age = "168h";
};

chunk_store_config = {
max_look_back_period = "0s";
};

table_manager = {
retention_deletes_enabled = false;
retention_period = "0s";
};

compactor = {
working_directory = "/var/lib/loki";
shared_store = "filesystem";
compactor_ring = {
kvstore = {
store = "inmemory";
};
};
};
};
};

configFile = ./loki.yaml;
extraFlags = ["-config.expand-env=true"];
};
# promtail: port 3031 (8031)
services.promtail = {
extraFlags = ["-config.expand-env=true"];
enable = true;
configuration = {
server = {
Expand All @@ -319,7 +247,7 @@
};
clients = [
{
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
url = "http://127.0.0.1:3100/loki/api/v1/push";
}
];
scrape_configs = [
Expand Down
38 changes: 2 additions & 36 deletions net.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,6 @@
};
};
networking.firewall = {
allowedTCPPorts = [
1100
11000
81
8080
443
80
22
3000
8443
1337
3001
9090
9100
1312
8090
];
allowedUDPPorts = [
1100
11000
81
8080
443
80
22
3000
8443
1337
3001
9090
9100
1312
17871
];
};

enable = false;
};
}
55 changes: 55 additions & 0 deletions nginx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,61 @@
recommendedProxySettings = true;
recommendedTlsSettings = true;
# other Nginx options
virtualHosts."routerlab1.ketamin.trade" = {
enableACME = true;
forceSSL = true;
basicAuth = {
foo = "foo";
};
locations."/" = {
proxyPass = "http://10.10.1.22:9001";
proxyWebsockets = true; # needed if you need to use WebSocket
};
};
virtualHosts."routerlab2.ketamin.trade" = {
enableACME = true;
forceSSL = true;
basicAuth = {
foo = "foo";
};
locations."/" = {
proxyPass = "http://10.10.1.22:9002";
proxyWebsockets = true; # needed if you need to use WebSocket
};
};
virtualHosts."routerlab3.ketamin.trade" = {
enableACME = true;
forceSSL = true;
basicAuth = {
foo = "foo";
};
locations."/" = {
proxyPass = "http://10.10.1.22:9003";
proxyWebsockets = true; # needed if you need to use WebSocket
};
};
virtualHosts."routerlab4.ketamin.trade" = {
enableACME = true;
forceSSL = true;
basicAuth = {
foo = "foo";
};
locations."/" = {
proxyPass = "http://10.10.1.22:9004";
proxyWebsockets = true; # needed if you need to use WebSocket
};
};
virtualHosts."routerlab5.ketamin.trade" = {
enableACME = true;
forceSSL = true;
basicAuth = {
foo = "foo";
};
locations."/" = {
proxyPass = "http://10.10.1.22:9005";
proxyWebsockets = true; # needed if you need to use WebSocket
};
};
virtualHosts.${config.services.grafana.settings.server.domain} = {
enableACME = true;
forceSSL = true;
Expand Down
Loading

0 comments on commit 64f9422

Please # to comment.