Closed katefike closed 4 months ago
(.venv) kfike@prod:~/sage$ cd ~/sage/ &&.venv/bin/python3 -m sage >> ~/sage/cron.log 2>&1
(.venv) kfike@prod:~/sage$ cat cron.log
2024-05-17 21:34:17.790 | INFO | __main__:main:28 - STARTING SAGE
2024-05-17 21:34:17.884 | CRITICAL | sage.db.execute_statements:open_connection:24 - Failed to connect to the database: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "admin"
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/kfike/sage/sage/__main__.py", line 103, in <module>
msg_count = main()
File "/home/kfike/sage/sage/__main__.py", line 72, in main
email_id = emails.insert_email(email)
File "/home/kfike/sage/sage/db/emails.py", line 30, in insert_email
email_id = execute_statements.insert_get_id(stmt, email_data)
File "/home/kfike/sage/sage/db/execute_statements.py", line 55, in insert_get_id
with open_connection() as conn:
File "/home/kfike/sage/sage/db/execute_statements.py", line 25, in open_connection
raise error
File "/home/kfike/sage/sage/db/execute_statements.py", line 16, in open_connection
conn = psycopg2.connect(
File "/home/kfike/sage/.venv/lib/python3.10/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "example_user"
PROBLEM
POSTGRES_USER
in the .env is configured on the dev DB, but doesn't exist on the prod DB.POSTGRES_USER
is changed to something new, locally it will be created with no errors. Seems like prod isn't accessing the .env vars.SOLUTION
Using a "base" docker-compose.yml with a docker-compose..yml file was the root problem. So I got rid of the "base" docker-compose and now just have two independent docker-compose..yml files. They're a little redundant but the base file introduced too many footguns.
TESTING
DEV
PROD
Successfully received gmail test email