forked from HPR/hpr_generator
Remove references to local use of MySQL
Preferred option is to use SQLite, as it is simpler to set up
This commit is contained in:
parent
65c2d972e8
commit
50bcdf7c60
@ -81,8 +81,8 @@ or
|
||||
|
||||
`wget --directory-prefix=./ https://www.hackerpublicradio.org/hpr.sql`
|
||||
|
||||
You can process the file using SQLite, or MySQL as you prefer. SQLite is the recommended option for local processing, but instructions are given for both options:
|
||||
## Option 1: Creating an SQLite database file
|
||||
You can process the file using SQLite:
|
||||
## Creating an SQLite database file
|
||||
|
||||
The SQL of the hpr.sql file must be converted from MySQL specific statements to
|
||||
SQLite specific statements. The mysql2sqlite script found in the utils directory
|
||||
@ -102,17 +102,6 @@ From the root of the local hpr_generator repository run:
|
||||
|
||||
`./utils/update-hpr-db.sh`
|
||||
|
||||
## Option 2: Creating a MySQL database file
|
||||
|
||||
The SQL code in the hpr.sql file needs to be loaded into a local database:
|
||||
* Create database hpr_hpr in the MySQL server from HPR dump file.
|
||||
- ``sudo mysql --host=localhost < hpr.sql``
|
||||
* Create a user that will be used by the site-generator.
|
||||
- Suggested username: hpr-generator
|
||||
- ``CREATE USER 'hpr-generator'@'localhost' IDENTIFIED BY '<password>';``
|
||||
* Limit the user's privileges to EXECUTE and SELECT
|
||||
- ``GRANT SELECT ON hpr_hpr.* TO 'hpr-generator'@'localhost';``
|
||||
- ``GRANT EXECUTE ON `hpr_hpr`.* TO 'hpr-generator'@'localhost';``
|
||||
# Configure the site-generator
|
||||
|
||||
In your favorite text editor, open the site.cfg file found in the root of the
|
||||
@ -123,7 +112,7 @@ file are found in the comments within the file.
|
||||
|
||||
Any database supported by the Perl:DBI and Perl::DBD modules can be used with
|
||||
the site-generator program. Currently the hpr_generator project works with
|
||||
a MySQL or SQLite database.
|
||||
an SQLite database.
|
||||
|
||||
Find the [DBI] section of the file. It should look like the following
|
||||
|
||||
@ -134,15 +123,8 @@ Find the [DBI] section of the file. It should look like the following
|
||||
#driver: dbi:SQLite:hpr.db
|
||||
#user: (not used - leave blank)
|
||||
#password: (not used - leave blank)
|
||||
# Configuration settings for MySQL
|
||||
#database: mysql
|
||||
#driver: dbi:mysql:database=hpr_hpr:hostname=localhost
|
||||
#user: hpr-generator (Suggested user with read-only privileges)
|
||||
#password: ********* (Password for user)
|
||||
```
|
||||
|
||||
### SQLite
|
||||
|
||||
Remove the comment character from the start of the database and driver
|
||||
option lines:
|
||||
|
||||
@ -158,26 +140,6 @@ The hpr.db section of the driver option `dbi:SQLite:hpr.db` is the path
|
||||
to the sqlite file. The default assumes the hpr.db file is located in the same
|
||||
directory as the site-generator.
|
||||
|
||||
### MySQL
|
||||
|
||||
Remove the comment character from the start of the database, driver,
|
||||
user, and password option lines:
|
||||
|
||||
```
|
||||
# Configuration settings for MySQL
|
||||
database: mysql
|
||||
driver: dbi:mysql:database=hpr_hpr:hostname=localhost
|
||||
user: hpr-generator
|
||||
password: *********
|
||||
```
|
||||
|
||||
This assumes that the MySQL database service is available at the localhost
|
||||
hostname, that the database name (hpr_hpr) is the database created from
|
||||
the hpr.sql dump file or manually created by you, that the user (hpr-generator)
|
||||
was added by you and has read rights to the hpr_hpr database, and that the
|
||||
password (replace ********* with the actual password) matches the password set
|
||||
for the hpr-generator database user.
|
||||
|
||||
## Configuring the website for viewing locally
|
||||
|
||||
For HTML links to work when viewing the files on your local machine using the
|
||||
|
Loading…
x
Reference in New Issue
Block a user