Let's go through how we will setup a Symfony2 project from start to beginning! We will be using nice hipster stuff that employers love on automated resumé buzzword screeners (throw a wrench in their system! \o):
- Symfony2 (!)
This is mostly for myself to reference for other projects, such as this particular one, so if I am missing something, it maybe because I am only writing this for myself. Feel free to contribute, however!
Install the latest version of Vagrant through their downloads page. The latest version fixed that unnecessary issue of manually setting up your private/public keys. Finally, no need to spend five hours setting up Vagrant! Only four.
Since I already have an existing VirtualBox with my choice of virtualization OS cached, I simply need to use the Vagrantfile that I've commited to my scripts repo. Note: Skip this step if you're doing a Symfony 2 project, as the next step will contain the necessary
Vagrantfilefor Symfony 2.
Setting Up Vagrant with your Tech Stack Stuff using Provisioning (the cool way)
git clone https://github.com/we-bridge/vagrant-ansible-symfony.git
Vagrantfilefile and put it into your project root directory
APPNAMEin line 6 of the
Vagrantfileand assign your project's name to it.
Change 'config.vm.network "forwarded_port", guest: 80, host: XXXX' to your needs, especially if you have multiple projects
vagrant up --provision
The above steps would automagically install all the necessary things onto your Vagrant machine such as PHP, Apache5, and more. Automagically!
Setting Up Vagrant with your Tech Stack Stuff Manually (the un-cool way)
The above step replaces this step, but I am keeping this part so the curious ones like me can understand what is happening during the automation process
Digital Ocean has a really good article on setting up your dev stack aka LAMP.
Note: I condensed Digital Ocean's article and put it here. Please visit their article as well - they did a really good job going through the steps.
The gist is, while in your Vagrant VM:
Update your repo using:
Install Apache using:
apt-get install apache2
You can now check if Apache is up and running by going to
hostport that you've set in your
Install MySQL using:
apt-get install mysql-server
At this point MySQL will ask you for a username and password combo. Out of pure laziness just put in
root/root. You can easily change this later.
apt-get install php5 php-pear php5-mysql
- Restart Apache2 to see your hard work!
service apache2 restart
Get the Composer Installer within your Vagrant Machine
- Grab the Composer installer
composer.pharfrom this place:
curl -sS https://getcomposer.org/installer | php
- Symfony might scream at you in a later step if you keep
composer.pharin the root directory, so for precautionary sake, put
mv composer.phar /tmp
- . Good job for making this far! You're getting close. Finally, install Symfony2 using an already-configured package from
php /tmp/composer.phar create-project webridge/framework-standard-edition . -vvv
- Symfony2 is going to put a lot of files into your project directory, so we can now setup the
.gitignorewhich I have put in my scripts repo. Don't forget to rename the
I haven't gone this far yet. I'll update the article as I go.
This article was mirrored from my tracking.tf's Wiki page on Github, with technical consulting from my coworker, our company's senior software architect, Allan Simon.