'meltano.db' is not being created when using gunicorn
Hi there, nice work so far on Meltano!
I'm currently trying to write a devops-y wrapper for Meltano, so a Meltano 'base' project that is already pre-setup (with all required taps, targets, etc...) can be checked out from git and an infrastructure around it is being created (Postgresql service, other stuff like Consul, Vault, etc.). The Data sources I use as input have a very specific, well-known format, and the Analytic needs are always/mostly the same too. It's just the source data itself that differes. Basically, I try to create something that lets you create a sort of 'Meltano distribution' that people can just use without configuration (unless they want to).
Long story short, this is a bit different to your expected use-case, where people would have one-off, custom Meltano setups, and where issues like the one I'm reporting wouldn't really be a bit problem.
What is the current bug behavior?
When checking out a Meltano project that does not contain a 'meltano.db' file, and starting it via gunicorn (as described here, I'm getting an 'Internal Server Error' when visiting the page.
This does not happen when using 'meltano ui' instead, or when using 'meltano ui' before starting the gunicorn service, so I guess there is some initialization done when using the 'ui' command that is not done when using gunicorn. I have not tested the whole thing with a Postgresql backend instead of sqlite yet.
What is the expected correct behavior?
'meltano.db' should be created, with the correct/required default schema/tables.
Steps to reproduce
meltano init test cd test gunicorn -c python:meltano.api.wsgi.config -w 4 meltano.api.wsgi:app
Relevant logs and/or screenshots
File "/home/markus/.pyenv/versions/3.7.3/envs/meltano/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: role [SQL: 'SELECT role.id AS role_id, role.name AS role_name, role.description AS role_description \nFROM role'] (Background on this error at: http://sqlalche.me/e/e3q8)
Use the same initializtion code when the app starts up, independent of whether 'ui' is used or not.