dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
17.3k stars 965 forks source link

[feature] Import the backup file into the "import" function in WebUI #130

Open Tziware opened 3 years ago

Tziware commented 3 years ago

Would be great to be able to restore a backup within the webUI. Even if its just the websites and snapshot history.

dgtlmoon commented 3 years ago

@Tziware

Even if its just the websites and snapshot history.

isnt that sort of the whole thing? isnt that what the program does? :) or i dont understand?

Tziware commented 3 years ago

Recently I was moving between servers so installed a second instance on another server used the backup function in the instance on my existing server thinking thats what it was for I was surprised that the restore function didnt use the file generated by the backup function.

g000m commented 3 years ago

+1

dgtlmoon commented 3 years ago

You can always do this with the docker volume copy for now, but fair idea yes

bayview commented 3 years ago

In the meantime, can we get effective instructions on how to manually restore a backup? I tried the one in the Wiki with no success...

After exporting an accurate BACKUP_PATH, I get this:

$ docker run -v datastore-volume:/datastore -v $BACKUP_PATH:/backup.zip python:3.8-slim bash -c "apt-get update && apt-get install unzip -y; unzip -o /backup.zip-d /datastore" Unable to find image 'python:3.8-slim' locally 3.8-slim: Pulling from library/python 33847f680f63: Pull complete e8124950597e: Pull complete cc636c24d49d: Pull complete 1fbf3ac5d4b6: Pull complete 37cfb6b6e136: Pull complete Digest: sha256:2a41e35b42bf984f05b4c40bd444d0ea3224e6cdd1b7a683ee364521f5501de3 Status: Downloaded newer image for python:3.8-slim Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB] Get:2 http://deb.debian.org/debian buster InRelease [122 kB] Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB] Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [299 kB] Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB] Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [15.2 kB] Fetched 8460 kB in 9s (976 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... Suggested packages: zip The following NEW packages will be installed: unzip 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 172 kB of archives. After this operation, 580 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian buster/main amd64 unzip amd64 6.0-23+deb10u2 [172 kB] debconf: delaying package configuration, since apt-utils is not installed Fetched 172 kB in 1s (245 kB/s) Selecting previously unselected package unzip. (Reading database ... 6840 files and directories currently installed.) Preparing to unpack .../unzip_6.0-23+deb10u2_amd64.deb ... Unpacking unzip (6.0-23+deb10u2) ... Setting up unzip (6.0-23+deb10u2) ... unzip: cannot find or open /backup.zip-d, /backup.zip-d.zip or /backup.zip-d.ZIP.


The issue is probably something quite simple, but I have never used docker.

bayview commented 3 years ago

I solved my problem with the restore instructions from the wiki.

The command line in the wiki is missing a space before the last "-d /datastore"

The correct command is: docker run -v datastore-volume:/datastore -v $BACKUP_PATH:/backup.zip python:3.8-slim bash -c "apt-get update && apt-get install unzip -y; unzip -o /backup.zip -d /datastore"

Two recommendations: 1) Mention on the home page that installing a new version will wipe out all the data and settings. 2) Put the backup and restore instructions on the home page.

Thanks for a very useful tool!

dgtlmoon commented 3 years ago

@bayview thanks I fixed that wiki!

1 - It will never wipe out your data just because of a upgrade, it must be because of something else, maybe you didnt kill the docker process before you ran your unzip.. that would confuse the system

2 - yes!

niemsoen commented 1 year ago

Is there also a way to backup the settings,snapshots,etc... without the docker image running? Mine doesn't start anymore because of this bug. (output taken with sudo docker logs CONTAINER_ID)

Process Process-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/local/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/app/changedetectionio/changedetection.py", line 96, in main
    datastore = store.ChangeDetectionStore(datastore_path=app_config['datastore_path'], version_tag=__version__)
  File "/app/changedetectionio/store.py", line 56, in __init__
    from_disk = json.load(json_file)
  File "/usr/local/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.10/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

This bug is probably not reproducible, because my system had a crash, so this is literally all the info I have.

I'd highly appreciate, if you could point out a way to backup the instance offline so that I can import it again in a new instance with the instructions from the wiki. Thanks in advance! :100:

ghost commented 1 year ago

a pull request was opened by the developer at the end of 2022: https://github.com/dgtlmoon/changedetection.io/pull/1248

ghost commented 1 year ago

On a related note, does the Python package make backing up changedetection.io config data easier? As a beginner I may switch (see this discussion about auto-starting the pip version).

c0d3z3r0 commented 5 months ago

I solved my problem with the restore instructions from the wiki.

The command line in the wiki is missing a space before the last "-d /datastore"

The correct command is: docker run -v datastore-volume:/datastore -v $BACKUP_PATH:/backup.zip python:3.8-slim bash -c "apt-get update && apt-get install unzip -y; unzip -o /backup.zip -d /datastore"

Shorter and faster:

docker run -ti --rm -v $PWD/backup.zip:/backup.zip -v changedetectioniogit_changedetection-data:/datastore alpine sh -c "rm -r /datastore/*; unzip -d /datastore /backup.zip"