Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit d8b4771

Browse files
authored
Merge pull request #67 from DivanteLtd/develop
docker support
2 parents 981835c + b3cd25b commit d8b4771

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+7249
-6772
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMPOSE_PROJECT_NAME=vue-storefront-api

README.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,47 @@ Besides a big improvement for the shopping experience, we also want to create a
1616

1717
## Requirements
1818

19-
- Node.js 8.x or higher
2019
- Docker and Docker Compose
20+
21+
Already included in `vue-storefront-api` Docker image (required locally, if you do not use containerization):
22+
- Node.js 8.x or higher
23+
- Yarn
2124
- [ImageMagick](https://www.imagemagick.org/script/index.php) (to fit, resize and crop images)
2225

2326
## Installation
2427

25-
**Warm up [ElasticSearch](https://www.elastic.co/products/elasticsearch) Cluster and [Redis](https://redis.io/)**
28+
**Start a containerized environment**
2629

30+
The **legacy** (A) mode - starting just the Elastic and Redis containers:
2731
`docker-compose up -d`
2832

29-
`npm run migrate` to execute all data migrations up to date
33+
The **standard** (B) mode - starting Elastic, Redis + Vue Storefront API containers:
34+
`docker-compose -f docker-compose.yml -f docker-compose.nodejs.yml up -d`
3035

31-
**Import product catalog**
36+
As a result, all necessary services will be launched:
37+
- Vue Storefront API runtime environment (Node.js with dependencies from `package.json`)
38+
- [ElasticSearch](https://www.elastic.co/products/elasticsearch)
39+
- [Redis](https://redis.io/)
40+
- Kibana (optional)
3241

33-
Product catalog is imported using [elasticdump](https://www.npmjs.com/package/elasticdump), which is installed automatically via project dependency. The default ElasticSearch index name is: `vue_storefront_catalog`
42+
Then, to update the structures in the database to the latest version (data migrations), do the following:
3443

35-
`npm run restore`
44+
(A) `docker exec -it vuestorefrontapi_app_1 yarn migrate`
45+
(B) `yarn migrate`
3646

37-
It restores JSON documents stored in `./var/catalog.json`. The opposite command - used to generate `catalog.json` file from running ElasticSearch cluster:
47+
By default, the application server is started in development mode. It means that code auto reload is enabled along with ESLint, babel support.
3848

39-
`npm run dump`
49+
**Import product catalog**
4050

41-
**Run development server**
51+
Product catalog is imported using [elasticdump](https://www.npmjs.com/package/elasticdump), which is installed automatically via project dependency. The default ElasticSearch index name is: `vue_storefront_catalog`
4252

43-
Code auto reload is enabled along with ESLint, babel support.
53+
(A) `yarn restore`
54+
(B) `docker exec -it vuestorefrontapi_app_1 yarn restore`
55+
56+
It restores JSON documents stored in `./var/catalog.json`. The opposite command - used to generate `catalog.json` file from running ElasticSearch cluster:
4457

45-
`PORT=8080 npm run dev`
58+
(A) `yarn dump`
59+
(B) `docker exec -it vuestorefrontapi_app_1 yarn dump`
4660

4761
**Access ElasticSearch data with Kibana**
4862

@@ -57,7 +71,7 @@ Catalog API calls are compliant with ElasticSearch (it works like a filtering pr
5771

5872
Elastic search endpoint: `http://localhost:8080/api/catalog/search/<INDEX_NAME>/`. You can run the following command to check if everything is up and runing (it assumes `vue_storefront_catalog` as default index name):
5973

60-
`curl -i http://localhost:8080/api/search/vue_storefront_catalog/_search?query=*`
74+
`curl -i http://elastic:changeme@localhost:8080/api/search/vue_storefront_catalog/_search?query=*`
6175

6276
## Data formats
6377
This backend is using ElasticSearch data formats popularized by [ElasticSuite for Magento2 by Smile.fr](https://github.com/Smile-SA/elasticsuite).
@@ -75,7 +89,7 @@ To do this, define the `package.json` with your dependencies in your custom modu
7589
- `src/api/extensions/{your-custom-extension}/package.json`
7690
- `src/platforms/{your-custom-platform}/package.json`
7791

78-
Executing `yarn` at root level will also download your custom modules dependencies.
92+
Executing `docker exec -it vuestorefrontapi_app_1 yarn install` will also download your custom modules dependencies.
7993

8094
NOTE: `npm` users will still have to install the dependencies individually in their modules.
8195

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"server": {
3+
"host": "BIND_HOST",
4+
"port": "BIND_PORT"
5+
},
6+
"elasticsearch": {
7+
"host": "ELASTICSEARCH_HOST",
8+
"port": "ELASTICSEARCH_PORT"
9+
},
10+
"redis": {
11+
"host": "REDIS_HOST",
12+
"port": "REDIS_PORT"
13+
}
14+
}

0 commit comments

Comments
 (0)