Skip to content

Commit

Permalink
feat: add meilisearch profile
Browse files Browse the repository at this point in the history
Deployed on athena.
  • Loading branch information
diogotcorreia committed Nov 7, 2024
1 parent d716648 commit 5623ab8
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions hosts/athena/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
security.acme.cloudflare
security.fail2ban
services.caddy.common
services.meilisearch
services.ssh
services.stalwart-mail
services.umami
Expand Down
59 changes: 59 additions & 0 deletions profiles/services/meilisearch.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Meilisearch configuration
{
config,
lib,
secrets,
...
}: let
dataDir = "/var/lib/meilisearch";
port = 3449;

domain = "meilisearch.diogotc.com";

user = "meilisearch";
group = "meilisearch";
in {
age.secrets = {
meilisearchEnv.file = secrets.host.meilisearchEnv;
};

services.meilisearch = {
enable = true;
listenPort = port;
environment = "production";
# Contains:
# - MEILI_MASTER_KEY
masterKeyEnvironmentFile = config.age.secrets.meilisearchEnv.path;
};

services.caddy.virtualHosts = {
${domain} = {
enableACME = true;
extraConfig = ''
reverse_proxy localhost:${toString port} {
import CLOUDFLARE_PROXY
}
'';
};
};

users = {
groups.${group} = {};
users.${user} = {
isSystemUser = true;
inherit group;
};
};

systemd.services.meilisearch = {
serviceConfig = {
# Don't use dynamic user since it doesn't work correctly with impermanence
User = user;
Group = group;
DynamicUser = lib.mkForce false;
};
};

modules.impermanence.directories = [dataDir];
modules.services.restic.paths = [dataDir];
}
5 changes: 5 additions & 0 deletions secrets/athena/meilisearchEnv.age
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
age-encryption.org/v1
-> ssh-ed25519 x+PS/Q 8OgRRrWH0BAEv+MQ9HYbIeC7Rmu4LclfBdfrOF12IC8
x4OfrEIXGRl3PxacxVRlKcYGftztcTMh4xWnLXGIkEQ
--- Ez4ndlz/ugyIWkGF5ZDSK5yxhI+zyEsiiofy0TFEsfI
<}Q���^ѷF@z�X�W�)��+[6@e�`����)�Ș�R�FH�zg�4�T-��"�|�Y{i�R���o�T4��^�S \ �6i_��K��oLkE�DJ�!2�������Ί��a��)_>J�I��ӌ��e������I�b�_iS,�>8�$ܒ@�Se~ ��?E��:��Ľ�
1 change: 1 addition & 0 deletions secrets/secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ in
"autoUpgradeHealthchecksUrl"
"cloudflareToken"
"healthchecksUrl"
"meilisearchEnv"
"nebulaCert"
"nebulaKey"
"resticHealthchecksUrl"
Expand Down

0 comments on commit 5623ab8

Please sign in to comment.