Add pipeline for todo app deployment

This commit is contained in:
thiloho
2023-11-12 19:18:41 +01:00
parent f9376ebad2
commit eed097dc94
6 changed files with 61 additions and 15 deletions

21
flake.lock generated
View File

@@ -165,9 +165,30 @@
"home-manager": "home-manager_2",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"todos": "todos",
"website": "website"
}
},
"todos": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1699811932,
"narHash": "sha256-HfzWtq2qBcjCnhWzDXdmaK5yNk49HapzJ0c+ER8RirA=",
"owner": "thiloho",
"repo": "todos",
"rev": "3e411cb41681d4dc69df85178c6d6550c7f63da3",
"type": "github"
},
"original": {
"owner": "thiloho",
"repo": "todos",
"type": "github"
}
},
"website": {
"flake": false,
"locked": {

View File

@@ -20,6 +20,10 @@
url = "github:thiloho/discord-bot";
inputs.nixpkgs.follows = "nixpkgs";
};
todos = {
url = "github:thiloho/todos";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";

View File

@@ -11,6 +11,7 @@
age.secrets.hedgedoc-environment-file.file = ../../secrets/hedgedoc-environment-file.age;
age.secrets.discord-bot-token.file = ../../secrets/discord-bot-token.age;
age.secrets.todos-environment-file.file = ../../secrets/todos-environment-file.age;
environment.systemPackages = with pkgs; [
nodejs_20
@@ -79,6 +80,11 @@
extraConfig = "proxy_ssl_server_name on;";
};
};
"todos.thilohohlt.com" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://localhost:5173";
};
};
};
hedgedoc = {
@@ -101,7 +107,7 @@
postgresql = {
enable = true;
package = pkgs.postgresql_15;
ensureDatabases = [ "dcbot" "hedgedoc" ];
ensureDatabases = [ "dcbot" "hedgedoc" "todos" ];
ensureUsers = [
{
name = "hedgedoc";
@@ -125,10 +131,23 @@
'';
};
systemd.services.denbot = {
systemd.services = {
todoapp = {
description = "Todo application to plan your daily tasks effectively";
wantedBy = ["multi-user.target"];
wants = ["network-online.target"];
serviceConfig = {
Type = "simple";
Environment = "PORT=5173 DOTENV_CONFIG_PATH=${config.age.secrets.todos-environment-file.path}";
ExecStart = "${pkgs.nodejs_20}/bin/node -r dotenv/config .";
WorkingDirectory = inputs.todos.packages.${pkgs.system}.default;
Restart = "always";
};
};
denbot = {
description = "Thilo's Den discord bot";
wantedBy = ["multi-user.target"];
after = ["network-online.target"];
wants = ["network-online.target"];
serviceConfig = {
Type = "simple";
ExecStartPre = [
@@ -140,6 +159,7 @@
Restart = "always";
};
};
};
users.users.thiloho.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMkvr+vT7Ik0fjquxb9xQBfVVWJPgrfC+vJZsyG2V+/G thiloho@pc"

View File

@@ -5,4 +5,5 @@ in
{
"hedgedoc-environment-file.age".publicKeys = [ server pc ];
"discord-bot-token.age".publicKeys = [ server pc ];
"todos-environment-file.age".publicKeys = [ server pc ];
}

Binary file not shown.