backup web server data with rsync

This command backs up whole directory containing the persistent volumes for the wordpress docker containers to the workstation PC.

Files on VPS that we want to back up:

$ ls
code_sonm_cloud  code_vas_cz  database_sonm_cloud  database_vas_cz  docker_backup  docker-compose.yml  html_sonm_cloud  html_vas_cz  Untitled.ipynb
$ pwd
/home/ubuntu/Desktop

Sync the files from your PC/laptop:

coil@coil:~$ rsync -avzh root@194.182.67.242:/home/ubuntu/Desktop /home/coil/Desktop/webserver_backup

Resulting files on the workstation:

coil@coil:~/Desktop$ ls
webserver_backup
coil@coil:~/Desktop$ tree -L 2 webserver_backup/
webserver_backup/
└── Desktop
    ├── code_sonm_cloud
    ├── code_vas_cz
    ├── database_sonm_cloud
    ├── database_vas_cz
    ├── docker_backup
    ├── docker-compose.yml
    ├── html_sonm_cloud
    ├── html_vas_cz
    └── Untitled.ipynb

8 directories, 2 files
coil@coil:~/Desktop$ 

So we see that the whole directory structure has been replicated under new local parent directory.

Eventually we will reverse the process and will be doing all the development on the workstation PC and provision the VPS via ansible or something like this.