Move each Mono web app into its own subdomain

This commit is contained in:
coolneng 2021-05-11 13:56:04 +02:00
parent 6315ab62af
commit 4cc39850b9
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 28 additions and 33 deletions

View File

@ -43,28 +43,31 @@
}; };
}; };
virtualHosts = { virtualHosts = {
"frontend.coace.duckdns.org" = { "gcw.coace.duckdns.org" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
root = "/vault/backups/frontend/inetpub/wwwroot"; root = "/vault/backups/frontend/inetpub/wwwroot/gcw";
locations = { locations."/".extraConfig = ''
"/few/".extraConfig = ''
fastcgi_index Default.aspx; fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000; fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root/few/$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_INFO ""; fastcgi_param PATH_INFO "";
fastcgi-mono-server4 /applications=/few/:/vault/backups/frontend/inetpub/wwwroot/few/socket=tcp:127.0.0.1:9000; fastcgi-mono-server4 /applications=gcw.coace.duckns.org/:/vault/backups/frontend/inetpub/wwwroot/gcw/socket=tcp:127.0.0.1:9001;
include ${pkgs.nginx}/conf/fastcgi_params;
'';
"/gcw/".extraConfig = ''
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root/few/$fastcgi_script_name;
fastcgi_param PATH_INFO "";
fastcgi-mono-server4 /applications=/gcw/:/vault/backups/frontend/inetpub/wwwroot/gcw/socket=tcp:127.0.0.1:9000;
include ${pkgs.nginx}/conf/fastcgi_params; include ${pkgs.nginx}/conf/fastcgi_params;
''; '';
}; };
"few.coace.duckdns.org" = {
enableACME = true;
forceSSL = true;
root = "/vault/backups/frontend/inetpub/wwwroot/few";
locations."/".extraConfig = ''
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9001;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_INFO "";
fastcgi-mono-server4 /applications=few.coace.duckdns.org/:/vault/backups/frontend/inetpub/wwwroot/few/socket=tcp:127.0.0.1:9001;
include ${pkgs.nginx}/conf/fastcgi_params;
'';
}; };
}; };
}; };
@ -75,7 +78,7 @@
email = "secretario@arquitectosdeceuta.com"; email = "secretario@arquitectosdeceuta.com";
certs."coace.duckdns.org" = { certs."coace.duckdns.org" = {
webroot = "/var/lib/acme/acme-challenge"; webroot = "/var/lib/acme/acme-challenge";
extraDomainNames = [ "frontend.coace.duckdns.org" ]; extraDomainNames = [ "few.coace.duckdns.org" "gcw.coace.duckdns.org" ];
}; };
}; };
@ -103,19 +106,11 @@
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
path = with pkgs; [ mono6 ]; path = with pkgs; [ mono6 ];
script = '' script = ''
lockfile=/tmp/mono-service gcw_lockfile=/tmp/mono-service-gcw
${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/gcw -l:$lockfile few_lockfile=/tmp/mono-service-few
${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/few -l:$lockfile ${pkgs.mono6}/bin/mono-service --applications /:/vault/backups/frontend/inetpub/wwwroot/gcw -l:$gcw_lockfile --socket=tcp:127.0.0.1:9000
${pkgs.mono6}/bin/mono-service --applications /:/vault/backups/frontend/inetpub/wwwroot/few -l:$few_lockfile --socket=tcp:127.0.0.1:9001
''; '';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
User = "nginx";
Group = "nginx";
ExecStop = ''
kill `cat $lockfile`
'';
};
before = [ "nginx.service" ]; before = [ "nginx.service" ];
}; };
} }