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
|
let
|
||||||
port = 4322;
|
port = 4322;
|
||||||
dataDir = "/srv/wynne";
|
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
|
in
|
||||||
{
|
{
|
||||||
services.caddy.virtualHosts."wynne.rs" = {
|
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 = {
|
systemd.services.wynne = {
|
||||||
description = "wynne.rs";
|
description = "wynne.rs";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" "wynne-deploy.service" ];
|
||||||
|
requires = [ "wynne-deploy.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
environment = {
|
environment = {
|
||||||
HOST = "127.0.0.1";
|
HOST = "127.0.0.1";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue