feat: panel now installs properly when enabled
This commit is contained in:
parent
88db47d13d
commit
d9ce8c5a79
1 changed files with 65 additions and 26 deletions
|
@ -10,6 +10,30 @@ with lib; let
|
||||||
cfg = config.services.skynet."${name}";
|
cfg = config.services.skynet."${name}";
|
||||||
php_pool = name;
|
php_pool = name;
|
||||||
domain_panel = "${cfg.panel.domain.sub}.${cfg.panel.domain.base}.${cfg.panel.domain.tld}";
|
domain_panel = "${cfg.panel.domain.sub}.${cfg.panel.domain.base}.${cfg.panel.domain.tld}";
|
||||||
|
|
||||||
|
packages = let
|
||||||
|
dir = cfg.panel.dir;
|
||||||
|
in [
|
||||||
|
pkgs.curl
|
||||||
|
pkgs.gnutar
|
||||||
|
pkgs.unzip
|
||||||
|
pkgs.gzip
|
||||||
|
pkgs.php83
|
||||||
|
pkgs.php83Packages.composer
|
||||||
|
pkgs.php83Extensions.gd
|
||||||
|
pkgs.php83Extensions.mysqli
|
||||||
|
pkgs.php83Extensions.mbstring
|
||||||
|
pkgs.php83Extensions.bcmath
|
||||||
|
pkgs.php83Extensions.xml
|
||||||
|
pkgs.php83Extensions.curl
|
||||||
|
pkgs.php83Extensions.zip
|
||||||
|
pkgs.php83Extensions.intl
|
||||||
|
pkgs.php83Extensions.sqlite3
|
||||||
|
(import ./pelican-panel-update.nix {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit dir;
|
||||||
|
})
|
||||||
|
];
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
];
|
];
|
||||||
|
@ -66,32 +90,7 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.systemPackages = let
|
environment.systemPackages = packages;
|
||||||
dir = cfg.panel.dir;
|
|
||||||
in [
|
|
||||||
pkgs.curl
|
|
||||||
pkgs.gnutar
|
|
||||||
pkgs.unzip
|
|
||||||
pkgs.php83
|
|
||||||
pkgs.php83Packages.composer
|
|
||||||
pkgs.php83Extensions.gd
|
|
||||||
pkgs.php83Extensions.mysqli
|
|
||||||
pkgs.php83Extensions.mbstring
|
|
||||||
pkgs.php83Extensions.bcmath
|
|
||||||
pkgs.php83Extensions.xml
|
|
||||||
pkgs.php83Extensions.curl
|
|
||||||
pkgs.php83Extensions.zip
|
|
||||||
pkgs.php83Extensions.intl
|
|
||||||
pkgs.php83Extensions.sqlite3
|
|
||||||
(import ./pelican-panel-install.nix {
|
|
||||||
inherit pkgs;
|
|
||||||
inherit dir;
|
|
||||||
})
|
|
||||||
(import ./pelican-panel-update.nix {
|
|
||||||
inherit pkgs;
|
|
||||||
inherit dir;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.timers."pelican-cron" = {
|
systemd.timers."pelican-cron" = {
|
||||||
wantedBy = ["timers.target"];
|
wantedBy = ["timers.target"];
|
||||||
|
@ -124,6 +123,46 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.pelican-panel-setup = {
|
||||||
|
wantedBy = ["pelican-queue.target" "pelican-cron.target"];
|
||||||
|
partOf = [];
|
||||||
|
path = packages;
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = "root";
|
||||||
|
Group = "root";
|
||||||
|
TimeoutSec = "infinity";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = pkgs.writeShellScript "pelican-panel-install" ''
|
||||||
|
DIR=${cfg.panel.dir}
|
||||||
|
|
||||||
|
echo "Installing Pelican panel to $DIR ..."
|
||||||
|
if [ -d $DIR ]; then
|
||||||
|
echo "Directory $DIR already exists, exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Creating directory ..."
|
||||||
|
mkdir -p $DIR
|
||||||
|
cd $DIR
|
||||||
|
|
||||||
|
echo "Downloading Pelican panel ..."
|
||||||
|
curl -L https://github.com/pelican-dev/panel/releases/latest/download/panel.tar.gz | tar -xzv
|
||||||
|
echo "Installing Pelican panel using composer ..."
|
||||||
|
yes | composer install --no-dev --optimize-autoloader
|
||||||
|
|
||||||
|
echo "Setting up the environment ..."
|
||||||
|
yes "" | php artisan p:environment:setup
|
||||||
|
|
||||||
|
echo "Setting permissions ..."
|
||||||
|
chmod -R 755 storage/* bootstrap/cache/
|
||||||
|
chown -R ${config.services.nginx.user}:${config.services.nginx.group} $DIR
|
||||||
|
|
||||||
|
echo "Pelican panel installed successfully"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.phpfpm.pools.${php_pool} = {
|
services.phpfpm.pools.${php_pool} = {
|
||||||
user = config.services.nginx.user;
|
user = config.services.nginx.user;
|
||||||
group = config.services.nginx.group;
|
group = config.services.nginx.group;
|
||||||
|
|
Loading…
Reference in a new issue