This repo contains the source code for advancedspecialty.com. It uses: Docker, MySQL v5.6.32, and Magento2 v2.1.2.
To set up a local instance of this repo, you must first download Docker.
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 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;
-
-
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
-
Run Magento Cron
./bin/magento setup:cron:run
-
Set up Integration modules.
- System > Integrations
- Add new Integration
- Enter information for the Integration
- Save
- Activate
-
Install Third-Party modules
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.
- Create and download a backup of the source database from the Magento Admin Panel.
- Drop the destination database.
- Re-create the destination database.
- 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 asasp_db_1
)$DATABASE_NAME
is the name of the database (such asmagento_asp
); and$SQL_BACKUP_PATH
is the directory where the.sql
back up file was downloaded.
These instructions are for upgrading Magento versions. It's recommended to do do this inside the Docker container.
-
Backup the Magento database.
-
Backup the Magento 2 directory.
-
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 as2.1.5
) -
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
-
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
-
If you're curious to see if it worked, check the version.
php ./bin/magento --version
This project uses the following Magento modules:
To view the IP address of a linked container, look at the /etc/hosts
file to
see how docker has mapped the ports.
$ docker exec -it $CONTAINER_NAME /bin/bash
Where $CONTAINER_NAME
is the name of the container (such as asp
).
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, load the image by running the following command:
$ docker load -i asp_web.tar
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
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;