I am developing a WordPress 5.2.3 site. My provider offers Plesk Obsidian 18.0.21 as admin tool. I want to store the custom PHP source code and the image upload area on a private GitHub repository. Images are currently too few to justify an autonomous storage solution, like S3 or similar. I am not concerned about the DB used by WP, because its backups are already well managed.
I am new to WP development and I am unsure which directories must be preserved on the GitHub repository, so I decided to store on GitHub the whole httpdocs area of my server.
I have performed the following operations:
installed WP from my Plesk console
zipped the whole lot from the Plesk file manager
downloaded the zipfile on my PC
created an empty repo on GitHub
cloned the GitHub repo on my PC
expanded the zipfile in the local repo on my PC
committed the new files and pushed to GitHub
deleted the files on the server using the Plesk file manager
from the Plesk console, enabled Git for my domain and linked it to the GitHub repo
on GitHub I have installed the public key provided by Plesk, allowing both read and write access to the repo
The clone performed by Plesk went smoothly: all the files from the remote GitHub repo have been copied, I can see on the Plesk console that the git log reports every commit, and the WP site works perfectly.
Now I have uploaded a test image from the WP admin dashboard, the directory uploads
shows the new image file in the Plesk file manager, and now I wish to push it to GitHub.
I enter the httpdocs
directory with an SSH shell, but there is no trace of a .git directory. I try git status
and the answer is not a git repository
.
Has Plesk performed a real git clone
, or has it just created a directory that allows GitHub hooks to fire and copy files there?
I may be possibly doing things the wrong way, but I have basically two needs:
develop PHP code (widgets, custom post types, etc.)
upload images from the WP admin dashboard
Both these assets must be versioned on GitHub.
I understand that I can develop the PHP code on my PC, push it on GitHub and have the hooks bring the changes on my Plesk-managed server. But I cannot envision a workflow for storing on GitHub the uploaded images, because they originate from the Plesk-managed server.
Is there a best practice for addressing both these needs at the same time in my environment?
mysqldump
andrsync
to backup the database and files created by my WordPress sites.