Commit Graph

72 Commits

Author SHA1 Message Date
Michael Schmoock
f3d741e7af chore: some cleanups and minor fixes
This removes debug output and corrects some code nits that have
been introduced by the big CI restoration PR #418
2023-01-02 14:43:05 +01:00
Christian Decker
12a400e386 backup: Temporarily disable no-init test
It is failing since we no longer throw an exception if the daemon dies
while we wait for a log.
2023-01-01 17:14:05 +01:00
Christian Decker
b20d966320 backup: Remove stale requirements.txt file
It was causing mis-identification as a pip plugin
2023-01-01 17:14:05 +01:00
Michael Schmoock
6ab4d35003 backup: nits assert without parentheses 2022-12-31 14:55:43 +01:00
Michael Schmoock
70c1f0a4ee backup: fix a broken testcase
This fix works, but its a bit slow as it waits for a 30 second timeout
when a node could not have been started.
2022-12-31 14:55:43 +01:00
Michael Schmoock
7f18073a3a backup: fix flake8 code nits 2022-12-31 14:55:43 +01:00
Michael Schmoock
4d3560b129 reqirements: switch to pyln-client 0.12 for backup, drain, feeadj, rebalance and summary
This is required as newer versions of cln (>=0.12) use non numeric json
rpc IDs.
2022-11-04 11:43:00 +01:00
Seth For Privacy
af8bc417ca Add referenced requirements.txt
This file is referenced in https://lightning.readthedocs.io/BACKUP.html#backup-plugin-and-remote-nfs-mount, but does not exist, making installation and usage of backup plugin much more tricky.

This commit simply adds the two required packages so that the docs are correct now and the plugin can be more easily installed.
2022-08-22 12:00:09 +02:00
Michael Schmoock
59bad754cb backup: doc use poetry run also for backup-cli cmd 2022-07-21 19:06:34 +02:00
Nilesh Londhe
5250222189 now uses poetry to manage dependencies
poetry
2022-07-10 11:34:51 +02:00
Christian Decker
7ef9e6c172 docs: Rename from c-lightning to core-lightning for local plugins 2022-05-13 18:07:13 +02:00
Christian Decker
8077a5cebb gci: Do not nest virtualenvs in poetry
Poetry will automatically manage virtualenvs for our project, so we
can rely on `poetry install` and `poetry run` in the main environment
to keep the nested env up-to-date and enter it for testing.
2022-04-28 12:57:06 +02:00
Christian Decker
42f88ce24a backup: Migrate to poetry 2022-04-28 12:57:06 +02:00
LightningHelper
3da5778dcf explain that plugin can also be added to the config 2021-08-18 14:26:52 +02:00
LightningHelper
bfd80ada80 added instruction to stop the node before running the plugin
As instructed here:
https://github.com/ElementsProject/lightning/blob/master/doc/BACKUP.md#backup-plugin-and-remote-nfs-mount
2021-08-18 14:26:28 +02:00
Simon Vrouwe
44cf6ecaea backup: optimize restore and backup-compact
fix comments and typos, enable the `restore` progress bar
2021-08-18 14:26:00 +02:00
Wladimir J. van der Laan
43fc3c6d34 backup: Implement automatic reconnect in socket backend
Add automatic reconnect (with exponential back-off) to the socket backend.

If the connection is lost while pusing a change, try to reconnect.
Handle edge-cases that might come up depending on when the disconnect
happaned.

Currently the parameters are hardcoded: it will retry 5 times,
on the first retry it will wait 5 seconds before reconnecting.
There is an exponential backoff of 1.5, so on the fifth try it
will wait about 25 seconds.

This is particularly useful when conencting over Tor, as transient
interruptions are fairly common there.
2021-07-23 17:44:38 +09:30
Wladimir J. van der Laan
d59eb41e3f backup: Improve logging configurability for socket server
Add two optional arguments to `backup-cli server`:

- `--log-mode`: either `plain` (simply print the log message) or `systemd`
  (prefix log message with systemd log level, useful for running as a
  a service)

- `--log-level`: minimum level for messages to be logged, from `DEBUG`
  to `CRITICAL`

Also, move some noisy messages to the debug level.
2021-02-26 10:38:22 +01:00
Wladimir J. van der Laan
f66af8d2cf backup: Add section on backup compaction to README 2021-02-26 10:36:29 +01:00
Wladimir J. van der Laan
eada16c688 backup: Add support for Tor
Add support for connecting to the backup server through Tor, via its
SOCKS5 proxy.

See "Usage with Tor" in remote.md for documentation.
2021-02-26 10:35:48 +01:00
Wladimir J. van der Laan
cdfcd5a2fe backup: Add support for IPv6 addresses in socket backend
Support the bracketed `socket:[::]:1234` syntax for IPv6 addresses.

