summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorEliot Whalan <ewhal@pantsu.cat>2016-06-24 12:08:15 +0200
committerEliot Whalan <ewhal@pantsu.cat>2016-06-24 12:08:15 +0200
commitc28e5cb54469d514c08b7a44e6abceb4045e7041 (patch)
treed4bb88a341d8d3e77504afcd3ef10b3c22b9ac90 /README.md
parentfe69cdbb29939f99817643f94eb7396c8cfe5285 (diff)
parent424eea4f630d25158ec033a004666ecd0107f8b8 (diff)
Merge branch 'master' of github.com:pomf/pomf
Diffstat (limited to 'README.md')
-rw-r--r--README.md55
1 files changed, 55 insertions, 0 deletions
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.