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

Add WordPress Playground blueprint #1282

Merged
merged 3 commits into from
Oct 15, 2024
Merged

Conversation

dottxado
Copy link
Contributor

Description of the Change

I added the WordPress Playground blueprint that permits to spin up a WordPress instance and demonstrates the Distributor plugin in action. The blueprint ships an environment with the following:

  • multisite active and two websites created
  • the plugin installed and activated at network level

Closes #1266

⚠️ An important note: the blueprint installs the plugin from the stable branch, but in the documentation I built the example URL pointing to the develop branch (which is where this PR is pointing to). I don't know if you prefer the example URL to target the stable branch, so please let me know!

How to test the Change

You can test the blueprint by following this link

Changelog Entry

Added - Playground blueprint and documentation

Credits

Props @dottxado

Checklist:

@dottxado dottxado requested a review from a team as a code owner October 11, 2024 11:42
@dottxado dottxado requested review from Sidsector9 and removed request for a team October 11, 2024 11:42
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this working, looks really good!

Two things I'd suggest:

  1. When the Playground is ready, it just lands you on the homepage of the main site. I think landing you on one of the Distributor settings screens would be a better demo experience, maybe /wp-admin/admin.php?page=pull? Or maybe just a single post in the admin, giving a user quick access to try pushing content?
  2. Would be great to add a badge to the readme file that links to the Playground. Can see an example of that here

@dottxado
Copy link
Contributor Author

Hello @dkotter!
Thanks for the feedback, I added the badge and the landing page. About this last change, I wanted to suggest to add some content with WP-CLI ready to be distributed (and not relying only the "Hello world" default one), but I am not finding a proper way, and I also would like to not overcomplicate the blueprint only to create some content.

Please let me know if you want me to move the bluprint.json file to another folder: from the classifai PR I see it has been loaded in the .github folder.

@jeffpaul
Copy link
Member

If additional content is desired, perhaps using starter content might help there?

@jeffpaul jeffpaul added this to the 2.1.0 milestone Oct 14, 2024
@dottxado
Copy link
Contributor Author

Hello @jeffpaul!
In my opinion, the problem with the solutions I have considered is overengineering, and I don't think the game is worth it, in terms of the readability and maintainability of the blueprint 🤔

I have tested the following setups:

  • a WP-CLI step that creates a demo post in the second website: it doesn't work because I need to provide the website full URL that I don't know. I tried to compose WP-CLI commands to obtain the URL but, without surprise, it wasn't working
  • a WP-CLI step that creates a demo post on the first website while the blueprint lands the user in the dashboard of the second: WordPress is loaded on the 404 page. Manually I can navigate to the dashboard and everything works, so it is not really clear why it isn't working automatically.

The nearest solution I can provide with a small footprint on the blueprint is like the last one, but instead of using the dashboard as a landing page, I can land you on the homepage of the second website. This is an example if you want to test
And these are the changes in the blueprint:

- "landingPage": "/wp-admin/admin.php?page=pull",
+ "landingPage": "/test",
.
.
.
+    {
+      "step": "wp-cli",
+     "command": "wp post create --post_type=post --post_title='A sample post to be distributed'"
+    }

Every other setup I thought of requires writing a plugin to insert content into the second website, while the blueprint can land you in the dashboard of the first website. Is it worth having such a portion of code inside the blueprint? Also, this idea is untested, so I don't even know if it will work 🤷‍♀️
Sounds to me that the issues I have encountered will be fixed in the future (maybe I can open some issues to track them), so I don't think that this amount of overengineering is needed 😄
Let me know your thoughts!

@dkotter
Copy link
Collaborator

dkotter commented Oct 15, 2024

@dottxado This looks good to me and I agree that we can look to make additional changes to the content in the future if we decide that's worth the effort. For now this at least gets a demo environment working

@dkotter dkotter merged commit 83e7f4d into 10up:develop Oct 15, 2024
9 of 10 checks passed
@dottxado
Copy link
Contributor Author

Cool, thank you very much for having me contribute, @dkotter! 😄
Can I ask you if you can add the hacktoberfest-accepted label? 🙇

@dottxado dottxado deleted the add-blueprint branch October 15, 2024 20:44
@jeffpaul
Copy link
Member

Sharing some notes here on leveraging Starter Content to get some example posts/pages onto the multisite, perhaps even some that show posts already in a push and pull state as examples for folks (maybe going even further with skipped in the pull state).

Two new blueprints in the Gallery: ImportStarter Content

Since WordPress 4.7, Theme builders could add Starter Content to their themes, to showcase how the theme could shine or to give users a head start on building their new site. Playground offers two methods to import Starter Content: via an option on the installTheme step or as a separate importStarterContent step. The two new examples in the Blueprint Gallery show how to use both of them.

startercontent

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

Successfully merging this pull request may close these issues.

Add WordPress Playground integration
3 participants