From 2f5c8e303603ac0be6858e381e5d73a3d7be18f2 Mon Sep 17 00:00:00 2001 From: Brian Porter Date: Sun, 24 Oct 2021 16:39:57 -0500 Subject: [PATCH 1/7] Overhaul Vagrantfile and bootstrap.sh provisioner. --- .gitignore | 6 +- .vagrant/bootstrap.sh.example | 56 --------- README.md | 34 ++++- Vagrantfile | 75 +++++++++-- cgi-bin/.gitignore | 217 -------------------------------- cgi-bin/db_end.php | 3 +- cgi-bin/db_start.php.example | 9 +- provision/bootstrap.sh | 230 ++++++++++++++++++++++++++++++++++ provision/schema.sql | 1 + 9 files changed, 334 insertions(+), 297 deletions(-) delete mode 100644 .vagrant/bootstrap.sh.example delete mode 100644 cgi-bin/.gitignore create mode 100644 provision/bootstrap.sh create mode 100644 provision/schema.sql diff --git a/.gitignore b/.gitignore index db66051..8e31a4c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ tiles/ tiles/**/* google*.html *.sql -.vagrant/bootstrap.sh -.vagrant/machines/ +cgi-bin/db_start.php +.vagrant/ .well-known/brave-payment-verification.txt 9A4F12FD1854F031824A5EE0E710E4F0.txt @@ -231,4 +231,4 @@ pip-log.txt #Mr Developer .mr.developer.cfg -*.code-workspace \ No newline at end of file +*.code-workspace diff --git a/.vagrant/bootstrap.sh.example b/.vagrant/bootstrap.sh.example deleted file mode 100644 index 35538b4..0000000 --- a/.vagrant/bootstrap.sh.example +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -echo "Provisioning virtual machine..." -export DEBIAN_FRONTEND=noninteractive - -echo "Updating apt" -apt-get update > /dev/null - -echo "Installing vim" -apt-get install -y vim > /dev/null - -echo "Installing Apache and linking /vagrant to /var/www" -apt-get install -y apache2 > /dev/null -if ! [ -L /var/www ]; then - rm -rf /var/www - ln -fs /vagrant /var/www -fi - -echo "Installing PHP" -apt-get install -y php7.2 php7.2-dev libapache2-mod-php7.2 libsodium23 php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline > /dev/null - -echo "Installing PHP extensions" -apt-get install -y curl php-curl php7.2-gd php-gd mcrypt php-mysql php7.2-mysql > /dev/null -sed -i "s|;extension=pdo_mysql|extension=pdo_mysql|g" /etc/php/7.2/apache2/php.ini - -echo "Making PHP and Apache work together" -sudo a2enmod php7.2 # > /dev/null -service apache2 stop # > /dev/null -echo "listen 4069" | sudo tee --append /etc/apache2/httpd.conf -echo "ServerName localhost" | sudo tee --append /etc/apache2/httpd.conf -sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load -sudo rm /etc/apache2/sites-enabled/000-default.conf -sudo cp /vagrant/.vagrant/default.conf /etc/apache2/sites-enabled/000-default.conf -service apache2 restart # > /dev/null - -echo "Preparing MySQL" -apt-get install debconf-utils -y > /dev/null -debconf-set-selections <<< "mysql-server mysql-server/root_password password 1234" -debconf-set-selections <<< "mysql-server mysql-server/root_password_again password 1234" - -echo "Installing MySQL" -apt-get install mysql-server -y > /dev/null - -echo "Setup database" -mysql -uroot -p1234 -e "DROP DATABASE IF EXISTS ---your-db-name-here---"; -mysql -uroot -p1234 -e "CREATE DATABASE ---your-db-name-here---;" - -echo "Make MySQL external accessible" -mysql -uroot -p1234 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1234';" -mysql -uroot -p1234 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '1234';" -mysql -uroot -p1234 -e "GRANT ALL PRIVILEGES ON *.* TO 'cartographer'@'localhost' IDENTIFIED BY '1234';" - -echo "Import bootstrap SQL" -mysql -uroot -p1234 ---your-db-name-here--- < /vagrant/---your-db-name-here---.sql - -sudo service mysql restart diff --git a/README.md b/README.md index f868068..11464cc 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,32 @@ -Dave's Mapper -============= +# Dave's Mapper + This is the code behind [Dave's Mapper](https://davesmapper.com). It's based on the Morph Mapper by Rob Lang, but vastly larger in scope and ambition. -License -------- + +## Development + +This project includes a Vagrantfile to bundle all necessary dependencies. Locally you will need: + +* git v2.0+ +* [Vagrant](https://www.vagrantup.com/downloads) + * [Virtualbox](https://www.virtualbox.org/wiki/Downloads) + +The included `provision/boostrap.sh` script defines all other system-level dependencies including PHP, Apache and MySQL. + +### Setup + +1. Clone the repo. +2. Run `vagrant up` to download, provision and launch the development box. + * This will take some time during the first execution as the base VM image needs to be downloaded from the internet. +3. This local folder is mapped into the VM's `/app` folder. Changes to files in the project will be updated inside the VM nearly instantaneously. +4. Visit http://localhost:4069 +5. When you are done, run `vagrant down` to halt the configured VM. (Subsequent `vagrant up` commands will boot this already-provisioned VM.) + +Database credentials will be automatically configured in `cgi-bin/db_start.php` to work with Vagrant. This file is gitignore'd to prevent it from being committed back to the repo with sensitive credentials. + +## License + Dave's Mapper Copyright © 2010-2018 David Millar @@ -22,7 +44,7 @@ License You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. -Contact -------- +## Contact + I can be reached at dave@davegoesthedistance.com or dave@davesmapper.com diff --git a/Vagrantfile b/Vagrantfile index 100519d..2a47dd4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,13 +1,70 @@ -project_name = "mapper" - -Vagrant.configure("2") do |config| - config.vm.box = "hashicorp/bionic64" - config.vm.box_version = "1.0.282" - config.vm.synced_folder ".", "/vagrant" - config.vm.provision :shell, path: ".vagrant/bootstrap.sh" - config.vm.network :forwarded_port, host: 4069, guest: 80 - config.vm.provider "virtualbox" do |v| +conf = { + PROJECT_NAME: 'daves-mapper', + PROJECT_ROOT: '/var/www/daves-mapper', + PROJECT_PORT: 4069, +} + +Vagrant.require_version '>= 2.0.0' + +Vagrant.configure('2') do |config| + config.vm.box = 'bento/ubuntu-20.04' + + config.vm.network :forwarded_port, + host: conf[:PROJECT_PORT], + guest: 80 + config.vm.network :forwarded_port, + host: 3307, + guest: 3306, + auto_correct: true + + config.vm.synced_folder '.', conf[:PROJECT_ROOT] + + config.vm.provider 'virtualbox' do |v| v.name = "Dave's Mapper Vagrant" v.gui = false end + + config.vm.provision :shell, + name: 'bootstrap', + path: 'provision/bootstrap.sh', + args: [ + conf[:PROJECT_ROOT], + "#{conf[:PROJECT_NAME]}.test", + 'vagrant' + ] + + config.vm.provision :shell, + name: 'vagrant specific', + privileged: false, + inline: <<~VAGRANTONLYSCRIPT + cd #{conf[:PROJECT_ROOT]} + + echo '## Creating a limited vagrant-only DB user.' + cat <> ~/.profile + fi + + VAGRANTONLYSCRIPT + + # TODO: Define a safety trigger to export MySQL data before destroying the VM. + + config.vm.post_up_message = "VM is up! Visit http://localhost:#{conf[:PROJECT_PORT]}" end diff --git a/cgi-bin/.gitignore b/cgi-bin/.gitignore deleted file mode 100644 index 49f0df5..0000000 --- a/cgi-bin/.gitignore +++ /dev/null @@ -1,217 +0,0 @@ -db_start.php - -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results - -[Dd]ebug/ -[Rr]elease/ -x64/ -build/ -[Bb]in/ -[Oo]bj/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.log -*.scc - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf -*.cachefile - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.Publish.xml -*.pubxml - -# NuGet Packages Directory -## TODO: If you have NuGet Package Restore enabled, uncomment the next line -#packages/ - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -sql/ -*.Cache -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.[Pp]ublish.xml -*.pfx -*.publishsettings - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -App_Data/*.mdf -App_Data/*.ldf - -############# -## Windows detritus -############# - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac crap -.DS_Store - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist/ -build/ -eggs/ -parts/ -var/ -sdist/ -develop-eggs/ -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg diff --git a/cgi-bin/db_end.php b/cgi-bin/db_end.php index f76d4fd..5b3017f 100644 --- a/cgi-bin/db_end.php +++ b/cgi-bin/db_end.php @@ -1 +1,2 @@ - + +$user = 'vagrant'; +$password = 'vagrant'; +$database = 'daves_mapper'; +$pdo = new PDO("mysql:host=localhost;dbname=$database", $user, $password); diff --git a/provision/bootstrap.sh b/provision/bootstrap.sh new file mode 100644 index 0000000..c0b3397 --- /dev/null +++ b/provision/bootstrap.sh @@ -0,0 +1,230 @@ +#!/usr/bin/env bash +# +# Provisioning script. Intended to configure an Ubuntu 20 server with all +# necessary system-level dependencies. This script is written to be used +# in both development (Vagrant) and potentially in production against a +# standard Ubuntu cloud server or VPS. +# +# This script is also written to be idempotent (safe to re-run) to make for +# easier testing/tweaking. +# +# This script must be run as root. To use this script on a new +# production server: +# +# 1. SCP or clone this repo to `/var/www/daves_mapper` on the server. +# 2. SSH into the server: `ssh ubuntu@$YOUR_SERVER` +# 3. Move to the project dir: `cd /var/www/daves_mapper` +# 4. Switch to root: `sudo su -` +# 5. Run `provision/bootstrap.sh "$PWD" 'davesmapper.com' $USER` + + +# Config vars. + +export MYSQL_PASS=$(date +%s|sha256sum|base64|head -c 32) +export MYSQL_DATABASE_NAME=daves_mapper +export PROJECT_NAME=daves-mapper +export PROJECT_ROOT="${1:-/var/www/$PROJECT_NAME}" +export PROJECT_DOMAIN="${2:-daves-mapper.test}" +export PROJECT_USER="${3:-vagrant}" +export PROJECT_GROUP="${4:-www-data}" + +PHP_VERSION='7.4' +PHP_REQ_EXT=( 'cli' 'curl' 'fpm' 'gd' 'json' 'mysql' 'opcache' 'readline' 'xml' 'zip' ) + + +# Users. +# Adding the login user to the web server's group makes editing files easier. +echo '## Setting up user groups for convenience.' + +if ! id -g ${PROJECT_GROUP} &>/dev/null; then + groupadd ${PROJECT_GROUP} +fi +if ! id -u ${PROJECT_GROUP} &>/dev/null; then + useradd ${PROJECT_USER} -g ${PROJECT_GROUP} +fi +# Login user can manage files owned by Apache. +usermod -a -G ${PROJECT_USER} ${PROJECT_GROUP} +# Apache can manage files owned by user. +usermod -a -G ${PROJECT_USER} ${PROJECT_GROUP} + + +# Locales +echo '## Configuring locale and apt.' + +export LANGUAGE=en_US.UTF-8 +export TERM=xterm +export DEBIAN_FRONTEND=noninteractive + +locale-gen en_US.UTF-8 +dpkg --configure -a + + +# Low-level system dependencies. +echo '## Installing and configuring system dependencies.' + +apt-get -qqq update +apt-get -yqq install \ + software-properties-common \ + build-essential \ + debconf-utils \ + zip \ + unzip \ + git \ + libsodium23 \ + mcrypt + + +# PHP and Apache. +echo '## Installing and configuring Apache and PHP.' + +add-apt-repository -y ppa:ondrej/php +add-apt-repository -y ppa:ondrej/apache2 +apt-get -qqq update + +EXT_LIST="" +for EXT in "${PHP_REQ_EXT[@]}"; do + EXT_LIST+=" php${PHP_VERSION}-${EXT}" +done +apt-get -yqq install \ + apache2 \ + libapache2-mod-fcgid \ + php$PHP_VERSION \ + $EXT_LIST + +cat < /etc/php/7.4/fpm/conf.d/99-logging.ini +error_log /var/log/php_error.log + +PHPINI + +if [ -f "/etc/php/$PHP_VERSION/fpm/pool.d/www.conf" ]; then + rm /etc/php/$PHP_VERSION/fpm/pool.d/www.conf +fi +cat < /etc/php/$PHP_VERSION/fpm/pool.d/$PROJECT_NAME.conf +[$PROJECT_NAME] + +user = $PROJECT_USER +group = $PROJECT_GROUP + +listen = /var/run/php/php$PHP_VERSION-fpm.sock; + +listen.owner = www-data +listen.group = www-data +listen.mode = 0660 + +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +pm.process_idle_timeout = 10s +pm.max_requests = 500 + +chdir = / +FPMCONF + +systemctl enable php$PHP_VERSION-fpm +systemctl restart php$PHP_VERSION-fpm + +a2enconf php7.4-fpm +a2enmod \ + actions \ + alias \ + fcgid \ + proxy_fcgi \ + rewrite \ + setenvif + +mkdir -p /var/log/apache2/${PROJECT_DOMAIN} +touch /var/log/apache2/${PROJECT_DOMAIN}/{access,error}.log +chown root:www-data /var/log/apache2/${PROJECT_DOMAIN}/{access,error}.log +chmod ug=rw,o=r /var/log/apache2/${PROJECT_DOMAIN}/{access,error}.log +if [ -f '/etc/apache2/sites-enabled/000-default.conf' ]; then + rm /etc/apache2/sites-enabled/000-default.conf +fi +cat < "/etc/apache2/sites-available/${PROJECT_NAME}.conf" + + ServerAdmin admin@${PROJECT_DOMAIN} + ServerName ${PROJECT_DOMAIN} + DocumentRoot "${PROJECT_ROOT}" + DirectoryIndex index.php + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + Allow from all + + + + # For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server + SetHandler "proxy:unix:/var/run/php/php$PHP_VERSION-fpm.sock|fcgi://localhost" + + + ErrorLog \${APACHE_LOG_DIR}/${PROJECT_DOMAIN}/error.log + CustomLog \${APACHE_LOG_DIR}/${PROJECT_DOMAIN}/access.log combined + + +APACHECONF + +a2ensite $PROJECT_NAME + +apachectl configtest +systemctl enable apache2 +systemctl restart apache2 + +# Install composer. + +curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + + +# MySQL. +echo '## Installing and configuring MySQL server.' + +if [ ! -f '/home/$PROJECT_USER/.my.cnf' ]; then + echo "mysql-server mysql-server/root_password password $MYSQL_PASS" | debconf-set-selections + echo "mysql-server mysql-server/root_password_again password $MYSQL_PASS" | debconf-set-selections +fi + +apt-get -yqq install mysql-server +mysqld --initialize +systemctl enable mysql +systemctl restart mysql + +# Save local credentials for streamlined command-line usage. +# Example: `ssh ubuntu@your-server.com mysql` will work by reading +# the root credentials directly from the ~/.my.cnf file on the server. +# This SSH-styled approach also means you don't have to open 3306 to +# the world, nor do you need to allow external TCP connections to the +# MySQL service directly. +if [ ! -f '/home/$PROJECT_USER/.my.cnf' ]; then + # This heredoc MUST be indented with TABS. + cat <<-MYCNF > /home/$PROJECT_USER/.my.cnf + [client] + user=root + password="$MYSQL_PASS" + + [mysql] + user=root + password="$MYSQL_PASS" + + [mysqldump] + user=root + password="$MYSQL_PASS" + + [mysqldiff] + user=root + password="$MYSQL_PASS" + + [mysqladmin] + user=root + password="$MYSQL_PASS" + MYCNF +fi + +if [ ! -f '/root/.my.cnf' ]; then + ln -s /home/$PROJECT_USER/.my.cnf /root/.my.cnf +fi +chown $PROJECT_USER:$PROJECT_GROUP /home/$PROJECT_USER/.my.cnf +chmod u=r,go= /home/$PROJECT_USER/.my.cnf + +mysql -e "CREATE DATABASE IF NOT EXISTS $MYSQL_DATABASE_NAME;" diff --git a/provision/schema.sql b/provision/schema.sql new file mode 100644 index 0000000..7ed610d --- /dev/null +++ b/provision/schema.sql @@ -0,0 +1 @@ +-- TODO: Commit schema-only table structure to this file for first-run setup. From 40e56039c55551dfb2b238fefcd0c4cabd163c39 Mon Sep 17 00:00:00 2001 From: Brian Porter Date: Sun, 24 Oct 2021 18:35:14 -0500 Subject: [PATCH 2/7] Make all PATH declarations consistent to project root. --- admin/index.php | 8 +++++--- contribute.php | 4 +++- fullmap.php | 4 +++- includes/magic.php | 6 ++++-- index.php | 4 +++- profile.php | 4 +++- scripts/load_authors.php | 4 +++- scripts/load_morphs.php | 8 +++++--- supporters-all.php | 4 +++- 9 files changed, 32 insertions(+), 14 deletions(-) diff --git a/admin/index.php b/admin/index.php index 920b706..983d3c8 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,7 +1,9 @@ query("SELECT icon FROM artists ORDER BY icon ASC"); @@ -435,4 +437,4 @@ function bounceOut(){ header("Location: /admin/"); exit; } - + diff --git a/contribute.php b/contribute.php index 9b1d3f8..97b2615 100644 --- a/contribute.php +++ b/contribute.php @@ -1,5 +1,7 @@ diff --git a/fullmap.php b/fullmap.php index 8a64f9f..9120156 100644 --- a/fullmap.php +++ b/fullmap.php @@ -1,5 +1,7 @@ About Us
query("SELECT url_slug, name FROM dmillar_cartography.artists ORDER BY name ASC"); if ($navdata->rowCount() > 0) { diff --git a/index.php b/index.php index 8401027..a7d745f 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,7 @@ 0) ? $map_type : 1; $datafile = PATH . "/datacache/" . $map_type . ".json"; if (file_exists($datafile) && (time() - filemtime($datafile) >= 60 * 60 *24 * 5)) { include($datafile); } else { - include PATH . "/../cgi-bin/db_start.php"; + include PATH . "/cgi-bin/db_start.php"; $map_type_phr = ($map_type == 3) ? "IN (1,2,3)" : "= ". $map_type; $query = "SELECT id, image, artist_id, tile_type FROM tiles WHERE map_type ".$map_type_phr." AND approved = 1"; @@ -28,7 +30,7 @@ echo ''; } - include PATH . "/../cgi-bin/db_end.php"; + include PATH . "/cgi-bin/db_end.php"; echo $our_json; } ?> diff --git a/supporters-all.php b/supporters-all.php index 8bf5b65..63c0739 100644 --- a/supporters-all.php +++ b/supporters-all.php @@ -1,5 +1,7 @@ From f4afdef6840c7d48f0eb2b8b8e5692681354fa20 Mon Sep 17 00:00:00 2001 From: David Millar Date: Mon, 25 Oct 2021 20:18:12 -0500 Subject: [PATCH 3/7] Added the schema for the current database structure. --- provision/schema.sql | 53 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/provision/schema.sql b/provision/schema.sql index 7ed610d..81e4692 100644 --- a/provision/schema.sql +++ b/provision/schema.sql @@ -1 +1,52 @@ --- TODO: Commit schema-only table structure to this file for first-run setup. +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + + +CREATE TABLE `artists` ( + `id` int(11) NOT NULL, + `name` text COLLATE utf8_unicode_ci NOT NULL, + `url_slug` text COLLATE utf8_unicode_ci NOT NULL, + `initials` text COLLATE utf8_unicode_ci NOT NULL, + `icon` text COLLATE utf8_unicode_ci NOT NULL, + `url` text COLLATE utf8_unicode_ci NOT NULL, + `bio` text COLLATE utf8_unicode_ci NOT NULL, + `email` text COLLATE utf8_unicode_ci NOT NULL, + `password` text COLLATE utf8_unicode_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +CREATE TABLE `tiles` ( + `id` int(11) NOT NULL, + `image` varchar(70) COLLATE utf8_unicode_ci NOT NULL, + `tile_type` int(11) NOT NULL, + `map_type` int(11) NOT NULL, + `artist_id` int(11) NOT NULL, + `has_exit` tinyint(1) NOT NULL, + `approved` tinyint(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + +ALTER TABLE `artists` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `tiles` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `image` (`image`); + + +ALTER TABLE `artists` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +ALTER TABLE `tiles` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 42146c22184a09bc9c84e2ff22aea0d0a2551f53 Mon Sep 17 00:00:00 2001 From: David Millar Date: Mon, 25 Oct 2021 20:34:02 -0500 Subject: [PATCH 4/7] Add test data for databases. --- Vagrantfile | 6 +- provision/artists.sql | 78 +++++++++++++++++++++++++ provision/tiles.sql | 131 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 provision/artists.sql create mode 100644 provision/tiles.sql diff --git a/Vagrantfile b/Vagrantfile index 2a47dd4..08378b5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -54,7 +54,11 @@ Vagrant.configure('2') do |config| TABLE_COUNT=$(mysql --batch --skip-column-names -e 'SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = "daves_mapper";') if [ $TABLE_COUNT -eq 0 ]; then echo '## Importing MySQL schema.' - mysql daves_mapper < provision/schema.sql #TODO this sql file needs to get populated. + mysql daves_mapper < provision/schema.sql + echo '## Importing scrubbed artist data.' + mysql daves_mapper < provision/artists.sql + echo '## Importing randomized dump containing 100 tiles.' + mysql daves_mapper < provision/tiles.sql fi echo '## Setting convenience login dir.' diff --git a/provision/artists.sql b/provision/artists.sql new file mode 100644 index 0000000..64edf1f --- /dev/null +++ b/provision/artists.sql @@ -0,0 +1,78 @@ +-- phpMyAdmin SQL Dump +-- version 4.9.5 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost:3306 +-- Generation Time: May 29, 2021 at 01:24 PM +-- Server version: 5.6.41-84.1 +-- PHP Version: 7.3.28 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Dumping data for table `artists` +-- + +INSERT INTO `artists` (`id`, `name`, `url_slug`, `initials`, `icon`, `url`, `bio`, `email`, `password`) VALUES +(1, 'Dyson Logos', 'dyson-logos', 'DL', 'dy', 'http://rpgcharacters.wordpress.com/', 'Dyson\'s original geomorph project spawned this entire geomorphic mapping movement. With over 100 tiles (I still need to add more of them) and a ton of other amazing and beautiful maps, Dyson has created quite a following.', '', ''), +(2, 'Risus Monkey', 'risus-monkey', 'RM', 'mk', 'http://www.risusmonkey.com/', 'Risus Monkey\'s geomorphs look a little different than the pen and paper ones, but they add a lot of interesting features', '', ''), +(3, 'Stonewerks', 'stonewerks', 'SW', 'sw', 'http://stonewerks.wordpress.com/', 'Stonewerks may have gone with a style similar to Dyson\'s originals, but looking beyond the surface similarities you\'ll find a wealth of details in his tiles that you\'d be hard-pressed to find elsewhere.', '', ''), +(4, 'Amanda Michaels', 'amanda-michaels', 'AM', 'am', '', 'Amanda may not have built dungeon tiles, but if ever in need of a post-apocalyptic city to tear through, she\'s your gal.', '', ''), +(5, 'Talysman', 'talysman', 'Tal', 'tl', 'http://9and30kingdoms.blogspot.com/', 'Talysman is a maker of specialty geomorphic tiles. With a generous sprinkling of his tiles in your map, you\'ll have some big features to craft stories around.', '', ''), +(6, 'Brutus Motor', 'brutus-motor', 'BM', 'bm', 'http://thisisdicecountry.blogspot.com/', 'Brutus Motor has just started blogging at \"This is Dice Country\" but has already jumped right into the geomorph mapping movement and created some great tiles.', '', ''), +(7, 'Paul Gorman', 'paul-gorman', 'PG', 'pg', 'http://quicklyquietlycarefully.blogspot.com/', 'Paul Gorman makes geomorphs too — with a neat curly scribble fill style. He releases them under the Creative Commons attribution non-commercial license.', '', ''), +(8, 'Fighting Fantasist', 'fighting-fantasist', 'FF', 'ff', 'http://fightingfantasist.blogspot.com/', 'Fighting Fantasist is \"just a 30-something gamer from the old Brit days of Fighting Fantasy, Lone Wolf and Warhammer with a renewed enthusiasm for it after discovering online that other people were going back to the older stuff as well.\"', '', ''), +(9, 'Stuart Robertson', 'stuart-robertson', 'SR', 'sr', 'http://strangemagic.robertsongames.com/', 'Stuart Robertson was inspired by the 1 hour maps and geomorphs of others, and has leapt into the geomorph fray.', '', ''), +(10, 'Shane Knysh', 'shane-knysh', 'SK', 'sk', 'http://fictitiousentry.com/', 'Software tester, designer and developer, UX geek, online and table top game player, father, nerd and husband. His tiles are released under the Creative Commons Attribution-NonCommercial 2.5 Canada License.', '', ''), +(11, 'Tony Brotherton', 'tony-brotherton', 'TB', 'tb', 'http://roleplay-geek.blogspot.com/', 'Tony\'s city tiles are the best way to put together a sprawling metropolis in no time.', '', ''), +(12, 'M.S. Jackson', 'ms-jackson', 'MSJ', 'msj', 'http://snikle.wordpress.com/', 'Currently stationed in Iraq and making a set of geomorphs on his trusty iPad. He releases the content from his blog under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.', '', ''), +(13, 'Glenn Jupp', 'glenn-jupp', 'GJ', 'gj', 'http://seekingwing.blogspot.com/', 'Geomorph artist that loves adding DungeonWords to his signature tiles to spark ideas for GMs. (Our copies have them removed so you can start fresh.)', '', ''), +(14, 'Rorschachhamster', 'rorschachhamster', 'RH', 'rh', 'http://rorschachhamster.wordpress.com/', 'Rorschachhamster ist ein Rollenspieler, Punkmusiker, Vater, Buchhändler und Pseudointellektueller, der langsam auf die 40 zu geht.', '', ''), +(15, '1nfinite zer0', '1nfinite-zer0', '∞0', 'i0', 'http://shashnia.blogspot.com/', '1nfinite zer0 is a landscape ecologist and hobby game designer who has also jumped on the geomorph bandwagon.', '', ''), +(16, 'Bryan Meadows', 'bryan-meadows', 'BMe', 'bme', 'http://bearmeadows.com/', 'Bryan Meadows creates his geomorphs in Adobe Illustrator using a Wacom tablet.', '', ''), +(17, 'David Millar', 'david-millar', 'DM', 'dm', 'http://davegoesthedistance.com', 'Prior to making this web app, I had never role-played before. Weird, right? I\'m a web and graphic designer and also a puzzle author, and I have a blog where I share some (a ton) of my puzzles for free.', '', ''), +(18, 'David Brawley', 'david-brawley', 'DB', 'db', 'http://towerofthearchmage.blogspot.com/', '\"I\'ve loved dungeons ever since my mum read me the story of the minotaur and the labyrinth. That love resulted in reams of paper being covered in mazes. This lead quite naturally to Dungeons and Dragons. I\'ve gone from the Rules Cyclopedia to 2nd Edition, 3.0, 3.5, 4e, and finally back to the Rules Cyclopedia. I now post my various monsters, magic items, and maps at Tower of the Archmage My geomorphs are released under the Creative Commons license.\"', '', ''), +(19, 'Mark L. Chance', 'mark-l-chance', 'MC', 'mc', 'http://spesmagna.com/', 'Mark, a long time RPGer, runs Spes Magna Games, a small but\r\nmighty publisher of RPG PDFs. Mark releases his geomorphs under the\r\nCreative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported\r\nLicense.', '', ''), +(20, 'FrDave', 'frdave', 'FrD', 'frd', 'http://bloodofprokopius.blogspot.com/', 'FrDave got into this hobby decades ago when his mom came home with the Holmes Basic Edition. He has recently returned to that edition and found it necessary to create geomorphs with the ability to create rooms larger than 100 x 100. Compatible with other geomorphs, these can be pieced together so that rooms that go all the way to the edge of the geomorphs come together to make rooms as large as needed.', '', ''), +(22, 'Billdakat', 'billdakat', 'BDK', 'bdk', 'http://www.freepiratesforhire.com', 'Billdakat is a long time RPer, occasional GM, and would be writer and card game maker. He saw a need for city tiles and because he enjoys drawing maps made some edge tiles and more.', '', ''), +(23, 'Dominic Toghill', 'dominic-toghill', 'RD', 'rd', 'http://sites.google.com/site/earthbindersroleplayingstuff/', 'A Welshman, A Biomedical Scientist with a Masters Degrees in Haematology, A husband, sounds like a joke well actually its a confessed RPG/LRP addict for over twenty years.', '', ''), +(24, 'EricMTGCast', '/ericmtgcast', 'emc', 'emc', 'http://www.twitter.com/EricMTGCast', 'Eric is just a guy who gamed in his youth through college and is now picking it up with his kids. He can be found podcasting about Magic the Gathering on the MTGCast network.', '', ''), +(25, 'bygrinstow', 'bygrinstow', 'byg', 'byg', 'http://appendixm.blogspot.com/', ' 30+ year pen-and-paper gamer, husband, father, son, brother, friend, baker, entrepreneur (but can\'t pronounce it), doodler, reader, scribbler, crafter, dreamer and napper. Find his monster blog at http://appendixm.blogspot.com/.', '', ''), +(26, 'Dakin & Lorna Burdick', 'dakin-lorna-burdick', 'DLB', 'dakin', 'http://lostdelights.wordpress.com/', 'I\'m an Instructional Consultant. I\'ve been playing rpgs since 1978.', '', ''), +(27, 'PublicOpinion', 'publicopinion', 'PO', 'po', 'http://publop.tumblr.com/', 'PublicOpinion is a grad student who uses his geomorphs for running games online, and has released his tiles under the CreativeCommons Attribution-NonCommerical-ShareAlike license.', '', ''), +(28, 'Marc Majcher', 'marc-majcher', 'MM', 'mm', 'http://gizmet.com/', 'Marc is a game developer and improviser living in Austin, TX. In addition to self-publishing board, card, and role-playing games, he likes to draw stuff when he\'s not able to squeeze actual gaming into his ridiculous schedule.', '', ''), +(29, 'Sean Smith', 'sean-smith', 'SS', 'ss', 'http://archaism.co.uk', 'Sean Smith usually runs slightly anarchic campaigns, but between then writes at archaism.co.uk — mostly about spec. fic.', '', ''), +(31, 'Danilo Montauriol', 'danilo-montauriol', 'DMD', 'dmd', 'http://leningrado8.wix.com/danilo', 'I\'m an Architect, Guitarist, RPG player and PC games player. I play RPG since 1998, and have been developing my own system (and a card game), which I hope to publish some day.', '', ''), +(32, 'Jelle \'Yazza\' Meersman', 'jelle-yazza-meersman', 'JM', 'jm', '', 'Creative jack of all trades with too many projects and too little time. Got strong links to the water and likes using it in his wargames and roleplay. Working in a model kit and wargame store in Antwerp, Belgium, inspiration always strikes!\r\nFrom building complete wargame tables, busy gameclub live to making props, painting/converting miniature. All around geekery always has a spot in his schedule.', '', ''), +(33, 'zombotron', 'zombotron', 'zt', 'zt', '', ' I\'ve been playing RPGs off-and-on for literally half my life. I\'ve played probably equal parts D&D, Palladium, and my friends unpublished homebrew system.', '', ''), +(34, 'morgajel', 'morgajel', 'mgj', 'mgj', 'http://citygenerator.morgajel.net/', 'Morgajel is a Linux Systems administrator who enjoys automation and random generation. He\'s been playing tabletop RPGs since 1988 and is the developer behind the CityGenerator suite of tools.', '', ''), +(35, 'FiTH HaZard', 'hazard', 'HZD', 'hzd', 'http://www.tantrumtech.info', 'HaZard is a screen printer and textiles worker from Adelaide. He is currently operating a vector design and vinyl cutting business called Tantrum Tech and is spreading out into indie game design.', '', ''), +(36, 'Matt Joyce', 'matt-joyce', 'MJ', 'mjo', 'https://plus.google.com/+MattJoyce01', 'Hobbyist in Australia. Licenses his tiles under Creative Commons license Attribution-ShareAlike 4.0 International(CC BY-SA 4.0).', '', ''), +(37, 'Nate McD', 'nate-mcd', 'NM', 'nm', 'http://gameofthought.blogspot.com/', 'Nate was an avid reader of fantasy and science fiction from a very young age, and an avid artist and cartographer, inspired by the stories, maps and illustrations from his father\'s early fantasy novel collection. He took up RPGs in the fourth grade which quickly absorbed his spare time and further fueled his imagination. He has gone on to be an artist, drafter, designer, and engineer, but is now focusing on game development, cartography, and illustration.\r\n\r\nIf you have a problem, if no one else can help, and if you can find him, maybe you can get Nate McD to help.', '', ''), +(38, 'WarrenAbox', 'warrenabox', 'WB', 'wb', 'http://warinabox.blogspot.com/', 'A thirty year gamer looking to give a little something back to the on-line community from which I\'ve taken so much. Tiles licensed under Creative Commons Attribution 4.0 International.', '', ''), +(39, 'PinkClouds', 'pink-clouds', 'PC', 'pc', '', 'Just another new GM trying to hash out some ideas for interesting dungeons. PinkClouds\' tiles are released under the Creative Coimmons Attribution-ShareAlike 4.0 International license.', '', ''), +(40, 'Rodger Thorm', 'rodger-thorm', 'RT', 'rt', 'https://rthorm.wordpress.com/', 'His tiles are released under CC BY-NC 4.0.', '', ''), +(41, 'Benjamin Wenham', 'benjamin-wenham', 'BW', 'bwen', 'http://savevscosmichorror.blogspot.com/', 'Ben is a occasional freelance writer; who seems to have become obsessed with drawing maps and specifically geomorphs. He warns that it may be contagious. His contributions to Dave\'s Mapper are released under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.', '', ''), +(42, 'Kosmic', 'kosmic', 'Ko', 'ko', 'http://kosmicdungeon.com/', 'Kosmic is a passionate RPG mapper and map blogger.', '', ''), +(43, 'David J Rust', 'david-j-rust', 'DJR', 'djr', 'https://twitter.com/sylvan_wolf', 'A gamer for decades, having started with AD&D back in late \'79. David began refereeing on January 1st, 1980 after having gotten all the AD&D books as a Christmas present. He loved the old, \"random dungeon generation\" tables and spent weeks just doodling dungeons.', '', ''), +(44, 'Flemtop', 'flemtop', 'flem', 'flem', '', 'A casual gamer, dipping their toes into the world of pen and paper RPGs. Main interest is in ‘Paranoia’. In my spare time I’m trying to build additional content for DMs to help populate the infamous ‘Alpha Complex’.', '', ''), +(45, 'Draconian Rogue', 'draconian-rogue', 'DR', 'drac', '', 'A gamer for 40+ years, into maps even before that. Maps, floorplans, and mazes make\'s Draconian Rogue\'s head spin!', '', ''), +(46, 'Skia10', 'skia10', 'SK10', 'skia', '', 'I love art, and i also love RPG and roleplay. I found out about this site and loved it so much i was determined to contribute, wall, that was last year. I did it though, hoping to help out more.', '', ''), +(47, 'sidy111', 'sidy111', 'JB', 'sidy', '', 'sidy111 is an aspiring artist and programmer.', '', ''), +(48, 'Søren Nissen', 'soren-nissen', 'SRN', 'srn', '', 'Søren needed tiles for his own campaign, and decided he might as well share with others DMs.', '', ''), +(49, 'Culture20', 'culture20', 'C20', 'c20', '', 'I was short until high school.', '', ''); + +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/provision/tiles.sql b/provision/tiles.sql new file mode 100644 index 0000000..4218335 --- /dev/null +++ b/provision/tiles.sql @@ -0,0 +1,131 @@ +-- phpMyAdmin SQL Dump +-- version 4.9.5 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost:3306 +-- Generation Time: May 29, 2021 at 01:26 PM +-- Server version: 5.6.41-84.1 +-- PHP Version: 7.3.28 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Dumping data for table `tiles` +-- + +INSERT INTO `tiles` (`image`, `tile_type`, `map_type`, `artist_id`, `has_exit`, `approved`) VALUES +('byg/tile-corner-06.jpg', 3, 1, 25, 0, 1), +('mk/geomorph-94.jpg', 1, 2, 2, 0, 1), +('po/PublicOpinion_corner008.png', 3, 1, 27, 0, 1), +('nm/dungeon/1428282672dcorner4.png', 3, 1, 37, 0, 1), +('nm/cavern/1425840494cave8.png', 1, 2, 37, 0, 1), +('po/PublicOpinion_base30.png', 1, 2, 27, 0, 1), +('rd/Organic1.png', 1, 2, 23, 0, 1), +('dm/sideview/14290640932015_04_09_02_topleft.png', 1, 6, 17, 0, 1), +('dy/sides/005.png', 1, 6, 1, 0, 1), +('am/19.png', 1, 4, 4, 0, 1), +('byg/tile-base-19.jpg', 1, 1, 25, 0, 1), +('dmd/spaceship/1428685738SciFi_Pack2_-_5.jpg', 2, 7, 31, 0, 1), +('rd/rd_e011.png', 2, 7, 23, 0, 1), +('dy/sides/013.png', 1, 6, 1, 0, 1), +('frd/DG29.png', 1, 1, 20, 0, 1), +('sw/sideview/1397973183vertical-geomorph3-12.png', 1, 6, 3, 0, 1), +('dm/border/border-c-3.png', 2, 3, 17, 1, 1), +('i0/corner/dc_cornr2.png', 3, 3, 15, 0, 1), +('po/PublicOpinion_edge18.png', 2, 2, 27, 0, 1), +('uploads/1367399846CGP_23b.png', 1, 7, 11, 0, 1), +('uploads/1379393886dungeon_7_7.png', 1, 1, 33, 0, 1), +('uploads/1371754354tunnels_lrg.png', 1, 1, 23, 0, 1), +('sw/geomorph8.png', 1, 1, 3, 0, 1), +('nm/cavern/1425842690ccorner4.png', 3, 2, 37, 0, 1), +('frd/BPGE14.png', 2, 1, 20, 0, 1), +('mjo/dungeon/1421009706003-StdBase-1.png', 1, 1, 36, 0, 1), +('dy/geomorph-13-d.png', 1, 1, 1, 0, 1), +('ko/cavern/1457499565edge-geomorph-cavern-10.png', 2, 2, 42, 0, 1), +('uploads/1366327585Dungeon-Geomorphs-2013-04-16_23.png', 1, 1, 28, 0, 1), +('uploads/1379393854dungeon_7_1.png', 1, 1, 33, 0, 1), +('rt/cavern/1469254841SpiralThrone-geomorph300x.png', 1, 2, 40, 0, 1), +('wb/sideview/1428714183side008.png', 7, 6, 38, 0, 1), +('sw/sides/side_001.png', 1, 6, 3, 1, 1), +('dy/geomorph-3-d.png', 1, 1, 1, 0, 1), +('tb/015-crematorium.jpg', 1, 4, 11, 0, 1), +('dm/geo-a-11.png', 1, 1, 17, 0, 1), +('uploads/1366070858CGP_06.png', 2, 7, 11, 0, 1), +('uploads/1365994438cavern_2013_1.png', 1, 2, 17, 0, 1), +('ko/cavern/1457499404edge-geomorph-cavern-04.png', 2, 2, 42, 0, 1), +('bm/Geodice 09 - Sewer.png', 1, 3, 6, 0, 1), +('uploads/1366327721Dungeon-Geomorphs-2013-04-16_53.png', 2, 1, 28, 0, 1), +('dy/corner/corner2a.jpg', 3, 1, 1, 0, 1), +('frd/DG10.png', 1, 1, 20, 0, 1), +('bm/Geomorph 016.png', 1, 1, 6, 0, 1), +('nm/dungeon/1428417713dung10.png', 1, 1, 37, 0, 1), +('c20/dungeon/1575601348tile_geomorph_300x300_001.png', 1, 1, 49, 0, 1), +('frd/BPG13.png', 1, 1, 20, 0, 1), +('am/50.png', 1, 4, 4, 0, 1), +('uploads/1372125701bl_2013_01.png', 7, 6, 17, 0, 1), +('am/7.png', 1, 4, 4, 0, 1), +('mk/geomorph-42.jpg', 1, 3, 2, 0, 1), +('sidy/sideview/1570598846FullTiles4.png', 1, 6, 47, 0, 1), +('uploads/1366766924Geomorph-2013-04-23_07_19.png', 1, 1, 28, 0, 1), +('tl/dcmix/1474747884eb5geo.png', 2, 3, 5, 0, 1), +('pc/dungeon/14316541404.png', 1, 1, 39, 0, 1), +('mk/corner/corner-05.jpg', 3, 2, 2, 0, 1), +('dak/downdowndown1.png', 1, 2, 26, 0, 1), +('dy/geomorph-14-c.png', 1, 1, 1, 0, 1), +('dm/border/border-c-6.png', 2, 1, 17, 0, 1), +('mk/geomorph-39.jpg', 1, 1, 2, 0, 1), +('frd/BPG35.png', 1, 1, 20, 0, 1), +('djr/cavern/1525496980cavernsOfPirateIsland_bottomEdge04.png', 2, 2, 43, 0, 1), +('dm/corner/corner-c-15.png', 3, 1, 17, 0, 1), +('mjo/dungeon/1421010129005-StdEdge-4.png', 2, 1, 36, 0, 1), +('uploads/1366239642CGP_14.png', 1, 7, 11, 0, 1), +('ko/cavern/1457499474edge-geomorph-cavern-05.png', 2, 2, 42, 0, 1), +('dm/geo-b-4.png', 1, 2, 17, 0, 1), +('ko/cavern/1457499281base-geomorph-cavern-21.png', 1, 2, 42, 0, 1), +('ko/cavern/1469910318geomorph-set-01.jpg', 1, 2, 42, 0, 1), +('dm/cavern_2013_006.png', 1, 2, 17, 0, 1), +('ko/cavern/1457497648geomorph-06.png', 3, 2, 42, 0, 1), +('mjo/dungeon/1421009829004-StdBase-4.png', 1, 1, 36, 0, 1), +('dy/geomorph-7-e.png', 1, 1, 1, 0, 1), +('mk/geomorph-65.jpg', 1, 2, 2, 0, 1), +('frd/BPGE09.png', 2, 1, 20, 0, 1), +('uploads/1379392795cavern_1_5.png', 1, 2, 33, 0, 1), +('mjo/dungeon/1421010008005-StdCorner-2.png', 3, 1, 36, 0, 1), +('sw/geomorph1.png', 1, 1, 3, 0, 1), +('tb/scificity/1622312293mcm-006.jpg', 1, 9, 11, 0, 1), +('dm/scifi004.png', 1, 7, 17, 0, 1), +('frd/BPG28.png', 1, 1, 20, 0, 1), +('sk/sk_012_4.png', 1, 1, 10, 0, 1), +('po/PublicOpinion_edge007.png', 2, 2, 27, 0, 1), +('db/TotA Geomorph 24.jpg', 1, 1, 18, 0, 1), +('srn/village/1572412416corner-005.png', 3, 5, 48, 0, 1), +('sw/geomorph17-3.png', 1, 3, 3, 0, 1), +('frd/DG26.png', 1, 1, 20, 0, 1), +('tb/018-keep.jpg', 1, 4, 11, 0, 1), +('db/TotA Geomorph 14.jpg', 1, 1, 18, 0, 1), +('dy/geomorph-12-f.png', 1, 3, 1, 0, 1), +('djr/cavern/1525496879cavernsOfPirateIsland_centerTile08.png', 1, 2, 43, 0, 1), +('mk/geomorph-10.jpg', 1, 3, 2, 0, 1), +('uploads/1366482333edge-geomorphs0001.png', 2, 1, 27, 0, 1), +('sw/geomorph27-5.png', 1, 3, 3, 0, 1), +('dak/border9.png', 2, 2, 26, 0, 1), +('sk/dungeon_geomorph_004_6.png', 1, 1, 10, 0, 1), +('am/31.png', 1, 4, 4, 0, 1), +('am/9.png', 1, 4, 4, 0, 1), +('uploads/1366327830Dungeon-Geomorphs-2013-04-16_55.png', 3, 1, 28, 0, 1), +('mjo/dungeon/1421010294005-StdEdge-8.png', 2, 1, 36, 0, 1); + +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 923bbf6b0179942b76902e0e7b46f98dc544a8b0 Mon Sep 17 00:00:00 2001 From: Brian Porter Date: Sat, 30 Oct 2021 09:30:41 -0500 Subject: [PATCH 5/7] Adjust SQL query to not use database name explicitly. --- includes/magic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/magic.php b/includes/magic.php index d5508b2..2e37a71 100644 --- a/includes/magic.php +++ b/includes/magic.php @@ -10,7 +10,7 @@ include PATH . "/cgi-bin/db_start.php"; - $navdata = $pdo->query("SELECT url_slug, name FROM dmillar_cartography.artists ORDER BY name ASC"); + $navdata = $pdo->query("SELECT url_slug, name FROM artists ORDER BY name ASC"); if ($navdata->rowCount() > 0) { while ($nextguy = $navdata->fetch(PDO::FETCH_ASSOC)) { ?> Date: Sat, 30 Oct 2021 09:50:51 -0500 Subject: [PATCH 6/7] Fix up php error log config, open mysql to host, log slow queries. --- datacache/.keep | 0 provision/bootstrap.sh | 26 +++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 datacache/.keep diff --git a/datacache/.keep b/datacache/.keep new file mode 100644 index 0000000..e69de29 diff --git a/provision/bootstrap.sh b/provision/bootstrap.sh index c0b3397..0ef3947 100644 --- a/provision/bootstrap.sh +++ b/provision/bootstrap.sh @@ -91,8 +91,10 @@ apt-get -yqq install \ php$PHP_VERSION \ $EXT_LIST -cat < /etc/php/7.4/fpm/conf.d/99-logging.ini -error_log /var/log/php_error.log +touch /var/log/php_error.log +chown $PROJECT_USER:$PROJECT_GROUP /var/log/php_error.log +cat < /etc/php/$PHP_VERSION/fpm/conf.d/99-logging.ini +error_log = /var/log/php_error.log PHPINI @@ -125,7 +127,7 @@ FPMCONF systemctl enable php$PHP_VERSION-fpm systemctl restart php$PHP_VERSION-fpm -a2enconf php7.4-fpm +a2enconf php$PHP_VERSION-fpm a2enmod \ actions \ alias \ @@ -187,6 +189,24 @@ fi apt-get -yqq install mysql-server mysqld --initialize + +# Supplement the default MySQL daemon configs with some overrides. +touch /var/log/mysql/slow_queries.log +chown mysql:adm /var/log/mysql/slow_queries.log + +cat < "/etc/mysql/mysql.conf.d/zzz_${PROJECT_NAME}.cnf" +[mysqld] + +bind_address = * +character-set-server = UTF8MB4 +collation-server = utf8mb4_0900_ai_ci +slow-query-log = 1 +slow_query_log_file = /var/log/mysql/slow_queries.log +long_query_time = 1 +; log-queries-not-using-indexes + +MYSQLCONF + systemctl enable mysql systemctl restart mysql From d1a01d7bf2d4253479260d4c9baf30db5a68aa8a Mon Sep 17 00:00:00 2001 From: Brian Porter Date: Sat, 30 Oct 2021 10:55:51 -0500 Subject: [PATCH 7/7] Ignore the datacase dir and fix readme typo. --- .gitignore | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8e31a4c..785d00f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.sublime* *.ftpquota scripts/datacache/ +datacache/ blog/ bucket/ error_log diff --git a/README.md b/README.md index 11464cc..d7911cb 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The included `provision/boostrap.sh` script defines all other system-level depen * This will take some time during the first execution as the base VM image needs to be downloaded from the internet. 3. This local folder is mapped into the VM's `/app` folder. Changes to files in the project will be updated inside the VM nearly instantaneously. 4. Visit http://localhost:4069 -5. When you are done, run `vagrant down` to halt the configured VM. (Subsequent `vagrant up` commands will boot this already-provisioned VM.) +5. When you are done, run `vagrant halt` to halt the configured VM. (Subsequent `vagrant up` commands will boot this already-provisioned VM.) Database credentials will be automatically configured in `cgi-bin/db_start.php` to work with Vagrant. This file is gitignore'd to prevent it from being committed back to the repo with sensitive credentials.