An ApostropheCMS companion script for syncing MongoDB database collections and /uploads folder contents between local and remote environments.
bashrsyncjqmongodump&mongorestore- they can be installed as a part of the MongoDB Database Tools- correctly set environmental variables inside the
aposync.config.jsin order to connect via SSH client
- Add the package with your favourite package manager to your project e.g.
npm install @bohemicastudio/apostrophe-sync - Run
aposync initto create the configuration fileaposync.config.jsin the root folder of your project and set the necessary variables inside. - Run
aposynccommand in your terminal to access an action overview menu. - Input the numeric code inside the square brackets to run the desired action.
- If you remember the code number you can enter it after the command e.g.
aposync 101oraposync 101 -yto skip the confirmation.
- If you remember the code number you can enter it after the command e.g.
- Now relax and let the script do the work for you.
aposync.sh - the main script file that serves as a crossroad for executing the subscripts:
db-up.sh- transfers MongoDB collection from a local to a remote environmentdb-down.sh- transfers MongoDB collection from a remote to local environmentfiles-up.sh- transfers local "uploads" files to a remote environment-d,--dry- only executes a test run and lists files missing in the remote folder-f,--force- deletes remote files that don't exist locally
files-down.sh- transfers remote "uploads" files to a local environment-d,--dry- only executes a test run and lists files missing in the local folder
restore-local.sh- restores local MongoDB collection from a chosen local backup/dump filerestore-remote.sh- restores remote MongoDB collection from a chosen remote backup/dump filelist-local.sh- lists all local MongoDB backup fileslist-remote.sh- lists all remote MongoDB backup filesbackup-local.sh- creates a MongoDB backup file locallybackup-remote.sh- creates a MongoDB backup file remotely
