I installed Docker and Nitro and successfully used nitro create <folder-name>
, and ended up with the 'Welcome to Craft CMS!' message.
I cd
ed into the new folder and invoked ./craft setup
, which along the way has reported 'success!' at testing database credentials.
After saying yes to installing on the command line and creating an admin user account, I've received:
*** installed Craft successfully (time: 12.240s)
Generating project config files from the loaded project config ... done
I can see my new local dev instance running in Docker.app, but when I go to the site in a browser I get 503 – Service Unavailable
.
If I go to {hostname}/admin
I get the browser prompt to Install Craft. If I try and fill that out I get PDO exception: SQLSTATE[HY000] [2002] Connection refused
.
The potential ease of use of Nitro looks really promising so it's frustrating to be so close!
What could I be missing?
Update 1
I have the following in my .env
:
DB_DRIVER=mysql
DB_SERVER=127.0.0.1
DB_PORT=3306
DB_DATABASE=<dbname>
DB_USER=nitro
DB_PASSWORD=nitro
DB_SCHEMA=
DB_TABLE_PREFIX=
where <dbname>
is the DB name I was asked to define (during nitro create
I think) and which it said it could connect to.
Under 'Databases' nitro context
reports:
Databases:
engine: mysql 5.6 hostname: mysql-5.6-3306.database.nitro
username: nitro password: nitro
port: 3306
Update 2
To start from scratch, I junked my nitro instance in Docker and uninstalled nitro, and then reinstalled it, and went through nitro create
again, and…
ended up in basically the same place.
I've tried my custom database name as the value of DB_DATABASE
and the default nitro
database name, and it makes no difference.
.env
file or have Nitro do it for you? YourDB_*
values need to reference the details you get for the relevant database engine runningnitro context
..env
I did a combination of both I think. I have updated my question above with the current state..env
so thatDB_SERVER=mysql-5.6-3306.database.nitro
in this case, not127.0.0.1
.