Skip to content

SmartWeb Development Environment

Docker

Prerequisites

Install Docker

To install Docker use one of the following links:

  • Windows:
    • https://docs.docker.com/engine/installation/windows/#/docker-for-windows
  • WSL:
    • Docker comes as standard.
  • Mac:
    • https://docs.docker.com/engine/installation/mac/
  • Linux:
    • https://docs.docker.com/engine/install/ubuntu/

Docker ID

For Docker to be able to fetch smartweb images, you need to be a member of the smartweb organization on Docker Hub. If you are not, create a user on Docker Hub and ask the DevOps to add you, as membership can only be granted from the admin.

Install Dev-CLI

The dev-cli is required for the following steps, See the README.md in this repo for install instructions:

  • https://gitlab.group.team.blue/hostedshop/proj/dev-cli/-/blob/master/README.md

Hosts file

Run the following command to add all entries to your hosts file:

dev-cli hosts-file system

First time install

System setup

To set up the system for the first time, use the following sequence of commands.

Getting the entire smartweb project
dev-cli smartweb clone && dev-cli smartweb init && dev-cli smartweb install-templates && dev-cli smartweb install-design-apps

Useful information (Optional)

Database migrations in Docker

How to run database migrations
dev-cli webshop migrate sw0001
# OR
dev-cli webshop migrate-all

SmartWeb CLI

docker compose run --rm smartweb-cli --help

Reset your local environment

dev-cli smartweb reset all

Live demo from local environment

# Set the WEBSHOP_URL env in your docker-compose.override.yml

services:
  callback-proxy:
    environment:
      WEBSHOP_URL: sw[xxxx].smartweb.test

# Register an account on https://dashboard.ngrok.com/user/login and copy the authToken into docker-compose.override.yml:

services:
  callback-proxy:
    environment:
      NGROK_AUTH: [authToken]

# Starting the ngrok proxy

docker compose up -d callback-proxy

# Goto ngrok.smartweb.test (remember to add ngrok.smartweb.test in your hosts file) and find the ngrok domain (fx 65d4eaf5.eu.ngrok.io)

# Changing the primary domain for solution

dev-cli webshop change-domain sw[xxxx] 65d4eaf5.eu.ngrok.io (WITHOUT the http://)
docker compose up -d sw[xxxx]

# If you want to go back to sw[xxxx].smartweb.test

dev-cli webshop change-domain sw[xxxx] sw[xxxx].smartweb.test

Testing Coolrunner Locally
In order to test Coolrunner locally you need to ensure that you have set the correct credentials for Coolrunner in server.inc.php (source/core/frontend/server.inc.php). Once you have setup the Coolrunner credentials, you can run the following Docker CLI command to force an URL re-write to allow your local administration to be accessed publicly by Coolrunner.

# Force re-write of https://login.smartweb.test to https://xxxxxxxx.eu.ngrok.io

docker compose run --rm --entrypoint ngrok callback-proxy http -region=eu -host-header=rewrite login.smartweb.test:80