From 367579f5cdeb6e3dedb6cc1619f97c2a6cad350e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Sun, 12 Jul 2020 18:32:19 +0100 Subject: [PATCH] Use Gitea over GitLab Gitea simply offers better performance. I wasn't using all of GitLab's features anyway, and while the missing CI is annoying, I hadn't previously managed to set this up anyway, and it can be easily replaced by something a bit more dedicated than GitLab's implementation. This should hopefully allow me to host git repositories without compromising on memory/CPU time available to other services. --- etc/nixos/configuration.nix | 4 +-- etc/nixos/services/configs/gitlab.rb | 18 ---------- etc/nixos/services/gitea.nix | 51 ++++++++++++++++++++++++++++ etc/nixos/services/gitlab.nix | 25 -------------- 4 files changed, 53 insertions(+), 45 deletions(-) delete mode 100644 etc/nixos/services/configs/gitlab.rb create mode 100644 etc/nixos/services/gitea.nix delete mode 100644 etc/nixos/services/gitlab.nix diff --git a/etc/nixos/configuration.nix b/etc/nixos/configuration.nix index b0d8c61..eed52eb 100644 --- a/etc/nixos/configuration.nix +++ b/etc/nixos/configuration.nix @@ -12,7 +12,7 @@ # and set inside the docker-containers set, instead of setting the # docker-containers set here. ./services/nginx.nix - ./services/gitlab.nix + ./services/gitea.nix ./services/nextcloud.nix ./services/tlaternet.nix ]; @@ -30,7 +30,7 @@ 80 443 2222 - 3022 + 2221 ]; }; }; diff --git a/etc/nixos/services/configs/gitlab.rb b/etc/nixos/services/configs/gitlab.rb deleted file mode 100644 index 5af01fd..0000000 --- a/etc/nixos/services/configs/gitlab.rb +++ /dev/null @@ -1,18 +0,0 @@ -external_url 'https://gitlab.tlater.net/'; -pages_external_url 'https://pages.tlater.net/'; - -gitlab_rails['gitlab_shell_ssh_port'] = 3022; - -user['git_user_email'] = 'gitlab@tlater.net'; -gitlab_rails['gitlab_email_from'] = 'gitlab@tlater.net'; -gitlab_rails['gitlab_email_display_name'] = 'GitLab'; -gitlab_rails['gitlab_email_reply_to'] = 'noreply@tlater.net'; -gitlab_rails['incoming_email_enabled'] = false; - -gitlab_rails['registry_enabled'] = false; - -letsencrypt['enable'] = false; -nginx['listen_port'] = 80; -nginx['listen_https'] = false; -pages_nginx['listen_port'] = 80; -pages_nginx['listen_https'] = false; diff --git a/etc/nixos/services/gitea.nix b/etc/nixos/services/gitea.nix new file mode 100644 index 0000000..d2264ca --- /dev/null +++ b/etc/nixos/services/gitea.nix @@ -0,0 +1,51 @@ +{ ... }: + +{ + networked-docker-containers = { + gitea = { + image = "gitea/gitea:latest"; + ports = [ + "2221:2221" + ]; + volumes = [ + "gitea:/data:Z" + "/etc/timezone:/etc/timezone:ro" + "/etc/localtime:/etc/localtime:ro" + ]; + environment = { + VIRTUAL_PORT = "3000"; + VIRTUAL_HOST = "gitea.tlater.net"; + LETSENCRYPT_HOST = "gitea.tlater.net"; + + DB_TYPE = "postgres"; + DB_HOST = "gitea-postgres:5432"; + DB_NAME = "gitea"; + DB_USER = "gitea"; + DB_PASSWD = "/qNDDK9WCMuubfA7D8DFwfl9T+Gy2IMDvPhiNpcxZjY="; + + RUN_MODE = "prod"; + DOMAIN = "gitea.tlater.net"; + SSH_PORT = "2221"; + }; + networks = [ + "webproxy" + "gitea" + ]; + }; + + gitea-postgres = { + image = "postgres:alpine"; + environment = { + POSTGRES_DB = "gitea"; + POSTGRES_USER = "gitea"; + POSTGRES_PASSWORD = "/qNDDK9WCMuubfA7D8DFwfl9T+Gy2IMDvPhiNpcxZjY="; + }; + volumes = [ + "gitea-db-data:/var/lib/postgresql/data" + ]; + networks = [ + "gitea" + ]; + }; + }; +} diff --git a/etc/nixos/services/gitlab.nix b/etc/nixos/services/gitlab.nix deleted file mode 100644 index 60866a4..0000000 --- a/etc/nixos/services/gitlab.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ ... }: - -{ - networked-docker-containers = { - gitlab = { - image = "gitlab/gitlab-ce:latest"; - ports = [ - "3022:22" - ]; - volumes = [ - "gitlab-data:/var/opt/gitlab:Z" - "gitlab-logs:/var/log/gitlab:Z" - "gitlab-config:/etc/gitlab:Z" - ]; - environment = { - VIRTUAL_HOST = "gitlab.tlater.net"; - LETSENCRYPT_HOST = "gitlab.tlater.net"; - GITLAB_OMNIBUS_CONFIG = builtins.replaceStrings [ "\n" ] [ "" ] (builtins.readFile ./configs/gitlab.rb); - }; - networks = [ - "webproxy" - ]; - }; - }; -}