Laravel for Clients: What is deployment and how does it work in Laravel?

Notice: This is one chapter of my e-book “Laravel for Clients” – it’s available for free at LaravelForClients.com

Deployment is a process of “installing” the project to the server, to make it work “in public”. Imagine software installation process of Download -> Install -> Some configuration -> Finish -> Use. Similar here, just not visual – it all happens with “command magic” usually.

Deployment can happen for both absolutely new projects, as well as deploying of some new code for new feature, also for any bugfixes etc. The whole “deployment” term basically refers to pushing the latest code changes to a live server.

There are various ways to get the code from wherever developers write it – to the server.
In the old days it used to be done by transferring files via FTP and copying database changes via tools like phpMyAdmin. With a lot of possibility left for human error or lost connections.
These days it’s much more strict and therefore reliable – we have version control systems like Git and database migrations scripts, as well as the ability to easily put “Under construction” page while deployment is in progress.


So, how does it work in a typical Laravel project?

  1. First, the code is placed to a version control system like Github or Bitbucket, in a structure called “repository”.
  2. On the first deployment there’s quite a lot of magic involved – “cloning” that repository, configuring the folder with domain name, setting up the database etc.
  3. Then, with every deployment you need to connect to the server via SSH and from there – run a command “git pull” to pull latest code from Github or Bitbucket.
  4. Then there are some additional commands for checking new package versions, database migration, stopping-starting the whole project while deploying etc. You don’t need to know about that magic.

Painfully difficult at first sight, isn’t it?

That’s the point why I’m telling you this – as a client, you need to understand three things:

  1. You need to have dedicated server to run proper deployment process. There’s no way of running SSH and Terminal commands on shared hosting environment.
  2. Deployment is being done by professional developers, and clients shouldn’t do it, neither have access to do it – if you want to change some texts somewhere in the project, there should be a CMS built for it, or you need to ask your developer.
  3. Deployment isn’t just “one button click” – system needs to check code and merge with previous versions, possibly run some tests etc. That’s all needed for a reliable project and for the future deployments. So don’t ask your developers to “just deploy” – it’s not that simple. Of course, there are tools like Laravel Forge and Envoyer that makes life easier, but it’s still not a 1-minute job.

– – – – – –

Want to read the full e-book for free? Go to LaravelForClients.com

Like our articles?
Check out our Laravel online courses!

2 COMMENTS

  1. Hi Povilas,

    very good and informative post. However I’d like to share with you, that there is a way for a client to avoid a dedicated server, there is a way to use ssh on shared hosting environment and run all required commands like git, node etc. A good and a safe one.

    • Hi Donatas, thanks for your opinion. From my experience, all hosting providers that provide such functionality still limit what you can do with command line – for example, can you install git or Composer if it’s not installed? Can you configure some server parameters? PHP extensions? From my experience, command line on shared hosting is really limited. And that makes sense – that environment is SHARED with others so if you screw something up…

LEAVE A REPLY

Please enter your comment!
Please enter your name here