diff --git a/README.md b/README.md index c10ac46..ed7a2c9 100755 --- a/README.md +++ b/README.md @@ -2,28 +2,35 @@ Backup Commander is a simple web-based backup platform powered by PHP offering: -- Easy installation (used to be anyway) +- Complex and comvoluted installation - Intuitive UI - Incremental file backup - Backup scheduling ### Installation -------- -Backup Commander requires a running webserver such as apache using php +Backup Commander requires a running webserver such as apache using php. The install script no longer works due to considerable upgrades. -1. Grab the latest version from the repository: `git clone http://pearcey.net:8080/johnpearcey/backup-commander` -2. Navigate to the install folder `cd install` -3. Run the install bash script. Note that you must specify the web user which apache is serving as, e.g. www-root or http etc.. -The install.sh script will automatically pull the latest version so it can be run at any time to update the system. +* Better to login as the webserver user. Use su -s /bin/bash to specify a shell if necessary. This will ensure that user permissions + do not require configuring. +* Grab the latest version from the repository: `git clone http://pearcey.net:8080/johnpearcey/backup-commander` +* Copy the blank database cp install/db/data.db ../../html/data/data.db +* Create install.conf.php based on the sample and set the paths correctly +* Run the database patcher: cd install; php apply-patches.php +* Setup the backup service by copying cp html/svc/bu_cmdr.service /usr/lib/systemd/system/ +* Edit the bu_cmdr.service so that the directories point to the correct locations in your docroot +* Install the service: systemctl daemon-reload +* Start the service: systemctl start bu_cmdr.service +* Check that the service has no errors: journalctl -fu bu_cmdr +* Install composer if not already present +* run composer install (and/or update as required) +* sign up using the login page by clicking on the register link +* After registering, you may prohibit any further registration attempts by non-logged in users by editing the bu-command-nav.json file, + place the entry "secure":1 under the "Naviage"."/register" section. This will ensure that only a logged in user can signup another + email address, a crude form of an invitation. -The first time install.sh is run, it will require the presence of conf.php. You will need to fill this in with specific information -relative to your setup. An template file is supplied as conf-sample.php. - -The last thing which needs to be done is to edit the sudoers file using visudo. The following line should be added: -> www-data ALL=(ALL) NOPASSWD: /usr/bin/php /var/www/html/bin/run-bu-by-id.php * - -This line shoul be towards the end of the file, e.g. AFTER the %sudo line if you have one. +There is some commandline control of the backup service which can be performed by running various scripts in the html/bin directory. >
 Test by switching user to www-data:
@@ -33,13 +40,23 @@
 	where 19 is the backup id and 0/1 is not-test/test
 
-Comment out /inc/secure.php in post_handler.php if the login is not required - ### Project directory structure +
 backup-commander
-└─html		All web code. You can create a symlink to this directory for your web-server
+├─logs Runtime log files
+└─src You can create a symlink to this directory for your web-server. This is written in
+			the new style using composer.
+	├─bu-command-local-conf.json	local conf including smtp server details
+	├─bu-command-nav.json  Site navigation file - overriding Amara defaults
+	├─bu-command-pages.json Site page templates file - overriding Amara defaults  
+	├─css All css files - new location
+	├─img	All image files - new location
+	├─templates All template referenced by the pages-file, overriding Amara defaults
+	└─ html-old	This is a link to the legacy code used where new code has not yet been written
+├─vendor	Composer libraries, including Amara.
+└─html		1st version web code. This is being rewritten and placed in src using Amara.
   ├─ bin	Binary scripts runnable via bash. This directory is NOT served
   ├─ css	All CSS files
   ├─ img	All image files
@@ -49,5 +66,6 @@
   ├─ shd	Common files shared throughout the project
   ├─ svc	Files dedicated for use by the service only
   └─ lib	Library files from external projects
-└─install	Install and update scripts
+└─install	Mostly deprecated, will need to be fixed.
+
 
