Code Monkey home page Code Monkey logo

asp-magento's Introduction

Advanced Specialty Website

This repo contains the source code for advancedspecialty.com. It uses: Docker, MySQL v5.6.32, and Magento2 v2.1.2.

Getting Started

Prerequisites

To set up a local instance of this repo, you must first download Docker.

Run Docker containers

Run the following command in a Terminal window to start the Docker container. If this Docker image doesn't exist, it will be built using the instructions found in the Dockerfile (and docker-compose.yml).

$ npm start

Setup Magento

  1. Setup the database

    • Use the database name as defined in the docker-compose file.

      CREATE DATABASE [db_name];
    • Grant permissions to the user as defined in the docker-compose file.

      USE [db_name];
      GRANT ALL PRIVILEGES ON [db_name].* TO '[mysqluser]'@'%' WITH GRANT OPTION;
  2. Go through the setup process

    • Set the database host to the name of the docker-compose service.
    • Set the database values accordingly, as shown in the docker-compose.
    • Follow the rest of the setup process.
    • Take note of the confirmation screen
  3. Run Magento Cron

    ./bin/magento setup:cron:run
  4. Set up Integration modules.

    • System > Integrations
    • Add new Integration
    • Enter information for the Integration
    • Save
    • Activate
  5. Install Third-Party modules

Migrate Databases

Before doing any development, make sure to get the latest copy of the Database from the production server. Advise Smart Vent that you'll be making some updates and any edits they make should wait until after the code update is complete.

  1. Create and download a backup of the source database from the Magento Admin Panel.
  2. Drop the destination database.
  3. Re-create the destination database.
  4. Run
$ docker exec -i $CONTAINER_NAME \
  mysql -uroot -proot --database $DATABASE_NAME \
  < $SQL_BACKUP_PATH

Where:

  • $CONTAINER_NAME is the name of the container (such as asp_db_1)
  • $DATABASE_NAME is the name of the database (such as magento_asp); and
  • $SQL_BACKUP_PATH is the directory where the .sql back up file was downloaded.

Update Magento version

These instructions are for upgrading Magento versions. It's recommended to do do this inside the Docker container.

  1. Backup the Magento database.

  2. Backup the Magento 2 directory.

  3. In terminal, navigate to the Magento 2 directory, then update composer.json:

    $ cd ./asp-web/src/magento2; \
      composer require magento/product-community-edition 2.1.5 --no-update

    Where $MAGENTO_VERSION is the latest stable version (such as 2.1.5)

  4. Run the update command, which will prompt for repo.magento.com credentials. Note: both the username and password are 32-bit random strings. Find the appropriate credentials for your account online.

    $ composer update
  5. Cleanup the installation.

    $ rm -rf var/di var/generation; \
      php bin/magento cache:clean; \
      php bin/magento cache:flush; \
      php bin/magento setup:upgrade; \
      php bin/magento setup:di:compile; \
      php bin/magento setup:static-content:deploy; \
      php bin/magento indexer:reindex
  6. If you're curious to see if it worked, check the version.

    php ./bin/magento --version

Third-Party Magento Modules

This project uses the following Magento modules:

FAQ

How do I view the IP of a linked Docker container?

To view the IP address of a linked container, look at the /etc/hosts file to see how docker has mapped the ports.

How do I connect to a Docker container?

$ docker exec -it $CONTAINER_NAME /bin/bash

Where $CONTAINER_NAME is the name of the container (such as asp).

How do I Deploy Docker Containers?

Locally

In your local environment, run the following commands in Terminal.

$ # Commit Changes
$ docker commit [OPTIONS] CONTAINER [ REPOSITORY[:TAG] ]

$ # Save the Image
$ docker save -o asp_web.tar asp_web

On the Server

On the server, load the image by running the following command:

$ docker load -i asp_web.tar

CSS styles haven't loaded

Make sure Magento is in developer mode

php bin/magento deploy:mode:set developer

In terminal, run the following command:

$ php bin/magento cache:clean
$ php ./bin/magento setup:static-content:deploy -t CRHain/asp

When finished, set the deploy mode back to default

php bin/magento deploy:mode:set production

MySQL is throwing 'max_allowed_packet' error

In the MySQL container, enter the MySQL CLI.

$ mysql -u[user] -p[password]

Run the following commands:

mysql> set global net_buffer_length=1000000;
mysql> set global max_allowed_packet=1000000000;

asp-magento's People

Contributors

xianhain avatar

Watchers

James Cloos avatar  avatar  avatar

asp-magento's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.