diff --git a/README.md b/README.md index a7db28a..f835d51 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,44 @@ > Warning: trying to access before db instance finishes initialization results in failure to initialize the xwiki instance, recommended to wait for about 5 minutes (that is plenty of time) before accessing the app from your browser. +## How to edit configs + + +Method 1: You can mount the volume `xwiki_cfg` in `rw` mode, navigate to the files, and make the edits. + +Method2: You can also use `abra app cmd`, here is an example: + +``` +$ abra app cmd -l edit_config +Which config file do you wish to edit? + +/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.cfg +/usr/local/tomcat/webapps/ROOT/WEB-INF/xwiki.properties +/usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml +/usr/local/tomcat/webapps/ROOT/WEB-INF/classes/logback.xml +/usr/local/tomcat/webapps/ROOT/WEB-INF/web.xml +Enter file name (without the path) +web.xml +Enter file path (including the file name) +/usr/local/tomcat/webapps/ROOT/WEB-INF/web.xml +Pulling web.xml from the app + +web.xml is temporarily available + +edit the file, save and exit, then press enter to continue + + +Moving the edited file to the app + +deleting the local copy + +Done! +``` + +TODO: on macos, the associative arrays won't work (declare -A throws an error) + +You can use a brew version of bash to make it work, but abra currently [defaults to /bin/bash](https://git.coopcloud.tech/coop-cloud/abra/src/branch/main/cli/app/cmd.go#L98) + +To simplify the interactive script above, we would first need abra to allow us to choose the shell path. + For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech). diff --git a/abra.sh b/abra.sh new file mode 100644 index 0000000..943094a --- /dev/null +++ b/abra.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +CONTEXT_PATH=ROOT +WEBINF=/usr/local/tomcat/webapps/$CONTEXT_PATH/WEB-INF + +# Config files +xwiki_cfg=$WEBINF/xwiki.cfg +xwiki_properties=$WEBINF/xwiki.properties +hibernate_cfg_xml=$WEBINF/hibernate.cfg.xml +logback_xml=$WEBINF/classes/logback.xml +web_xml=$WEBINF/web.xml +ALL_FILES=($xwiki_cfg $xwiki_properties $hibernate_cfg_xml $logback_xml $web_xml) + +edit_config() { + select_file + echo -e "Pulling $FILE_NAME from the app\n" + abra app cp $APP_NAME app:$FILE_PATH ./ + echo -e "$FILE_NAME is temporarily available\n" + echo -e "edit the file, save and exit, then press enter to continue\n" + read