diff --git a/composer.lock b/composer.lock index d3b7b0b..0998495 100644 --- a/composer.lock +++ b/composer.lock @@ -228,11 +228,11 @@ }, { "name": "johnpearcey/amara", - "version": "v0.9.10", + "version": "v0.9.11", "source": { "type": "git", "url": "http://johnpearcey:325bfbed42068584ee2d850e1934c79677e0d296@pearcey.net:8080/johnpearcey/Amara.git", - "reference": "11d38eb93ddb9930583886dbc19bbf9a00f2b9c0" + "reference": "f0dccdf4236edf0656b841d70bfbdddc36ce622c" }, "require": { "delight-im/auth": "^8.3", @@ -258,7 +258,7 @@ } ], "description": "Home grown web navigation framework complete with login", - "time": "2025-01-21T11:51:44+00:00" + "time": "2025-01-24T21:00:30+00:00" }, { "name": "katzgrau/klogger", diff --git a/html/index.php b/html/index.php index e2fbe0c..c80a649 100755 --- a/html/index.php +++ b/html/index.php @@ -1,10 +1,12 @@ =4 ){ - $strui_login = "Logout"; - }else{ - $strui_login = "Login"; + $strui_login = "Logout"; + //}else{ + //$strui_login = "Login"; } + ?> diff --git a/html/logout.php b/html/logout.php new file mode 120000 index 0000000..a23246f --- /dev/null +++ b/html/logout.php @@ -0,0 +1 @@ +../src/logout.php \ No newline at end of file diff --git a/src/bu-command-nav.json b/src/bu-command-nav.json index deccd9b..4ff4d54 100644 --- a/src/bu-command-nav.json +++ b/src/bu-command-nav.json @@ -87,6 +87,22 @@ "class-handler": "Johnpearcey\\Amara\\Router\\RqHandlerCls_mainpage" }, + "/login/auth": { + "class-handler": "Johnpearcey\\Amara\\Router\\RqHandlerCls_login", + "success":"/html-old/index.php", + "class_props":{ + "email-verify":"/login/tok", + "submit_auth":"/login/auth" + } + }, + + "/register": { + "class-handler": "Johnpearcey\\Amara\\Router\\RqHandlerCls_register", + "secure":1, + "class_props":{ + "submit_reg":"/register/auth" + } + }, "/mainpage": { "secure":1, diff --git a/src/html-old b/src/html-old new file mode 120000 index 0000000..298be23 --- /dev/null +++ b/src/html-old @@ -0,0 +1 @@ +../html \ No newline at end of file diff --git a/src/index.php b/src/index.php index a610a8d..2069f18 100755 --- a/src/index.php +++ b/src/index.php @@ -16,6 +16,8 @@ use \Johnpearcey\Amara\AmaraApp; use \Johnpearcey\Amara\JPLogger; + use \Johnpearcey\Amara\Router\UserState; + JPLogger::init( dirname(__DIR__).'/logs', Psr\Log\LogLevel::DEBUG ); JPLogger::get()->info("*** Request start ***"); @@ -44,4 +46,12 @@ // Start Amara application $app->run( ); + //for the old stuff to be loggedin, we need to set the session user + $auth = UserState::get()->getAuth(); + if( $auth->isLoggedIn()){ + $_SESSION['username'] = $auth->getEmail(); + }else{ + unset($_SESSION['username']); + } + ?> diff --git a/src/logout.php b/src/logout.php new file mode 100644 index 0000000..0773ec8 --- /dev/null +++ b/src/logout.php @@ -0,0 +1,18 @@ +logout(); +} + +header("Location: /login"); + +?> \ No newline at end of file diff --git a/src/templates/body_o.tp b/src/templates/body_o.tp index 7f851ce..6e83c91 100644 --- a/src/templates/body_o.tp +++ b/src/templates/body_o.tp @@ -4,9 +4,7 @@ $strui_login = ''; if ($auth->isLoggedIn()) { - $strui_login = "Logout"; - }else{ - $strui_login = "Login"; + $strui_login = "Logout"; } ?>