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.
Related
For example:
I have a Homestead with Laravel in Virtual Machine. After I finish my project could I just copy the files and bring them to my Wamp server, and export the database and import it into Wamp?
Or is there more behind all this?
Yes, generally this could be one way to deploy a project to a server.
The question is a bit broad to give a good answer because there are many ways how to built a good project deploy chain. First of all it depends on the server you are deploying to and the access rights you have (e.g. are you allowed to ssh into the server or can you run git at your server).
If you have ssh access and you are able to run git a good way could be to pull the git project from your git server, run composer install and migrate and seed your database with artisan.
There are even more ways up to full integrated deploy chains where you just need to push your project to a git server to trigger a deploy (e.g have a look at Capistrano or Laravel Forge for automated deploy).
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.
I am trying to deploy my first Laravel App. So I hope I am providing all the necessary info. I have walked down several paths trying to deploy this app. I tried a shared hosting account, but found too many errors to continue deploying my Laravel app. In the meantime, someone has said to me I need a VPS, so I may go with that.
So with a new VPS, I now am trying to install the following: phpMyAdmin, node.js, Composer, and Laravel 4. These are the technologies I am using on my local server with MAMP. Now after being overwhelmed with the information on installing each on a VPS, I have found myself extremely confused. Some places say I need to install Ubuntu. Some say I need to install Apache first. Some talk about using CentOS. I honestly have no idea what I need to install, and in what order. All I really need is to figure out how to set up a PHP environment on my VPS with phpMyAdmin, Node.js, and Composer. After that I am pretty sure it's all straight forward, as far as installing my app.
I also saw some one talking about committing my app to Git, and the cloning it to the VPS. If I did this, I would still need to set up the environment correct? Once again, I hope I have provided the necessary information. If my question is not clear, could you please refer me to a resource that I can study.
You don't need install Laravel separately from the app it is part of - these days a PHP app just contains everything it needs in its vendor folder. How to deploy depends on how you have arranged your dependencies locally, but the simplest way is to copy everything in your local project to your remote server (FTP or rsync). I don't think Laravel demands a VPS, but if you are using Node as well, then yes you will.
So, the short answer is: if it works locally, copy it up to the remote host, and it should work there. Make sure you've set up your config system in your app so that it can cope with the different settings you need in local/remote environments, such as database connection settings.
My feeling is that a shared host would be easier for you as a beginner - is the Node.js component of your app critical? Running your own VPS is not difficult, but there is quite a bit to learn. Your distro (such as Ubuntu) would be ready-installed, and on top of that you would use the package system (something like apt-get) to install Apache, PHP, PHP modules, phpMyAdmin, git, and whatever else you need.
Yes, you can certainly deploy using Git. One way to do this is to create bare repositories on your server in a private place, set it up as a remote in your local dev machine, and push to it as your off-site copy. Then, from your dev or production web folders, pull and update submodules. This is not trivial, and requires at least a working knowledge of Git - so presently I wouldn't recommend this route.
At the moment I am using poor method to work at home and at work to do web development.
I use Wamp for testing/development and then I upload to a production web server (Linux) via FTP.
If I continue with the project at home, I have to download the files from FTP.
What is good method to work on same projects at multiple locations?
Someone suggest me to learn Git and get Github private account. Also suggested to get Vagrant installed at work and home. Do I need to install Git in Vagrant VM or local machine?
Learn git: http://try.github.io
Create a Vagrant/VrtualBox VM by following the directions at https://puphpet.com
One of the tricks here is to put the Vagrant stuff you get from Puphpet directly in your project and then commit all of it to git. You'll then be able to check out the project in a new environment and, as long as Vagrant and VirtualBox are installed, you can run vagrant up and be working in about 5 mins.
Here's an example of how I'm doing just that to allow people to easily try out a library I've written: https://github.com/jeremykendall/query-auth-impl.
Enjoy! Your life as a developer is about to get a lot easier and a whole lot better.
Github or Bitbucket. Git or Mercurial, and also Svn if it's just for yourself and you want an easier learning curve.
Any source control system would be ideal for this.
You don't want your production server to be the source of truth for the actual code. Those two concerns should definitely be separated. The production application is the output of the code, not the code itself. For a language like PHP the two may be identical, but the concerns themselves should still be separated. Indeed, for small systems the two services may even be hosted on the same server, but should still be logically separated.
The source control system maintains the changes made to the code over time, the production server is a snapshot of the current release version of the code.
I am currently developing a medium sized web application using PHP and need to use some kind of version control. I also need to have the master copy of the code running in the apache document root so I can test the app while it is in development. Does anyone have any sugestions?
Thanks,
RayQuang
You can't go wrong with Git; everything you need to know is here: http://progit.org/book/
Yeah you should definitely use version control (Git or Subversion).
Here a short explanation how I'm using it in my web projects (I am using SVN):
I have a SVN project which I have checkouted on my local machine and on the webserver
Always when you change something you can commit your current running version
Log into the server (Could also be multiple servers) and do a svn update, so the newest code gets automatically deployed on the machine. The only thing you have to do is restart of the webserver
Note:
Take care what you commit. You've maybe another database configuration file on your local machine than on your server. You can put this into the svn ignore file list (guess git has something similar)
It is also easy possible that multiple persons work on the same project..
Don't commit logfiles
Links:
Git: http://git-scm.com/
Subversion: http://subversion.tigris.org/
I'd recommend Mercurial for its ease of use and that it keeps the working copy uncluttered, all versioning information is kept in just one .hg folder. I'd do it like this:
Set up a Mercurial repository at the server (hg init)
Do a hg clone of that repository to where you want your working copy
Work away!
When you want to test on the server, do a hg commit and hg push to move the changed files to the server
Run hg update on the server, or add
[hooks]
changegroup = hg update >&2
to the .hg/hgrc file (create it if it doesn't exist) on the server to have it automatically update.
For more info, you can also check out: http://hginit.com/