Unverified Commit d7370eff authored by Luj's avatar Luj Committed by GitHub
Browse files

uptime-kuma: 1.23.16 -> 2.0.2 (#455928)

parents 0c984f89 a2e2f0b0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

- Create the first release note entry in this section!
- `uptime-kuma` has been updated to v2, which requires an automated migration that can take a few hours. **A backup is highly recommended.**
  If your SQLite database is corrupted, the migration might fail and require [manual intervention](https://github.com/louislam/uptime-kuma/issues/5281).
  See the [migration guide](https://github.com/louislam/uptime-kuma/wiki/Migration-From-v1-To-v2) for more information.

## Nixpkgs Library {#sec-nixpkgs-release-26.05-lib}

+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,11 @@ in
        example = {
          PORT = "4000";
          NODE_EXTRA_CA_CERTS = lib.literalExpression "config.security.pki.caBundle";
          UPTIME_KUMA_DB_TYPE = "mariadb";
          UPTIME_KUMA_DB_HOSTNAME = "localhost";
          UPTIME_KUMA_DB_NAME = "uptime-kuma";
          UPTIME_KUMA_DB_USERNAME = "uptime-kuma";
          UPTIME_KUMA_DB_PASSWORD = "uptime-kuma";
        };
        description = ''
          Additional configuration for Uptime Kuma, see
@@ -42,6 +47,7 @@ in
      NODE_ENV = lib.mkDefault "production";
      HOST = lib.mkDefault "127.0.0.1";
      PORT = lib.mkDefault "3001";
      UPTIME_KUMA_DB_TYPE = lib.mkDefault "sqlite";
    };

    systemd.services.uptime-kuma = {
+11 −11
Original line number Diff line number Diff line
diff --git a/server/server.js b/server/server.js
index 0c9a45e6..cec31c7c 100644
--- a/server/server.js
+++ b/server/server.js
@@ -1583,6 +1583,7 @@ async function initDatabase(testMode = false) {
     if (! fs.existsSync(Database.path)) {
diff --git a/server/database.js b/server/database.js
index d22ceb29..7490be8a 100644
--- a/server/database.js
+++ b/server/database.js
@@ -236,6 +236,7 @@ class Database {
             if (! fs.existsSync(Database.sqlitePath)) {
                 log.info("server", "Copying Database");
         fs.copyFileSync(Database.templatePath, Database.path);
+        fs.chmodSync(Database.path, 0o640);
                 fs.copyFileSync(Database.templatePath, Database.sqlitePath);
+                fs.chmodSync(Database.sqlitePath, 0o640);
             }

     log.info("server", "Connecting to the Database");
             const Dialect = require("knex/lib/dialects/sqlite3/index.js");
+7 −12
Original line number Diff line number Diff line
@@ -3,23 +3,22 @@
  stdenv,
  fetchFromGitHub,
  buildNpmPackage,
  python3,
  nodejs,
  nixosTests,
}:

buildNpmPackage rec {
buildNpmPackage (finalAttrs: {
  pname = "uptime-kuma";
  version = "1.23.16";
  version = "2.0.2";

  src = fetchFromGitHub {
    owner = "louislam";
    repo = "uptime-kuma";
    rev = version;
    hash = "sha256-+bhKnyZnGd+tNlsxvP96I9LXOca8FmOPhIFHp7ijmyA=";
    tag = finalAttrs.version;
    hash = "sha256-zW5sl1g96PvDK3S6XhJ6F369/NSnvU9uSQORCQugfvs=";
  };

  npmDepsHash = "sha256-5i1NxwHqOahkioyM4wSu2X5KeMu7CdC4BqoUooAshn4=";
  npmDepsHash = "sha256-EmSZJUbtD4FW7Rzdpue6/bV8oZt7RUL11tFBXGJQthg=";

  patches = [
    # Fixes the permissions of the database being not set correctly
@@ -27,10 +26,6 @@ buildNpmPackage rec {
    ./fix-database-permissions.patch
  ];

  nativeBuildInputs = [ python3 ];

  CYPRESS_INSTALL_BINARY = 0; # Stops Cypress from trying to download binaries

  postInstall = ''
    cp -r dist $out/lib/node_modules/uptime-kuma/

@@ -50,10 +45,10 @@ buildNpmPackage rec {
    description = "Fancy self-hosted monitoring tool";
    mainProgram = "uptime-kuma-server";
    homepage = "https://github.com/louislam/uptime-kuma";
    changelog = "https://github.com/louislam/uptime-kuma/releases/tag/${version}";
    changelog = "https://github.com/louislam/uptime-kuma/releases/tag/${finalAttrs.version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ julienmalka ];
    # FileNotFoundError: [Errno 2] No such file or directory: 'xcrun'
    broken = stdenv.hostPlatform.isDarwin;
  };
}
})