Also, add factor out the socket URI parsing to a function and add
tests for it. As a forward compatibility measure, reject query strings
(`?a=b`) because I intend to use these for parameters such as SOCKS5
proxy (for Tor) in a future patch.
2021-02-08 10:31:28 +01:00
Wladimir J. van der Laan
be140a72f7 backup: Use dummy backend in test_rewrite
Additional checking was added that a file exists when `create=False`,
this runs into an error with the `test_rewrite()` test. Update the test
to use dummy backend for the test, as it tests a method on the base
class, not any specific backend.
2021-02-04 13:06:41 +01:00
Wladimir J. van der Laan
7819fef71e backup: Update README for --lightning-dir argument 2021-02-04 13:06:41 +01:00
Wladimir J. van der Laan
4d6d738f80 backup: Update test for optional lightning-dir argument 2021-02-04 13:06:41 +01:00
Wladimir J. van der Laan
804a9bb290 backup: Implement network backup 2021-02-04 13:06:41 +01:00
MrManPew
4f4e30bb49 add path for backyup solution info 2021-02-04 13:06:14 +01:00
Michael Schmoock
4a9df896ad backup: fix deadlock by removing the sqlite3 check
I commented out that check and placed a NOTE that future developers
to see upfront putting in RPC stuff in init is potentially bad.
2021-02-01 14:33:46 +01:00
Christian Decker
75ddf53400 backup: Add a test for compactions 2021-01-16 13:29:37 +01:00
Christian Decker
c32894bd08 backup: Implement compaction for FileBackend
Compaction for the FileBackend involves restoring the DB from the
backup, up to the penultimate state, then taking a snapshot of the
restored DB, and then appending the last change to the backup. The new
backup is then atomically swapped with the old backup.

The special treatment for the last change is necessary as usual due to
the rewind functionality, otherwise we'd be in an un-rewindable state,
which can cause trouble if c-lightning died without committing the
last change.
2021-01-16 13:29:37 +01:00
Christian Decker
2037240353 backup: Add scaffolding for compactions 2021-01-16 13:29:37 +01:00
Christian Decker
d28d68cb16 backup: Ensure entries in the tx are bytes
We could end up in some cases with string-encoded statements.
2021-01-16 13:29:37 +01:00
Christian Decker
a097606495 ci: Increase timeout so we don't kill tests too often 2021-01-13 11:23:56 +01:00
Christian Decker
b0784e4ae2 meta: Add development requirements where missing
We're about to start testing in isolation, so better make sure that
each plugin can be tested in isolation.
2021-01-13 11:23:56 +01:00
svewa
d48a8d128d Update backup/README.md
Co-authored-by: Christian Decker <decker.christian@gmail.com>
2021-01-03 16:44:04 +01:00
Sven
a60d8efcf0 clarify backup location to be a file 2021-01-03 16:44:04 +01:00
Christian Decker
70aeb75365 backup: Be more explicit about requirements in readme 2020-12-19 10:59:24 +01:00
Wladimir J. van der Laan
7678fe1ed1 backup: Some improvements to text of README.md 2020-12-19 10:59:24 +01:00
Wladimir J. van der Laan
a6afc5a612 backup: Increase version_count after each version
Fix #183.
2020-12-18 19:42:16 +01:00
Michael Schmoock
1e7701f033 backup: fix flake8 nits 2020-12-13 15:36:15 +01:00
Michael Schmoock
1f05674b5b backup: cleanup flake8 nits 2020-12-11 11:01:02 +01:00
Michael Schmoock
be523aa54f backup: restore default filename lightningd.sqlite3 2020-12-11 11:01:02 +01:00
Michael Schmoock
9591c1b31e backup: doc fix that restore needs a file not a dir 2020-12-11 11:01:02 +01:00
Christian Decker
092b295d06 backup: Rewrite erroneously expanded SQL stmts on-the-fly
Seems to have little to no performance impact.
2020-12-11 10:52:23 +01:00
Christian Decker
e6d26b479c backup: Add a test to reproduce #158 2020-12-11 10:52:23 +01:00
Michael Schmoock
0cbee3fc48 backup: fix loglevel to just INFO 2020-11-27 12:05:51 +01:00
Michael Schmoock
040b3a3a35 backup: adds a basic README.md 2020-11-27 12:05:51 +01:00
Christian Decker
3a1a89ecf8 backup: Add a warning about the deprecated backup-destination flag 2020-11-25 19:26:44 +01:00
Christian Decker
f34787d065 backup: Rely solely on backup.lock and do not cache writes
Caching writes was causing us some issues if the startup of
`lightningd` didn't complete, i.e., the writes would happen on the
live DB, but we'd forget about them. Since we have the backup.lock
file in same directory as the plugin is running in, we no longer have
to defer the writes. This hugely simplifies our logic.

Fixes #155

Changelog-Fixed: backup: The plugin doesn't lose sync anymore if the startup is interrupted
2020-11-25 19:26:44 +01:00
Christian Decker
630d385a0b backup: Mark the backup-destination option as UNUSED
We'll start relying solely on the `backup.lock` file generated by the
`backup-cli`. But we keep the option so we don't automatically break
all configs that simply updated.
2020-11-25 19:26:44 +01:00
Christian Decker
b7804408f4 noise: Add missing dependency on psutil>=5 2020-10-21 16:13:29 +02:00