Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 1 year ago.
0

You can use new branch for local repo that ignores .env and for vps the master repo which doesn't ignore .env

For your VPS you should install git.

git pull vps master

And use the

composer update

It should help you to achieve your goal. Hope it helps you.

0

Thank you for your reply.

I googled quite a lot and finally figured out:

  • Laravel app does not require node_modules and vendor folders to run, they responsible for dependencies

  • It's possible to deploy using git without .env file. I just copied it on server from .env.example file and changed it's content.

  • Also I found that it's not a good idea to run compose update on production. Use composer install instead and after command executes, vendor file will be generated.

PS I'm making simple blog and probably will write an article about how I made that blog and what problems I surfaced. ))

Last updated 8 years ago.
0
  1. What files I need to deploy my app on VPS. Asking that, because I tried to remove content of .gitignore and commit changes. After that I typed following commands:
git add -A

and it took few minutes to add all untracked files. There are a lot of files in node_modules folder (Do I need them all?) Then:

git commit -m "comment"

No no no. Don't do this. They are ignored for a reason.

/vendor

Files in here are installed when you run composer install

/node_modules

Files here are installed when you do npm install

Homestead.yaml
Homestead.json

These are only used for your local Homestead virtual machine

.env

This has sensitive information in and should never be included in your git repos. It will expose things like your database username, password and other connection details (and possibly other things like third party API keys).

.idea

This is from your IDE (I'm guessing you use PHPStorm) and has settings for your local development.

If you have committed those already I would look at trying to remove the commits from your git history and then force pushing your branch.

0

teddywest32 said:

You can use new branch for local repo that ignores .env and for vps the master repo which doesn't ignore .env

No. Don't do this. Never commit a .env file to your git repo. Just create it the first time you deploy to the server and then it won't be overwritten and won't expose your secrets.

And use the

composer update

Only ever do composer install on your production servers. You don't want composer updating packages that you haven't tested.

0

Thank you very much for such clear explanation @EspadaV8.

As I understand, to deploy Laravel project I need to:

  • pull from repo

  • configure database connection and site's URL

  • run composer install

  • run php artisan migrate

and that's it.

0

You should not remove vendor/ and node_module/ folders from gitignore because you need to install them with composer and npm after you upload your project to VPS. To do so, you need nodejs installed and you can download composer.phar file to use it per project and to install your dependencies.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

4unkur 4unkur Joined 15 Aug 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.