Error when starting server with postgres db: FATA[0000] Error connecting to database
rig0 opened this issue · 2 comments
The full error displayed on terminal is:
FATA[0000] Error connecting to database err="dial tcp 127.0.0.1:3306: getsockopt: connection refused"
It seems to me my ACWEB_DB_TYPE
or ACWEB_DB_HOST
values are not being fully used. I am running Debian 9 on a VPS. I set up postgres and confirmed the user and db exists. I am going the manual route by the way. These are my variables and I also confirmed with bash they work.
export ACWEB_HOST=localhost:8057
export ACWEB_LOGDIR=/home/user/acw/web_logs
export ACWEB_LOGLEVEL=info
export ACWEB_INSTANCE_LOGDIR=/home/user/acw/instance_logs
export ACWEB_CONFIG_DIR=/home/user/acw/config
export ACWEB_DB_TYPE=postgres
export ACWEB_DB_USER=acweb
export ACWEB_DB_PASSWORD=password
export ACWEB_DB_HOST=localhost
export ACWEB_DB=acweb
export ACWEB_DB_PORT=5432
export ACWEB_DB_SSLMODE=disable
I have also tried export ACWEB_DB_HOST="tcp(127.0.0.1:5432)"
but get same error
I searched around the source code looking for a hint as to what is going wrong but ended up spending a couple of hours with no answer. Judging by the error it seems to be trying to connect to a mysql db even though I specified postgres. Any clue on what I might be doing wrong?
This was a silly mistake on my end. I was launching acweb at root level by typing sudo ~/acw/acweb
and that was not picking up the variables set in my user .profile
. After running acweb as user it ran and log showed no errors but now I am getting 404 page not found
. Will look around for solution for now.
You can check the server is up and running propperly by calling it using curl. But appart from that you might have a configuration issue I can't solve :)