Deploy

Environment

Purpose: it could be easier, we could have teams for each application we run, that those teams treat their production and non-production application environments the same. That they have fully automated full stack continuous deployment pipelines and the software is so well designed that there is no dependency between each application owner. Teams deliver code by the hour to production and use advance deployment techniques such as blue-green deployment coupled with highly effective monitoring, alerting and automated rollback to identify and resolve issues in production within minutes.

Site Path to Production

  • Internal Dev Site
  • Internal Test Site
  • Customer Stage/Dev/Test Site
  • Customer Live Site

Activity

Save Site Credentials Information

Define Acceptance Environment

  • Acceptance Environment is the Site used for Accept Process.
  • We must have agreement with the customer about what is the Acceptance Environment ASAP.
  • The Acceptance Environment may be the Customer Live Site or the Customer Stage/Dev/Test Site.
  • If the customer do not provide us their Live Site or Stage/Dev/Test Site, we should have agreement about using our Internal Test Site as Acceptance Environment.
  • We could have different Acceptance Environment for each Development Sprint.

Define Demonstration Environment

  • Demonstration Environment is used for Sprint Review Process
  • It is prefer to use Acceptance Environment same with Demonstration Environment if the Acceptance Environment is not Customer Live Site

Deploy

Deploy via SSH

Explainlation This delivery method contains 2 actions:

  • Delivery: Uploading the release package to customer UAT site (the site that we negotiated with customer when project starts).
  • Deploy: Extract the uploaded package then run necessary commands to deploy software to the UAT site.

Prerequisite

  • Customer provide correct SSH/Information about the site that software will deploy on.
  • Customer grant read/write permission for all files/folder under Magento Root Directory with SSH/FTP account that they provided to us to deploy.

Install from Original POS Package via SSH

Original POS Package is the package only contains Magestore POS product originally, it work compatible with Magento fresh installation depend on its release notes.

