Install Failed - Numerous Errors when running with pgsql Getting Numerous errors when trying to test a staging environment with Craft 3.1. States Install Failed - Check Logs which I have and I'm seeing the following logs being given. I don't understand what's causing this problem at all. 

When the server starts, it presents me with the following error repeated many times:

data.db (postgresql[daemon]) ::  STATEMENT:  INSERT INTO "resourcepaths" ("path", "hash") VALUES ($1, $2)
data.db (postgresql[daemon]) ::  ERROR:  relation "resourcepaths" does not exist at character 13


Then when I head through the install window it presents me with the following error outputs in the link below (was too much to paste here)

https://paste.ee/p/lrFsi

db.php

&lt;?php

 return [
     'driver'      =&gt; 'pgsql',
     'server'      =&gt; $_ENV['DATA_DB_HOST'],
     'user'        =&gt; $_ENV['DATA_DB_USER'],
     'password'    =&gt; $_ENV['DATA_DB_PASS'],
     'database'    =&gt; 'gonano',
     'schema'      =&gt; 'public',
     'tablePrefix' =&gt; '',
     'port'        =&gt; 5432
 ];


.env

# The database driver that will be used ('mysql' or 'pgsql')
DB_DRIVER="pgsql"

# The database server name or IP address (usually this is 'localhost' or '127.0.0.1')
DB_SERVER="localhost"

# The database username to connect with
DB_USER="root"

# The database password to connect with
DB_PASSWORD=""

# The name of the database to select
DB_DATABASE=""

# The database schema that will be used (PostgreSQL only)
DB_SCHEMA="public"

# The prefix that should be added to generated table names (only necessary if multiple things are sharing the same database)
DB_TABLE_PREFIX=""

# The port to connect to the database with. Will default to 5432 for PostgreSQL and 3306 for MySQL.
DB_PORT=""


Composer.json

{
  "require": {
    "craftcms/cms": "3.1.15",
    "craftcms/redactor": "2.3.2",
    "lukeyouell/craft-fetch": "1.2.0",
    "nystudio107/craft-seomatic": "3.1.44",
    "verbb/feed-me": "3.1.10",
    "verbb/feed-me-pro": "3.0.4",
    "vlucas/phpdotenv": "^2.4.0"
  },
  "autoload": {
    "psr-4": {
      "modules\\": "modules/"
    }
  },
  "config": {
    "sort-packages": true,
    "optimize-autoloader": true,
    "platform": {
      "php": "7.0"
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ]
  }
}


Project.yaml

https://paste.ee/p/VkgNe#F3NWs50GBWk0M1B7AgmQDuVphbDcwRau
This was due to the following problems on the system, some where 'gotchas' and some were just generic mistakes on my part. Putting this as an answer to help others.


Nanobox's boxfile.yml was classing anything that was in storage/logs/web.log as an [error] but obviously, it's not an error but rather a stack trace. This was fixed by changing it to the following within the boxfile:


    craft[stacktrace]: /app/storage/logs/web.log
    craft[error]: /app/storage/logs/phperrors.log
    php[error]: /data/var/log/php/php_error.log
    php[fpm]: /data/var/log/php-fpm.log



db.php driver was set to mysql when it was using postgres as a database. Changing it to the following 1/2 fixed the problem of installing.


'driver'      =&gt; 'pgsql'


.env was correctly set to DB_DRIVER="pgsql" but obviously this didn't match up to what my database was booting up as. This was the final piece of the puzzle.


Essentially the learning from this was make sure your db.php is nicely matched up to your .env file especially regarding your database structure. Make sure you properly set your logs to report as the correct things. As you can see above there are numerous log's craft reports into.