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

[SITE-988] Consolidate WordPress Composer multisite config doc with the existing Multisite Configuration doc #9260

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions source/content/guides/integrated-composer/06-ic-upstreams.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Integrated Composer
subtitle: Use an Upstream with Integrated Composer
description: Learn how to use an Upstream with Integrated Composer.
tags: [composer, workflow]
contributors: [ari, edwardangert]
reviewed: "2022-12-13"
contributors: [ari, edwardangert, jazzsequence]
reviewed: "2024-10-15"
showtoc: true
permalink: docs/guides/integrated-composer/ic-upstreams
contenttype: [guide]
Expand All @@ -21,20 +21,45 @@ This section provides information on how to use an Upstream with Integrated Comp

## Upstreams

An Upstream refers to the source code in Git that shares a Git history with "downstream" individual sites made from it. Upstreams includes the core code for [Drupal](https://github.com/pantheon-upstreams/drupal-composer-managed), [WordPress](https://github.com/pantheon-upstreams/wordpress-project), and some customizations for the Pantheon platform.
An Upstream refers to the source code in Git that shares a Git history with "downstream" individual sites made from it. Upstreams includes the core code for [Drupal](https://github.com/pantheon-upstreams/drupal-composer-managed), [WordPress](https://github.com/pantheon-upstreams/wordpress-composer-managed), and some customizations for the Pantheon platform.

### Upstream and Site Structure

<Partial file="ic-upstream-structure.md" />

<Partial file="upstream-management-dependencies.md" />

## Create Your Integrated Composer Custom Upstream

Follow the steps in this section to create a custom upstream that uses Integrated Composer.

1. Fork the Pantheon-maintained [WordPress (Composer Managed)](https://github.com/pantheon-upstreams/wordpress-composer-managed) or [Drupal Composer Managed](https://github.com/pantheon-upstreams/drupal-composer-managed) upstream repository.

1. [Connect your repository](/guides/custom-upstream/create-custom-upstream#connect-repository-to-pantheon) to Pantheon.

1. Update the **require** section of the root `/composer.json` file to match the name you chose in the preceding step.

## Add and Remove Packages

1. Use `composer require`in the `upstream-configuration` directory (or `composer upstream-require` if using `upstream-management`) to edit the upstream `composer.json` file.
- The WordPress (Composer Managed) repository places a theme in the upstream `composer.json` file. This works well for downstream sites that all use the same theme. You should remove themes from the upstream `composer.json` file if you do not intend to use the upstream to lock downstream sites into a particular theme. You cannot remove installed packages from downstream sites if the packages were included from the upstream site.

## Maintain Your Integrated Composer Fork

There are some special considerations to keep in mind if you intend to make modifications to your upstream based on this repository.

1. Increase the version number listed in the `upstream-configuration/composer.json` file each time you make edits.
- Composer checks the contents of the root `/composer.json` file for changes that should be pushed to your upstream configuration.

1. Verify your changes to the `upstream-configuration/composer.json` file by running `composer install` or `composer update` in the `upstream-configuration` directory.
- Be careful not to rely on ["root-only" properties of composer.json](https://getcomposer.org/doc/04-schema.md).

## More Resources

- [Custom Upstreams](/guides/custom-upstream)

- [Autopilot for Custom Upstreams](/guides/autopilot-custom-upstream)

- [Migrate a Custom Upstream to Drupal](/guides/drupal-hosted-createcustom)

- [Pantheon YAML Configuration Files](/pantheon-yml)
- [Best Practices for Maintaining Custom Upstreams](/guides/custom-upstream/maintain-custom-upstream)
- [Composer Fundamentals and WebOps Workflows](/guides/composer)
- [Create a Composer-managed WordPress Site with Bedrock](/guides/wordpress-composer/wordpress-composer-managed)
46 changes: 41 additions & 5 deletions source/content/guides/multisite/03-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,42 @@ Complete the steps below after spinning up a new WPMS site from the correct Cust
/* That's all, stop editing! Happy Pressing. */
```

## Setting up Multisite on WordPress (Composer Managed) sites

The [Bedrock](https://roots.io/bedrock/)-based [WordPress (Composer Managed)](https://github.com/pantheon-systems/wordpress-composer-managed) upstream uses `Config::define()` and `config/application.php` instead of traditional `define()` statements in `wp-config.php`. You will not be able to use WP-CLI via Terminus to enable multisite as documented above in a standard multisite configuration. This section provides guidance on how to set up a WordPress Multisite using the WordPress (Composer Managed) upstream.

1. Set the site's connection mode to Git:

```bash{promptUser: user}
terminus connection:set <site>.dev git
```
2. Open the `config/application.php` file in your site's codebase and add the following line anywhere _above_ the `Config::apply();` line:

```php
Config::define( 'WP_ALLOW_MULTISITE', true );
```
3. Visit your development site's WordPress admin and navigate to **Tools** > **Network Setup**.
![Network Setup page](../../../images/wordpress-composer/04-multisite-network-setup.png)
4. Choose **Sub-domains** or **Sub-directories** (depending on your needs), fill in the Network Title and Admin Email, and click **Install**.
5. You will be given instructions to update your `config/application.php` file. Below where you added the `WP_ALLOW_MULTISITE` line, copy and paste the code provided. The `SUBDOMAIN_INSTALL` value will be `true` or `false` depending on the option you chose in the previous step. For example, if you chose subdirectories, your `config/application.php` file should look like this:

```php
Config::define( 'MULTISITE', true );
Config::define( 'SUBDOMAIN_INSTALL', false );
// Use PANTHEON_HOSTNAME if in a Pantheon environment, otherwise use HTTP_HOST.
Config::define( 'DOMAIN_CURRENT_SITE', defined( 'PANTHEON_HOSTNAME' ) ? PANTHEON_HOSTNAME : $_SERVER['HTTP_HOST'] );
Config::define( 'PATH_CURRENT_SITE', '/' );
Config::define( 'SITE_ID_CURRENT_SITE', 1 );
Config::define( 'BLOG_ID_CURRENT_SITE', 1 );
```
6. Save your changes and commit them to your Git repository. WordPress will prompt you to log back in after you push the changes.
7. Log into your site. When you log back into your WordPress admin dashboard, you will see a new **My Sites** menu item in the top left corner. This is where you can manage your network of sites. You now have a WordPress subdirectory multisite network set up on a WordPress (Composer Managed)-based upstream.
![My Sites](../../../images/wordpress-composer/04-multisite-my-sites.png)

<Alert type="danger" title="Multisite Search and Replace with WordPress (Composer Managed)">
Currently, the built-in dashboard [WordPress Multisite Search and Replace](/guides/multisite/search-replace/) does not support Composer-based WordPress multisites. To perform a search and replace on a WordPress (Composer Managed) multisite, you will need to use WP-CLI via Terminus manually. For more information, see our [WordPress Multisite Search and Replace](guides/multisite/workflows/#run-wp-cli-search-replace-manually) guide.
</Alert>

## Develop the Multisite

Congratulations on setting up your first WordPress Multisite. When you log in to the WordPress Dashboard, you'll see a **My Sites** menu item in the toolbar:
Expand Down Expand Up @@ -178,8 +214,8 @@ define( 'DOMAIN_CURRENT_SITE', PANTHEON_HOSTNAME );

## More Resources

- [Environment-Specific Configuration for WordPress Sites](/guides/environment-configuration/environment-specific-config)

- [WordPress Pantheon Cache Plugin Configuration](/guides/wordpress-configurations/wordpress-cache-plugin)

- [WordPress with Composer on Pantheon](/guides/wordpress-composer)
* [Environment-Specific Configuration for WordPress Sites](/guides/environment-configuration/environment-specific-config)
* [WordPress Pantheon Cache Plugin Configuration](/guides/wordpress-configurations/wordpress-cache-plugin)
* [WordPress with Composer on Pantheon](/guides/wordpress-composer)
* [WordPress Multisite documentation](https://developer.wordpress.org/advanced-administration/multisite/)
* [WordPress Multisite Domain Mapping](https://developer.wordpress.org/advanced-administration/multisite/domain-mapping/)

This file was deleted.

80 changes: 0 additions & 80 deletions source/content/guides/wordpress-composer/06-wordpress-ic.md

This file was deleted.

Loading
Loading