LoutreOS: migration site musique Django
This commit is contained in:
parent
cfff6af12e
commit
3254dc0468
3 changed files with 55 additions and 74 deletions
|
@ -26,7 +26,6 @@ in
|
|||
imports = [
|
||||
../../services/haproxy-acme.nix
|
||||
../../services/mail-server.nix
|
||||
../../services/site-musique.nix
|
||||
../../services/site-max.nix
|
||||
../../services/auto-pr.nix
|
||||
../../services/python-ci.nix
|
||||
|
|
|
@ -40,6 +40,7 @@ in
|
|||
"factorio.${domaine}" = { ip = "127.0.0.1"; port = nginxGetFirstLocalPort "factorio"; auth = false; };
|
||||
"airsonic.${domaine}" = { ip = "127.0.0.1"; port = 4040; auth = false; };
|
||||
"${domaine}" = { ip = "127.0.0.1"; port = nginxGetFirstLocalPort "wkd"; auth = false; };
|
||||
"musique-meyenheim.fr" = { ip = "127.0.0.1"; port = nginxGetFirstLocalPort "musique-meyenheim.fr"; auth = false; };
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -65,6 +66,24 @@ in
|
|||
'';
|
||||
}; };
|
||||
};
|
||||
"musique-meyenheim.fr" = {
|
||||
listen = [ { addr = "127.0.0.1"; port = 52353; } ];
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = "http://unix:/run/site-musique.sock";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
'';
|
||||
};
|
||||
"/static/" = {
|
||||
alias = "/var/www/site-musique/staticfiles/";
|
||||
};
|
||||
"/media/" = {
|
||||
alias = "/var/www/site-musique/media/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -100,16 +119,46 @@ in
|
|||
|
||||
python-ci.enable = true;
|
||||
|
||||
site-musique = {
|
||||
enable = true;
|
||||
port = 52349;
|
||||
domaine = "musique-meyenheim.fr";
|
||||
};
|
||||
|
||||
site-max = {
|
||||
enable = true;
|
||||
port = 52348;
|
||||
domaine = "maxspiegel.fr";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.site-musique = let
|
||||
djangoEnv =(pkgs.python3.withPackages (ps: with ps; [ gunicorn django_2_2 pillow setuptools ]));
|
||||
in {
|
||||
description = "Site Django de la musique de Meyenheim";
|
||||
after = [ "network.target" ];
|
||||
requires = [ "site-musique.socket" ];
|
||||
preStart = ''
|
||||
${djangoEnv}/bin/python manage.py migrate;
|
||||
${djangoEnv}/bin/python manage.py collectstatic --no-input;
|
||||
'';
|
||||
environment = {
|
||||
DJANGO_SETTINGS_MODULE = "site_musique.settings.prod";
|
||||
NGINX_DIRECTORY = "/var/www/site-musique";
|
||||
};
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
Group = "nginx";
|
||||
StateDirectory = "site-musique";
|
||||
WorkingDirectory = "/var/www/site-musique/";
|
||||
ReadWritePaths = [ "/var/www/site-musique/staticfiles" "/var/www/site-musique/media" ];
|
||||
EnvironmentFile = "/mnt/secrets/site-musique.env";
|
||||
ExecStart = ''${djangoEnv}/bin/gunicorn \
|
||||
--access-logfile - \
|
||||
--bind unix:/run/site-musique.sock \
|
||||
site_musique.wsgi:application
|
||||
'';
|
||||
PrivateTmp = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.sockets.site-musique = {
|
||||
description = "Site Musique socket";
|
||||
wantedBy = [ "sockets.target" ];
|
||||
listenStreams = [ "/run/site-musique.sock" ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue