summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-11-25 14:21:53 +0100
committerYorhel <git@yorhel.nl>2017-11-25 14:21:53 +0100
commit374fbc0c68dd87ed86e36593606ffa95cac25cdd (patch)
tree4bc34bccc0a4a0739f493a435cd84d9e2236ade9
parentcc5611465e2bc9886ba6b9a9e74efd910cde1143 (diff)
Remove broken SQL functions from Makefile + add install instructions
-rw-r--r--Makefile112
-rw-r--r--README64
-rw-r--r--data/config_example.pl4
3 files changed, 57 insertions, 123 deletions
diff --git a/Makefile b/Makefile
index 831e1c7e..33a6bd6e 100644
--- a/Makefile
+++ b/Makefile
@@ -30,20 +30,12 @@
# Start/stop/restart the Multi daemon. Provided for convenience, a proper initscript
# probably makes more sense.
#
-# sql-import
-# Imports util/sql/all.sql into your (presumably empty) database
-#
-# update-<version>
-# Updates all non-versioned items from the version before to <version>.
-#
# NOTE: This Makefile has only been tested using a recent version of GNU make
# in a relatively up-to-date Arch/Gentoo Linux environment, and may not work in
# other environments. Patches to improve the portability are always welcome.
-.PHONY: all dirs js icons skins robots chmod multi-stop multi-start multi-restart sql-import\
- update-2.10 update-2.11 update-2.12 update-2.13 update-2.14 update-2.15 update-2.16 update-2.17\
- update-2.18 update-2.19 update-2.20 update-2.21 update-2.22 update-2.23
+.PHONY: all dirs js icons skins robots chmod chmod-autoupdate multi-stop multi-start multi-restart
all: dirs js skins robots data/config.pl util/sql/editfunc.sql
@@ -67,10 +59,10 @@ static/ch static/cv static/sf static/st:
data/log www www/feeds www/api static/f:
mkdir -p $@
-static/f/vndb.js: data/js/*.js util/jsgen.pl data/config.pl data/global.pl static/f
+static/f/vndb.js: data/js/*.js util/jsgen.pl data/config.pl data/global.pl | static/f
util/jsgen.pl
-data/icons/icons.css: data/icons/*.png data/icons/*/*.png util/spritegen.pl static/f
+data/icons/icons.css: data/icons/*.png data/icons/*/*.png util/spritegen.pl | static/f
util/spritegen.pl
static/s/%/style.css: static/s/%/conf util/skingen.pl data/style.css data/icons/icons.css
@@ -112,101 +104,3 @@ multi-start:
multi-restart:
$(multi-stop)
$(multi-start)
-
-
-# Small perl script that tries to connect to the PostgreSQL database using 'psql', with the
-# connection settings from data/config.pl. May not work in all configurations, though...
-define runpsql
- @perl -MDBI -e 'package VNDB;\
- $$ROOT=".";\
- require "data/global.pl";\
- $$_=(DBI->parse_dsn($$VNDB::O{db_login}[0]))[4];\
- $$ENV{PGPASSWORD} = $$VNDB::O{db_login}[2];\
- $$ENV{PGUSER} = $$VNDB::O{db_login}[1];\
- $$ENV{PGDATABASE} = $$2 if /(dbname|db|database)=([^;]+)/;\
- $$ENV{PGHOST} = $$1 if /host=([^;]+)/;\
- $$ENV{PGHOSTADDR} = $$1 if /hostaddr=([^;]+)/;\
- $$ENV{PGPORT} = $$1 if /port=([^;]+)/;\
- $$ENV{PGSERVICE} = $$1 if /service=([^;]+)/;\
- $$ENV{PGSSLMODE} = $$1 if /sslmode=([^;]+)/;\
- open F, "|psql" or die $$!;\
- print F while(<>);\
- close F or exit 1'
-endef
-
-
-sql-import: util/sql/editfunc.sql
- ${runpsql} < util/sql/all.sql
-
-
-update-2.10: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.10.sql
- $(multi-start)
-
-update-2.11: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.11.sql
- $(multi-start)
-
-update-2.12: all
- $(multi-stop)
- rm www/sitemap.xml.gz
- ${runpsql} < util/updates/update_2.12.sql
- $(multi-start)
-
-update-2.13: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.13.sql
- $(multi-start)
-
-update-2.14: all
- rm -f static/f/script.js
- $(multi-stop)
- ${runpsql} < util/updates/update_2.14.sql
- $(multi-start)
-
-update-2.15: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.15.sql
- $(multi-start)
-
-update-2.16: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.16.sql
- $(multi-start)
-
-update-2.17: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.17.sql
- $(multi-start)
-
-update-2.18: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.18.sql
- $(multi-start)
-
-update-2.19: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.19.sql
- $(multi-start)
-
-update-2.20: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.20.sql
- $(multi-start)
-
-update-2.21: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.21.sql
- $(multi-start)
-
-update-2.22: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.22.sql
- $(multi-start)
-
-update-2.23: all
- $(multi-stop)
- ${runpsql} < util/updates/update_2.23.sql
- $(multi-start)
diff --git a/README b/README
index 73e771f4..28bf16bc 100644
--- a/README
+++ b/README
@@ -1,18 +1,6 @@
The VNDB.org Source Code
------------------------
-
-Installation & documentation
-
- Documentation is lacking, you're pretty much on your own if you want to
- get things running. :-(
-
- Development notes for specific features or ideas can be found in data/notes/.
- Keep in mind, however, that these notes are often mostly technical and may
- not reflect the actual (current) implementation. They do elaborate on various
- design decisions and may be useful for understanding how certain things work.
-
-
Requirements
global requirements:
@@ -63,6 +51,58 @@ Requirements
pngcrush (optional)
+Setup
+
+ - Make sure all the required dependencies (see above) are installed
+ - Create a suitable data/config.pl, using data/config_example.pl as base.
+ - Run the build system:
+
+ make
+
+ - Setup a PostgreSQL server and make sure you can login with some admin user
+ - Initialize the VNDB database (assuming 'postgres' is a superuser):
+
+ # Create the database & roles
+ psql -U postgres -f util/sql/superuser_init.sql
+
+ # Set a password for each database role:
+ echo "ALTER ROLE vndb LOGIN UNENCRYPTED PASSWORD 'pwd1'" | psql -U postgres
+ echo "ALTER ROLE vndb_site LOGIN UNENCRYPTED PASSWORD 'pwd2'" | psql -U postgres
+ echo "ALTER ROLE vndb_multi LOGIN UNENCRYPTED PASSWORD 'pwd3'" | psql -U postgres
+
+ # Now import the rest
+ psql -U vndb -f util/sql/all.sql
+
+ - Update the vndb_site password in data/config.pl to whatever you set it in
+ the previous step.
+ - Configure a web server. To use a single subdomain for both static files
+ and the dynamic Perl code, here's a simple trick:
+
+ mv www/* static/
+ rmdir www
+ ln -s static www
+ ln -s ../util/vndb.pl www/cgi.pl
+
+ Then use the following Apache 2.4 config:
+
+ <Directory /path/to/vndb>
+ Options +ExecCGI +FollowSymLinks
+ AllowOverride None
+ Require all granted
+ </Directory>
+
+ <VirtualHost *:*>
+ ServerName your-test-vndb
+ DocumentRoot "/path/to/vndb/www"
+
+ RewriteEngine On
+ RewriteCond "%{DOCUMENT_ROOT}/%{REQUEST_URI}" !-s
+ RewriteRule ^/ /cgi.pl
+
+ AddHandler cgi-script .pl
+ </VirtualHost>
+
+
Contact
IRC: #vndb @ irc.synirc.net
diff --git a/data/config_example.pl b/data/config_example.pl
index ce272637..980d997a 100644
--- a/data/config_example.pl
+++ b/data/config_example.pl
@@ -5,7 +5,7 @@ package VNDB;
%O = (
%O,
- db_login => [ 'dbi:Pg:dbname=<database>', '<user>', '<password>' ],
+ db_login => [ 'dbi:Pg:dbname=vndb', 'vndb_site', '<password>' ],
logfile => $ROOT.'/err.log',
xml_pretty => 0,
log_queries => 0,
@@ -16,7 +16,7 @@ package VNDB;
%S = (
%S,
url => 'http://your.site.root/',
- url_static => 'http://your.static.site.root/',
+ url_static => 'http://your.static.site.root/', # Can be the same as the main url
form_salt => '<some unique string>',
scrypt_salt => '<another unique string>',
);