Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Provide wordpress quickstart for the standard wordpress? #3299

Closed
mandrasch opened this issue Oct 10, 2021 · 12 comments
Closed

Docs: Provide wordpress quickstart for the standard wordpress? #3299

mandrasch opened this issue Oct 10, 2021 · 12 comments

Comments

@mandrasch
Copy link
Collaborator

mandrasch commented Oct 10, 2021

My open suggestion would be to provide an example of a standard wordpress installation which can be used out of the box in the quickstart chapter https://ddev.readthedocs.io/en/stable/users/cli-usage/#wordpress-quickstart

In my personal opinion roots/bedrock as first example is a little bit confusing to people who just want to get wordpress up and running. I thought in the beginning DDEVs project-type=wordpress is tightly couple with it (which I now know is not the case :))

A suggestion I came up with is this:

Setup Example Using WP-CLI

mkdir my-wp-site
cd my-wp-site
ddev config --project-type=wordpress --docroot=web --create-docroot
ddev start
ddev ssh
cd web/
wp core download
wp core install --url=https://my-wp-site.ddev.site --title="New WordPress" --admin_user=admin --admin_email=admin@example.com --prompt=admin_password
exit
ddev launch

I tested it on mac, it works, wp core install does not delete the existing wp-config.php, there are just two notices displayed:

PHP Notice:  Constant ABSPATH already defined in phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1231) : eval()'d code on line 18

Notice: Constant ABSPATH already defined in phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1231) : eval()'d code on line 18

Found #3297, this should fix it? 🤔

Just a suggestion, no hard feelings if this issue gets closed. Thanks for maintaining DDEV! 👍 👍 👍

@gilbertsoft
Copy link
Member

The PHP Notice will be fixed with #3298

@rfay
Copy link
Member

rfay commented Oct 10, 2021

This would be accepted, go ahead and do a PR.

The problem with "standard" WP is there isn't actually a "standard", but I'm still willing to go with your definition of standard. Add it as a 3rd option on WP, and add it before "Composer Setup Example Using roots/bedrock" with a good descriptive name. You can do this by just editing https://ddev.readthedocs.io/en/stable/users/cli-usage/#wordpress-quickstart - click the pencil on that page in the upper right. But test it carefully please!

@mandrasch
Copy link
Collaborator Author

mandrasch commented Oct 15, 2021

Short update - another way of doing it could be:

mkdir my-wp-site
cd my-wp-site/
ddev config --project-type=wordpress --docroot=web --create-docroot
ddev start
ddev exec 'cd web/ && wp core download && wp core install --url=https://my-wp-site.ddev.site --title="New WordPress" --admin_user=admin --admin_email=admin@example.com --prompt=admin_password'
ddev launch

A really cool way of doing the install would be wp core install --url=$DDEV_URL (inspired by https://de.slideshare.net/FrankSchmittlein/ddev-eine-lokale-entwicklungsumgebung), but this only works in custom commands as far as I know?

I'll try to gather some more feedback before creating a PR.

@rfay
Copy link
Member

rfay commented Oct 15, 2021

Before switching to the roots example, we had something like the git checkout instructions for years, https://ddev.readthedocs.io/en/stable/users/cli-usage/#git-clone-example

But it seemed so few people had their sites under git control that it had no meaning to them. Your strategy of a wp core install seems quite good.

@rfay
Copy link
Member

rfay commented Oct 15, 2021

A really cool way of doing the install would be wp core install --url=$DDEV_URL (inspired by https://de.slideshare.net/FrankSchmittlein/ddev-eine-lokale-entwicklungsumgebung), but this only works in custom commands as far as I know?

No, I know no reason why that wouldn't work. wp-cli ships in the container always. So you can ddev exec away.

But projects of type wordpress do also come with the ddev wp wrapper command, so you can just use ddev wp.

@jonaseberle
Copy link
Collaborator

I would leave out the webroot ./web.

This is a bit simpler (and uses DDEV_PRIMARY_URL):

mkdir my-wp-site
cd my-wp-site/
ddev config --project-type=wordpress
# "ddev start" is not even needed here since "ddev wp" will startup ddev, too
ddev wp core download
# optional: you can use this automated install or leave it out (and finish installation in the frontend)
ddev exec 'wp core install --url=$DDEV_PRIMARY_URL --title="New WordPress" --admin_user=admin --admin_email=admin@example.com --prompt=admin_password'
ddev launch

@rfay
Copy link
Member

rfay commented Oct 15, 2021

Should be able to
ddev wp core install --url=$DDEV_PRIMARY_URL --title="New WordPress" --admin_user=admin --admin_email=admin@example.com --prompt=admin_password

@jonaseberle
Copy link
Collaborator

jonaseberle commented Oct 15, 2021

Would be nice but I don't think so because $DDEV_PRIMARY_URL is being expanded in the calling shell. I tried some escaping like
ddev wp core install --url='$DDEV_PRIMARY_URL' --title="New WordPress" --admin_user=admin --admin_email=admin@example.com --prompt=admin_password
but to no avail.

@rfay
Copy link
Member

rfay commented Oct 16, 2021

ddev wp 'core install --url=$DDEV_PRIMARY_URL --title="New WordPress" --admin_user=admin --admin_email=admin@example.com --prompt=admin_password' works, but not sure it's worth the bother.

@rfay
Copy link
Member

rfay commented Oct 16, 2021

Oh and btw your recipe from #3299 (comment) is great.

@mandrasch
Copy link
Collaborator Author

I like #3299 (comment) very much too! 👍 👍

Personally I would suggest sticking either to 'ddev wp' or 'ddev exec wp', otherwise this could be confusing. (Thanks @rfay for showing how it's done with ddev wp!) Here is a variation with 'ddev exec' only, I added some comments as well for better understanding:

mkdir my-wp-site
cd my-wp-site/

# create a new DDEV project inside this folder
# (the primary URL is automatically set to https://<folder>.ddev.site) 

ddev config --project-type=wordpress

# download latest wordpress (via built-in WP-CLI)

ddev exec wp core download

# optional: you can use this automated install or finish installation in your browser (see next step)
# (we need to use single quotes to get the primary site URL from .ddev/config.yaml automatically)

ddev exec 'wp core install --url=$DDEV_PRIMARY_URL --title="New WordPress" --admin_user=admin --admin_email=admin@example.com --prompt=admin_password'

# open website (https://my-wp-site.ddev.site) in your browser

ddev launch

# after installation: open WP admin dashboard in your browser

ddev launch wp-admin/

Optional side notes:

  • a) While I like short quickstart description as well, my educated guess is that some wordpress devs don't fiddle around with npm or other cli tools. Therefore this approach could need a lot of explaining in contrast to a "standard" wordpress installation via FTP (and maybe phpMyAdmin). I personally needed at least some months to figure out what DDEV was doing behind the scenes when I ran commands.
  • b) I added navigating to /wp-admin/, because this is done so often in WP world and most of the time we'll type it in the browsers adress bar because there is no link to the admin dashboard on the page itself. ;-) Could be a nice way of showing some of DDEVs magical advantages ;-)
  • c) Also I'm not sure If 'ddev start' should be left out, even if it is not needed. I worry that there might confusion after a reboot on how to get the project running. Writing that I noticed that 'ddev launch' also triggers 'ddev start' of course... An short official screencast could clear up some confusion I guess. Therefore: Leaving it out on quickstart is okay imho!

@rfay
Copy link
Member

rfay commented Nov 2, 2021

Looking forward to your docs PR, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants