persistent database not found, not initialized?

16 views
Skip to first unread message

chardi...@gmail.com

unread,
Jun 26, 2019, 2:59:07 PM6/26/19
to Tethys Platform
An app is displaying layers as I expect, but I can't find the 'layers' database upon which the layers are based.  When I use the tethys syncstores command, I get the error shown below, along with some preliminary lines I included to show that containers are running.  Also, when I go to Site Admin, and then go under Persistent Store Database Settings, I see 'layers' under NAME, but under INITIALIZED I see an x, indicating it was not initialized.  For the Port for Persistent Store Service, I have tried 5435 as the defualt, but also, based on other information, I tried 5436.  Both give me the same error as shown below, which is supposed due to postgis.control not existing.   http://sqlalche.me/e/e3q8 suggests that it's not the programmer's error.  This is with tethys release version from yesterday installed.  Any help would be much appreciated. 



PostGIS/Database container already running.
GeoServer container already running.
52 North WPS container already running.
(tethys) john@john-VirtualBox:~$ tethys syncstores glo_vli
Loading Tethys Extensions...
Loading Tethys Apps...
Tethys Apps Loaded: glo_vli

Loading Tethys Extensions...
Loading Tethys Apps...
Tethys Apps Loaded: glo_vli


Provisioning Persistent Stores...
INFO:tethys:Enabling PostGIS on database "layers" for app "glo_vli"...
Traceback (most recent call last):
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 550, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.UndefinedFile: could not open extension control file "/home/john/tethys/miniconda/envs/tethys/share/extension/postgis.control": No such file or directory


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/john/tethys/src/manage.py", line 20, in <module>
    execute_from_command_line(sys.argv)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/home/john/tethys/src/tethys_apps/management/commands/syncstores.py", line 44, in handle
    self.provision_persistent_stores(options['app_name'], options)
  File "/home/john/tethys/src/tethys_apps/management/commands/syncstores.py", line 91, in provision_persistent_stores
    force_first_time=options['first_time']
  File "/home/john/tethys/src/tethys_apps/models.py", line 766, in create_persistent_store_database
    new_db_connection.execute(enable_postgis_statement)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 982, in execute
    return self._execute_text(object_, multiparams, params)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1155, in _execute_text
    parameters,
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context
    e, statement, parameters, cursor, context
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 399, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 153, in reraise
    raise value.with_traceback(tb)
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "/home/john/tethys/miniconda/envs/tethys/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 550, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (psycopg2.errors.UndefinedFile) could not open extension control file "/home/john/tethys/miniconda/envs/tethys/share/extension/postgis.control": No such file or directory

[SQL: CREATE EXTENSION IF NOT EXISTS postgis]
(Background on this error at: http://sqlalche.me/e/e3q8)
(tethys) john@john-VirtualBox:~$

swainn

unread,
Jun 26, 2019, 3:24:46 PM6/26/19
to Tethys Platform
It looks as though the database you are using does not have the postgis extension installed. Based on the path in the exception it looks like the persistent store setting is pointing at the database in conda that is installed with Tethys (...miniconda/envs/tethys/share/extension/postgis.control). That database runs on port 5436 and is provided primarily for getting people up and running quickly with Tethys, but it doesn't have postgis installed. The postgis conda package did not play well with our other dependencies so we removed it in a hotfix earlier this year. As a result you cannot use that database for persistent stores with spatial enabled.

The docker version of postgis that is installed using the Tethys docker commands runs on port 5435. It does have postgis installed and should work with persistent stores that have spatial enabled. Can you please send a screenshot of your persistent store setting?

chardi...@gmail.com

unread,
Jun 26, 2019, 4:00:55 PM6/26/19
to Tethys Platform

Screenshot from 2019-06-26 14-43-49.png

Interesting.  Thanks, Nathan.  Knowing the Port must be 5435 helped me focus on trying other things.  I used tstopdb then tstartdb this time, after switching back to 5435, and now I don't get the error when I use the syncstores command, and the Persistent Settings page now shows that it was initialized.  But I still can't seem to find layers.db.  I try 127.0.0.1:5435, but get "trouble loading page", and don't see it in "Data" folder in app either.  Here's a screenshot of Persistent Settings page though you might be less interested in that now.  I appreciate your help on this. 

chardi...@gmail.com

unread,
Jun 27, 2019, 1:50:12 PM6/27/19
to Tethys Platform
I learned that I needed pgAdmin installed in order to view the data table.  Thanks.
Reply all
Reply to author
Forward
0 new messages