Deploying an application

With DeltaBlue, you have ultimate control over the way you deploy your applications.

For this tutorial we assume you are familiar with how projects and applications are structured on the DeltaBlue platform. If not, please click here to learn more about it

Create project

We start with creating a project. In the top left corner, click the ‘Create project’ button and give the project a name. When the project is created, you’ll see a page with one environment, named “Development”.

Create application

Click the ‘Add application’ button and give your application a name. When the application is created, a screen pops up in which you can choose the ‘components’ (also called “stackitems”) you need. For this demonstration, we’ll click the “Apache + PHP” dropdown and select “Apache + PHP 7.2”. We are now asked which technology we want to use (eg Laravel, Plain PHP, Craft CMS, Symfony, …). No worries, this will only set some pre-defined environment variables for you, nothing more. We’ll go for “Symfony 3.0”. In the next screen, you can choose which resources you need. Please think a moment about this, as this cannot be easily updated afterwards. When you choose a resource package, you’ll see a list of components (stackitems) that will be built for your application. We now only need the Apache + PHP, but you can add as many as you want. Once you are finshed with setting up your stack, you can click the “done” button.

Configure the application

When you click the application name, you’ll be taken to the application detail page. In order to do deployments, we’ll need to couple a VCS to our application. Please see this tutorial. Now launch the application. Click on the “config” tab. You’ll see a list of variables here. Under the “Apache + PHP 7.2” stack item, notice the “docroot” variable has an empty value. Enter this value: “/opt/approot/current”, click in the top right corner the “save” button and after that the “apply variables” button.

Create deployment scenario

On the application detail page, click on the ‘Actions’ tab and then the ‘Create new scenario’ button. Give your scenario a name (eg ‘Deploy application’). On the right of the screen, you’ll see a list of available tasks. In the ‘filter task’ box, type ‘Git Clone’ and click the green + (add) sign next to the “Git Clone” task. The action is now added to the scenario in the middle part of the screen. In the ‘filter task’ box, type ‘symfony’ and add a task ‘Symfony 3.x clear cache’. Now type ‘symlink’ in the filter task box and add the “Symlink release to current” to the scenario. Click the ‘Save changes’ button.

You probably have noticed that there is a “Git clone” and a “Git clone with symlink” task. The main difference is in which folder the clone action is performed: the “git clone” action creates a folder like ‘/opt/approot/build.123/’ and performs the clone there. The “git clone with symlink” performs the clone in what you configured as ‘docroot’ (in this case: “/opt/approot/current”). Doing things directly in the ‘docroot’ is immediately visible on your website, therefore it might be a better idea to first do a regular “Git clone”, then some other actions like database migrations, building of assets, clearing cache, etc and as the very last step you switch the docroot symlink to the newly built folder. In case you do all the database migrations, building of assets etc in the docroot folder, your site might look broken during the execution of the actions.

Deploy!

In the scenarios list, click the “Run” button. A timer will appear on top of the screen giving you an indication which task is running and which are completed. Once the scenario is completed, you can check it by clicking the “History” menu item on the left. Each scenario execution is listed here. If you click on the ‘details’ button, you’ll see at the right a list of tasks that were executed. Next to each task, a “View log” is displayed that will let you see the output of the task (if there was any).

Note 1: you can create scenarios or actions when an application is not launched, but you cannot execute scenarios or actions while the application is not launched.

Note 2: scenarios run sequentially per application. So if a scenario is already running and you run another one, the second scenario will only be started after the first one finishes!