0

I'm using Windows with XAMPP when developing web applications (with Laravel). Also, I use Git for version control. When I finish a project, I'll have to deploy it on VPS (LAMP). How to do it? For now, two ideas come to my mind:

  1. SFTP - For example, I would use MobaXterm's Graphical SFTP browser, I would just copy my project (files)... and then I would import MySQL database (or run migrations).

  2. Git/GitHub - on my VPS I would install Git and then I would:

    • create a remote repository on GitHub (should it be private?)
    • git push (from localhost to GitHub)
    • and then, on VPS, I would do git clone (from GitHub to VPS)
    • finally, I just need to import MySQL database (or run migrations).

Do you work in this way, or there is a better solution? I suppose that the second way (Git/GitHub) is better than the first (SFTP) because if I have to add some new features or fix bugs - all I will have to do on the server is: git pull (from GitHub).


EDIT:

Now I see that there are services such as envoyer.io and forge, but they are not free. So, what are the disadvantages of the second way (2. Git/GitHub ) that I described in my question, which is free?

PeraMika
  • 3,539
  • 9
  • 38
  • 63

3 Answers3

3

This is a question that will attract primarily opinion based answers as everyone prefers to work in different ways.

The most basic, and free way would be to do this using Git. This will provide you with strong version control and allow you to push all the changes you make in your local development to your repository and then pull them down on to your VPS.

You could even set up webhooks to automatically update the version on your VPS every time you push or merge changes to your master branch.

Doing it via SFTP can be quite slow due to the process it takes, and you lose out on version control. Which means that if you accidentally broke something then you couldn't easily undo it. With Git you could just roll back to a previous commit.

If you are wanting to make private repos and don't wish to pay for them then you could consider using GitLab instead of GitHub. GitLab allow you to either host the repository with them or you can deploy your own GitLab instance on your VPS and host it all of your VPS.

There's tonnes of options here though, and the best approach is really just what you deem to be fit for purpose.

James
  • 15,754
  • 12
  • 73
  • 91
1

There are lots of tools to help you deploy Laravel or pretty much any application.

I've used https://deploybot.com/ and https://envoyer.io/ in the past.

You can also use https://forge.laravel.com/ to manage your VPS and deploy your laravel application as well.

vivek
  • 1,944
  • 1
  • 17
  • 26
  • What is the difference between using **envoyer.io** and the second way (2. **Git/GitHub**) that I described in my question, I mean what is the advantage of using **envoyer.io** instead of that way which is free? – PeraMika Jul 17 '16 at 00:59
  • 1
    If you have multiple VPS Servers running behind a load balancer, you don't have to manually go and run git pull on all the servers. Also, if you have a team, you don't want them have access to VPS servers just for deployment. If you are okay using command line, you can use http://deployer.org/ which is completely free. – vivek Jul 17 '16 at 01:12
  • Ok, but if I don't have multiple VPS Servers running behind a load balancer - then the second way (2. **Git/GitHub**) that I described in my question is totally fine, right? Also, if I have a team, why would they need to have access to VPS server when only one person in team (for example me) can do deployment (pull) from GitHub when there are new features added, or when there are bug fixes... ? I don't understand why would they need to have access to VPS? – PeraMika Jul 17 '16 at 01:24
  • 1
    Yep, you will be totally fine by using just git/github for deployment. In case you are not available and someone needs to deploy the code, you'll have to provide server access in order to deploy the code. That's what I meant by giving access to the team. – vivek Jul 17 '16 at 02:37
-2

You can also try deploying your projects with https://appsailer.com

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33334038) – ahuemmer Dec 08 '22 at 07:40