Quick Start Guide for Magento Commerce Cloud Sandbox

·

8 min read

Magento Commerce Cloud sandbox is provided for Partners and Marketplace Developers to allow Partners/Developers to:

1.  Build out their Magento Commerce practice

2.  Demonstrate Magento Commerce Cloud functionality to their clients

3.  Developers to develop and test against Magento Commerce Cloud and submit for selling components to Magento Marketplace. 

Magento Commerce Cloud Sandbox Request Form for Marketplace Sellers - Please refer to 

docs.google.com/forms/d/e/1FAIpQLScwliujsBE..

Differences compared to a customer's environment:

Magento Commerce Cloud has a Starter and a Pro plan. 

Sandbox environment is being with Starter Plan, please see below web for the difference between these two plans.

devdocs.magento.com/cloud/architecture/clou..

Step 1 - Sign in to Magento Commerce Cloud

1.  Browse to Magento Commerce Cloud, the url pattern is 

region-4.magento.cloud/projects<project_id>

Sample Magento Cloud Sandbox Is Provisioned

Server URL: https://<region>-4.magento.cloud/projects/<project id>

Email: <your_email>

Password: You need reset password

2.  If you are first time to login and don't have Magento ID before, you may reset password

3.  After successfully logged, you are in Magento Cloud UI, in where you can:

3.1.  Get the Site URL by clicking "Access site" > "Web Access"

https://<environment>-<random_characters>-<project_id>.<region>-4.magentosite.cloud/

3.2.  Get the SSH access command by clicking "Access site" > "SSH Access" 

ssh <project id>-<enviroment>-<random characters>--mymagento@ssh.<region>-4.magento.cloud

3.3.  Get the Git repository by checking the CLI/GIT text box

CLI - magento-cloud get <project id> -e master

GIT - git clone --branch <enviroment> <project id>@git.region- 4.magento.cloud:<project id>.git <project name>

3.4.  Manage users by clicking "Configure environment"

https://<region>-4.magento.cloud/projects/<project id>/environments/master/edit

Step 2 - SSH to Backend Virtual Server

Once you has access to Magento Commerce Cloud, you should be able to SSH to its backend Server. 

Steps are:

1.  Copy your SSH public key

1.1.  In Mac, your ssh public key is at ~/.ssh/id_rsa.pub, if you can't find this file, see instructions at the end of this tutorial 

When finished, the output looks similar to:

Username@Username MINGW32 ~

$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/c/Users/Username/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /c/Users/Username/.ssh/id_rsa

Your public key has been saved in /c/Users/Username/.ssh/id_rsa.pub

The key fingerprint is:

SHA256:<key> Username@Username

The key's randomart image is:

+---[RSA 3072]----+

| +=+oo.          |

|. =o  .          |

|.= .o.           |

|o . .+           |

|o . . o S        |

|    o o .       |

|..E.. + o      |

|**o+.+ o.= .     |

|O++.oo..oo.      |

+----[SHA256]-----+

Username@Username MINGW32 ~

$ eval $(ssh-agent -s)

Agent pid 1830

Username@Username MINGW32 ~

$ ssh-add ~/.ssh/id_rsa

Enter passphrase for /c/Users/Username/.ssh/id_rsa:

Identity added: /c/Users/Username/.ssh/id_rsa (Username@Username)

1.2.  Copy the content of your SSH public key

$ clip < ~/.ssh/idrsa.pub

2.  Add your SSH public key into Magento

2.1.  Log in accounts.magento.cloud/user 

2.2.  Click Account Settings

2.3.  Expand SSH Keys section 

2.4.  Paste your public key

Sample Email Confirmation as Below

An SSH key was added to your account

Inbox

Magento Cloud <accounts@magento.cloud> 9:33 AM (2 hours ago) to me

Magento Cloud

The following SSH key was added to your account:

<title>

<key>

Manage Keys

Have questions? Contact support >>

When Magento finishes the adding, the public SSH key appears in the list of SSH keys.

3.  Get the SSH command line

3.1.  Login Magento Commerce Cloud URL

 https://<region>-4.magento.cloud/projects/<project id>

3.2.  You should see a yellow button "Access site", click this button and check the "SSH Access" 

3.3.  Copy the SSH command

ssh <project id>-<enviroment>-<random characters>--mymagento@ssh.region-4.magento.cloud

4.  Open a terminate in your desktop or laptop

5.  Input the SSH command

6.  You should be in

$ ssh <project id>-<enviroment>-<random characters>--mymagento@ssh.<region>-4.magento.cloud

                                             _

|  \/  | __ | | _   / | |_   | |

| |\/| / ` / ` / -) ' \  / _ \ | (| / \ || / ` |

||  |_,_, __|||___/  _|\/_,__,|

            |___/

 Welcome to Magento Cloud.

 This is environment <enviroment>-<random characters>

 of project <project id>.

More details, see Enable SSH Keys - devdocs.magento.com/cloud/before/before-wor..

Step 3 - Add Users to Cloud Projects

You can add users from Magento Cloud UI; but if you want to add project Super User, you have to use CLI, see devdocs.magento.com/cloud/project/user-admi..

Access Web Site

