Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Asmir Mustafic:
How do I deploy my Symfony API - Part 4 - Deploy
Oct 11, 2017 @ 10:23:12

Asmir Mustafic has posted the next part of his series covering the deployment of Symfony applications. In this latest article (part four) he focuses on some of the final steps of the deployment process.

This is the forth post from a series of posts that will describe the whole deploy process from development to production. The first article is available here, the second here and the third here.

After covering the steps 1-3 and having prepared our infrastructure, we can see how to deploy our application to production. Almost the same approach can be used to deploy not only to production but also to test environments.

He starts with the workflow for the deployment process, creating a flow where the "git push" should trigger other actions based on the branch pushed. Then CircleCI will fire off a series of jobs to handle environment setup tasks, connecting to a VPN and deploying the code. This includes a bit of preparation, credential handling and the Docker setup and push. Each step along the way also includes all of the YAML configurations you might need to replicate the deployment.

tagged: symfony api deployment part4 series docker configuration example

Link: https://www.goetas.com/blog/how-do-i-deploy-my-symfony-api-part-4-deploy/

Facile.it Engineering Blog:
Is it all PHP OPCache's fault?
Oct 05, 2017 @ 10:49:39

In a new post to the Facile.it Engineering Blog author Salvatore Cordiano wonders if it's all PHP OpCache's fault when it came to an issue they were seeing post-deploy.

Upon migrating to a new infrastructure we started experiencing cache issues after each deploy: as we refreshed pages that were updated by the new release, we didn’t see the right content for a very short period of time. Initially, we wrongly assumed that the cause of this issue was the PHP OPcache extension but, after our investigation, we understood that real path cache was the culprit.

He starts from the beginning (a good place to start) and gives some background on the application they were working with and what they were trying to correct. After they deployed the newly pushed version wouldn't show when the pages loaded for a little while. He covers the deployment process they use and the commands/scripts they use. They started wondering if it was somehow PHP's own Opcache functionality that was caching the pages and not releasing them right away. They made some updates to their deployment process to try to resolve this.

After some investigation, however, it was discovered that the realpath caching was at fault. It wasn't updating the cache to point to the newly released files. In order to correct the issue, they tinkered with the php.ini settings related to the cache to disable it when the code is pushed.

tagged: opcache realpath cache deployment issue tutorial

Link: https://engineering.facile.it/blog/eng/realpath-cache-is-it-all-php-opcache-s-fault/

Asmir Mustafic:
How do I deploy my Symfony API - Part 3 - Infrastructure
Oct 05, 2017 @ 09:29:06

Asmir Mustafic has posted the third part of his series covering the deployment of Symfony API applications. In this latest part (part three) of the series, he focuses on the infrastructure piece.

This is the third post from a series of posts that will describe the whole deploy process from development to production. The first article is available here and the second here.

In the previous two articles, I've covered the steps 1-3 from the schema here below. Before being able to discuss the steps 4-5 we will need to see how to configure the instances properly to be able to deploy our application to a docker-swarm cluster with rolling updates.

He starts off by describing the pieces that will make up the infrastructure: a PostgreSQL database, Docker swarm for machine/VM management and AWS instances to run the containers on. He then starts in on the instance type and setup you'll need to get the system up and running including manager and worker nodes. The post wraps up with a list of things he sees as improvements for the future such as using a custom AMI, use of elastic load balancers and handling node failure a bit better.

tagged: symfony api deployment tutorial infrastructure part3 series

Link: https://www.goetas.com/blog/how-do-i-deploy-my-symfony-api-part-3-infrastructure/

Rob Allen:
Deploying a PHP application to Cloud Foundry
Aug 30, 2017 @ 10:22:03

Rob Allen has a new post to his site today showing you how to deploy your PHP application to Cloud Foundry, an open source cloud platform that helps to automate deployment onto multiple cloud infrastructures.

I recently had a requirement to deploy a Slim application somewhere. As I already have a Bluemix account, it seemed sensible to deploy it to their Application Runtimes service which is an installation of the Open Source Cloud Foundry project.

This turned out to be quite easy, but there are a number of steps involved, so I'm documenting it here.

After installing some of the command line tools he then prepares the PHP application by selecting a version, creating a manifest file, setting up buildpack options and defining rewrite rules. He then walks you through the deployment steps required to push the code out to the Bluemix host via Cloud Foundry, including the commands needed to make it all work.

tagged: deployment application tutorial cloudfoundry bluemix command configuration

Link: https://akrabat.com/deploying-a-php-application-to-cloud-foundry/

CloudWays Blog:
Speed Up PHP Application Deployments Via Laravel’s Envoyer
Aug 01, 2017 @ 11:49:42

The Cloudways blog has a new tutorial posted showing you how to speed up your deployment using Envoyer, a service from the Laravel ecosystem that's used to push code to an environment in an automated way.

Envoyer is a deployment tool used to deploy PHP applications. The best thing about the the tool is the zero downtime during deployment. This means that your application and the customers using it are not even aware of the fact that a new version has been pushed.

Envoyer works well with major repository management platforms such as GitLab and Bitbucket. Other benefits include unlimited deployments and team members. The following blog will guide you through the process of deploying applications on Cloudways using Envoyer.

The tutorial then walks you through creating an Envoyer account, connect it to a repository and set up the server to deploy the code to. They then show how to set up the deployment itself, make the push to the server and configure any post-deployment steps that may need to be performed. Screenshots are included in each step of the process so you can be sure you're on the right path.

tagged: laravel envoyer deployment tutorial introduction process configuration server

Link: https://www.cloudways.com/blog/php-laravel-envoyer-deployment/

Laravel News:
Developing a CI Process for Laravel with Codeship and Forge
Jun 05, 2017 @ 13:01:05

