3

I am trying to deploy my Laravel app on a DigitalOcean droplet. The droplet is setup with nginx, php7, and postgres, I follow up the tuts from DigitalOcean on how to set them up. Then I try to follow this tutorial on how to deploy the Laravel app using the git hook and so on.

Now the app itself is up and running, I can access the pages and all. But I can't run php artisan migrate. I have been changing the database username, name, password on .env file, but I always get the exact same error:

[Illuminate\Database\QueryException]
SQLSTATE[08006] [7] FATAL:  password authentication failed for user "deploy"
FATAL:  password authentication failed for user "deploy" (SQL: select * from information_schema.tables where table_schema = apollo and table_name = migrations)


[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[08006] [7] FATAL:  password authentication failed for user "deploy"
FATAL:  password authentication failed for user "deploy"


[PDOException]
SQLSTATE[08006] [7] FATAL:  password authentication failed for user "deploy"
FATAL:  password authentication failed for user "deploy"

Here is my latest .env config for the database:

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=postgres
DB_DATABASE=postgres
DB_PASSWORD=[my password]
DB_SCHEMA=public

As you can see, what is so absurd is that even with the DB_USERNAME is set to postgres, the error will still say for user "deploy".

I have been googling around and the closest thing, or I thought so, is to update some configuration on /etc/postgresql/9.5/main/postgresql.conf, which is to make listen_addresses = '*'. I updated it, restarted postgres service, and still get the exact same error.

Anyone can help me to point out what did I miss?

Thanks.

taufn
  • 101
  • 4
  • 12
  • 1
    Just a long shot here. not a solution. try to clear your configuration cache. `php artisan config:cache`. – EddyTheDove Feb 22 '17 at 03:24
  • @EddyTheDove that works! But now it seems like I have to clear the cache every time I changed the config. Is there a better solution to this? – taufn Feb 22 '17 at 03:46
  • How often do you actually configurations in a specific environment. Anyway, you can do `php artisan config:clear` to avoid caching. – EddyTheDove Feb 22 '17 at 04:00
  • 1
    You are right, thanks mate! – taufn Feb 23 '17 at 09:43

1 Answers1

8

This happens due to caching.

When you run, php artisan config:cache, it will cache the configuration files. Whenever things get change, you need to keep running it to update the cache files. But, it won't cache if you never run that command.

This is OK for production, since config don't change that often. But during staging or dev, you can just disable caching by clearing the cache and don't run the cache command

So, just run php artisan config:clear, and don't run the command previously to avoid caching

geckob
  • 7,680
  • 5
  • 30
  • 39