add wynne-deploy service to build site on restart
This commit is contained in:
parent
cbac009667
commit
0c36b497c8
1 changed files with 19 additions and 1 deletions
|
|
@ -2,6 +2,14 @@
|
|||
let
|
||||
port = 4322;
|
||||
dataDir = "/srv/wynne";
|
||||
|
||||
deployScript = pkgs.writeShellScript "wynne-deploy" ''
|
||||
set -e
|
||||
cd ${dataDir}/repo
|
||||
${pkgs.git}/bin/git pull
|
||||
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
|
||||
ASTRO_DB_REMOTE_URL=file:${dataDir}/data/guestbook.db ${pkgs.pnpm}/bin/pnpm build
|
||||
'';
|
||||
in
|
||||
{
|
||||
services.caddy.virtualHosts."wynne.rs" = {
|
||||
|
|
@ -17,9 +25,19 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
systemd.services.wynne-deploy = {
|
||||
description = "Build wynne.rs from source";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "lew";
|
||||
ExecStart = deployScript;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.wynne = {
|
||||
description = "wynne.rs";
|
||||
after = [ "network.target" ];
|
||||
after = [ "network.target" "wynne-deploy.service" ];
|
||||
requires = [ "wynne-deploy.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = {
|
||||
HOST = "127.0.0.1";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue