Add program to open a rails console in accentor
This commit is contained in:
parent
192eba674b
commit
31b1095eb1
1 changed files with 35 additions and 17 deletions
|
@ -53,6 +53,23 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.chvp.accentor.enable {
|
config = lib.mkIf config.chvp.accentor.enable {
|
||||||
|
environment.systemPackages = [
|
||||||
|
(pkgs.writeShellScriptBin "accentor-console" ''
|
||||||
|
set -ex
|
||||||
|
export DATABASE_URL="postgresql://%2Frun%2Fpostgresql/accentor"
|
||||||
|
export FFMPEG_LOG_LOCATION="/var/log/accentor/ffmpeg.log"
|
||||||
|
export RAILS_STORAGE_PATH="${config.chvp.dataPrefix}/var/lib/accentor/storage"
|
||||||
|
export RAILS_TRANSCODE_CACHE="/var/tmp/accentor/transcode_cache"
|
||||||
|
export BOOTSNAP_CACHE_DIR="/var/tmp/accentor/bootsnap"
|
||||||
|
export PIDFILE="/run/accentor/server.pid"
|
||||||
|
export RACK_ENV="production"
|
||||||
|
export RAILS_ENV="production"
|
||||||
|
export RAILS_LOG_TO_STDOUT="yes"
|
||||||
|
cd ${api}
|
||||||
|
${gems}/bin/bundle exec rails c
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
dataDir = "${config.chvp.dataPrefix}/var/lib/postgresql/${config.services.postgresql.package.psqlSchema}";
|
dataDir = "${config.chvp.dataPrefix}/var/lib/postgresql/${config.services.postgresql.package.psqlSchema}";
|
||||||
|
@ -89,25 +106,26 @@ in
|
||||||
ExecStart = "${gems}/bin/bundle exec puma -C ${api}/config/puma.rb";
|
ExecStart = "${gems}/bin/bundle exec puma -C ${api}/config/puma.rb";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} // (builtins.foldl' (x: y: x // y) {} (builtins.genList (n: {
|
} // (builtins.foldl' (x: y: x // y) { } (builtins.genList
|
||||||
"accentor-worker${toString n}" = {
|
(n: {
|
||||||
after = [ "network.target" "accentor-api.service" "postgresql.service" ];
|
"accentor-worker${toString n}" = {
|
||||||
requires = [ "accentor-api.service" "postgresql.service" ];
|
after = [ "network.target" "accentor-api.service" "postgresql.service" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
requires = [ "accentor-api.service" "postgresql.service" ];
|
||||||
environment = env;
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [ pkgs.ffmpeg gems gems.wrappedRuby ];
|
environment = env;
|
||||||
serviceConfig = {
|
path = [ pkgs.ffmpeg gems gems.wrappedRuby ];
|
||||||
EnvironmentFile = "${config.chvp.dataPrefix}/var/secrets/accentor-api";
|
serviceConfig = {
|
||||||
Type = "simple";
|
EnvironmentFile = "${config.chvp.dataPrefix}/var/secrets/accentor-api";
|
||||||
User = "accentor";
|
Type = "simple";
|
||||||
Group = "accentor";
|
User = "accentor";
|
||||||
Restart = "on-failure";
|
Group = "accentor";
|
||||||
WorkingDirectory = api;
|
Restart = "on-failure";
|
||||||
ExecStart = "${gems}/bin/bundle exec rails jobs:work";
|
WorkingDirectory = api;
|
||||||
|
ExecStart = "${gems}/bin/bundle exec rails jobs:work";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
}) 4));
|
}) 4));
|
||||||
|
|
||||||
users.users.accentor = {
|
users.users.accentor = {
|
||||||
group = "accentor";
|
group = "accentor";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue