how to work with Vagrant with github repository? - php

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.

Related

Running a provisional script in one of the Homestead projects?

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.

Share homestead vagrant box and laravel project on Git

On my local machine I have created using homestead vagrant box a laravel project. Now I have an Homestead folder that contains many files like Vagrantfile, Homestead.yaml configuration and as soon as. I have also another folder sibling of Homestead folder that contain the Laravel files project. My question is how to share on Git this folders in order to clone the repository from another machine and recreate automatically the same Vagrant machine and the laravel project? In both folders there are composer.json files.Thanks in advance.
Depends on what you want to achieve. If you want to have a "frozen" in time vagrant box you would init homestead, let it do it's thing and them remove anything that's not mentioned in the vagrant file, then use that as a base for your repo. You can also fork homestead, run init and the use that as a base.
Homestead has an extra provisioning script, by convention named after.sh (see this for an example and this to see when it's called), which could clone your project from a separate repo into a place of your choosing (consistent with the project root you set up in your homestead file).
My point is -- don't mix development environment setup with your project files.
All of the above could be done under assumption you would have all the prerequisite software installed on your machine (vagrant, homestead, git, etc). Otherwise (maybe homestead would do it for you) you might also right a custom setup script that would check those dependencies, attempt to install them and the up the homestead box based on your configuration (something like a pre-init to init.sh :)). Or just put the instructions in the readme file (or link to Laravel's documentation).
I hope this helps!

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.

Projects got affected while installing laravel

While installing laravel through terminal command, my other projects in MAMP htdocs folder got affected and they are not working.
I followed this process for installing laravel
Those directions have you symlink the "htdocs" directory to your laravel install, effectively making your htdocs directly useful only for Laravel.
You should avoid this, perhaps by creating a symlink from your laravel build to a directory within htdocs. For example, linking to a directory in htdocs called "mylaravelapp": ln -s /path/to/laravel-master /path/to/htdocs/mylaravelapp.
Lastly, consider using Vagrant or another virtual machine provider instead of MAMP for a server. You'll have to get through a learning curve (potentially), but you'll end up better for it. This creates a virtual server for you, which won't interact with any other parts of your Mac (YOu can make a server per project!).
Here is a guide to get started with Laravel 4 and Vagrant.

Categories