OSX Catalina
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/code/web/laravel/project1
to: /home/vagrant/project1
- map: ~/code/web/laravel/biztrip
to: /home/vagrant/biztrip
sites:
- map: homestead.test
to: /home/vagrant/project1/public
- map: homestead.biztrip
to: /home/vagrant/biztrip/public
databases:
- homestead
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
proxy:
- http: http://companyproxy.domain.local:8080
- https: http://companyproxy.domain.local:8080
[will edit this in]
Set postgresql port and access system via web and CLI likewise.
Setting the postgresql port in .env to 54320 as stated in https://laravel.com/docs/7.x/homestead#connecting-to-databases the
SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 54320?
Setting the port to the standard 5432 resolves this.
However, when using artisan CLI, e.g. php artisan migrate:fresh this happens:
SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
So I have to set the port every time depending on the whether I use CLI or access the system via web? This doesn't seem right and I'm guessing I misconfigured something somewhere.
Edit: When I ssh into the vagrant machine and execute the CLI command from e.g. /home/vagrant/biztrip it works fine with the port 5432. So either change the port every time or go through the extra steps of ssh'ing into the machine and using the CLI from there?
As seen above
none, yet
Setting the postgresql port in .env to 54320 as stated in https://laravel.com/docs/7.x/homestead#connecting-to-databases the
You don't want to do this in your laravel code running on Homestead. The code runs in the vm so it needs to be set to 5432
Setting the port to the standard 5432 resolves this.
Correct, working as intended.
However, when using artisan CLI, e.g. php artisan migrate:fresh this happens:
Running artisan on your host PC, yes you will need to change the port to 54320 and then back to 5432 for the web to continue working. The solution here is to run artisan commands inside the VM from your project root.
I see, thanks a lot for clearing this up!
Most helpful comment
You don't want to do this in your laravel code running on Homestead. The code runs in the vm so it needs to be set to
5432Correct, working as intended.
Running artisan on your host PC, yes you will need to change the port to
54320and then back to5432for the web to continue working. The solution here is to run artisan commands inside the VM from your project root.