Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 53a27a6

Browse files
authored
Merge pull request #4188 from kkdg/master
[Docs] Production caching methods added + Elastic cookbook
2 parents ee7146a + 790f9f6 commit 53a27a6

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

docs/guide/cookbook/elastic.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,14 @@ module.exports = function (restClient) {
623623
}
624624
625625
````
626-
This library file only deals with _GET_ API to get a list of offline stores from Magento 2.
626+
This library file only deals with _GET_ API to get a list of offline stores from Magento 2.
627+
628+
:::tip NOTE
629+
```js
630+
var endpointUrl = util.format('/offline-stores');
631+
```
632+
This line is particularly important, since `'/offline-stores'` is where the API url endpoint is determined. It should match the API url endpoint of Magento 2 side.
633+
:::
627634
628635
5. Now we need to include this library in `index.js` :
629636
```bash
@@ -713,7 +720,7 @@ debug: Response received.
713720
2020-03-10T09:22:32.140Z - info: No tasks to process. All records processed!
714721
2020-03-10T09:22:32.140Z - info: Task done! Exiting in 30s...
715722
```
716-
:::tip NOTE
723+
:::warning NOTE
717724
You should tell the machine the environment variable like this before running the command :
718725
```bash
719726
export MAGENTO_URL=http://localhost/rest
@@ -855,16 +862,16 @@ Now you are all set to use custom entity you just created. The next step lets yo
855862
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
856863
import { registerModule } from '@vue-storefront/core/lib/modules'
857864
import { OrderModule } from '@vue-storefront/core/modules/order'
858-
import { quickSearchByQuery } from '@vue-storefront/core/lib/search';
865+
import { quickSearchByQuery } from '@vue-storefront/core/lib/search'; // Import the method to fetch data from ES
859866
860867
const storeView = currentStoreView()
861868
862869
// ... abridged
863870
864871
methods: {
865-
async showPayment () {
866-
let offlineStores = await quickSearchByQuery({ entityType: 'offline_stores' });
867-
alert("Your item will be sent from the shop at " + offlineStores.items[0].address);
872+
async showPayment () { // the method should be done with async/await
873+
let offlineStores = await quickSearchByQuery({ entityType: 'offline_stores' });
874+
alert("Your item will be sent from the shop at " + offlineStores.items[0].address);
868875
const payment = new PaymentRequest(this.paymentMethods, this.paymentDetails , this.paymentOptions)
869876
870877
// abridged ...
@@ -875,18 +882,7 @@ Now go to your online shop, put an item to cart and open it, click __Instant Che
875882
![instant_checkout_store_borderline](../images/stores.png)
876883
877884
878-
### 2-1. Recipe B (with GraphQL)
879-
880-
1. First off, we need to create an `graphql` folder under `src/search/adapter/` as follows :
881-
```bash
882-
cd src/search/adapter
883-
mkdir graphql
884-
```
885885
886-
2. Copy `searchAdapter` file from `core` folder :
887-
```bash
888-
cp ../../../core/lib/search/adapter/graphql/searchAdapter.ts graphql/
889-
```
890886
891887
### 3. Peep into the kitchen (what happens internally)
892888
In this recipe, we iterated a whole journey of building custom entities on your online shop (it was Magento 2 for this time) for whatever reason to deal with various information for enhancing your customer experience.
@@ -898,7 +894,7 @@ Second, as an appetizer, we had to import data from shop using _mage2vuestorefro
898894
Third, main dish, we extended core adapters in `src` folder so we are safe for future updates :).
899895
It was actually very easy! you just need to `registerEntityType` for your custom entity! We also looked at how to implement it in real example though it was simplified version, you better follow `vuex` best practice.
900896
901-
We also have a variety of main dish, by giving you an option to go with _GraphQL_. This approach took us a little more to tweak with, but believe me, _GraphQL_ has pretty good advantage over its competitors.
897+
We also have a variety of main dish, by giving you an option to go with _GraphQL_. This approach took us a little more to tweak with, but believe me, _GraphQL_ has [pretty good advantage](https://www.altexsoft.com/blog/engineering/graphql-core-features-architecture-pros-and-cons/) over its competitors.
902898
903899
Now we can extend our shop as good as it gets to handle more versatile information on your shop. Congratulation!
904900

docs/guide/installation/production-setup.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,14 @@ yarn start
444444

445445
Both applications use [`PM2` process manager](https://pm2.keymetrics.io/docs/usage/process-management/) in production mode (`start` commands) to manage and respawn the node.js processes when needed.
446446

447+
## Cache Strategies
448+
449+
### Varnish cache for VSF
450+
_Vue Storefront_ has multiple layers of cache, and the forefront cache is _Varnish_ which serves a request just as fast as a static HTML page once it's hit. You can install it from [here](https://github.com/new-fantastic/vsf-cache-varnish).
451+
452+
### Vue Storefront Proxy
453+
_Vue Storefront_ can be set up with [OpenResty](http://openresty.org/en/) based reverse proxy serving cached pages from Redis without Vue StoreFront (VSF or VSF API) calls, using LUA. [Here](https://github.com/ClickAndMortar/docker/tree/master/vue-storefront/proxy) is the github repo.
454+
447455
## Production setup - using Docker / Kubernetes
448456

449457
To be prepared.

0 commit comments

Comments
 (0)