Download the PHP package imaginationmedia/deployer-magento2 without Composer

On this page you can find all versions of the php package imaginationmedia/deployer-magento2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package deployer-magento2

Magento 2 Deployment Tool

Magento 2 code deployment tool with automated steps and extensibility features.

How to install


First you have to install Deployer:

How to install this Magento 2 Deployment Tool:

How to use


Create a file env.json inside app/etc/deployer and configure everything about the environments, repository, project name etc.

On this config file you have two sections; project and environments.

On project we set:

On environments we will set each environment that we are able to deploy. For each environment you can set:

You don't need to keep this file in your repo, but you need to have it if you want to run the deployment commands from your machine (we will show how to do that).

Deployer will create this structure in the server:

Deployer directory structure

.dep is the folder used by deployer to manage the deployer release and all the recent changes.

releases is the folder where we deploy all the new releases. It keep a quantity of release that we defined in the keep_release setting.

Deployer releases

shared is the folder where we store all the shared files and directories that we create symlinks to the current release. An example is the pub/media directory.

Deployer shared

current is a symlink to the latest release. Our server webroot should point to this symlink/pub. So the webroot will be current/pub.

Deploying manually & dep commands


If you want to manually run the commands you have to install the deployer tool using composer, or download the package and uncompress in a directory named as deployment.

Now that you are able to clone the git code from the repository we can deploy it using the dep commands.

Inside your local project you have to access the deployer tool directory (deployment if you installed manually, or vendor/imaginationmedia/deployer-magento2 if you installed by composer).

You are able to run these commands:

Keep in my mind that you need to have the app/etc/deployer/env.json in your local to be able to run these commands.

CI/CD with BitBucket Pipelines

Bitbucket Pipelines is a powerful tool that can be used to automate deployments. Let's say you have 2 branches, staging and master. Staging is used to deploy code to a test environment, and master is used to deploy the final code to production. We can use Bitbucket pipelines to deploy code to these environments every time a new commit is pushed to these branches.

We have also created a docker image that can be used to automate these deployments. Our docker image is available in DockerHub.

In order to start to set up Bitbucket pipelines to automate deployment you need to create a file called bitbucket-pipelines.yml in your repo, and you can add this content:

As you can see, it uses our docker image to build the cloud machine and then it basically clone our deployment tool to this remote machine and executes the dep deploy command.

We have 2 branches being watched, they are master and staging. On each one we run the proper deployment command (dep deploy staging for staging and dep deploy production for production).

If your server is restricting ssh access by ip address you will also need to whitelist bitbucket cloud ips. They are 34.199.54.113/32, 34.232.25.90/32, 34.232.119.183/32, 34.236.25.177/32, 35.171.175.212/32, 52.54.90.98/32, 52.202.195.162/32, 52.203.14.55/32, 52.204.96.37/32, 34.218.156.209/32, 34.218.168.212/32, 52.41.219.63/32, 35.155.178.254/32, 35.160.177.10/32, 34.216.18.129/32

Now you need to setup the Bitbucket pipelines repository variables. To do that go to Settings > Pipelines > Repository Variables. The only variable that we need here will be a variable called DEPLOYER_ENV. If you check our bitbucket-pipelines.yml file you will see we are creating the app/etc/deployer/env.json with the content of a system variable, our DEPLOYER_ENV variable. So, let's create this variable and paste the content of our app/etc/deployer/env.json file.

Bitbucket Pipelines env variables

The last and not less important step, Bitbucket pipelines will ssh into your server, so, it has to be authenticated without any password? What does it means? We will need a ssh key for bitbucket pipelines. That's easy, go to Settings > Pipelines > SSH Keys and generate a new key pair. Then whitelist the public key in your server and you are ready to go.

Bitbucket Key Pair Generation

Now you are ready to run automate deployments using bitbucket pipelines!

Bitbucket Pipelines deployment

Recommend Host Solutions

We have tested this deployment solution with different host providers, but here are our preferences and our partners where the process works better.

JetRails Logo

JetRails hosting for Magento is focused on the five pillars of mission critical hosting: Speed, Security, Support, Scalability, and Stability. Their platform continuously integrates the latest advancements to ensure the best hosting experience.

Website

Setup deployer on Jetrails

You will need to basically follow all the steps that were described above, and in the before_symlink_change config you will have to provide these three lines:

You will also need to open a support ticket requesting the Bitbucket Pipelines ips to be whitelisted in your server in case you want to use bitbucket pipelines for CI/CD.

Cron configuration

On JR we need to disable the cron jobs and start them again after every new deployment in order to avoid duplicated cron jobs os jobs running on incorrect code releases. We can't stop and start the cron service like we can do on AWS or MageMojo. So, in order to do that you first need to clean the crontab before a new deployment. On the before_deploy step you need to add the "crontab -r" command, it will clear the crontab, completely.

Then on the after_deploy step you need to add the Magento cron:install command. This command will setup the Magento crontab for you.

It will add something to the crontab like:

In case you have any other custom cron job that you need to add to the crontab, you can also add it to the crontab using the after_deploy step. For example:

#my command is the line you want to add to the crontab.

Also, please don't enable the cron for staging environments, otherwise they will dump the production configuration every time we deploy to staging. Enable CRON on staging only when needed for a test and manually. Don't add to the deployment script.

After a new production deployment make sure you check the cron_schedule table to see if any cron job got stuck during the deployment process.

You should have no downtime during this process.

MageMojo Stratus Logo

MageMojo Stratus created a unique hosting offering specifically and solely aimed at optimized Magento hosting.

Over ten years later, MageMojo is still growing. By delivering the highest level of Magento performance at prices no one can match in an apples-to-apples comparison, MageMojo established itself as the leader in its niche. And it’s achieved this growth by keeping its customers satisfied, with the industry’s only 15-minute support SLA.

Website

Setup deployer on MageMojo Stratus

You will need to basically follow all the steps that were described above and the option symlink_fullpath in your app/etc/deployer/env.json config has to be true (https://magemojo.com/kb/stratus-best-practices/using-symlinks/).

You also need to add the MM stratus clear cache command to be executed before a new deployment, on the before_deploy step:

First of all, before you start a new deployment you have to stop the Magento cron, to avoid a cron job to get stuck during the deployment process. You can do that on the MM Stratus panel.

MM Stratus Cron

Then you can start the deployment.

If you have the auto scaling option enabled, once the deployment is complete you have to re-init the auto scaling. You can also do that on MM stratus panel.

MM Stratus Auto scaling

That's the only time the store goes down for few seconds, because the servers are restarting.

Then, once your store is back you need to enable the cron again.

Keep checking on the next hours if any cron job get stuck on the cron_schedule table.

To use bitbucket pipelines for CI\CD you will also need to whitelist Bitbucket Cloud ips on the MM Stratus panel.


All versions of deployer-magento2 with dependencies

PHP Build Version
Package Version
Requires deployer/dist Version ^6.0
deployer/recipes Version ^6.2
php Version >=7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package imaginationmedia/deployer-magento2 contains the following files

Loading the files please wait ....