1.  Browse to Magento Commerce Cloud, the url pattern is 

region-4.magento.cloud/projects<project_id>

2.  After successfully logged, you are in Magento Cloud UI, in where you can:

2.1.  Get the Site URL by clicking "Access site" > "Web Access"

Step 4 - Sign in to Store Admin

The Web Site admin console URL is like

https://<environment>-<random_characters>-<project_id>.<region>-4.magentosite.cloud/admin/

1.  Add my user account via the UI and add the SSH Public Key

2.  Once the step 1 is completed. SSH to the instance. SSH URL can be retrieved from the UI

3.  Once the SSH access is success. Use the following command to create an admin user account

web@mymagento.0:~$ php bin/magento admin:user:create --admin-user="<your_username>" --admin-password="<your_password>" --admin-email="<your_email>" --admin-firstname="<your_first_name>" --admin-lastname="<your_last_name>"

5.  Once the command is successful. You can login via the created admin user account.

Username: <your_email>

Password: <your_password>

6.  In the first time to login, you will be asked to enable 2FA, which will immediately trigger an notification email titled "2FA configuration required for Main Website Store" to your inputed email address. In few cases, your company firewall will treat it as a spam and block it. The alternative solution is to set with your personal email address or ask IT to unblock this email.

Magento Admin Panel

Logout

You need to configure Two-Factor Authorization in order to proceed to your store's admin area

An E-mail was sent to you with further instructions

7.  In the notification email (for 2FA enablement), click the link to set up 2FA.

2FA configuration required for Truong Bui

Inbox

Owner via magentosite.cloud 10:16 AM (1 hour ago) to me

Truong Bui,

You are required to configure personal Two-Factor Authorization in order to login to Main Website Store

To do that please Click here

Thank you, Main Website Store

8.  After you set up, go back and re-login.

Reference: support.magento.com/hc/en-us/articles/11500..

Magento Commerce Cloud

Step 5 - Import Sample data

The init web site has no product data, you may need to import sample data into the website. Please refer to devdocs.magento.com/cloud/howtos/sample-dat.. 

1.  Clone your code to local

1.1.  In the Magento Cloud UI, select proper environment, such as Master

1.2.  Click the Git, you will see the command to get source codes, in my case the git command is:

GIT - git clone --branch <enviroment> <project id>@git.<region>-4.magento.cloud:<project id>.git <project name>

or

CLI - magento-cloud get <project id> -e master

1.3.  Copy git command and run locally to download codes to local 

Magento Code to Local


1.4.  cd to source folder

1.5.  Build code by issuing command: 

composer update

Note: Composer A Dependency Manager for PHP - please refer to getcomposer.org/download

1.6.  it will take some minutes to download all depended packages.

2.  In the local environment, issue below command to install sample data a.  

php -dmemory_limit=6G bin/magento sampledata:deploy

3.  Push to Magento Cloud

3.1.  git add -A && git commit -m "Install sample data" 

3.2.  git remote -v //this is to get the remote repository 

3.3.  git push <repository> <branch>

3.4.  You will see in Magento Cloud UI the deployment is running, it will take minutes 

3.5.  After deployment complete, visit the site again, you will see the samples.

Frequently Asked Questions

Q: I can't modify the composer.json file after SSH to Virtual Server

A: Magento cloud environments are strictly read-only, for security purposes so you will need to have a local development environment with access to a terminal so that you can issue changes via the composer framework and push the changes into your cloud environment.

Q: How to enable B2B?

A: Please refer to devdocs.magento.com/cloud/configure/setup-b.., Note that you have to set up in local development and then push to Git, for local environment setup, please refer to  devdocs.magento.com/cloud/setup/first-time-..

Q: Don't have enough disk space in Environment

A: See Regarding the disk space, as this is a development instance you have control to manage the disk space, see devdocs.magento.com/cloud/project/manage-di..

Q: How to generate an SSH key pair in Mac OS?

You can generate an SSH key pair in Mac OS following these steps:

Open up the Terminal by going to Applications > Utilities > Terminal

In the terminal, use the following command to start the key generation

ssh-keygen -t rsa

Next, you will be prompted to provide the location where you want to create the private key file:

Enter file in which to save the key (/home/youruser/.ssh/id_rsa):

Leave this empty to create the key in the default location, which is /home/youruser/.ssh/id_rsa. The public key file will be created in the very same location, and with the same name, but with the .PUB extension.

Afterwards you will be prompted to choose a password. This is the password required to use the private key.

Enter passphrase (empty for no passphrase):

That completes the key generation. Below is an example of the entire process:

Mac_user: ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/user/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in id_rsa.

Your public key has been saved in id_rsa.pub.

The key fingerprint is:

16:8e:e8:f2:1d:c9:b9:cf:43:9a:b3:3c:c1:1f:95:93 Mac_user

This will create a private key written to /home/user/.ssh/id_rsa and a public key written to /home/user/.ssh/id_rsa.pub.

Learning Resources

Magento Support will deliver commonly used resources/links:

Magento U Courses recommended

Create New Key Pair

Support channel

Contact support@magento.cloud for your issues and they will create a ticket for Support Services owns sandbox provisioning and support.

magento-cloud-front.png

magento-cloud.png