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

Stephan Hochdöfer:
Dockerizing GitLab Review Apps
Jun 07, 2017 @ 10:28:15

On the BitExpert blog Stephan Hochdöfer has written up a post showing how to "Dockerize" GitLab review apps to create a consistent platform for these self-contained environments.

Last year GitLab introduced the Review Apps feature. Review Apps are app environments that are created dynamically every time you push a new branch up to GitLab. As a bonus point the app environments are automatically deleted when the branch is deleted. Since we moved to using docker for quite a few of our projects I was keen on figuring out how to combine Docker and the GitLab Review Apps functionality as the documentation only mentions NGINX as a way to run Review Apps. As it turns out, it is rather simple to deploy docker containers as a Review App.

He describes the environment he needs and which tools he'll be using to perform the build of the environments. He then defines the sample GitLab configuration file including the "build" stage. He briefly explains the steps this follows then shows the configuration for the "deploy" step, grabbing the latest image from his Docker repo and running it. He ends the post with an "undeploy" stage that removes the Docker build automatically when the environment is no longer needed.

tagged: gitlab review application apps tutorial docker deploy undeploy

Link: https://blog.bitexpert.de/blog/dockerizing-gitlab-review-apps/

Phillip Shipley:
How to automatically deploy static single-page-apps to Amazon S3 and Cloudfront or
Jun 02, 2017 @ 10:39:26

Phillip Shipley has a post to his site for the AWS and Cloudflare users out there (or those that want to use these together) about an easy way to automatically deploy static sites.

Managing web servers can be a lot of work. Especially when it comes to configuring and maintaining SSL certs, server and software updates, etc. Let’s Encrypt has made the SSL part a lot easier, but it is still work and to me feels like overkill for something as simple as a static single-page-application. Especially when there are dead simple solutions like Amazon S3 that can be used to host and scale a static website without any server configuration or maintenance. Adding CloudFront with a free SSL certificate from Amazon’s Certificate Manager service make SSL painless too.

[...] In this article I’ll cover how to use Codeship’s continuous integration and deployment service to build/test your app, deploy it to S3, and then clear cached versions of it from CloudFront and Cloudflare.

He then shows how to use the Codeship service to do the actual deployment, broken down into a few steps:

  • Step 1: Setting up project in Codeship
  • Step 2: Configure Tests
  • Step 3: Configure Environment Variables
  • Step 4: Configure Deployment

Each step includes both screenshots and configuration examples you'll need to get the workflow set up and running for your site.

tagged: deploy tutorial singlepage amazon s3 cloudfront cloudflare codeship process

Link: http://www.phillipshipley.com/2017/05/how-to-automatically-deploy-single-page-apps-to-amazon-s3-and-cloudfront-or-cloudflare-using-codeship/

SitePoint PHP Blog:
The Ultimate Guide to Deploying PHP Apps in the Cloud
May 12, 2017 @ 12:18:59

On the SitePoint PHP blog author Prosper Otemuyiwa shares what they call the ultimate guide to deploying PHP apps in the cloud with examples for Heroku, Google Cloud, IBM BlueMix, Microsoft Azure, Amazon Web Services and Laravel Forge.

There is a popular mantra amongst developers that goes like this write, test and deploy. In this tutorial, I’ll show you how to deploy your PHP apps to different cloud server platforms such as Google Cloud, Microsoft Azure, Heroku, IBM Bluemix, and others.

Cloud servers are basically virtual servers that run within a cloud computing environment. There are various benefits to hosting and deploying your applications in the cloud. [...] In fact, many companies have moved their infrastructure to the cloud in order to reduce cost and complexity. It’s a great option for small, mid-sized, and enterprise scale businesses. If you write a lot of tutorials and do POCs (Proof-of-concepts) like me, it’s also a great choice for you!

He starts off by covering the technologies that will be involved in each deploy: Linux, Apache, MySQL and of course PHP. Then, for each of the platforms previously mentioned, he goes through the setup and configuration of the same functionality. Most include screenshots of the UI in the service setting up the account and application. He also links to two tools that can make it easier to deploy your actual application to these newly configured cloud instances: Envoyer and Deployer.

tagged: guide deploy application cloud google bluemix azure aws forge

Link: https://www.sitepoint.com/ultimate-guide-deploying-php-apps-cloud/

Laravel in Docker
May 05, 2017 @ 12:13:32

On the Hackernoon.com site they've posted a tutorial showing you how to set up a Docker image of a Laravel application to help speed up your development using the framework and standardize the environment it lives in.

With this article you’ll learn how to prepare a Docker image of a Laravel application, push it to the registry, and use Docker in Continuous Delivery.

The post starts with a brief introduction of the two technologies at play, the Laravel framework and Docker, and what they provide. The tutorial then walks you through the entire process of setup, configuration and deployment of the Docker image:

  • Install Docker
  • Write a Dockerfile (including the install of Laravel)
  • Build Docker image (and Run)

At this point you have the image set up and ready to serve Laravel requests so they move on to sharing the image out on a Docker registry. In this case they opt to deploy it to hub.docker.com and use the login and push commands to quickly and easily share your creation. Finally they provide some use cases for this kind of deployment including creating standard development environments, using them for testing and keeping a consistent environment between development, staging and production.

tagged: laravel framework docker tutorial configure deploy dockerhub environment

Link: https://hackernoon.com/laravel-in-docker-ceed4465352

Mattias Noback:
Containerizing a static website with Docker, part III
Jan 09, 2017 @ 11:48:46

Matthias Noback has posted the third part of his "containerizing a static website with Docker" service, continuing on from his previous two posts to look at deploying the environment he's created.

In the previous posts we looked at creating a build container, and after that we created a blog container, serving our generated static website.

It's quite surprising to me how simple the current setup is — admittedly, it's a simple application too. It takes about 50 lines of configuration to get everything up and running.

The idea of the blog container, which has nginx as its main process, is to deploy it to a production server whenever we feel like it, in just "one click". There should be no need to configure a server to host our website, and it should not be necessary to build the application on the server too. This is in fact the promise, and the true power of Docker.

He then gets into the two remaining steps in the process resulting in the deployment of the simple application: pushing to Docker Hub and deploying out to a DigitalOcean server. He includes all of the commands and configuration you'll need to get the process set up and work with the remote machine.

tagged: docker series container part3 deploy dockerhub digitalocean

Link: https://php-and-symfony.matthiasnoback.nl/2017/01/containerizing-a-static-website-with-docker-part-iii/

SitePoint PHP Blog:
How to Properly Deploy Web Apps via SFTP with Git
Nov 29, 2016 @ 11:53:49

On the SitePoint PHP blog there's a new tutorial posted showing you how to properly deploy applications with SFTP and Git. In their examples they build a PHP-based deployment process that uses a few handy packages to make the flow simpler than a set of manual commands.

Uploading files is an integral aspect of any deployment process, and the underlying implementation can vary depending on the type of your server.

[...] The PHPSECLIB (PHP Secure Communications Library) package has an awesome API for routine SFTP tasks: it uses some optional PHP extensions if they’re available, and falls back on an internal PHP implementation otherwise. You don’t need any additional PHP extension to use this package, the default extensions that are packaged with PHP will do. In this article, we will first cover various features of PHPSECLIB – SFTP, including but not limited to uploading or deleting files. Then, we will take a look at how we can use Git in combination with this library to automate our SFTP deployment process.

They start with a quick command (Composer) to get the phpseclib library installed but then quickly move into using it and some SSH keys to:

  • authenticate to the server with public/private keys
  • uploading a sample file
  • automating the deployment with Git, pushing only changed files from a local git repo
  • getting the contents of a specific commit
  • the actual push of the files via SFTP

There's also a few other helpful hints included showing how to manage permissions on the remote server, execute remote commands and downloading files. The post ends with links to other similar tools if you're interested in more complete approaches.

tagged: deploy application sftp git deployment tutorial phpseclib example

Link: https://www.sitepoint.com/how-to-properly-deploy-web-apps-via-sftp-with-git/

SitePoint Web Blog:
Heroku Alternative: Deploy Apps with Dokku on DigitalOcean
Jun 29, 2016 @ 10:28:54

