working ulogger!
This commit is contained in:
parent
042c8dcec9
commit
a68dd78843
16
flake.lock
16
flake.lock
|
@ -32,11 +32,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1680877018,
|
||||
"narHash": "sha256-jhd0G+LWF79L2m8dME55pBBoDY1FBenZ75WgKRA/Quk=",
|
||||
"lastModified": 1682226636,
|
||||
"narHash": "sha256-fmETHfUtQ5zOVr/4MT5wE7eNALCSQCnEUYZYmV3UEwg=",
|
||||
"ref": "main",
|
||||
"rev": "15db0ea5c19c70bce8504290724661586dc94006",
|
||||
"revCount": 71,
|
||||
"rev": "095d14ff2469c8f3de7cbf45d229c0f46a733aae",
|
||||
"revCount": 77,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.sealight.xyz/aynish/basant"
|
||||
},
|
||||
|
@ -403,11 +403,11 @@
|
|||
"vimwiki-cli": "vimwiki-cli"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681311621,
|
||||
"narHash": "sha256-EQo+NdexCl+7I8vTsXpPvLHKJNU7dd4nRE2PqEoGJCA=",
|
||||
"lastModified": 1682222403,
|
||||
"narHash": "sha256-mLheDjdJ9TkmrR62FlPQtrYxKc/PJt4lhNBi5s9A97U=",
|
||||
"ref": "main",
|
||||
"rev": "dfb078dbd8eb679e8f133afb4b6fec0f9e229b6c",
|
||||
"revCount": 607,
|
||||
"rev": "01fae2ec19d01256c17b58dcdc8ff43d717ec9da",
|
||||
"revCount": 640,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.sealight.xyz/aynish/kitaab"
|
||||
},
|
||||
|
|
|
@ -83,6 +83,9 @@
|
|||
unstable = unstable.legacyPackages.${prev.system};
|
||||
deploy = deploy-rs.packages.${prev.system}.deploy-rs;
|
||||
};
|
||||
llamaOverlay = final: prev: {
|
||||
llama = llamacpp.packages.${prev.system}.default;
|
||||
};
|
||||
|
||||
nixpkgsFor = forAllSystems (system: import nixpkgs {
|
||||
inherit system;
|
||||
|
@ -222,6 +225,7 @@
|
|||
self.nixosModules.wireguard
|
||||
self.nixosModules.wallabag
|
||||
self.nixosModules.gonic
|
||||
self.nixosModules.ulogger-server
|
||||
# grasp.nixosModule
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
# ../profiles/archivebox
|
||||
../profiles/woodpecker-agent
|
||||
../profiles/jellyfin
|
||||
../profiles/ulogger-server
|
||||
];
|
||||
|
||||
# Something broke when manually updating grasp...
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
"paper.mossnet.lan"
|
||||
"cal.mossnet.lan"
|
||||
"archive.mossnet.lan"
|
||||
"tracks.mossnet.lan"
|
||||
];
|
||||
"192.168.1.226" = [
|
||||
"df-web.lan"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ "ulogger" ];
|
||||
ensureUsers = [{
|
||||
name = "ulogger";
|
||||
|
@ -14,6 +15,7 @@
|
|||
services.ulogger = {
|
||||
enable = true;
|
||||
hostName = "tracks.mossnet.lan";
|
||||
user = "ulogger";
|
||||
conf = ''
|
||||
<?php
|
||||
/* μlogger
|
||||
|
@ -37,81 +39,25 @@
|
|||
// This is default configuration file.
|
||||
// Copy it to config.php and customize
|
||||
|
||||
// default map drawing framework
|
||||
// (gmaps = google maps, openlayers = openlayers/osm)
|
||||
//$mapapi = "gmaps";
|
||||
$mapapi = "openlayers";
|
||||
// Database config
|
||||
|
||||
// openlayers additional map layers
|
||||
// OpenCycleMap (0 = no, 1 = yes)
|
||||
$layer_ocm = 1;
|
||||
// MapQuest-OSM (0 = no, 1 = yes)
|
||||
$layer_mq = 1;
|
||||
// osmapa.pl (0 = no, 1 = yes)
|
||||
$layer_osmapa = 1;
|
||||
// UMP (0 = no, 1 = yes)
|
||||
$layer_ump = 1;
|
||||
// PDO data source name, eg.:
|
||||
// mysql:host=localhost;port=3307;dbname=ulogger;charset=utf8
|
||||
// mysql:unix_socket=/path/to/mysql.sock;dbname=ulogger;charset=utf8
|
||||
// pgsql:host=localhost;port=5432;dbname=ulogger
|
||||
// sqlite:/path/to/ulogger.db
|
||||
$dbdsn = "pgsql:host=/run/postgresql/;port=5432;dbname=ulogger";
|
||||
|
||||
// default coordinates for initial map
|
||||
$init_latitude = 52.23;
|
||||
$init_longitude = 21.01;
|
||||
// Database user name
|
||||
$dbuser = "ulogger";
|
||||
|
||||
// you may set your google maps api key
|
||||
// this is not obligatory by now
|
||||
//$gkey = "";
|
||||
// Database user password
|
||||
$dbpass = "";
|
||||
|
||||
// MySQL config
|
||||
$dbhost = "localhost"; // mysql host, eg. localhost
|
||||
$dbuser = "ulogger"; // database user
|
||||
$dbpass = ""; // database pass
|
||||
$dbname = "ulogger"; // database name
|
||||
$dbprefix = ""; // optional table names prefix, eg. "ulogger_"
|
||||
|
||||
// other
|
||||
// require login/password authentication
|
||||
// (0 = no, 1 = yes)
|
||||
$require_authentication = 0;
|
||||
|
||||
// all users tracks are visible to authenticated user
|
||||
// (0 = no, 1 = yes)
|
||||
$public_tracks = 0;
|
||||
|
||||
// admin user, who
|
||||
// - can add new users
|
||||
// - can edit all tracks, users
|
||||
// - has access to all users locations
|
||||
// none if empty
|
||||
$admin_user = "admin";
|
||||
|
||||
// miniumum required length of user password
|
||||
$pass_lenmin = 12;
|
||||
|
||||
// required strength of user password
|
||||
// 0 = no requirements,
|
||||
// 1 = require mixed case letters (lower and upper),
|
||||
// 2 = require mixed case and numbers,
|
||||
// 3 = require mixed case, numbers and non-alphanumeric characters
|
||||
$pass_strength = 0;
|
||||
|
||||
// Default interval in seconds for live auto reload
|
||||
$interval = 10;
|
||||
|
||||
// Default language
|
||||
// (en, pl, de, hu)
|
||||
$lang = "en";
|
||||
//$lang = "pl";
|
||||
//$lang = "de";
|
||||
//$lang = "hu";
|
||||
//$lang = "fr";
|
||||
//$lang = "it";
|
||||
|
||||
// units
|
||||
// (metric, imperial)
|
||||
$units = "metric";
|
||||
//$units = "imperial";
|
||||
// Optional table names prefix, eg. "ulogger_"
|
||||
$dbprefix = "";
|
||||
|
||||
?>
|
||||
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
hesienbridge = import ./heisenbridge.nix;
|
||||
wireguard = import ./wireguard.nix;
|
||||
backup = import ./backup.nix;
|
||||
ulogger-server = import ./ulogger.nix;
|
||||
}
|
||||
|
|
|
@ -9,14 +9,7 @@ let
|
|||
configFile = pkgs.writeTextFile {
|
||||
name = "ulogger-config";
|
||||
text = cfg.conf;
|
||||
destination = "config.php";
|
||||
};
|
||||
|
||||
appDir = pkgs.buildEnv {
|
||||
name = "ulogger-app-dir";
|
||||
ignoreCollisions = true;
|
||||
checkCollisionContents = false;
|
||||
paths = [ configFile "${cfg.package}/app" ];
|
||||
destination = "/config.php";
|
||||
};
|
||||
|
||||
in
|
||||
|
@ -207,34 +200,41 @@ in
|
|||
services.nginx.virtualHosts."${cfg.hostName}" = {
|
||||
enableACME = false;
|
||||
forceSSL = false;
|
||||
root = "${cfg.package}";
|
||||
root = "${cfg.dataDir}";
|
||||
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
'';
|
||||
|
||||
locations."/" = {
|
||||
extraConfig = ''
|
||||
'';
|
||||
};
|
||||
|
||||
locations."~ ^/app\\.php(/|$)" = {
|
||||
locations."~ .php$" = {
|
||||
extraConfig = ''
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."${poolName}".socket};
|
||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
fastcgi_index ${conf.pkg}/index.php;
|
||||
fastcgi_param DOCUMENT_ROOT ${cfg.dataDir};
|
||||
fastcgi_param SCRIPT_FILENAME ${cfg.dataDir}/$fastcgi_script_name;
|
||||
fastcgi_index index.php;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
users.users = {
|
||||
${cfg.user} = {
|
||||
group = "nginx";
|
||||
description = "ulogger server user";
|
||||
isSystemUser = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.ulogger-install = {
|
||||
description = "ulogger install service";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "phpfpm-ulogger.service" ];
|
||||
after = [ "mysql.service" "postgresql.service" ];
|
||||
path = with pkgs; [ coreutils php phpPackages.composer ];
|
||||
path = with pkgs; [ coreutils php phpPackages.composer postgresql ];
|
||||
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
|
@ -246,28 +246,25 @@ in
|
|||
preStart = ''
|
||||
mkdir -p "${cfg.dataDir}"
|
||||
mkdir -p "${cfg.dataDir}/uploads"
|
||||
chown ${cfg.user}:nginx "${cfg.dataDir}"
|
||||
chown -R ${cfg.user}:nginx "${cfg.dataDir}"
|
||||
'';
|
||||
|
||||
environment = {
|
||||
ULOGGER_ADMIN_USER = "admin";
|
||||
ULOGGER_ADMIN_PASSWORD = "admin";
|
||||
ULOGGER_ADMIN_PASSWORD = "\$2y\$10\$7OvZrKgonVZM9lkzrTbiou.CVhO3HjPk5y0W9L68fVwPs/osBRIMq"; # hashed "admin"
|
||||
};
|
||||
|
||||
script = ''
|
||||
echo "Setting up wallabag files in ${cfg.dataDir} ..."
|
||||
echo "Setting up ulogger-server files in ${cfg.dataDir} ..."
|
||||
cd "${cfg.dataDir}"
|
||||
|
||||
rm -rf var/cache/*
|
||||
rm -f app
|
||||
ln -sf ${appDir} app
|
||||
ln -sf ${cfg.package}/composer.{json,lock} .
|
||||
cp -R ${cfg.package}/* ./
|
||||
cp ${configFile}/config.php ./
|
||||
|
||||
if [ ! -f installed ]; then
|
||||
echo "Install file not found, installing ..."
|
||||
# TODO, taken from https://github.com/bfabiszewski/ulogger-server/blob/master/.docker/init.sh
|
||||
su postgres -c "psql -U ulogger < ${appDir}/scripts/ulogger.pgsql"
|
||||
su postgres -c "psql -d ulogger -c \"INSERT INTO users (login, password, admin) VALUES ('$ULOGGER_ADMIN_USER', '$ULOGGER_ADMIN_PASSWORD', TRUE)\""
|
||||
psql -U ulogger < ${cfg.package}/scripts/ulogger.pgsql
|
||||
psql -d ulogger -c "INSERT INTO users (login, password, admin) VALUES ('$ULOGGER_ADMIN_USER', '$ULOGGER_ADMIN_PASSWORD', TRUE)"
|
||||
touch installed
|
||||
fi
|
||||
'';
|
||||
|
@ -277,6 +274,4 @@ in
|
|||
meta = with stdenv.lib; {
|
||||
maintainers = with maintainers; [ nadrieril ];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
fennel-ls = pkgs.callPackage ./fennel-ls.nix { };
|
||||
kobopatch = pkgs.callPackage ./kobopatch.nix { };
|
||||
my-mautrix-discord = pkgs.callPackage ./mautrix-discord.nix { }; # Handled by matrix-appservices input
|
||||
ulogger-server = pkgs.callPackage ./ulogger.nix { };
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ stdenv.mkDerivation {
|
|||
# Release tarball includes vendored files
|
||||
src = fetchurl {
|
||||
url = "https://github.com/bfabiszewski/ulogger-server/archive/refs/tags/v${version}.tar.gz";
|
||||
hash = "";
|
||||
hash = "sha256-+ZyNA5+lhD6DKXIWNdlLA7ArtV1F61H3UmMyRVRdws0=";
|
||||
};
|
||||
|
||||
dontBuild = true;
|
||||
|
@ -19,6 +19,7 @@ stdenv.mkDerivation {
|
|||
runHook preInstall
|
||||
rm -R .docker
|
||||
rm -R .tests
|
||||
rm -R uploads/
|
||||
mkdir $out
|
||||
cp -R * $out/
|
||||
runHook postInstall
|
||||
|
|
Loading…
Reference in a new issue