From 0d539ff4af4bb62d783d1920abb4158655645398 Mon Sep 17 00:00:00 2001 From: akpu1 Date: Wed, 22 Jun 2016 15:23:29 +1000 Subject: Significant Makefile improvements (#21) * Refactored makefile Fixed min-js error; renamed routines inline with make conventions Previously min-js would continually append to the file with `@echo "// @source https://github.com/pomf/pomf/tree/master/static/js" >> ./dist/pomf.min.js`. Fixed so that it overwrites the file whenever it is run now. mkdirs was renamed to installdirs as per makefile conwentions copy was renamed to install for the same reasons Added clean rule Removed install from default target Added DESTDIR,uninstall support Added dist support Replaced static program paths; misc improvements Added missing installdirs target to default target Added npm_dependencies target Properly separated "build" and install targets Modified readme to reflect make install and DESTDIR Modified .travis.yml to reflect make npm_dependencies Reverted to cp for install target, temporarily Ideally this target would use install, but need to work out how to do that properly, For the meantime, cp works. Added missing * to install target Update .travis.yml Fixed bad markdown * Update Makefile * Removed @s cuz ??? --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index df781f5..6e43462 100644 --- a/README.md +++ b/README.md @@ -41,13 +41,17 @@ Node, or NPM. So we'll just assume you already have them all running well. Assuming you already have Node and NPM working, compilation is easy. Use the following shell code: - - git clone https://github.com/pomf/pomf - cd pomf/ - npm install - make - -After this, the pomf site is now compressed and set up inside `dist/`. +```bash +git clone https://github.com/pomf/pomf +cd pomf/ +make +make install +``` +OR +```bash +make install DESTDIR=/desired/path/for/site +``` +After this, the pomf site is now compressed and set up inside `dist/`, or, if specified, `DESTDIR`. ## Configuring -- cgit v1.2.3 From 424eea4f630d25158ec033a004666ecd0107f8b8 Mon Sep 17 00:00:00 2001 From: akpu1 Date: Wed, 22 Jun 2016 15:58:15 +1000 Subject: Added instructions and schema to use or migrate to SQLite (#17) * Added MySQL to SQLite migration instructions; SQLite setup instructions * Renamed schema.sql to mysql_schema.sql * Produced modified schema suitable for SQLite * Added SQLite setup and migration instructions --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 6e43462..ec2101b 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,29 @@ option for nginx webserver is `client_max_body_size`. Example nginx configs can be found in confs/. +## Using SQLite as DB engine + +We need to create the SQLite database before it may be used by pomf. +Fortunately, this is incredibly simple. + +First create a directory for the database, e.g. `mkdir /var/db/pomf`. +Then, create a new SQLite database from the schema, e.g. `sqlite3 /var/db/pomf/pomf.sq3 -init /home/pomf/sqlite_schema.sql`. +Then, finally, ensure the permissions are correct, e.g. +```bash +chown nginx:nginx /var/db/pomf +chmod 0750 /var/db/pomf +chmod 0640 /var/db/pomf/pomf.sq3 +``` + +Finally, edit `php/includes/settings.inc.php` to indicate this is the database engine you would like to use. Make the changes outlined below +```php +define('POMF_DB_CONN', '[stuff]'); ---> define('POMF_DB_CONN', 'sqlite:/var/db/pomf/pomf.sq3');` +define('POMF_DB_USER', '[stuff]'); ---> define('POMF_DB_USER', null); +define('POMF_DB_PASS', '[stuff]'); ---> define('POMF_DB_PASS', null); +``` + +*NOTE: The directory where the SQLite database is stored, must be writable by the web server user* + ### Apache If you are running Apache and want to compress your output when serving files, @@ -79,6 +102,38 @@ add to your `.htaccess` file: Remember to enable `deflate_module` and `filter_module` modules in your Apache configuration file. +### Migrating from MySQL to SQLite + +MySQL is relatively complicated to administer, brings in many unneeded dependencies, and consumes +more resources than SQLite would, and result in worse performance for pomf. Additonally, poorly configured installations have the potential +to pose a security risk. + +Fortunately, it is incredibly simple to migrate your database. This may be done on a live server, and should require +zero downtime. + +_If doing this on a live server, you way wish to work in a subdirectory (or vhost, or equivelant), so that any complications or mistakes do not affect your main site. +If you choose not to do so, know that mistakes in the changes outlined below, will only temporarily impact **uploading**, causing **Server error** to be displayed. None of these steps are destructive, and are easily reverted._ + +Run the following commands as root, to dump your database, and make a SQLite database with the contents. +```bash +mkdir /var/db/pomf +wget -O /tmp/m2s https://github.com/dumblob/mysql2sqlite/raw/master/mysql2sqlite.sh +mysqldump -u OLD_DB_USER -p OLD_DB_PASS pomf | sh /tmp/m2s | sqlite3 /var/db/pomf/sq3 +rm /tmp/m2s +chown -R nginx:nginx /var/db/pomf #replace user as appropriate +chmod 0750 /var/db/pomf && chmod 0640 /var/db/pomf/sq3 +``` +Edit the file `php/includes/settings.inc.php`, in the subdirectory you just made, making the changes outlined below. +```php +define('POMF_DB_CONN', '[stuff]'); ---> define('POMF_DB_CONN', 'sqlite:/var/db/pomf/pomf.sq3');` +define('POMF_DB_USER', '[stuff]'); ---> define('POMF_DB_USER', null); +define('POMF_DB_PASS', '[stuff]'); ---> define('POMF_DB_PASS', null); +``` + +Then, run `make` to rebuild the website pages, and copy the new `settings.inc.php` file into place. + +All done! You may disable or uninstall MySQL if you wish. + ## Getting help The Pomf community gathers on IRC. You can also email the maintainer for help. -- cgit v1.2.3 From 77022be248c5ce3e2a92022271277b046130f1ae Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 26 Jun 2016 01:34:31 -0500 Subject: Reword SQLite migration That was bad --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index ec2101b..8b4a2e6 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,7 @@ configuration file. ### Migrating from MySQL to SQLite -MySQL is relatively complicated to administer, brings in many unneeded dependencies, and consumes -more resources than SQLite would, and result in worse performance for pomf. Additonally, poorly configured installations have the potential -to pose a security risk. - -Fortunately, it is incredibly simple to migrate your database. This may be done on a live server, and should require -zero downtime. +For older versions of Pomf you may want to migrate to SQLite. Fortunately, it is incredibly simple to migrate your database. This may be done on a live server, and should require zero downtime. _If doing this on a live server, you way wish to work in a subdirectory (or vhost, or equivelant), so that any complications or mistakes do not affect your main site. If you choose not to do so, know that mistakes in the changes outlined below, will only temporarily impact **uploading**, causing **Server error** to be displayed. None of these steps are destructive, and are easily reverted._ -- cgit v1.2.3 From 3028e13607d82b9d979f017eaddd0243878e5394 Mon Sep 17 00:00:00 2001 From: Austin Date: Sun, 26 Jun 2016 02:09:38 -0500 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8b4a2e6..0220a53 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Node, or NPM. So we'll just assume you already have them all running well. Assuming you already have Node and NPM working, compilation is easy. Use the following shell code: ```bash -git clone https://github.com/pomf/pomf +git clone --recursive https://github.com/pomf/pomf cd pomf/ make make install -- cgit v1.2.3 From d6406d4d65bee9ba392d6010b2251509421ae837 Mon Sep 17 00:00:00 2001 From: ileyd Date: Mon, 27 Jun 2016 12:05:46 +1000 Subject: Improved MySQL to SQLite migration instructions (#38) The initial paragraph explaining why you may prefer to use SQLite was made more brief, and rephrased to sound more neutral (note that it already was neutral). The clarifying section prior to the actual migration instructions was rewritten to better convey that the changes are non-destructive, and that they do not affect the user's main site until the final command (whose purpose is made clear), after verifying there are no issues. The instructions themselves have been modified to clarify where some commands are run from, their purpose, and also made more brief (the section itself is very slightly longer, but something happened to or I forgot to commit an important paragraph that was initially there). --- README.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 0220a53..2b06d60 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Node, or NPM. So we'll just assume you already have them all running well. Assuming you already have Node and NPM working, compilation is easy. Use the following shell code: ```bash -git clone --recursive https://github.com/pomf/pomf +git clone https://github.com/pomf/pomf cd pomf/ make make install @@ -103,11 +103,17 @@ Remember to enable `deflate_module` and `filter_module` modules in your Apache configuration file. ### Migrating from MySQL to SQLite + , +Compared to SQLite, MySQL is relatively complicated to administer, brings in many unneeded dependencies, and consumes more resources. Additonally, as a network service, poorly configured installations have the potential +to pose a security risk. -For older versions of Pomf you may want to migrate to SQLite. Fortunately, it is incredibly simple to migrate your database. This may be done on a live server, and should require zero downtime. +For these reasons, you may wish to use SQLite rather than MySQL. -_If doing this on a live server, you way wish to work in a subdirectory (or vhost, or equivelant), so that any complications or mistakes do not affect your main site. -If you choose not to do so, know that mistakes in the changes outlined below, will only temporarily impact **uploading**, causing **Server error** to be displayed. None of these steps are destructive, and are easily reverted._ +Fortunately, it is incredibly simple to migrate your database. This may be done on a live server, if you desire, and requires zero downtime. + +The process described below involves running these commands on a live server. Nothing done here affects your main site, until running the very last command, which is done after verifying there are no issues. + +No changes described here are destructive, and are easily reverted. They only have the potential to cause uploading to fail gracefully, and will not affect downloading. Run the following commands as root, to dump your database, and make a SQLite database with the contents. ```bash @@ -118,14 +124,15 @@ rm /tmp/m2s chown -R nginx:nginx /var/db/pomf #replace user as appropriate chmod 0750 /var/db/pomf && chmod 0640 /var/db/pomf/sq3 ``` -Edit the file `php/includes/settings.inc.php`, in the subdirectory you just made, making the changes outlined below. +Edit the file `php/includes/settings.inc.php`, in your **source directory**, making the changes outlined below. Note, changing the second two lines is optional, as they are simply ignored when using SQLite. ```php define('POMF_DB_CONN', '[stuff]'); ---> define('POMF_DB_CONN', 'sqlite:/var/db/pomf/pomf.sq3');` define('POMF_DB_USER', '[stuff]'); ---> define('POMF_DB_USER', null); define('POMF_DB_PASS', '[stuff]'); ---> define('POMF_DB_PASS', null); ``` +Then, run `make DESTDIR=/path/to/main_site/testing_dir` (note the *testing_dir* component) to rebuild the website, and copy it into place, in a new testing subdirectory. -Then, run `make` to rebuild the website pages, and copy the new `settings.inc.php` file into place. +Now, navigate to this subdirectory in your web browser, e.g. https://try.pantsu.cat/testing_dir, and verify that uploading works fine. If so, excellent! You may rerun `make DESTDIR=/path/to/main_site` to update your main site. All done! You may disable or uninstall MySQL if you wish. -- cgit v1.2.3 From 186b9bf0aed3638845544c1dad9f54297cc23413 Mon Sep 17 00:00:00 2001 From: Austin Date: Mon, 27 Jun 2016 16:09:19 -0500 Subject: Fix cloning instructions (again..) caused by commit 7ea276bbdf881905c1e2ad42ea0501de623da223 in PR #38 author being ileyd --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 2b06d60..0b7d9a3 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Node, or NPM. So we'll just assume you already have them all running well. Assuming you already have Node and NPM working, compilation is easy. Use the following shell code: ```bash -git clone https://github.com/pomf/pomf +git clone --recursive https://github.com/pomf/pomf cd pomf/ make make install -- cgit v1.2.3