Note:

  • The package is not personalized on current customer web site situation like: additional features or integration, bug fixing to integrate with any other extensions, after install may occurs some unexpected conflict with other extensions
  • This guide only apply for newly install POS (upgrade current POS to higher version in other guide).
  • All the word surrounded by "<" and ">" is variable, change it by the case you use.
  1. Upload Original POS Package to the site and place to Magento Root Directory

  2. Connect to server by SSH

    • Connect use password
    ssh <username>@<ip> -p <port_number>
    
    • Connect use key_file
    ssh -i <key_file> <username>@<ip> -p <port_number>
    

    Example: ssh user@127.0.0.1 -p 22

  3. Change to Magento Root Directory

    cd <magento_root_dir>
    

    Example: cd /var/www/html

  4. Create new directory

    mkdir <dir_name>
    

    Example: mkdir magestore_pos

  5. Extract the package to new directory

    tar -xf <package_name> -C <dir_name>
    

    Example: tar -xf pos-pro-v3.8.0.tar.gz -C magestore_pos

  6. Copy extracted files to Magento Root

    cp -R <dir_name>/server/* ./
    

    Example: cp -R magestore_pos/server/* ./

  7. Run Magento Commands

    php bin/magento maintenance:enable
    php bin/magento setup:upgrade
    php bin/magento cache:flush
    php bin/magento webpos:deploy
    php bin/magento maintenance:disable
    

Definition of done

Install from Customized Package via SSH

Delivery package is the package contain Original POS Package (currently installed on customer website), and extra part of code personalized by customer website situation depend on its release notes, like: bug fixing, features request, integration with 3rd extension on customer site.

Note:

  • We usually deploy the package to the Acceptance Website right after each release - the website that we negotiated with you after you purchase POS to support, testing, acceptance. Currently package is not support download from my.magestore.com, please contact with PM of your project at Magestore if you want the package
  • This guide only apply for newly install POS (upgrade current POS to higher version in other guide).
  • All the word surrounded by "<" and ">" is variable, change it by the case you use.
  1. Request to get a package from Magestore Delivery Team

    • Filename format: <your_domain>-delivery-v<release_version>.tar.gz

    Example: example-com-delivery-v1.2.2.tar.gz

  2. Upload package to your server and place to Magento Root Directory

  3. Connect to server by SSH

    • Connect use password
    ssh <username>@<ip> -p <port_number>
    
    • Connect use key_file
    ssh -i <key_file> <username>@<ip> -p <port_number>
    

    Example: ssh user@127.0.0.1 -p 22

  4. Change to Magento Root Directory

    cd <magento_root_dir>
    

    Example: cd /var/www/html

  5. Remove all current code under app/code/Magestore

    rm -r app/code/Magestore
    
  6. Extract the package directly on Magento Root Directory

    tar -xf <package_name>
    

    Example: tar -xf example-com-delivery-v1.2.2.tar.gz

  7. Run Magento Commands

    php bin/magento maintenance:enable
    php bin/magento setup:upgrade
    php bin/magento cache:flush
    php bin/magento webpos:deploy
    php bin/magento maintenance:disable
    

Definition of done

Deploy on Magento Cloud

Explainlation This delivery method contains 2 actions:

  • Delivery: Commit and push the released code to related branch on git of Magento Cloud
  • Deploy: Make sure the deploy job of Magento Cloud run successfully (Magento Cloud trigger the push event and do deployment automatically, we just need to watch the deploy log and fix issue (if have) to make it successful).

Prerequisite

  • Customer specified the branch (as environment) that we will deploy the software to.
  • Customer grant read/write permission to the deploy branch for all developers from Delivery Team.
  • Customer grant access to Magento Cloud Infrastructure for all developers from Delivery Team so they can watch the deploy log.

Definition of done

Deploy to Magento Cloud via customer Bitbucket, Github, Gitlab

Explainlation This delivery method contains 2 actions:

  • Delivery: Commit and push the released code to related branch on customer Version Control System (VCS) like Bitbucket, Gitlab, Github.. etc
  • Deploy: Deploy the code from customer VCS to Magento Cloud.

Prerequisite

  • Customer specified the branch will receive the release on theirs VCS
  • Customer grant read/write permission to the repository and branch for all developers > from Delivery Team on theirs VCS
  • Customer give the guide about deployment workflow from theirs VCS to Magento Cloud.
  • Customer grant read/write permission to the deploy branch for all developers from Delivery Team.
  • Customer grant access to Magento Cloud Infrastructure for all developers from Delivery Team so they can watch the deploy log.

Definition of done

Deploy to Magento Cloud from you Version Control System (VCS) using your own CI/CD system

Prerequisite:

  • Configured CI/CD system to auto deploy specific branch from VCS (Gitlab, Github, Bitbucket) to Magento Cloud.
  • Using Magento Cloud to operate deployment for Magento 2 site.
  1. Take The Delivery Package from Magestore deployment team.

  2. Checkout the branch to deploy at your local

  3. Change to Project Root directory

  4. Remove all code under app/code/Magestore

    rm -r app/code/Magestore
    
  5. Extract The Delivery Package

    tar -xf "<package_name>"
    

    NOTE: <package_name> here is the variable, please replace with real package name.

  6. Configure the .magento.app.yaml

    Note: This is only need to configure for the first time you deploy the delivery package, no need for the next if the configuration still persist.

    1. Open file .magento.app.yaml in your favourite text editor.

    2. Move on to the "web"" section in that file. It will looks like image below

    3. Go on to the ending line of static sectio, then put the text below to:

              "/apps/pos":
              root: "pub/apps/pos"
              allow: true
              scripts: true
              index:
                  - index.html
              rules:
                  \.(html|css|js|svg|json|map|hbs|gif|jpe?g|png|tiff|wbmp|ico|jng|bmp|svgz|midi?|mp?ga|mp2|mp3|m4a|ra|weba|3gpp?|mp4|mpe?g|mpe|ogv|mov|webm|flv|mng|asx|asf|wmv|avi|ogx|swf|jar|ttf|eot|woff|otf)$:
                      allow: true
              passthru: "/get.php"
          "/apps/pos/static":
              root: "pub/apps/pos/static"
              allow: true
              scripts: true
              passthru: "/front-static.php"
              rules:
                  ^/apps/pos/static\d+/(?<resource>.*)$:
                      passthru: "/static/$resource"
      
      
    4. Your file now will looks like image below

  7. Configure to add Magestore Delivery Release Manifest (optional)

    Note: This is only need to configure for the first time you deploy the delivery package, no need for the next if the configuration still persist.

    1. Open file .gitignore at Project Root in your favourite text editor.
    2. Put the text below to the end of file
      !/var
      !/var/.magestore_delivery/
      !/var/.magestore_delivery/**
      
  8. Commit changes

    git add app/code/Magestore var/.magestore_delivery .gitignore .magento.app.yaml
    git commit -m "Magestore Delivery v<release_verion>"
    

    NOTE:

    • <release_version> above is a variable please take it from name of the release package which you extracted, or you can take from app/code/Magestore/Deli/config.xml, inside the tag <version></version>
    • Depend on how many changes you make on each deployment, so you can choose the list directory and file to commit. Here above is the full list of files and directories for the first time deploy The Delivery Package.
  9. Push to remote

    git push -u origin "<your_branch>"
    

    NOTE: <your_branch> above is a variable, please replace with your branch name on your VCS.

  10. Go to to the branch which you've configured to auto deployment from bitbucket to Magento Cloud

  11. Get the result

    After a while deployment, you will get the result from Magento Cloud (red retagle in the image below) is that the delpoyment job is success or not.

    • Success: Come to website backend and check the new POS.
    • Failed: Click into the failed status it will show you the detail of deployment log. Copy error log and screen shoot then [report problem to Magestore consultant].

Delivery Only

Delivery by push release code to customer Bitbucket, Github, Gitlab.

Explainlation

This delivery method contains only 1 actions:

  • Delivery: Commit and push the released code to related branch on customer Version Control System (VCS) like Bitbucket, Gitlab, Github... etc

Prerequisite

  • Customer specified the branch will receive the release on theirs VCS
  • Customer grant read/write permission to the repository and branch for all developers from Delivery Team on theirs VCS

Definition of done

Delivery by send release package to customer via Project Slack Channel.

Explainlation

This delivery method contains only 1 actions:

  • Delivery: Send the release package via Project Slack Channel

Prerequisite

  • Project has Slack Channel

Definition of done

Delivery by grant customer access to Project.

Explainlation

This delivery method contains only 1 actions:

  • Delivery: Notify to Project Slack Channel about the release to customer

Prerequisite

  • Customer has been granted access to Project Reposiory on Gitlab.
  • Project has Slack Channel

Definition of done


Reference