Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key error database_uri in config file #55

Closed
Ryonez opened this issue Mar 7, 2019 · 4 comments
Closed

Key error database_uri in config file #55

Ryonez opened this issue Mar 7, 2019 · 4 comments

Comments

@Ryonez
Copy link
Contributor

Ryonez commented Mar 7, 2019

When using the database_uri in config, pk will throw a key error.

Recreating annabelle-proxy_bot_1 ... done
Recreating annabelle-proxy_api_1 ... done
Attaching to annabelle-proxy_api_1, annabelle-proxy_bot_1
api_1  | Traceback (most recent call last):
api_1  |   File "api_main.py", line 202, in <module>
api_1  |     web.run_app(run())
api_1  |   File "/usr/local/lib/python3.6/site-packages/aiohttp/web.py", line 53, in run_app
api_1  |     app = loop.run_until_complete(app)
api_1  |   File "/usr/local/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
api_1  |     return future.result()
api_1  |   File "api_main.py", line 197, in run
api_1  |     os.environ["DATABASE_URI"]
api_1  |   File "/usr/local/lib/python3.6/os.py", line 669, in __getitem__
api_1  |     raise KeyError(key) from None
api_1  | KeyError: 'DATABASE_URI'
bot_1  | [2019-03-07 17:26:50,556] [discord.client] [WARNING] PyNaCl is not installed, voice will NOT be supported
bot_1  | [2019-03-07 17:26:50,557] [discord.client] [INFO] logging in using static token
annabelle-proxy_api_1 exited with code 1
bot_1  | [2019-03-07 17:26:51,797] [discord.gateway] [INFO] Created websocket connected to wss://gateway.discord.gg?encoding=json&v=
bot_1  | [2019-03-07 17:26:51,799] [discord.gateway] [INFO] Shard ID None has sent the IDENTIFY payload.
api_1  | Traceback (most recent call last):
api_1  |   File "api_main.py", line 202, in <module>
api_1  |     web.run_app(run())
api_1  |   File "/usr/local/lib/python3.6/site-packages/aiohttp/web.py", line 53, in run_app
api_1  |     app = loop.run_until_complete(app)
api_1  |   File "/usr/local/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
api_1  |     return future.result()
api_1  |   File "api_main.py", line 197, in run
api_1  |     os.environ["DATABASE_URI"]
api_1  |   File "/usr/local/lib/python3.6/os.py", line 669, in __getitem__
api_1  |     raise KeyError(key) from None
api_1  | KeyError: 'DATABASE_URI'
bot_1  | [2019-03-07 17:26:52,154] [discord.gateway] [INFO] Shard ID None has connected to Gateway: gateway-prd-main-wrhh, discord-s
api_1  | Traceback (most recent call last):
api_1  |   File "api_main.py", line 202, in <module>
api_1  |     web.run_app(run())
api_1  |   File "/usr/local/lib/python3.6/site-packages/aiohttp/web.py", line 53, in run_app
api_1  |     app = loop.run_until_complete(app)
api_1  |   File "/usr/local/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
api_1  |     return future.result()
api_1  |   File "api_main.py", line 197, in run
api_1  |     os.environ["DATABASE_URI"]
api_1  |   File "/usr/local/lib/python3.6/os.py", line 669, in __getitem__
api_1  |     raise KeyError(key) from None
api_1  | KeyError: 'DATABASE_URI'
annabelle-proxy_api_1 exited with code 1
api_1  | Traceback (most recent call last):
api_1  |   File "api_main.py", line 202, in <module>
api_1  |     web.run_app(run())
api_1  |   File "/usr/local/lib/python3.6/site-packages/aiohttp/web.py", line 53, in run_app
api_1  |     app = loop.run_until_complete(app)
api_1  |   File "/usr/local/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
api_1  |     return future.result()
api_1  |   File "api_main.py", line 197, in run
api_1  |     os.environ["DATABASE_URI"]
api_1  |   File "/usr/local/lib/python3.6/os.py", line 669, in __getitem__
api_1  |     raise KeyError(key) from None
api_1  | KeyError: 'DATABASE_URI'
annabelle-proxy_api_1 exited with code 1
^CGracefully stopping... (press Ctrl+C again to force)
Stopping annabelle-proxy_api_1   ... done
Stopping annabelle-proxy_bot_1   ... done

Using the same uri in docker-compose.yml functions correctly.

@xSke
Copy link
Member

xSke commented Mar 7, 2019

The API container doesn't read from the same configuration file, and just checks the environment variable given in the docker-compose.yml file. I didn't have any specific intentions in mind since I didn't exactly expect anyone to mess with the compose file, so it's not exactly intended behaviour this way :) I could make it read from the config file too, though. Or just split it off into a separate container entirely.

@Ryonez
Copy link
Contributor Author

Ryonez commented Mar 7, 2019

I see. I have the bot use database I have set up elsewhere, and as I haven't gotten round to setting up an creating apremade docker image to use on the main system, I've just been messing with the dockerfile for now to point it the right server and use the right network.

Why don't you merge the api into the bot proper and have it use a config value to have it enabled/disabled?

@xSke
Copy link
Member

xSke commented Mar 8, 2019

I'd like to be able to run the API in a separate container (and eventually on a different server entirely) for scalability reasons.

@Ryonez
Copy link
Contributor Author

Ryonez commented Mar 8, 2019

At the moment it can be run on another server, doesn't it read the bots data from the database?

Maybe this should be split out into it own repo then. And from there docker image creation can be automated. Been thinking about doing that for a while, but the repo here doesn't have tags or version info and some of the changes like this config file does break things.

@xSke xSke closed this as completed Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants