How to deploy a Laravel application using Ultim8e Deployer?

While using Ultim8e Deployer, you can create a standard process to be able to automate deployments process of your Laravel web applications and websites. It can also be your SaaS platform using Laravel framework.

This article assumes you already have a server in place for your Laravel application deployment and your application is ready for deployment on that server. You can find a useful set of guides for how to install it in Laravel’s documentation.

Creating user for Ultim8e Deployer

For security reasons, we recommend you to create a separate user for the use of deployments.

sudo adduser ultimate
sudo usermod -a -G apache ultimate

Note: We assume that you are using Apache web service. If you are using any other web service then please change the name of the group accordingly.

Configuring server

Now to connect Ultim8e Deployer with your server, we need to create a server by going to Servers > New Server.

  1. Enter the name that you can easily memorize and select SSH from the list of protocols.
  2. Enter the IP Address of your server into the Hostname field.
  3. The Username should be ulimate as we created in previous step.
  4. Select/Enter information in the rest of the fields accordingly.
  5. Click on Save.

 

Once you save the see the list of all the servers. From that list click on SSH Key button on the server that you have recently created for this project.

su - ultimate
mkdir ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys

Paste Ultim8e Deployer’s public key, then press Ctrl + X, y then Enter to save.

Now set the correct permissions on the authorized_keys file.

chmod 600 ~/.ssh/authorized_keys

Note: We assume that you are using Apache web service. If you are using any other web service then please change the name of the group accordingly.

Creating a project

Create a project by going to Projects > New Project.

  1. Enter the name that you can easily memorize for this project
  2. Select the project environment.
  3. Select the repository tool that you have your laravel project repository hosted on along with other required fields. (if you need any help with repository settings please visit our  support page.
  4. Select the option for Notification and enter relevant information.
  5. Project Base path is the path that will be used for Deployment purpose. Set the deployment path to /var/www/yourproject.com.
  6. Check the radio button if you would like to deploy the project automatically once anyone commits to the branch.
  7. Provide the live URL in-case if you would like to monitor it.
  8. Select the server that you have added during previous step of this article.
  9. Click on Save.

 

If you are planning to use Zero-Downtime option then Ultim8e Deployer will take care of ensuring the previous version of your applicatio stays live and running until the moment of deployment is completed. You can find more information about this in our  documentation.
 
Enabling Zero-Downtime, your application files will actually live in a path like /var/www/yourproject.com/current so you will need to update your web server configuration file appropriately.
 

Adding Config File to the project

Config files are files that you want to upload during deployment process, but dont want to keep it in your repository. This is particularly useful for configuration files that migt contain sensitive data such as .env file in this case.

Go to Projects > Select your Project > Click on Config Tabs and click New Config File.

  1. Provide the name of file as .env
  2. Provide the location path where you would like to keep your .env file. Incase if you want to keep file in your project base then leave it empty.
  3. In your project, open up the .env.example file and paste the contents into the config file content field.

Setting up Scripts

We need to execute few commands on the server after every deployment.

To do so go to Projects > Select your Project > Click on Scripts Tabs and click New Script File.

  • Install Dependencies
  • Run Migrations
  • Cache Configuration

 

Scripts are run from top to bottom, so make sure they’re in the correct sequence.

If you are using multiple scripts then ensure that those are also in the order. You can review the order sequence of the scripts in the Scripts Tab.

Deploying your Laravel Project

So now, its time to deploy!!!
 
Go to Projects > Select your Project > Click on Deploy button on top right hand side of the screen.
 
  1. The server you created should be pre-selected, along with the branch you provided in the project setting.
  2. Select the revision that you would like to deploy.
  3. Click on Deploy to begin the deployment.

Now sit back, relax and look to your logs while deployment is happening.

Offer available till 15th July 2020 and Only 50 Coupons left!

Creating apps that helps to improve your productivity with minimal efforts!

Terms & conditions

* Discount applicable only on Ultim8e Deployer.

WE ACCEPT

©2020, Ultim8e.com. All Rights Reserved. Powered by Ingress IT Solutions

GO TOP