ok, i've figured out how to keep my old way of initializing and resetting
things in my CMS
seductiveapps.com :
i have a PHP script
https://gitlab.com/seductiveapps/seductiveapps/blob/master/seductiveapps/siteData/reInit.php
that via
https://gitlab.com/seductiveapps/seductiveapps/blob/master/boot_stage_001.php
->
https://gitlab.com/seductiveapps/seductiveapps/blob/master/seductiveapps/functions.php
:: couchdb_address() and the credentials (loaded via
https://gitlab.com/seductiveapps/seductiveapps/blob/master/seductiveapps/globals.php
:: global $saCouchDB) in
https://gitlab.com/seductiveapps/seductiveapps/blob/master/config.localhost.couchdb.json
or
https://gitlab.com/seductiveapps/seductiveapps/blob/master/config.seductiveapps.com.couchdb.json
(whichever is the server domain name for the current server),
correctly initializes my couchdb, including the removal of old databases.
using a .php site-wide re-init script allows me to start afresh whenever i
need to, from anywhere,
and i will be able to implement .php site backup and site restore scripts
as well, using probably something like adrienverge's coucharchive, and
listing a backup as a folder path instead of a zip file path to save time
during backup and restore operations.
i have chosen to use php-couchdb (
https://github.com/ibm-watson-data-lab/php-couchdb, which is fairly easy to
install on ubuntu at least, if you follow the instructions) and to augment
and patch it where necessary.
it's undergoing semi-active development, and even more importantly : it's
MIT / Apache licensed, so can be used in commercial / closed-source /
originally-licensed software without violating licensing terms.
php-on-couchdb is GPL3, and that's an infectious license. you have to
publish your own stuff as GPL3 as well if you use any GPL3 software. don't
say i didn't warn you ;)
as far as i know, only MIT / LGPL / Apache licenses are safe for commercial
usage.
together with using git for the source-codes (
gitlab.com instead of
github.com because you never know if github's new owner Microsoft will
quietly add licensing terms to github that effectively nullify any license
you put on software that you publish there),
i will have a very robust set of easy scripts to manage my CMS
seductiveapps with, all php, except for one shell script (
https://gitlab.com/seductiveapps/seductiveapps/blob/master/updateLiveServer.sh),
which fetches from gitlab whatever i put on there from my development
machine.
i thank you all for your earlier tips in this thread, but i believe this
solution i'm at now to be the easiest for me to manage.
there's one more thing i'd like to mention : for the javascript side, i use
pouchdb (
https://pouchdb.com/guides/setup-pouchdb.html), and there's one
note-worthy thingy i'd like to mention here :
walking through an array of items that might need changing, and how
pouchdb's asynchronous nature can mess up a simple for loop.
the cure for that is at
https://gitlab.com/seductiveapps/seductiveapps/blob/master/seductiveapps/businessLogic/saTree/1.0.0/saTree-1.0.0.source.js
, in the handler for .on('activate_node.jstree', function (e, data)
i mention all of this of course to save other people a significant search
for a realistic couchdb PHP + JS stack.
the only thing i haven't figured out yet is how to set security settings on
the couchdb from PHP. i don't know if i can keep nginx with it's
reverse-proxy features out of the loop, i'd like to of course, until i need
nginx for it's load balancing features.
but i'll dig into that later tonight or tomorrow or sometime in the next
few weeks.