Setting up a Test Server – Part 06/??

I know the last post said I wanted to figure out what I forgot to add to this, but I’m going to skip that actually. I will be making a nice actual guide on how to do this, so I’ll figure it all out again then and in a nice list order thing. 90% of the steps are on here anyways.

Let’s get back to getting this thing going. I suppose we should get in the right spot at least:

cd /var/www/html/maf/

Oh yes!

app/console doctrine:schema:create

And then we get…

ATTENTION: This operation should not be executed in a production environment.

Creating database schema…

[Doctrine\ORM\Tools\ToolsException]                                                                                            Schema-Tool failed with Error ‘An exception occurred while executing ‘CREATE TABLE GeoData (id SERIAL NOT NULL, biome_id IN    T DEFAULT NULL, center geometry(Point) DEFAULT NULL, poly geometry(Polygon) NOT NULL, altitude INT NOT NULL, hills BOOLEAN      NOT NULL, coast BOOLEAN NOT NULL, lake BOOLEAN NOT NULL, river BOOLEAN NOT NULL, humidity DOUBLE PRECISION NOT NULL, passab    le BOOLEAN NOT NULL, PRIMARY KEY(id))’:                                                                                        SQLSTATE[42704]: Undefined object: 7 ERROR:  type “geometry” does not exist at character 77′ while executing DDL: CREATE TA    BLE GeoData (id SERIAL NOT NULL, biome_id INT DEFAULT NULL, center geometry(Point) DEFAULT NULL, poly geometry(Polygon) NOT     NULL, altitude INT NOT NULL, hills BOOLEAN NOT NULL, coast BOOLEAN NOT NULL, lake BOOLEAN NOT NULL, river BOOLEAN NOT NULL    , humidity DOUBLE PRECISION NOT NULL, passable BOOLEAN NOT NULL, PRIMARY KEY(id))                                                                                                                                     [Doctrine\DBAL\DBALException]                                                                                                  An exception occurred while executing ‘CREATE TABLE GeoData (id SERIAL NOT NULL, biome_id INT DEFAULT NULL, center geometry    (Point) DEFAULT NULL, poly geometry(Polygon) NOT NULL, altitude INT NOT NULL, hills BOOLEAN NOT NULL, coast BOOLEAN NOT NUL    L, lake BOOLEAN NOT NULL, river BOOLEAN NOT NULL, humidity DOUBLE PRECISION NOT NULL, passable BOOLEAN NOT NULL, PRIMARY KE    Y(id))’:                                                                                                                        SQLSTATE[42704]: Undefined object: 7 ERROR:  type “geometry” does not exist at character 77                                                                                                                              [PDOException]                                                                                  SQLSTATE[42704]: Undefined object: 7 ERROR:  type “geometry” does not exist at character 77

After some research, I’ve discovered we’re missing postgis. Lets fix that. Also, I’m going to use pgadmin3 for my postgreSQL management, so if you don’t have that, get it too. By now, I’m sure you know how.

sudo apt-get install postgis

Now we need to make our database use postgis, so lets open pgadmin3. If you’re using a GUI, I recommend in a separate terminal window.

pgadmin3

Open up your server, then select your database, mine is “bm2”, click the magnifying glass with “SQL” on it, then type the following in the new window:

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

After that, press the green play arrow on the tool bar (you may need to expand that window). Should return (in roughly the same amount of time):

Query returned successfully with no result in 2.6 secs.

Alright, that got us past our last error. Now lets try that schema create command again. (no, I won’t type it again)

[Doctrine\ORM\Tools\ToolsException]
Schema-Tool failed with Error ‘An exception occurred while executing ‘CREAT
E TABLE statistic.resources (id SERIAL NOT NULL, resource_id INT DEFAULT NU
LL, cycle INT NOT NULL, supply INT NOT NULL, demand INT NOT NULL, trade INT
NOT NULL, PRIMARY KEY(id))’:
SQLSTATE[3F000]: Invalid schema name: 7 ERROR: schema “statistic” does not
exist at character 14′ while executing DDL: CREATE TABLE statistic.resourc
es (id SERIAL NOT NULL, resource_id INT DEFAULT NULL, cycle INT NOT NULL, s
upply INT NOT NULL, demand INT NOT NULL, trade INT NOT NULL, PRIMARY KEY(id
))

[Doctrine\DBAL\DBALException]
An exception occurred while executing ‘CREATE TABLE statistic.resources (id
SERIAL NOT NULL, resource_id INT DEFAULT NULL, cycle INT NOT NULL, supply
INT NOT NULL, demand INT NOT NULL, trade INT NOT NULL, PRIMARY KEY(id))’:
SQLSTATE[3F000]: Invalid schema name: 7 ERROR: schema “statistic” does not
exist at character 14

[PDOException]
SQLSTATE[3F000]: Invalid schema name: 7 ERROR: schema “statistic” does not
exist at character 14

Augh, nooooo…… Well, at least it’s a different error. Lets try it anyways. Since I’ve shutdown and restarted my computer since the last post.

app/console server:start

Fire up the browser, firefox in my case, and lets point it at localhost:8000/en/ to save use a redirect.

And clicking around reveals that I actually … have … a … map? Huh? I’ve an idea that’s actually referencing the actual game’s map rather than the localhost but whatever, that’s not bad, for a test server anyways. Ideally, I’ll probably setup the tables for the map info as it’s own thing eventually anyways.

But, I have a registration page too! I wonder what happens when I put something in.

screenshot-from-2016-10-05-11-38-49And that worked too! Neato. One last thing before I end this one. Lets go back to pgadmin3 (you probably even still have it open). Select your database for the test server, then go to the SQL script runner and run the following:

UPDATE public.fos_user
SET enabled=TRUE
WHERE enabled=FALSE

This will enable that account you just made, if you’re like me and don’t have a mail handler setup for your test server, or if you do and just don’t feel like confirming your email.