Skip to content

Commit

Permalink
Add DB setup to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
acabal committed Oct 23, 2024
1 parent b6fbcab commit 82e43cb
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 21 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.ini /etc/p
sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.ini /etc/php/*/fpm/conf.d/
sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.conf /etc/php/*/fpm/pool.d/
sudo systemctl restart "php*-fpm.service"

# Create and populate the SE database.
mariadb < /standardebooks.org/web/config/sql/se.sql
mariadb < /standardebooks.org/web/config/sql/users.sql
mariadb se < /standardebooks.org/web/config/sql/se/*.sql
```

If everything went well you should now be able to open your web browser and visit `https://standardebooks.test`. However, you won’t see any ebooks if you visit `https://standardebooks.test/ebooks`. To install some ebooks, first you have to clone their source from GitHub, then deploy them to your local website using the `./scripts/deploy-ebook-to-www` script:
Expand Down
1 change: 1 addition & 0 deletions config/sql/se.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS `se` DEFAULT CHARACTER SET = 'utf8mb4' DEFAULT COLLATE 'utf8mb4_general_ci'
2 changes: 1 addition & 1 deletion config/sql/se/ArtistAlternateNames.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `ArtistAlternateNames` (
CREATE TABLE IF NOT EXISTS `ArtistAlternateNames` (
`ArtistId` int(10) unsigned NOT NULL,
`Name` varchar(255) NOT NULL,
`UrlName` varchar(255) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Artists.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Artists` (
CREATE TABLE IF NOT EXISTS `Artists` (
`ArtistId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`UrlName` varchar(255) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/ArtworkTags.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `ArtworkTags` (
CREATE TABLE IF NOT EXISTS `ArtworkTags` (
`ArtworkId` int(10) unsigned NOT NULL,
`TagId` int(10) unsigned NOT NULL,
UNIQUE KEY `idxUnique` (`ArtworkId`,`TagId`)
Expand Down
4 changes: 2 additions & 2 deletions config/sql/se/Artworks.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Artworks` (
CREATE TABLE IF NOT EXISTS `Artworks` (
`ArtworkId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ArtistId` int(10) unsigned NOT NULL,
`Name` varchar(255) NOT NULL,
Expand All @@ -19,7 +19,7 @@ CREATE TABLE `Artworks` (
`EbookUrl` varchar(255) NULL,
`MimeType` enum('image/jpeg', 'image/png', 'image/bmp', 'image/tiff') NOT NULL,
`Exception` TEXT NULL DEFAULT NULL,
`Notes` TEXT NULL DEFAULT NULL
`Notes` TEXT NULL DEFAULT NULL,
PRIMARY KEY (`ArtworkId`),
KEY `index1` (`Status`),
KEY `index2` (`UrlName`),
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Benefits.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Benefits` (
CREATE TABLE IF NOT EXISTS `Benefits` (
`UserId` int(10) unsigned NOT NULL,
`CanAccessFeeds` tinyint(1) unsigned NOT NULL DEFAULT 0,
`CanVote` tinyint(1) unsigned NOT NULL DEFAULT 0,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/FeedUserAgents.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `FeedUserAgents` (
CREATE TABLE IF NOT EXISTS `FeedUserAgents` (
`UserAgentId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`UserAgent` text NOT NULL,
`Created` datetime NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Museums.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Museums` (
CREATE TABLE IF NOT EXISTS `Museums` (
`MuseumId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
`Domain` varchar(255) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/NewsletterSubscriptions.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `NewsletterSubscriptions` (
CREATE TABLE IF NOT EXISTS `NewsletterSubscriptions` (
`UserId` int(10) unsigned NOT NULL,
`IsConfirmed` tinyint(1) unsigned NOT NULL DEFAULT 0,
`IsSubscribedToNewsletter` tinyint(1) unsigned NOT NULL DEFAULT 1,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Patrons.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Patrons` (
CREATE TABLE IF NOT EXISTS `Patrons` (
`UserId` int(10) unsigned NOT NULL,
`IsAnonymous` tinyint(1) unsigned NOT NULL DEFAULT 0,
`AlternateName` varchar(80) DEFAULT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Payments.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Payments` (
CREATE TABLE IF NOT EXISTS `Payments` (
`PaymentId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`UserId` int(10) unsigned DEFAULT NULL,
`Created` datetime NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/PendingPayments.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `PendingPayments` (
CREATE TABLE IF NOT EXISTS `PendingPayments` (
`Created` datetime NOT NULL,
`Processor` enum('fractured_atlas') NOT NULL,
`TransactionId` varchar(80) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/PollItems.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `PollItems` (
CREATE TABLE IF NOT EXISTS `PollItems` (
`PollItemId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`PollId` int(10) unsigned NOT NULL,
`Name` varchar(255) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/PollVotes.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `PollVotes` (
CREATE TABLE IF NOT EXISTS `PollVotes` (
`UserId` int(10) unsigned NOT NULL,
`PollItemId` int(10) unsigned NOT NULL,
`Created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Polls.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Polls` (
CREATE TABLE IF NOT EXISTS `Polls` (
`PollId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`Name` varchar(255) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Sessions.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Sessions` (
CREATE TABLE IF NOT EXISTS `Sessions` (
`UserId` int(10) unsigned NOT NULL,
`Created` datetime NOT NULL,
`SessionId` char(36) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Tags.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Tags` (
CREATE TABLE IF NOT EXISTS `Tags` (
`TagId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(255) NOT NULL,
PRIMARY KEY (`TagId`),
Expand Down
2 changes: 1 addition & 1 deletion config/sql/se/Users.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE `Users` (
CREATE TABLE IF NOT EXISTS `Users` (
`UserId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Email` varchar(80) DEFAULT NULL,
`Name` varchar(255) DEFAULT NULL,
Expand Down
6 changes: 3 additions & 3 deletions config/sql/users.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
create user 'se'@'localhost' identified via unix_socket;
create user 'www-data'@'localhost' identified via unix_socket;
create user 'se-vcs-bot'@'localhost' identified via unix_socket;
create user if not exists 'se'@'localhost' identified via unix_socket;
create user if not exists 'www-data'@'localhost' identified via unix_socket;
create user if not exists 'se-vcs-bot'@'localhost' identified via unix_socket;

grant select, insert, update, delete, execute, lock tables on se.* to 'se'@'localhost' identified via unix_socket;
grant select, insert, update, delete, execute on se.* to 'www-data'@'localhost' identified via unix_socket;
Expand Down

0 comments on commit 82e43cb

Please sign in to comment.