33 Commits

Author SHA1 Message Date
Hamza Younas bf1beb5c99 Append leader hostname to backup filename (#1257)
Backup tar files currently use a filename that only encodes a
timestamp and the leader's IP, e.g.

    caprover-backup-2026_04_10-19_30_00-1744312200000-ip-1_2_3_4.tar

When you run several CapRover instances behind a NAT or with
similar IPs, that filename is not enough to tell the backups apart
after downloading them.

This appends the swarm leader's hostname to the existing filename:

    caprover-backup-...-ip-1_2_3_4-host-captain-prod.tar

The hostname is sanitized to a portable charset ([A-Za-z0-9._-]) so
it is safe in filesystems and HTTP Content-Disposition headers, and
the segment is omitted entirely when the leader has no hostname, so
existing single-node setups see no change beyond an additional
suffix when one is available.

The sanitization step is exposed as a small static helper
(`BackupManager.sanitizeHostnameForFilename`) so it can be unit
tested in isolation. Top-level cleanup hooks in the existing test
file are now gated on `process.env.CI`, matching how the
integration tests in the same file are gated, so the new pure
helper tests can run on a developer workstation.

Closes #1257
2026-04-10 19:56:29 +05:00
Ivn Nv 38a45dfbe7 Add PATCH /update/ endpoint for partial app definition updates
The existing POST /update/ replaces all fields — omitted fields are
reset to defaults (e.g. envVars becomes [], instanceCount becomes 0).
This makes simple operations like scaling dangerous: sending only
{appName, instanceCount} wipes all environment variables.

The new PATCH /update/ endpoint fetches the existing app definition
and merges only the explicitly provided fields. Omitted fields retain
their current values.

Example — scale without touching env vars:
  PATCH /api/v2/user/apps/appDefinitions/update/
  {"appName": "my-app", "instanceCount": 1}

The POST endpoint is unchanged — full backward compatibility.
2026-01-30 13:33:45 -05:00
Kasra Bigdeli 5d03bb3ea2 Fixed tests
Run build / build (push) Has been cancelled
Run formatter / check-code-formatting (push) Has been cancelled
Run lint / run-lint (push) Has been cancelled
Build and push the edge image / run-pre-checks (push) Has been cancelled
Build and push the edge image / build-publish-docker-hub (push) Has been cancelled
2025-10-13 22:55:17 -07:00
Kasra Bigdeli 6fe86982bc adding report for unused fields so that we can better prioritize adding support 2025-10-13 22:50:21 -07:00
Douglas Nassif Roma Junior a394dddaf1 Enhance SSH_PATH_RE on GitHelper to improve URL parsing 2025-03-31 10:24:52 -03:00
Kasra Bigdeli 4a32cb9dc3 Updated packages (#2165)
* Updated packages

* Updated packages

* Fixed formatting

* Fixed tests
2024-10-17 21:16:25 -07:00
Kasra Bigdeli e44d440488 Added functionality to remove multiple projects 2024-10-04 23:14:02 -07:00
ZeekoZhu ab2668da8c refactor: use shell-quote to parse cert command rule 2024-05-26 22:33:27 +08:00
ZeekoZhu a5e87d6e82 feat: enhanced Certbot command customization
- Introduced CertbotCertCommandRule for dynamic command generation
- Refactored CertbotManager to utilize a CertCommandGenerator
- Added new tests for the CertCommandGenerator logic
2024-02-26 19:07:41 +08:00
Kasra Bigdeli c1741833a9 Fixed https://github.com/caprover/caprover/issues/1863 2023-08-29 20:19:17 -07:00
Jonas Kuske d5c6174fcb test: only run backup tests in CI 2022-11-05 14:20:41 +01:00
Jonas Kuske 053cc4622b test: add tests for . and .git in repo name 2022-11-04 22:36:18 +01:00
Nico Beierle 2807beaae1 additional tests for sanitizeRepoPathSsh() 2021-11-06 17:56:21 +01:00
Nico Beierle 4cc507ad4b support any domain and ssh-user when using git deploy 2021-11-05 16:43:12 +01:00
Kasra Bigdeli e188a9c1ef Pass linter 2021-08-28 12:14:44 -07:00
Kasra Bigdeli d87cf7d5e0 Updated linter 2021-08-27 18:58:02 -07:00
Kasra Bigdeli 4968c1098a Add Authenticator tests 2021-07-03 10:28:56 -07:00
Long Nguyen 28889039b7 fix: add app's subdomain & add test case 2021-05-05 10:19:51 +07:00
Kasra Bigdeli 7f6d88f3a8 Added service override to BE 2020-08-12 07:35:16 -04:00
Kasra Bigdeli 6537ae3c8c Fixed tests 2020-06-19 23:38:00 -04:00
Kasra Bigdeli e5dd3340a2 Fix https://github.com/caprover/caprover/issues/606 2020-03-16 21:42:14 -04:00
Kasra Bigdeli ccfceec4b5 Fixed naming 2020-02-23 21:18:21 -05:00
Kasra Bigdeli ebcb762284 Improve sanitization process for the git repository address - fixes: https://github.com/caprover/caprover/issues/551 2019-11-23 19:44:14 -05:00
Kasra Bigdeli cd28300015 Added limit on wrong password 2019-08-13 21:43:20 -04:00
Kasra Bigdeli d9c313b47e Queued builds 2019-08-03 14:48:04 -04:00
Kasra Bigdeli b50c632d89 Capping version chistory to 50 2019-04-04 22:14:59 -07:00
Kasra Bigdeli 66f7c21013 Updated test 2019-02-18 23:06:49 -08:00
Kasra Bigdeli ae75859bea Cleanup after tests 2019-02-18 22:18:11 -08:00
Kasra Bigdeli d47aa0c758 Backup prep is done 2019-02-18 22:16:22 -08:00
Kasra Bigdeli 096a198fa4 Backup extraction is working 2019-02-18 17:30:20 -08:00
Kasra Bigdeli 16922feaf2 updated test dir 2019-02-18 17:07:42 -08:00
Kasra Bigdeli 1aae772cf1 Updated tests 2019-02-18 17:06:51 -08:00
Kasra Bigdeli c936b54ca0 Separated Core App 2019-01-11 21:57:33 -08:00