Linode is the newest addition to the already robust options of Cloudways cloud infrastructure providers that include Vultr,DO, AWS, Kyup and GCE. The Cloudways users now have another great option for hosting their Symfony 3.x & upcoming Symfony 4.x applications on the robust Cloudways Platform. Previously I ran a series of articles on Symfony covering technical use cases and how-to’s. Symfony 4 comes with great features (such as Symfony Flex) that will transform web development.
Linode has a huge following in Symfony communities because of its robustness and developer friendly features. Cloudways adds another layer of optimization through the managed ThunderStack on Linode servers. In this article, I will demonstrate the deployment of a Symfony application on a Linode server.
As a developer, you must be familiar with the concept of stack – an arrangement of technologies that form the underlying hosting solution. To provide a fast blazing speed and a glitch-free performance, Cloudways has built a PHP stack, known as ThunderStack. This stack consists of technologies that combine together to offer maximum uptime and page load speed to all PHP applications. Check out the following visual representation of ThunderStruck and the constituent technologies.
As you can see, ThunderStack comprises a mix of static and dynamic caches with two web servers, Nginx and Apache. This combination ensures the ultimate experience for the users and visitors of your application.
Deploying Symfony Applications on Linode Server
You will see the power of the Cloudways Platform right away in the first step! Signing up for your account at Cloudways takes a few minutes only!
To set up a PHP 7 server on Linode at Cloudways, simply sign up for your Cloudways account, and login using your newly acquired login credentials. Next, at the server launch page, select Custom PHP App as your application & Linode as your infrastructure provider. Next, identify your server resource needs along with other required details. And you’re done! Your Linode server will now be deployed. By default you will get PHP 7.0 on server. However, you can upgrade or downgrade to any of the three versions, 5.6,7.0,7.1.
Launch SSH Terminal
Move on to the “Server Management tab” to launch “SSH Terminal” that is located in the “Master Credentials”. Here you can find your login credentials for SSH terminal.
Login to SSH with these Master Credentials.
Empty your public_html directory
Empty your public_html directory by deleting all files in it. To remove all files, move to your public_html folder and delete all files using
rm -Rf * command.
Install Symfony 3
In the directory of your “public_html”, run this command to install the latest version of Symfony.
composer create-project symfony/framework-standard-edition your_project_name "3.0.*"
For 3.1 and higher version replace the version number with x:
composer create-project symfony/framework-standard-edition your_project_name "3.x.*"
Database Information and finishing Installation
As Symfony starts downloading, it will ask you for your database information.
You can find your database information under the “Application Management”. Go to the “Access Detail” tab and see MySQL Access.
After providing your database information, the installation will soon complete installing Symfony
After that the installation is complete, go to “Access Detail” in the “Application Management tab” and copy your application’s URL.
Open any web browser and access the welcome page of Symfony by entering
This is it, your latest version of Symfony is ready to use.
More Application Settings
Now, go to Servers >> Settings & Packages tab. There are three sub tabs: Basic, Advanced and Packages. In the Basic tab, you can set basic PHP attribute values such as Execution limit, Upload Size, Memory Limit and Error Reporting.
In the Advanced tab, you can set up advance attribute values for Nginx, Apache, MySQL and PHP including Max input variables, Xdebug, Opcache Memory, Max Connection limit,HTTP2. You can simply input the values and use toggles for enabling and disabling options.
In the Packages tab, you can easily downgrade PHP version to 5.6, if your application requires it. In addition, you can choose between MySQL or MariaDB as you preferred database driver.
Deploying Symfony Application on Linode From GitHub
You likely have your PHP application on GitHub. No problem, because you could easily deploy it on the Cloudways Platform. The Platform has a simple system for direct deployment of your application from Git repositories.
To deploy the application from a Git repo, first, in the Platform dashboard, click the ‘Applications’ tab from the top menu bar and select your application from the list that pops down. You will now need a mechanism to generate and download the SSH keys that are the critical-authentication aspect of the process.
To do this, click on the ‘Deployment via Git’ button in the ‘Application Management’ area, and then click the ‘Generate SSH Keys’ button to generate your unique SSH key. To download these keys, simply click on ‘Download SSH Keys’.
To allow Cloudways to access your application on the Git repository, upload the ‘SSH Public Key’ (that you have just downloaded in the previous step) to the GitHub.
To do this, login to your GitHub account, go to the desired repository, and into the ‘Settings’ tab. Here, locate the ‘Add Deploy Key’ button and use it to add the SSH Public Key. You can do this by opening the file downloaded in the previous step and pasting its content into the space provided by the GitHub. Click on the ‘Add Key’ button to finalize the input of the SSH key.
You will also need a path link to allow GitHub to communicate with the Cloudways Platform. This path is provided by the ‘Repository SSH Address’ that you will see in the top panel in your main GitHub dashboard. Copy and paste this address in your Cloudways’ ‘Git Remote Address’ field.
Next you need to input the deployment path and click on ‘Start Deployment’ button to have your application code deployed onto the Cloudways platform!
PHP-FPM, Varnish & Cron Settings
Cloudways provides custom UI panel to set and maintain PHP-FPM and Varnish settings. Although the default configuration is already in place, you could easily change all the settings to suit your own particular development related requirements. In Varnish settings, you can define URL that is to be excluded from caching. You can also set permissions in this panel.
Cron jobs are a very commonly used component of PHP application development process. On Cloudways Platform, you could easily set up cron jobs in just a few clicks. Just declare the PHP script URL and the time when the script will run.
Pre-Installed Composer & Git
PHP development requires working with external libraries and packages. Suppose you are working with Laravel and you need to install an external package. Since Composer has become the standard way of installing packages, it comes preinstalled on the Cloudways platform. Just launch the application and start using Composer in your project.
Similarly, if you are familiar with Git and maintain your project on GitHub or BitBucket, you don’t need to worry about Git installation. Git also comes pre-configured on Cloudways. You can start running commands right after application launch.
Managed Linode servers are ready to boost your PHP application on Cloudways. You can see everything is on mouse click whether they are PHP services, Application Settings, SSL installations etc. So start launching Linode servers and post your queries in comments if any.
Start Creating Web Apps on Managed Cloud Servers Now!
Easy Web App Deployment for Agencies, Developers and E-Commerce Industry