Before you can install your Laravel application on one of your deployments, you first need to create an image. Images in Smoothy provide you with a powerful way to automatically test your code, turn your code into an executable binary, and roll out the latest version of your application to your deployments as part of a single automated workflow.
This tutorial assumes that:
You can create an image by navigating to the images page via the main navigation, hovering the button in the right upper corner of the images table, and clicking on Create image.
This will open up a form that asks you under which project you want to create your deployment.
Make sure to select the same project as the one assigned to the deployment on which you want to run the application. If you select a different project, you will not be able to run your application on this deployment.
Next, you need to specify the git repository and branch that contain the source code of your application that you wish to run. As depicted in the screenshot below, to ease this process, Smoothy provides you with a list of all your git repositories from which you can select the desired one. In the same way, you can then also select the branch of your git repository.
In the subsequent step, you need to select the type of your application. Since this tutorial is focussed on Laravel applications, you should select the type Laravel.
Next, you need to specify the Laravel and PHP version in which your application code is written.
Besides compiling the assets of your application, you may also want to run a few (artisan) commands upon the installation of your application to prepare it for production. Examples are:
php artisan migrate
php artisan route:cache
php artisan storage:link
Based on the Laravel version of your application, Smoothy suggests a deploy script that will be executed every time your application is installed on a deployment. Make sure to verify that this script matches all the requirements of your application and if not change it accordingly.
In the next step of the creation process, you are asked whether or not your Laravel application uses the Laravel scheduler to execute periodic tasks. If this is the case, you should enable the option Run Laravel scheduler. Smoothy then configures your image to automatically run
php artisan schedule:run every minute.
If your application requires some daemon processes to run, you should also specify them in this step. Examples of common Laravel-related daemon processes are:
php artisan queue:work
php artisan horizon
The sixth step in the creation process of your application is about Laravel Nova. If your Laravel application uses Laravel Nova and installs it via Composer, you should enable the option Laravel Nova.
The "problem" with Laravel Nova is that it's source code is stored in a private Packagist registry which only customers of Nova can access using their login credentials. This means that, whenever you want to install your application on a deployment, you need to specify your login credentials in order for Composer to be able to download the Laravel Nova source code.
When you enable the Laravel Nova option for your application, Smoothy will ask you to provide the credentials of your Laravel Nova account once. After that, Smoothy will use these credentials to automatically authenticate with the private registry of Laravel Nova to download its source code upon every installation of your application.
Smoothy will turn your Laravel application into an image that includes:
These packages and extensions support the large majority of Laravel applications. However, if your application requires some additional packages to be installed, such as for example
mysql-client, you can specify them in the last step of the creation process.
Make sure that all the additional packages can be installed via the apt package manager.
When you successfully completed all the steps in the creation process, you should see your new image appear on the images page.
Now that you have created a Laravel image that is linked to your git repository, you should trigger your first image build to actually build the source code of your application into an image. After that, you can use the image to install your Laravel application on one of your deployments.
A passionate cloud engineer who helps software companies adopt modern cloud technologies through an intelligent all-in-one cloud platform called Smoothy.
Alle rechten voorbehouden. Ja. Allemaal.