Skip to content

Restic UI - mein zweites Python3 Projekt

Python3
  • Ich habe mal ein kleines UI für Restic erstellt. Das ist das Resultat, wenn man sich ein wenig Python3 und PyQt5 versucht beizubringen 🙂

    Der Code wird vermutlich keinen professionellen Ansprüchen genügen, mir hat er aber sehr viel Wissen neu vermittelt.

    Sollte so zu 98% fertig sein und neue Ideen zur Verbesserung sind auch schon im Kopf.

    Funktionen

    • init
    • backup
    • mount
    • restore
    • check
    • prune
    • snapshots

    sind drin und eine Funtion, mehrere Backups zu verwalten.

  • Noch ein kurzes Video zum Tool.

  • Ja, ich bin immer noch dran mich in Python3 und PyQT5 einzuarbeiten bzw. zu erlernen 😉

    Nachdem ich am Anfang alles mit einem JSON-File gemacht habe, habe ich die letzten Tage alles umgebaut. Ich nutze nun eine Klasse um mit den Daten zu hantieren, das JSON-File dient noch zur dauerhaften Speicherung der Daten.

    Es waren wieder interessante Stunden, in denen ich hoffentlich viel gelernt habe. Da ich aber bei solchen Dingen immer wieder feststelle, das man es besser machen kann 🙂 werde ich wohl bald mal anfangen es von vorne anzugehen.

    Hier ein paar Eindrücke.

    Start.png

    add.png

    add2.png

    init2.png

    backup.png

    snapshot.png

    snapshot2.png

    Das soll mal reichen 😉

  • Hallo,
    das interessiert mich brennend!
    Kann man das Ganze denn mal selbst probieren?
    VG

  • @berthold Hallo Berthold. Ich bin eigentlich immer noch nicht mit meinem Code zufrieden. Ist man das jemals? Da ich auch noch ein kleines Problem habe, würde ich da ungerne jemanden reinschauen lassen. Der Code ist stellenweise in deutsch kommentiert, stellenweise in englisch. Kennt man ja, man will es irgendwann mal ordentlich machen und dann kommt das nächste Problem auf einen zu.

    Hast Du Python3 Vorkenntnisse? Wenn Du "brennend" dran interessiert bist, könnte ich Dir evt. Zugang zu meinem Gitlab-Projekt geben.

    Wenn Du interessiert bist und ich dich nicht los werde :), dann schreib mir eine PN.

  • 0 Stimmen
    1 Beiträge
    53 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    5 Beiträge
    128 Aufrufe
    FrankMF

    Hab ChatGPT nochmal nach der Installation auf einem Production Server befragt.

    ChatGPT

    Certainly! Here's a short example of the steps you can follow to deploy a Flask application on a production server using Nginx and Gunicorn:

    Prepare your server:

    Set up a server (e.g., using a cloud provider like AWS, DigitalOcean, or a dedicated server) and ensure it has a clean, up-to-date installation of a Linux distribution (e.g., Ubuntu or CentOS).

    Install required software:

    Install necessary software packages on your server. You'll need Python, pip (Python package manager), Nginx, and Gunicorn. You can use your distribution's package manager (e.g., apt for Ubuntu or yum for CentOS) to install these dependencies.

    Deploy your Flask application:

    Copy your Flask application code and any required dependencies to your server.

    Set up a virtual environment (optional but recommended):

    Create a virtual environment for your Flask application to isolate its dependencies. You can use venv or virtualenv for this purpose.

    Install Flask and any required Python packages within your virtual environment:

    pip install flask

    Test your Flask application:

    Ensure your Flask application runs correctly within your server's virtual environment.

    Configure Gunicorn:

    Create a Gunicorn configuration file (e.g., gunicorn_config.py) to specify the settings for running your Flask application. Here's a simple example: workers = 4 # Number of Gunicorn worker processes bind = '0.0.0.0:8000' # The address and port Gunicorn should listen on

    Start Gunicorn:

    Start Gunicorn with your Flask application: gunicorn -c gunicorn_config.py your_app:app

    Configure Nginx:

    Create an Nginx server block (often located in /etc/nginx/sites-available) to define how Nginx should handle incoming requests. Here's a simplified example: server { listen 80; server_name your_domain.com www.your_domain.com; location / { proxy_pass http://127.0.0.1:8000; # Pass requests to Gunicorn proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }

    Enable the Nginx server block and restart Nginx:

    sudo ln -s /etc/nginx/sites-available/your_config /etc/nginx/sites-enabled/ sudo nginx -t # Test Nginx configuration sudo systemctl restart nginx

    Configure your DNS:

    Point your domain name to your server's IP address.

    Secure your server (optional but recommended):

    Set up SSL/TLS certificates for your domain to enable HTTPS. You can use Let's Encrypt for free SSL certificates.

    Monitor your application:

    Set up monitoring tools and logs to keep track of your application's performance and troubleshoot any issues.

    These are the basic steps to deploy a Flask application on a production server with Nginx and Gunicorn. Please note that this is a simplified example, and there are many additional considerations, such as database configuration, security, and optimization, depending on your specific application and requirements. It's also important to keep your server and software up to date and follow security best practices to ensure the stability and security of your production environment.

    Das werde ich doch mal ausprobieren 😎

  • Restic - riscv64

    Restic
    4
    0 Stimmen
    4 Beiträge
    128 Aufrufe
    FrankMF

    Hier der kurze Praxistest 🙂

    root@visionfive2:/etc# apt install restic Reading package lists... Done Building dependency tree... Done Reading state information... Done Suggested packages: libjs-sphinxdoc sphinx-rtd-theme-common The following NEW packages will be installed: restic 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 6,899 kB of archives. After this operation, 20.8 MB of additional disk space will be used. Get:1 http://ports.ubuntu.com lunar/universe riscv64 restic riscv64 0.14.0-1 [6,899 kB] Fetched 6,899 kB in 1s (5,589 kB/s) Selecting previously unselected package restic. (Reading database ... 34675 files and directories currently installed.) Preparing to unpack .../restic_0.14.0-1_riscv64.deb ... Unpacking restic (0.14.0-1) ... Setting up restic (0.14.0-1) ... Processing triggers for man-db (2.11.2-1) ... root@visionfive2:/etc# restic version restic 0.14.0 compiled with go1.19.2 on linux/riscv64 root@visionfive2:/etc# restic self-update writing restic to /usr/bin/restic find latest release of restic at GitHub latest version is 0.15.2 download SHA256SUMS download SHA256SUMS.asc GPG signature verification succeeded download restic_0.15.2_linux_riscv64.bz2 downloaded restic_0.15.2_linux_riscv64.bz2 saved 21954560 bytes in /usr/bin/restic successfully updated restic to version 0.15.2 root@visionfive2:/etc# restic version restic 0.15.2 compiled with go1.20.3 on linux/riscv64 root@visionfive2:/etc#
  • Python - Match-Case Statement

    Python3
    1
    0 Stimmen
    1 Beiträge
    82 Aufrufe
    Niemand hat geantwortet
  • Python - mehrsprachiges GUI

    Python3
    1
    0 Stimmen
    1 Beiträge
    111 Aufrufe
    Niemand hat geantwortet
  • 0 Stimmen
    3 Beiträge
    302 Aufrufe
    FrankMF

    Kein globalen Variablen mehr im Projekt 🙂

    Das Widget ließ sich relativ einfach erledigen.

    Vorher #----QPlainTextEdit ----# layout = QVBoxLayout() widget = QTextEdit() widget.setReadOnly(True) widget.setLayout(layout) setCentralWidget(widget) Nachher #----QPlainTextEdit ----# layout = QVBoxLayout() self.widget = QTextEdit() self.widget.setReadOnly(True) self.widget.setLayout(layout) self.setCentralWidget(self.widget)

    Aufruf dann nicht mehr mit

    # UI widget.setHtml("")

    sondern mit

    # UI mainWin.widget.setHtml("")

    Problem erledeigt und hoffentlich auch verstanden 😉

  • Restic v0.11.0 released

    Restic
    1
    0 Stimmen
    1 Beiträge
    184 Aufrufe
    Niemand hat geantwortet
  • Restic & Rclone & Nextcloud

    Linux
    3
    0 Stimmen
    3 Beiträge
    687 Aufrufe
    FrankMF

    Hier mal eine Ausgabe vom ersten Durchgang

    root@frank-MS-7C37:~# restic --password-file /root/passwd -r rclone:Nextcloud:HOME_UBUNTU backup --files-from /root/includes.txt repository 99xxxxa0 opened successfully, password is correct created new cache in /root/.cache/restic rclone: 2020/05/08 17:47:57 ERROR : locks: error listing: directory not found rclone: 2020/05/08 17:47:58 ERROR : index: error listing: directory not found rclone: 2020/05/08 17:47:58 ERROR : snapshots: error listing: directory not found Files: 3503 new, 0 changed, 0 unmodified Dirs: 2 new, 0 changed, 0 unmodified Added to the repo: 16.872 GiB processed 3503 files, 21.134 GiB in 1:02:56 snapshot fdxxxxec saved

    Der erste Durchgang hat also etwa eine Stunde benötigt. Durch die Deduplikation der Daten, ist der Vorgang beim zweiten Durchgang viel schneller weil nur neue oder geänderte Daten gesichert werden. Und außerdem sind alle Daten AES-256 verschlüsselt. Also perfekt zur Ablage in irgendeiner Cloud 😉

    root@frank-MS-7C37:~# restic --password-file /root/passwd -r rclone:Nextcloud:HOME_UBUNTU backup --files-from /root/includes.txt repository 99xxxxa0 opened successfully, password is correct Files: 57 new, 41 changed, 3449 unmodified Dirs: 0 new, 2 changed, 0 unmodified Added to the repo: 22.941 MiB processed 3547 files, 21.137 GiB in 0:13 snapshot c6xxxxe4 saved

    Wie ihr seht, hat der zweite Durchgang nur ein paar neue und geänderte Daten gesichert. Der Rest ist ja schon vorhanden. Und das kann man dann auch problemlos täglich, wöchentlich oder was auch immer mal eben schnell durchführen.

    Eines meiner absoluten Lieblingstool 🙂