maphew

Bookstack on Nearlyfreespeech.net

September 8, 2022

I just tried installing BookStack on NearlyFreeSpeech.net and it worked. The procedure is same as the Installation Manual in the documentation. With the exception of needing to use .htaccess to point document root to BookStack public folder instead of using Apache VirtualHost. So I think you can add it to the documentation. It would be great if there were more hosting options.

From <https://bytemeta.vip/index.php/repo/BookStackApp/website/issues/116>

huh. Interesting that the bookstack app site is Hugo static html.


Running notes on deploying a Laravel 5.4+ site to nearlyfreespeech.net

From <https://github.com/bhirons/deploy-laravel-nfs>

The /home/public folder is the web root, and the /home/protected folder is where we install the Larevel app. On nearlyfreespeech, the /home/protected folder is meant for scripts or tools that support web applications and sites, but are not meant to be openly available to browsing.

Laravel has its own public folder inside its own folder, and thus the difficulty of installing Laravel on your average shared host. The web server will expect to serve files from /home/public, but Laravel desires to serve the start page from /home/public/laravelfolder/public, so following the established approach, we will put the Laravel folder in /home/protected/laravelfolder, and utilize a symlink.

From <https://github.com/bhirons/deploy-laravel-nfs>

Installing laravel app
NFS will have everything setup for you on server side like composer, node etc…

While in the laravel folder location in /home/protected, run the following commands to fix permission issues: 

From <https://members.nearlyfreespeech.net/wiki/Applications/Laravel>

 

create a symlink between the public folder in the /home/protected/laravelproject/public and /home/public. And then copy the relevant files into place once the link is established. We back things up just n case.

$ cd /home/protected/laravelproject
$ mv public public_bak
$ ln -s /home/public public
$ cp -a public_bak/* public/
$ cp public_bak/.htaccess public/

From <https://github.com/bhirons/deploy-laravel-nfs>

Now the paths in Laravel's index.php need to be updated. 

From <https://github.com/bhirons/deploy-laravel-nfs>

Change this line in the Register The Autoloader section

require __DIR__.’/../bootstrap/autoload.php’;

to use the new paths

require __DIR__.'/../protected/laravelproject/bootstrap/autoload.php';

And make a similar change in the Turn on the lights section.

$app = require_once __DIR__.’/../bootstrap/app.php’;

becomes

$app = require_once __DIR__.'/../protected/laravelproject/bootstrap/app.php';

From <https://github.com/bhirons/deploy-laravel-nfs>

 

DRAFT#

cd ~/private/src
git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch

From <https://www.bookstackapp.com/docs/admin/installation/>

 

How to Access MySQL

 

Server / DSN / Hostname

bookstack.db (never use "localhost")

Default Admin Username

maphew (never use "root")

From <https://members.nearlyfreespeech.net/maphew/mysql/bookstack>

 

Remember that MySQL databases and MySQL processes are not the same thing. When you first create your MySQL process, there won't be any databases in it.

From <https://members.nearlyfreespeech.net/faq?keywords=mysql&submit=Search+for+Keywords#firstMatch>

We strongly recommend that you use your MySQL administrator username and password only for the purpose of creating other MySQL users. It is much too powerful to be used directly from your website or plugged into any web pages or config files! To create a new user with only the necessary privileges, see: this entry.

From <https://members.nearlyfreespeech.net/faq?keywords=mysql&submit=Search+for+Keywords#firstMatch>

MySQL Hostname (DSN): maphew.db
MySQL Admin Username: maphew
MySQL Admin Password: aHH4:m#T&9N7q

From <https://mail.google.com/mail/u/0/#inbox/FMfcgzGxRxCQMggpDmZtCXNrwCpPVVjx>

 

Go to NFSN mysql page >> login to phpmyadmin >> use temp password

>> user accounts >> click on {name} user >>  [change password]

mysql process admin password

%G^exampleC@b2

new user

bstack

pass

secret-example%smilies

 

checked yes to :

Create database with same name and grant all privileges. 

Grant all privileges on wildcard name (username\_%).

From <https://phpmyadmin.nearlyfreespeech.net/index.php?route=/server/privileges&adduser=1>

 

Ensure the storagebootstrap/cachepublic/uploads folders are writable by the web server (More information here).

From <https://www.bookstackapp.com/docs/admin/installation/>

chgrp -R web storage 
chgrp -R web bootstrap/cache 
chmod -R 775 storage 
chmod -R 775 bootstrap/cache 

From <https://members.nearlyfreespeech.net/wiki/Applications/Laravel>

cd /home/protected/repos/bookstack
php artisan migrate
rsync -av public/ /home/public/b
chgrp -R web storage bootstrap/cache/ public/uploads/
chmod -R 775 storage/ bootstrap/cache/

note: every time you do an update. You will need to copy over the public content again, excluding index.php

From <https://members.nearlyfreespeech.net/wiki/Applications/Laravel>

index.php: search and replace:

__DIR__

/home/protected/repos/bookstack/

https://www.bookstackapp.com/docs/admin/subdirectory-setup/

 

# Set the bookstack folders and files to be owned by the user barry and have the group www-data
sudo chown -R barry:www-data /var/www/bookstack

# Set all bookstack files and folders to be readable, writeable & executable by the user (barry) and
# readable & executable by the group and everyone else
sudo chmod -R 755/var/www/bookstack

# For the listed directories, grant the group (www-data) write-access
sudo chmod -R 775/var/www/bookstack/storage /var/www/bookstack/bootstrap/cache /var/www/bookstack/public/uploads

# Limit the .env file to only be readable by the user and group, and only writable by the user.
sudo chmod 640/var/www/bookstack/.env

From <https://www.bookstackapp.com/docs/admin/filesystem-permissions/>

 

Guides used#