I am running flipt through the docker container on my local machine using the latest image. I am trying to connect to my postgres database that I have set up in AWS. I can connect to this database from my local machine just fine, but no matter what I do with the environment variables, I cannot get flipt to connect to the DB. These are the commands I have tried:
No matter what, the container starts, then immediately fails with
Error: getting db driver for: postgres: failed to connect to database
Is there some kind of container setting I need to provide to make this work? I have no idea where to even look for the failures since its not kicking out any logs at this stage. Any help/guidance would be appreciated.
@dstrohschein-equips silly question, but is your database exposed to the outside world from AWS? Are you running your Flipt docker command on your local machine and then trying to connect to your DB inside AWS? OR is everything (including Flipt via Docker) running inside AWS?
This error message Error: getting db driver for: postgres: means that it is correctly parsing the DB URL string (or protocol in the later example) and knows it should be connecting to a Postgres DB, which leads me to believe it is something network related
Yes, the DB in AWS is exposed to the outside - I can connect to it just fine from PG_Admin running on the same machine that the docker container is running (with the same credentials). My docker skills are pretty weak, so maybe there is something in the run command I need to add networking wise? I figured that if my local machine can reach the DB, the container running on that same machine should be able to - but I may be missing some kind of network configuration specific to the docker container.
EDIT for clarity:
Flipt in docker container is running on my local machine. DB is in AWS, and is exposed to the outside. I can connect to the AWS DB via PG_Admin running on my local machine, so I know that the machine can connect.
I ran the container without the DB commands and connected to it via the shell. The container has psql on it already, so I tried to connect to the AWS DB via psql from the container itself using the below command - and it worked. I am able to connect to the AWS DB from the container.
This makes me think I am not providing something to flipt correctly, or that I am missing a flipt configuration option some how.
Turns out that because I had a special character in the password, it wasn’t working. I escaped the symbol, and now flipt is happily connecting to my AWS postgres DB.
So the lesson is this - if you are using environment variables from the command line, escape special characters.