summaryrefslogtreecommitdiffstats
path: root/krebs/2configs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-06-25 19:21:20 +0200
committertv <tv@krebsco.de>2019-06-25 20:16:12 +0200
commit8c667f09c0e6e412283c8d7982a7112123ba5c0c (patch)
tree983c08ee1f2e73fe6b3680a9fbf71866bb4ac173 /krebs/2configs
parentd343910e98736a94431fcac3da21274d2ecec449 (diff)
parent153505206cba1896685bf1fd7252cffeae19e290 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/2configs')
-rw-r--r--krebs/2configs/shack/gitlab-runner.nix21
-rw-r--r--krebs/2configs/shack/netbox.nix39
2 files changed, 60 insertions, 0 deletions
diff --git a/krebs/2configs/shack/gitlab-runner.nix b/krebs/2configs/shack/gitlab-runner.nix
new file mode 100644
index 000000000..0fd06426a
--- /dev/null
+++ b/krebs/2configs/shack/gitlab-runner.nix
@@ -0,0 +1,21 @@
+{ pkgs, ... }:
+let
+ runner-src = builtins.fetchTarball {
+ url = "https://gitlab.com/arianvp/nixos-gitlab-runner/-/archive/master/nixos-gitlab-runner-master.tar.gz";
+ sha256 = "1s0fy5ny2ygcfvx35xws8xz5ih4z4kdfqlq3r6byxpylw7r52fyi";
+ };
+in
+{
+ systemd.services.gitlab-runner.path = [
+ "/run/wrappers" # /run/wrappers/bin/su
+ "/" # /bin/sh
+ ];
+ imports = [
+ "${runner-src}/gitlab-runner.nix"
+ ];
+ services.gitlab-runner2.enable = true;
+ ## registrationConfigurationFile contains:
+ # CI_SERVER_URL=<CI server URL>
+ # REGISTRATION_TOKEN=<registration secret>
+ services.gitlab-runner2.registrationConfigFile = <secrets/shackspace-gitlab-ci>;
+}
diff --git a/krebs/2configs/shack/netbox.nix b/krebs/2configs/shack/netbox.nix
new file mode 100644
index 000000000..4fb5a7dbc
--- /dev/null
+++ b/krebs/2configs/shack/netbox.nix
@@ -0,0 +1,39 @@
+{ pkgs, ... }:
+{
+ environment.systemPackages = [ pkgs.docker-compose ];
+ virtualisation.docker.enable = true;
+ services.nginx = {
+ enable = true;
+ virtualHosts."netbox.shack".locations."/".proxyPass = "http://localhost:18080";
+ };
+ # we store the netbox config there:
+ # state = [ "/var/lib/netbox" ];
+ systemd.services.backup-netbox = {
+ after = [ "netbox-docker-compose.service" ];
+ startAt = "daily";
+ path = with pkgs; [ docker-compose docker gzip coreutils ];
+ script = ''
+ cd /var/lib/netbox
+ mkdir -p backup
+ docker-compose exec -T -upostgres postgres pg_dumpall \
+ | gzip > backup/netdata_$(date -Iseconds).dump.gz
+ '';
+ };
+
+ systemd.services.netbox-docker-compose = {
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-online.target" "docker.service" ];
+ environment.VERSION = "v2.5.13";
+ serviceConfig = {
+ WorkingDirectory = "/var/lib/netbox";
+ # TODO: grep -q NAPALM_SECRET env/netbox.env
+ # TODO: grep -q NAPALM_SECRET netbox-netprod-importer/switches.yml
+ ExecStartPre = "${pkgs.docker-compose}/bin/docker-compose pull";
+ ExecStart = "${pkgs.docker-compose}/bin/docker-compose up";
+ Restart = "always";
+ RestartSec = "10";
+ StartLimitIntervalSec = 60;
+ StartLimitBurst = 3;
+ };
+ };
+}