Tutorial: Setting Up a Production Instance

Requirements

  • A development environment
  • An Elastic Path training virtual machine

Prerequisites

Ensure that you are familiar with the following third-party technologies:

  • Git
  • Node.js
  • Visual Studio Code with the following extensions:
    • Debugger for Chrome
    • ESLint extension

Example

  1. Clone or pull the react-pwa-reference-storefront repository into your directory.
  2. Navigate to the react-pwa-reference-storefront directory.
  3. Build a production Docker image by running the following command:
    docker build -t ep-store -f ./docker/prod/Dockerfile .
  4. Push the ep-store image to the Docker repository.
  5. Navigate to the docker/prod/ directory.
  6. Copy the following files to the user home directory on the remote host:
    • docker-compose.yaml
    • nginx.conf
  7. In the nginx.conf file, update the following parameters:
    • $CORTEX_URL with Cortex server URL.
    • $DOMAIN with domain name without http://.
    • $SSL_CERT_PATH with the certificate file path in the remote server.
      For example, /etc/letsencrypt/live/reference.elasticpath.com/fullchain.pem.
    • $SSL_KEY_PATH with the path of the private key in the remote server.
      For example, /etc/letsencrypt/live/reference.elasticpath.com/privkey.pem.
      Note: You can use the certificate generated by any certificate provider, such as Let’s Encrypt.
  8. In the docker-compose.yaml file, update the following parameters:
    • $DOCKER_REPO with ep-store.
    • $SSL_CERT_PATH with the certificate file path in the remote server .
      For example, /etc/letsencrypt/live/reference.elasticpath.com/fullchain.pem.
    • $SSL_KEY_PATH with the path of the private key in the remote server.
      For example, /etc/letsencrypt/live/reference.elasticpath.com/privkey.pem.
  9. Run the following Docker command to start the Docker container created for the Docker image:
    • docker-compose up -d