On the SitePoint Web blog there's a new tutorial showing you how to deploy applications with Dokku on DigitalOcean in the same way that you might with Heroku.

When Heroku announced their (quite reasonable) new limits for free apps, I realized that I would have to find another source of hosting for all the small, low-traffic projects that I currently have running on Heroku. [...] Since I have such an unreasonable number of apps running on Heroku, I thought it was high time to try out Dokku. Dokku is a Heroku-like tool that allows you to deploy complex apps by simply pushing with Git.

They start with some of the differences between the Heroku setup and Dokku, mostly that Dokku uses Docker for the deployment and configuration. They then show you how to create a Dokku server on DigitalOcean: setting up the domain, making the application and deploying the app with a push and other datastore plugins.

tagged: heroku dokku digitalocean deploy application tutorial

Link: https://www.sitepoint.com/heroku-alternative-deploy-apps-dokku-digitalocean/

SitePoint PHP Blog:
Setting up PHP 7 Servers with Laravel Forge and DigitalOcean
Jan 07, 2016 @ 11:11:38

The SitePoint PHP blog has another new article from editor Bruno Skvorc showing you how to set up PHP 7 servers in two different ways: one the DigitalOcean platform and the other using the Laravel Forge service.

In this quick guide, we’ll cover two ways to bring a PHP 7 server online on DigitalOcean – a popular VPS provider. We’ll use two approaches, the latter of which will be applicable to any Ubuntu installation whereas the former will only work on DigitalOcean.

He starts with a brief description of what Laravel Forge is for those not familiar with it and how to use it to set up your new server instance. Screenshots of the interface are included showing the setup of the instance, backups, configuration of the server and how to link it to a repository. Then he gets into the more "manual" installation, working with a simple low-tier DigitalOcean droplet to secure and configure it with similar kinds of features: PHP 7 installed and working, Nginx and a fresh checkout of the repository.

tagged: php7 server tutorial setup laravelforge digitalocean deploy repository

Link: http://www.sitepoint.com/setting-up-php-7-servers-with-laravel-forge-and-digitalocean/

Rob Allen:
Using Composer with shared hosting
Dec 28, 2015 @ 09:25:44

Rob Allen has a post to his site talking about using Composer with shared hosting, showing how to use this popular tool even if you're on a shared hosting environment and don't have direct SSH or shell access.

I've seen this sentiment a few times now, so this seems like a good time to point out that you do not need SSH access to your server in order to use Composer. In fact, I don't run Composer on a live server (regardless of whether it's using shared hosting) and it's not on my list of things to do in the near future.

What you do need is a process where you handle your Composer dependencies on your own computer where you have PHP running.

He gives two possible solutions to the problem: either commit your dependencies or create some kind of build script that can execute the Composer install for you on deploy. He gives details on both of these solutions including the process for installing the dependencies with an automated FTP script (run at deploy rather than committed).

tagged: composer shared hosting ftp deploy script commit dependency

Link: https://akrabat.com/using-composer-with-shared-hosting/

Zend Blog:
Running Zend Server on Google Cloud Platform
Oct 30, 2015 @ 10:46:49

On the Zend blog there's a recent post showing you how to run Zend Server on the Google Cloud Platform, an easy to use service that makes deploying new sites a few clicks away.

Day 1 at ZendCon in Las Vegas has seen some pretty interesting announcements, one of them being the availability of Zend Server on Google’s Cloud Platform. Just in case you want to check it out, this article will help you get started.

Google’s Cloud Platform boasts a highly-scalable and reliable infrastructure, with computing, storage and application services for developing, testing and deploying your apps. With Zend Server, you get a certified and secure PHP stack, advanced development tools which include Z-Ray, and a bunch of additional features to aid your development workflow. Taken together, you get a powerful development setup.

They walk you through the simple process you'll need to follow to get the Zend Server instance up and running, complete with screenshots. They help you create the instance, create the server password and launch the result.

tagged: zendserver google cloudplatform deploy virtualmachine instance tutorial

Link: http://blog.zend.com/2015/10/20/running-zend-server-on-google-cloud-platform/