Running a provisional script in one of the Homestead projects? - php

In my Homestead directory, I have mapped two projects, one laravel, and one PHP.
My PHP project could be run with vagrant up. This would then create tables in a database and everything setup to work.
My question is how would I set up this to happen automatically after I vagrant up my Homestead machine?
I think that vagrant up inside a Homestead machine is not the best solution.
I know it is complicated if someone has any idea how this would be done, I am grateful.
Thank you

You can use after.sh to do anything you want to the Homestead VM after it's been booted but before it finishes the vagrant up process.

Related

How to set up React-Laravel project with out php artisan serve?

I have created a react-laravel project using laravel-mix. Right now I am run project using
npm run watch
php artisan serve
So by this, I access project by : http://localhost:8000
I have also worked in laravel. In laravel, if we want to access project without php artisan serve then we can access using : http://localhost/project_name/public.
Now my question is, how can I access/execute react-laravel project without php artisan serve? Is there any kind of way to access/execute project without port? Because I want to set up react-laravel on live server and I don't want to continue open terminal on server after code uploading.
I will really appreciate your feedbacks.
There are a multitude of ways to set up a laravel project. and it has nothing to do with the frontend suite you use whether its React or Vue, I will give you 2 options here to run a laravel application.
1. vagrant/homestead
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
Doc Link
2. XAMPP/WAMP/ or any LAMP stack
XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.
Link
Personally I prefer Laravel Homestead since it contains everything out of the box for laravel Development. like PHP, Nginx, MariaDB, Node, etc...

Vagrant Issue: Which Vagrant file is the correct one to edit?

Recently I bought a course on sitepoint.com for learning the Laravel Homestead framework.
I've been running into so many issues with simply just setting it up on VirtualBox. Mainly the issue is Vagrant timing out when trying to connect to the homestead7 box. Going through what it says when it times out, there are no errors with it booting, the connection just times out. So the solution is to configure the config.vm.boot_timeout variable to a larger number.
However, in which Vagrant file is that in? There's 4: One in the Homestead directory itself, one on my User directory in .vargrant.d/boxes/"Name of the box"/1.1.0/virtualbox, and a few others scattered around. None of which contain a variable called "config.vm.boot_timeout".
Should I just do a fresh install of Vagrant and VirtualBox?
Here's where the connect times out on vagrant up or vagrant reload --provision
Update: Based on comments it appears in this case the problem was due to the vagrant init <boxname> step not happening yet, so the local Vagrantfile was not created.
The Vagrantfile which is used will depend on where you ran the vagrant up command. In your case it should be under C:\Homestead\Homestead.
You can see a bit more detail on the search order for Vagrantfile in the Vagrantfile docs.
There might not be a default config.vm.boot_timeout value, but you can always add it. (By default I think most Vagrantfile leave it out.)
To troubleshoot the problem you might also turn on the GUI mode. See my answer here for more details: https://stackoverflow.com/a/23742373/9965

Run Laravel on existing Apache server

I have a DigitalOcean server running Ubuntu 14.04. I'm using this as a host for my web-development projects.
Now I want to start using Laravel for a project of mine, but I have a question about this.
In the /var/www/html folder of Ubuntu I created a folder, let's say, "project". In this folder I installed Laravel using this tutorial. Now everything is setup I want to run Laravel so I can test it and start developing on it.
When I run the command php artisan serve from within the "project"-folder it says "running on http://localhost:8000". So it's working.
But how do I access it? When I go to http://example.com/project it just shows me the files in that folder.
So it's running on the localhost on my server. Does that mean that it is external-accesible (the url above) or how does this work? (I guess the port is also different, 8000 instead of the default 80 for Apache)
I hope the question is clear and someone can help me out.
I have a Laravel project up and running on Digital Ocean with the Ubuntu 14.04 x64 vmlinuz-3.13.0-24-generic (1221) kernal.
I don't think you should be using php artisan serve for this purpose, as that is more for your local computer if you would like to preview your webpage if you don't want to use Apache.
To get set up, I used the excellent below instructions that were incredibly helpful. As you can see, there are many steps that you should carefully follow to get things up and running.
https://github.com/susanBuck/dwa15-fall2016-notes/blob/master/01_Servers_and_Git/07_Deploy_to_Digital_Ocean.md
Let me know if that helps you, and feel free to follow up with more questions if you get stuck on a step.

Vagrant based development

I was just discovered Vagrant and i want to use it in my development. I just wanted to see how are some more experienced developers handing this.
I will assume on my local machine i will have a folder, say ~/server/, where i will keep all my projects (one in each folder), and each will contain a Vagrantfile.
Questions:
GIT: do i install the git on my machine and make the pushing/pulling locally, or put it on the vm for each project and run those from there?
DB: the database will obviously go into the vm for each project, but how will i be able to easily modify them? Should i install phpmyadmin or a tool like that on each vm?
what is the best way to access the vms in the browser? Do i assign each of them a different IP and then add a record into my /etc/hosts?
I'm just starting out with Vagrant, so there are probably questions i have that didn't even popped into my head yet, so any other suggestions you could give me that you think are important for this will be very useful to me.
Thanks in advance for the answers.
GIT: In my opinion, you should install git and setup repositories via vagrant provisioning on each VM, and after that you can create git hooks on your local machine that will update the code on each VM on local commit.
DB: You don't need to install phpmyadmin on vms. You can easily modify DB (I am assuming, you want to modify records) via DB client installed on your local machine (preferred) or you can also use local machine's phpmyadmin with remote connection.
Yes, you can do that.

how to work with Vagrant with github repository?

Someone please describe how to work with vagrant? what i have done so far
I have installed Virtual Machine
Installed Vagrant
run few command and now Ubuntu 32 bit is installed in virtual machine
I have my project on github.
I make clone of the repository on my desktop ( D:)
created clone on my desktop
now my question is how to work with this repository code and associate vagrant?
Clearly no idea what this Vagrant actually is?
I think you have web project written in php. First you need to define vagrant folder. Clone your repository to the folder from your host machine. For folder in guest machine , let apache know where is you host. This is the step you need to do.
But I wanna suggest you to learn how vagrant work first. If you don't know the concept, it will not be ok. And you can use https://puphpet.com/ for vagrant configuration.

Categories