Initializing Shopware#

Initializing an Empty Shopware Development Project#

  1. Clone the code and initialize a Reward Shopware environment

    git clone https://github.com/shopware/development.git -b v6.4.11.1 ~/Sites/your-awesome-shopware-project/webroot
    cd ~/Sites/your-awesome-shopware-project
    reward env-init your-awesome-shopware-project --environment-type=shopware
    

    Note

    In this example the shopware code will live in the $PROJECT/webroot directory. If you’d like to use a different directory, change REWARD_WEB_ROOT environment variable in .env file.

  2. Sign a new certificate for your dev domain

    reward sign-certificate your-awesome-shopware-project.test
    
  3. Bring up the Reward environment

    reward env up
    
  4. Install Shopware

    If you use different domain, make sure to update the APP_URL in the .psh.yaml.override file.

    reward shell
    
    echo $'const:\n  APP_ENV: "dev"\n  APP_URL: "https://your-awesome-shopware-project.test"\n  DB_HOST: "db"\n  DB_NAME: "shopware"\n  DB_USER: "app"\n  DB_PASSWORD: "app"' > .psh.yaml.override
    
    # Windows only: give run permissions for the necessary files
    chmod +x psh.phar bin/console bin/setup
    
    ./psh.phar install
    

Note

Now you can reach the project on the following url:

https://your-awesome-shopware-project.test

Or the admin dashboard on https://your-awesome-shopware-project.test/admin

user: admin password: shopware

Initializing an Empty Shopware Production Project#

  1. Clone the code and initialize a Reward Shopware Production environment

    git clone https://github.com/shopware/production.git -b v6.4.18.0 ~/Sites/your-awesome-shopware-project/webroot
    cd ~/Sites/your-awesome-shopware-project
    reward env-init your-awesome-shopware-project --environment-type=shopware
    

    Note

    In this example the shopware code will live in the $PROJECT/webroot directory. If you’d like to use a different directory, change REWARD_WEB_ROOT environment variable in .env file.

  2. Sign a new certificate for your dev domain

    reward sign-certificate your-awesome-shopware-project.test
    
  3. Make some fixes in the .env file

    # Enable opensearch
    # REWARD_OPENSEARCH=true
    sed -i.bak "s/^REWARD_OPENSEARCH=.*/REWARD_OPENSEARCH=true/g" .env
    
    # Change node version
    # NODE_VERSION=16
    sed -i.bak "s/^NODE_VERSION=.*/NODE_VERSION=16/g" .env
    
  4. Bring up the Reward environment

    reward env up
    
  5. Install Shopware

    reward shell
    
    # Issue with composer version 2.5
    # https://github.com/shopware/production/issues/168
    # Rollback to a previous composer version
    sudo composer self-update 2.4.4
    
    composer install --no-interaction
    
    # Configure Shopware
    bin/console system:setup --no-interaction --app-env dev --app-url https://your-awesome-shopware-project.test --database-url mysql://app:app@db:3306/shopware --es-enabled=1 --es-hosts=opensearch:9200 --es-indexing-enabled=1 --cdn-strategy=physical_filename --mailer-url=native://default
    
    # Install Shopware
    bin/console system:install --no-interaction --drop-database --create-database --basic-setup
    
    # Dump plugin and theme settings
    export CI=1
    bin/console bundle:dump
    bin/console theme:dump
    
    # Build storefront
    export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
    bin/build.sh
    
    # Do the migrations and install assets
    bin/console system:update:finish --no-interaction
    

Note

Now you can reach the project on the following url:

https://your-awesome-shopware-project.test

Or the admin dashboard on https://your-awesome-shopware-project.test/admin

user: admin password: shopware