Skip to content

Commit 2c8c3da

Browse files
Merge pull request #81 from bcgov/documentation/DESCW-2980_update-documentation
DESCW-2980 updates docs with new setup and local deploy instructions.
2 parents 05f5f69 + c861ae9 commit 2c8c3da

1 file changed

Lines changed: 50 additions & 17 deletions

File tree

documentation/docs/guide/GettingStarted/deploy_locally.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,32 @@ cd wordpress/dev
1818
cp sample-env .env
1919
```
2020

21+
::: tip
22+
you should be using <https://github.com/bcgov/wordpress> as your local WordPress development.
23+
ensure you pull the latest: `git pull origin main` before you start working on your local WordPress development.
24+
:::
25+
2126
## Environment Basics
2227

2328
- Update variables inside `.env` file to reflect your setup.
2429
- The `CONTENT_DIR` variable is the location of your WordPress content directory.
2530
- The `TEMP_DIR` variable can be used to import/export db using the wp-cli command.
26-
::: tip
27-
When Importing and Exporting databases with the `wp cli` This will be the link between the WordPress container and your local machine.
28-
:::
31+
::: tip
32+
When Importing and Exporting databases with the `wp cli` This will be the link between the WordPress container and your local machine.
33+
:::
34+
::: warning Optional: Switching to Rancher Desktop
35+
If you are using Docker Desktop, you can switch to Rancher Desktop. This is not required, but it is recommended for a more stable experience.
36+
Rancher Desktop is a free and open-source desktop application that is designed to be lightweight and easy to use.
37+
38+
If you want to use Rancher Desktop:
39+
40+
- Uninstall Docker Desktop
41+
- Install and start Rancher Desktop: https://rancherdesktop.io/
42+
- Don't enable Kubernetes
43+
- run `wp_start` (might have to do this 2x and it should create a network)
44+
- `wp db import /tmp/WordPress/all-sites-2025-04-03.sql` (or whatever the name of your file is)
45+
your site should now be back to normal.
46+
:::
2947

3048
## Setting up SSL on Mac (required)
3149

@@ -46,11 +64,11 @@ docker compose --file docker-compose-init.yaml run self-signed-certificate-gener
4664
![keychainSnippet](../../assets/keychainSnippet.png)
4765

4866
::: tip
49-
If this cert is not working, try restarting your MAC, however there might be a less drastic way of making this work.
67+
If this cert is not working, try refreshing the Keychain or verifying the certificate installation before considering a Mac restart as a last resort.
5068
:::
5169

5270
::: warning
53-
WordPress will now run on localhost port 443, which is exactly the same port that Kubernetes runs on. Therefore local Kubernetes and WordPress can't be running at the same time.
71+
WordPress will now run on localhost port 443, which is exactly the same port that Kubernetes runs on. Therefore, local Kubernetes and WordPress can't be running at the same time.
5472
:::
5573

5674
## Run Docker compose
@@ -70,18 +88,31 @@ docker compose up --build
7088
wp_start
7189
```
7290

91+
- ensure that the wp-cli container backs up the latest WP Database
92+
- You should see the following in the terminal:
93+
94+
```shell:no-line-numbers
95+
...
96+
wp-cli-1 | *** Backing up Database in case of disaster ***
97+
wp-cli-1 | Success: Exported to '/tmp/WordPress/all-sites-<yyyy-mm-dd>.sql'.
98+
# (This should be accessible to ~/tmp/WordPress)
99+
...
100+
```
101+
73102
- Access Wordpress at [https://localhost](https://localhost)
74-
- Access PHPMyAdmin at [http://localhost:8081](http:/localhost:8081) (Note: does not use https)
103+
- Access PHPMyAdmin at [http://localhost:8081](http://localhost:8081) (Note: does not use https)
75104

76-
When you access Wordpress local for the first time, you will be prompted with the intial setup. You can use this screenshot for reference for what to enter.
105+
When you access Wordpress local for the first time, you will be prompted with the initial setup. You can use this screenshot for reference for what to enter.
77106

78107
![wordpressInitialSetup](../../assets/wordpressInitialSetup.png)
79108

80109
Once you have filled out all required inputs, click "Install WordPress"
81110

82-
## Optional multi-site (Recommended):
111+
## Recommended multi-site configuration
83112

84-
WordPress (WP) multisite is a configuration that enables multiple websites on the same WP installation.
113+
::: tip
114+
WordPress (WP) multi-site is a configuration that enables multiple websites on the same WP installation.
115+
:::
85116

86117
- In the WordPress admin UI, go to menu Tools -> Network Setup and click install
87118
- Bring down the WordPress site `docker compose down` (or \<CTRL>-C if docker is in the foreground and then `docker compose down`).
@@ -94,23 +125,26 @@ WordPress (WP) multisite is a configuration that enables multiple websites on th
94125

95126
<img src="/images/max-upload-file-size.png" style="max-width:250px;margin: 1rem 0"/>
96127

97-
## Running Thereafter:
128+
- The WordPress wp-content directory can be found at the path specified in your `.env` file under the `CONTENT_DIR` variable.
129+
130+
## Running Thereafter
98131

99132
- `docker compose up` runs the nginx, db, WordPress php-fpm, and wp-cli containers, this will also output debug.log in the stdout.
100133

101134
- WordPress wp-content directory, can be found at the path specified in your `.env` under variable `CONTENT_DIR`, .
102135

103-
## Helper functions.
136+
## Helper functions
104137

105138
The [Helper functions](./bin/commands.sh) can be linked to run anytime a new terminal window is open by adding it to your `~/.bash_profile`
106139

107-
### Including helper functions in bash profile.
140+
### Including helper functions in bash profile
108141

109142
::: tip
110143
In order to make the helper functions accessible you need to include them into your bash or zsh profile. These commands then can be run from anywhere on your file system from a terminal window.
111144
:::
112145

113-
If you are using bash add this to your `~/.bash_profile`
146+
If you are using bash, add this to your `~/.bash_profile`.
147+
If you are using Zsh, add this to your `~/.zshrc`.
114148

115149
```bash
116150
if [ -f /location-of-this-repo/wordpress/dev/bin/commands.sh ] ; then
@@ -164,16 +198,15 @@ If a plugin has been configured to use this method of unit testing, we can run t
164198

165199
The WordPress Docker instance must be up and running to use the `wp_setup_tests` or `wp_test` commands (run `wp_start` to start the Docker instance).
166200

167-
### Setup
201+
### Testing Setup
168202

169203
To set up the WP testing environment inside the WordPress container, run the command `wp_setup_tests` from anywhere.
170204

171205
If you get an error saying `command not found: wp_setup_tests`, follow the steps in the "Helper functions" section above.
172206

173207
### Running tests
174208

175-
To run a test:
176-
1. Navigate to the plugin you want to execute tests on.
177-
2. Run the command `wp_test`.
209+
1. Navigate to the plugin you want to execute tests on: `cd /path/to/your/plugin-directory`
210+
2. Run `wp_test`.
178211
- If you get a message saying "No tests executed" the plugin is most likely not configured using the `wp scaffold plugin-tests` command so its tests cannot be executed this way. Run the unit tests locally instead (`composer run test`).
179212
- If you get a message saying "Have you run bin/install-wp-tests.sh?" you will need to run the `wp_setup_tests` command, then try again.

0 commit comments

Comments
 (0)