On the Laravel News site they've posted a tutorial showing you how to create a CI process for deploying Laravel applications using the Codeship and Forge services.

Codeship empowers developers to efficiently test and deploy web applications with a basic command. Today, I want to demonstrate some of the platform’s features through testing and deploying a Laravel application.

They start the tutorial with some of the things you'll need to have set up prior to the process including a local instance of Docker, a DigitalOcean or AWS account and a Laravel Forge account. The tutorial then shows how to complete the process using this sample application:

  • Setting up our Codeship project
  • Setting up Laravel Forge
  • Connecting Forge and Codeship

The article walks you through all the setup and configuration you'll need to get the process integrated and up and running quickly.

tagged: laravel deployment codeship forge tutorial integration

Link: https://laravel-news.com/ci-process-codeship-forge

Master Zend Framework:
How to Go From Development to Deployment with Docker
Jun 01, 2017 @ 13:13:58

The Master Zend Framework series has posted the third part in their series covering deployment and development setups with Docker. In this latest article Matthew Setter builds on the knowledge from the first and second parts of the series and shows how to deploy your environment to production.

In my search to learn how to use Docker as a complete solution to develop with, I've found a range of tutorials which discuss or walk through some part of the process.

Sadly, no one tutorial contains all the steps necessary to step you through containerizing an (existing) application through to deploying said application in a production environment. Given that, my aim in writing this tutorial is to show you how to do this.

The challenge in doing so, unfortunately, is that there's a lot to learn and absorb. [...] So this is going to be a lengthy post. But I've aimed to provide the most direct path to your first production deployment, as well as to structure it so that it's easy to work through or navigate to the specific part you need.

He starts off with a few prerequisites you'll need to complete the process - a DigitalOcean account, a Docker Hub account, Docker installed and working and a project to deploy. The rest of the post is broken down into a few sections to make it a bit more consumable:

  • Create & Build the Container
  • Store the Image in an Accessible Registry
  • Build a Deployment Configuration
  • Make the Deployment

For each step in the process all of the code, configurations an commands you'll need are included. In some places screenshots are also included to help you ensure you're on the right path.

tagged: development deployment docker tutorial series production

Link: http://www.masterzendframework.com/docker-from-development-to-deployment/

Matt Stauffer:
How to set up your Laravel application for zero-downtime (Envoyer/Capistrano) deploys
Mar 30, 2017 @ 09:58:35

Matt Stauffer has a post to his site today sharing a step-by-step guide to setting up your Laravel application for zero downtime deploys when using the Envoyer/Capistrano combination.

The reason you're getting zero-downtime deploy from these tools is because the entire deploy process—clone, composer install, etc.—doesn't happen in the directory that is currently serving your site. Instead, each new release gets its own separate "release" directory, all while your site is still being served from its current "release" directory.

All of these release directories are just subdirectories of releases. Each directory here represents one of your deploys, and each directory individually has everything needed to serve your site. [...] So, once the build process is complete for each new release, your deploy tool will delete the current symlink and create a new current symlink that points to your latest release. Boom. Now that release is live.

He then relates this back to the deployment of a Laravel application with Envoyer which already follows this "symlink deploy" method. There's a few caveats he mentions with this deploy, however, including information that shouldn't be removed in each deploy (like caches or configuration files). He then provides the steps (commands) you can follow with the deploy to manually use the "symlink deploy" method in your own scripting.

tagged: laravel deployment envoyer capistrano manual symlink tutorial

Link: https://mattstauffer.co/blog/how-to-set-up-your-laravel-application-for-zero-downtime-envoyer-capistrano-deploys

Zend Framework Blog:
Create ZPKs the Easy Way
Mar 22, 2017 @ 09:05:17

On the Zend Framework blog Enrico Zimuel has posted a tutorial showing you how to easily create ZPKs and package up your application for deployment on Zend Server.

Zend Server provides the ability to deploy applications to a single server or cluster of servers via the ZPK package format. We have offered zf-deploy for creating these packages from Zend Framework and Apigility applications, but how can you create these for Expressive, or, really, any PHP application?

They start by listing out some of the requirements you'll need to get started (the zip binary, Composer, etc). The tutorial then walks you through the setup including the contents of the .htaccess and deployment.xmlconfiguration files. It then walks through the installation of dependencies and actually creating the ZFK (via the zip binary). It wraps up with a simple example of the creation of a ZPK containing a single index.php file.

tagged: zendframework zendserver zpk zip package deployment tutorial

Link: https://framework.zend.com/blog/2017-03-21-create-zpks-the-easy-way.html

SitePoint PHP Blog:
Crash Course: Continuous Deployment with Semaphore CI
Mar 13, 2017 @ 12:42:23

On the SitePoint PHP blog there's a new post that gives you a crash course in using Semaphore, a "continuous delivery pipeline" service, and how to use it to deploy your PHP applications.

Understanding continuous delivery, a now already long-standing buzzword, is not a problem, but implementing it in the right way has been a challenge for quite a few of us, and one we’ll discuss in this post.

[...] In this article, we will cover the process of deploying a Laravel application on a Digital Ocean server through a continuous delivery pipeline using Semaphore. The source code for the application is present on Github.

They walk you through each step of the way (complete with screenshots) to:

  • Create a Semaphore account, linking it to GitHub
  • Creating a new Project
  • Setting up the plan for the deployment
  • Performing the first build
  • Parallelizing the builds

With the project all set up the tutorial then starts on the continuous deployment changes, adding in a "Deployment" step and making a first push.

tagged: crashcourse continuous deployment semaphoreci tutorial setup configuration

Link: https://www.sitepoint.com/crash-course-continuous-deployment-semaphore-ci/