Skip to content

Commit

Permalink
medEng site docs
Browse files Browse the repository at this point in the history
  • Loading branch information
luukee committed Sep 4, 2024
1 parent 678e800 commit e64e9f7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
29 changes: 26 additions & 3 deletions _posts/2023-05-20-mediaengagement-technical-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ It might be a little overwhelming at first, but after a couple of weeks, things

### 2. Import .zip

- Request the lead dev to export a "slimmer" version of the site. This will be a .zip file you can import into your Local App.
> Windows users need to run the Local app as an administrator. Right-click on the Local app icon and select "Run as administrator" to open the app.
- Request the lead dev to [export a "slimmer" version](#export-from-local-app) of the site. This will be a .zip file you can import into your Local App.

- In the Local App click the plus (+) icon in the bottom left

Expand Down Expand Up @@ -65,7 +67,7 @@ Create a `config.json` file in the root of your theme (ex.`/themes/engage-2-x/co

Replace `localhost:10000` with the local URL in the Local App / Overview / Site host.

### 4. Proxy Requests for `/wp-content/uploads/` to the Production Site
### 4. Proxy Image Requests

This will save you storage on your machine because all images will be fetched from the live site.

Expand All @@ -79,7 +81,7 @@ This will save you storage on your machine because all images will be fetched fr
}
```

2. Open `siteRoot/conf/nginx/site.conf.hbs` in your editor and add the below snippet below the `{{/unless}}` line in the `# WordPress Rules`:
2. Open `siteRoot/conf/nginx/site.conf.hbs` in your editor and add the below snippet below the "{{/unless}}" line in the `# WordPress Rules`:

```
include uploads-proxy.conf;
Expand Down Expand Up @@ -1247,3 +1249,24 @@ If you want to optimize specific tables only, you can do so by running a SQL que
```bash
wp db query "OPTIMIZE TABLE wp_posts, wp_postmeta, wp_usermeta, wp_options;"
```

## Get WordPress Info

WP Sidebar > Site Health > Info Tab

# Lead Notes

## Export from Local App

To export a slimmer version of the site you first need to export your main site and import is into Local as a new site. This new site is the site you will remove files from to "slim" it down. Then you can export the new site and send the zip to the new undergrads.

**Delete these files & folders**

Before you export the new duplicate local site you need to delete these:

- siteRoot/app/public/.git
- siteRoot/app/public/wp-content/themes/engage-2-x/node_modules
- any vs code *.code-workspace files
- all .* files in siteRoot/app/public/
- siteRoot/app/public/enp-quiz-database-config.php
- siteRoot/app/public/LocalValetDriver.php
32 changes: 31 additions & 1 deletion _posts/2023-05-21-mediaengagement.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,37 @@ Welcome to the CME (Engage) Website documentation. This guide covers everything
```

### Step 4: Proxy Requests for `/wp-content/uploads/`
- Set up a proxy to save local storage by fetching images from the live site.
- Set up a proxy to save storage on you local machine by fetching images from the live/production site. If this step is not completed your local site willnot show any images.

<details>
<summary><strong>How to configure the proxy</strong></summary>

<ol>
<li>
<p>Create a file named <code>uploads-proxy.conf</code> in the <code>siteRoot/conf/nginx</code> directory with this content:</p>
<pre class="highlight"><code>
location ~ ^/wp-content/uploads/(.*) {
if (!-e $request_filename) {
rewrite ^/wp-content/uploads/(.*) https://mediaengagement.org/wp-content/uploads/$1 redirect;
}
}
</code></pre>
</li>

<li>
<p>Open <code>siteRoot/conf/nginx/site.conf.hbs</code> in your editor and add the below snippet below the <code>{{</code><code>/unless}}</code> line in the `# WordPress Rules`:</p>

<pre class="highlight"><code>
include uploads-proxy.conf;
</code></pre>

<p>Your updated <code>site.conf.hbs</code> hould look like this screenshot:</p>
<img src="../assets/img/site.conf.hbs-proxy.png" alt="Proxy Configuration Example" style="max-width: 100%; height: auto;">
</li>

<li>Save and restart the site in the Local App.</li>
</ol>
</details>

### Step 5: Sync with GitHub
- Initialize the repository and set the remote origin:
Expand Down
Binary file added assets/img/site.conf.hbs-proxy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e64e9f7

Please sign in to comment.