Description
This is the "main" component of both Vue Storefront Frontend and Vue Storefront Backend instances.
Settings
As with all components, this component uses parent -> child inheritance. If you configure the settings on a live instance, all child instances will initially inherit these settings.
Once the instance has rolled up you can change them as required.
SSettings
- Version - The version of NodeJs to use.
- Post rollup commands - Commands to run to set up the environment, you can use this to install additional dependencies/binaries that your project requires and aren't available by default
- Host File Amends - Entries you would like to add to the host file (/etc/hosts). This can be especially useful when you have api endpoints that aren't available through public DNS.
Recreation
Files modified by env variables
Platform | File | Delimeter | Example |
---|---|---|---|
VSF Backend | config/local.json | <%:%> |
host value to localhost you would pass in -e VSF_SERVER_HOST=localhost |
To change the
ecosystem.json | {% raw %}{{:}}{% endraw %} |
max_memory_restart value to 1G you would pass in -e PM2_MAX_MEMORY_RESTART=1G |
To change the |
VSF Frontend | config/local.json | <%:%> |
host value to localhost you would pass in -e VSF_SERVER_HOST=localhost |
To change the
ecosystem.json | {{:}} |
max_memory_restart value to 1G you would pass in -e PM2_MAX_MEMORY_RESTART=1G |
To change the
As part of the image creation MDOQ will:
- copy
config/default.json
toconfig/local.json
- apply any custom variables you have configure
This means that anything set in custom variables will be static across environments.
The rule of thumb is: "If it should change per environment use environment variables. If it shouldn't change per environment use custom variables"
Default Environment Variables
To help with configuration and post release action scripts MDOQ provides a number of environment variables to each instance that can be accessed.
You can confirm these yourself by running printenv
from within an SSH session.
Vue Storefront Backend
Variable | Default Vaule | Addtional Notes |
---|---|---|
VS_ENV |
prod |
|
MDOQ_INSTANCE_ID |
|
The ID of the current instance |
MDOQ_INSTANCE_TICKET_NUMBER |
|
The ticket number of the current instance |
MDOQ_INSTANCE_TYPE |
|
The type of the current instance (development , release-candidate ) |
PM2_ARGS |
||
PM2_INSTANCES |
0 |
|
PM2_MAX_MEMORY_RESTART |
1G |
|
VSF_SERVER_HOST |
localhost |
|
VSF_SERVER_PORT |
3000 |
|
VSF_ELASTICSEARCH_HOST |
https://127.0.0.1/api/catalog |
|
VSF_ELASTICSEARCH_PORT |
9200 |
|
VSF_ELASTICSEARCH_PROTOCOL |
http |
|
VSF_ELASTICSEARCH_USERNAME |
elastic |
|
VSF_ELASTICSEARCH_PASSWORD |
changeme |
|
VSF_REDIS_HOST |
http://127.0.0.1 |
|
VSF_REDIS_PORT |
6379 |
|
VSF_REDIS_DB |
0 |
|
VSF_AUTH_HASH_SECRET |
__SECRET_CHANGE_ME__ |
|
VSF_OBJECT_HASH_SECRET |
__SECRET_CHANGE_ME__ |
|
VSF_MAGENTO2_ASSETPATH |
/../var/magento2-sample-data/pub/media |
|
VSF_MAGENTO2_API_CONSUMERKEY |
[CHANGE ME] |
MDOQ will attempt to retrieve an integration with the name mdoq-XXXX where XXXX is the ID of the backend instance, and use the details to populate this variableIf an integration does not exist MDOQ will attempt to create one |
VSF_MAGENTO2_API_CONSUMERSECRET |
[CHANGE ME] |
|
VSF_MAGENTO2_API_ACCESSTOKEN |
[CHANGE ME] |
|
VSF_MAGENTO2_API_ACCESSTOKEN_SECRET |
[CHANGE ME] |
|
VSF_MAGENTO2_URL |
{{BASE_URL}} |
MDOQ will replace {{BASE_URL}} with the secure url of the first non-admin store found in the linked instance |
VSF_MAGENTO2_IMAGEURL |
{{BASE_URL}}/media/catalog/product |
|
VSF_MAGENTO2_API_URL |
{{BASE_URL}}/rest |
|
VSF_MAGENTO2_XX_URL |
{{STORE_URL}} |
MDOQ will replace XX with the uppercased store code of each enabled store found in the linked instance and {{STORE_URL}} with the secure url of that store. |
VSF_MAGENTO2_XX_API_URL |
{{STORE_URL}}/rest |
Vue Storefront Frontend
Variable | Default Vaule | Addtional Notes |
---|---|---|
VSF Frontend | VS_ENV | prod |
MDOQ_ENV | prod | |
NODE_CONFIG_ENV | docker | |
PM2_ARGS | ||
PM2_INSTANCES | 0 | |
PM2_MAX_MEMORY_RESTART | 1G | |
VSF_SERVER_HOST | localhost | |
VSF_SERVER_PORT | 3000 | |
VSF_REDIS_HOST | localhost | |
VSF_REDIS_PORT | 6379 | |
VSF_REDIS_DB | 0 | |
VSF_GRAPHQL_HOST | localhost | |
VSF_GRAPHQL_PORT | 8080 | |
VSF_BACKEND_API | http://localhost:8080 | |
VSF_ELASTICSEARCH_HOST | 9300 | |
VSF_ELASTICSEARCH_INDEX | vue_storefront |
Deploying Images On Your Own Infra
MDOQ creates a deployable docker image as part of it's "I'm Done" process. Once a piece of work has been
accepted and merged into master, you are asked to provide a tag, this tag is the tag of your image that MDOQ will create.
For example
If your Live Connector ID is 1234
, the image name will be: vue-storefront-api-1234
If the tag you select is 2019.0.0.1
then your changes will be in: vue-storefront-api-1234:2019.0.0.1
N.B: To gain access to this image please speak to us and we can provide you with access credentials so that
you can pull your image from our Docker Registry into your own, or use directly from there.
Running the image is the same as any other docker image:docker run --name=vuestorefront-backend -e MDOQ_ENV="" -e VS_ENV=prod vue-storefrontbackend:3.2019.49.00
There are many ENV variables you can pass to your image, as well as others you can add/include.
The image will automatically run Dockerize when starting up.