config.sample.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. // Manage client configuration.
  3. //
  4. // Copy this file to config.php inside this folder and adjust the values.
  5. // config.php must NOT be committed to the host project's repository, and it
  6. // must NOT be part of the release package (see 06_UPDATE_PACKAGING.md).
  7. //
  8. // Every constant has a default in lib/client.php, so a minimal config.php only
  9. // needs the three connection values plus the backup sources.
  10. // ---------------------------------------------------------------------------
  11. // Connection
  12. // ---------------------------------------------------------------------------
  13. // Base URL of the manage server, without a trailing slash and without /api.
  14. define("MANAGE_SERVER_URL", "https://manage.example.org");
  15. // Instance id and token, both shown when the instance is created on the server
  16. // (Instanzen -> Instanz anlegen). The token is displayed exactly once.
  17. define("MANAGE_INSTANCE", "psa-prod");
  18. define("MANAGE_TOKEN", "");
  19. // Seconds per HTTP request. Package downloads and backup uploads use the long
  20. // timeout, manifest and heartbeat the short one.
  21. define("MANAGE_HTTP_TIMEOUT", 15);
  22. define("MANAGE_HTTP_TIMEOUT_LONG", 300);
  23. // ---------------------------------------------------------------------------
  24. // Application layout
  25. // ---------------------------------------------------------------------------
  26. // Root of the host application. Defaults to the parent of this folder, which is
  27. // correct when manage-client/ sits directly in the application root.
  28. define("MANAGE_APP_ROOT", dirname(__DIR__));
  29. // Where the installed version is stored.
  30. // - PHP file with a constant: set both values
  31. // - plain text file containing only "v1.2.3": set MANAGE_VERSION_CONSTANT null
  32. define("MANAGE_VERSION_FILE", MANAGE_APP_ROOT . "/includes/version.php");
  33. define("MANAGE_VERSION_CONSTANT", "APP_VERSION");
  34. // Working directories. Must be writable by PHP and should not be web-readable.
  35. define("MANAGE_WORK_DIR", MANAGE_APP_ROOT . "/data/manage/work/");
  36. define("MANAGE_UPDATE_BACKUP_DIR", MANAGE_APP_ROOT . "/data/manage/updates/");
  37. define("MANAGE_BACKUP_DIR", MANAGE_APP_ROOT . "/data/manage/backups/");
  38. define("MANAGE_LOG_FILE", MANAGE_APP_ROOT . "/data/manage/manage-client.log");
  39. // ---------------------------------------------------------------------------
  40. // Update
  41. // ---------------------------------------------------------------------------
  42. // Paths the updater must never overwrite, relative to MANAGE_APP_ROOT.
  43. // A trailing slash marks a directory; everything below it is protected.
  44. define("MANAGE_UPDATE_PROTECTED_PATHS", [
  45. "config.php",
  46. "data/",
  47. ".git/",
  48. "manage-client/config.php",
  49. ]);
  50. // A package must contain at least one of these paths, otherwise it is rejected
  51. // before anything is copied. Guards against deploying an unrelated ZIP.
  52. define("MANAGE_UPDATE_SANITY_PATHS", ["index.php"]);
  53. // Optional callback executed after a successful deployment.
  54. // See docs/07_POST_UPDATE_HOOKS.md.
  55. define("MANAGE_UPDATE_POST_HOOK", null);
  56. // define("MANAGE_UPDATE_POST_HOOK", [
  57. // "file" => MANAGE_APP_ROOT . "/includes/after-update.php",
  58. // "callback" => "myProjectAfterUpdate",
  59. // ]);
  60. // Migrations shipped inside the release package. Set to null to disable.
  61. define("MANAGE_MIGRATIONS_DIR", MANAGE_APP_ROOT . "/migrations");
  62. define("MANAGE_MIGRATIONS_STATE", MANAGE_APP_ROOT . "/data/manage/migrations.json");
  63. // ---------------------------------------------------------------------------
  64. // Backup
  65. // ---------------------------------------------------------------------------
  66. // What goes into the archive. Paths are relative to MANAGE_APP_ROOT.
  67. // "glob" => shell glob, non-recursive
  68. // "dir" => directory, recursive
  69. // "file" => single file
  70. // "as" => path prefix inside the ZIP
  71. define("MANAGE_BACKUP_SOURCES", [
  72. ["as" => "data", "glob" => "data/*.json"],
  73. ["as" => "data/uploads", "dir" => "data/uploads"],
  74. ]);
  75. // Optional MySQL/MariaDB dump. null disables it entirely.
  76. define("MANAGE_BACKUP_DATABASE", null);
  77. // define("MANAGE_BACKUP_DATABASE", [
  78. // "dsn" => "mysql:host=localhost;dbname=myproject;charset=utf8mb4",
  79. // "user" => "myproject",
  80. // "password" => "...",
  81. // // Optional: only dump the structure of these tables, not their rows.
  82. // "skip_data_tables" => ["sessions", "cache"],
  83. // ]);
  84. // Local archives kept on the instance. Minimum 1.
  85. define("MANAGE_BACKUP_LOCAL_RETENTION", 4);
  86. // Interval for manageBackupCreateAutomaticIfDue(), in seconds. 0 disables it.
  87. // Default is weekly. Irrelevant when a cron job runs the CLI instead.
  88. define("MANAGE_BACKUP_AUTO_INTERVAL_SECONDS", 604800);
  89. // Compress entries in the ZIP. Deflate needs zlib (bundled with PHP by default)
  90. // and matters mostly for SQL dumps; false stores everything uncompressed.
  91. define("MANAGE_BACKUP_COMPRESS", true);
  92. // Upload every new backup to the manage server. Set false for local-only backups.
  93. define("MANAGE_BACKUP_UPLOAD", true);
  94. // Additional targets besides the manage server: s3, sftp, custom.
  95. // See docs/05_BACKUP_SOURCES.md.
  96. define("MANAGE_BACKUP_REMOTE_TARGETS", []);