Quick way to get the platform for joind.in development set up
This repository provides a vagrant virtual machine so you can start contributing quickly. Joind.in is a big project, so there a few parts involved.
-
Install requirements. (Note: these are not required by joind.in itself, but are required for this quick start guide.)
- VirtualBox and the VirtualBox Extension Pack (https://www.virtualbox.org/) (version 4.0 or later)
- Ruby (http://www.ruby-lang.org/)
- Vagrant (http://vagrantup.com/) version 1.5+
-
Fork the following joind.in repositories:
-
Clone joindin-vm
git clone [email protected]:%%YourGitHubId%%/joindin-vm.git --recursive
-
Execute the script that will clone the other 3 repository from your forks
cd joindin-vm php scripts/cloneRepository.php
-
Start the VM
vagrant up
-
If you don't have the hostsupdater Vagrant plugin, then add hostname to /etc/hosts.
If you are on Linux, run this: (echo ; echo "10.223.175.44 dev.joind.in api.dev.joind.in web2.dev.joind.in") | sudo tee -a /etc/hosts If you are on OSX, run this: echo "10.223.175.44 dev.joind.in api.dev.joind.in web2.dev.joind.in" | sudo tee -a /etc/hosts If you are on Windows, run this on the cmd line echo 10.223.175.44 dev.joind.in api.dev.joind.in web2.dev.joind.in >> %SYSTEMDRIVE%\Windows\System32\Drivers\Etc\Hosts
-
Browse to the sites
- For the joind.in site: http://dev.joind.in/
- For the responsive site: http://web2.dev.joind.in/
- For the API: http://api.dev.joind.in/
-
You can log to joind.in test site with those credentials for an admin account: * Username: imaadmin * Password: password
-
For other users, look at the dbgen documentation.
Notes:
-
The joind.in directory you cloned will be mounted inside the VM at
/vagrant
-
You can develop by editing the files you cloned in the IDE of you choice.
-
The database is running inside the VM. You can get to it with the following commands:
you@you> vagrant ssh vagrant@vm> mysql joindin -uroot
-
The database is also forwarded on port 3307 to your host, so you can also use:
you@you> mysql -u joindin -h 10.223.175.44 -P 3306 -ppassword joindin
-
To stop the VM so that you can work on it later, issue the following command from the host machine:
vagrant halt
-
To delete the VM completely, issue the following command from the host machine:
vagrant destroy
To install the testing tools in the VM
-
Copy the file
puppet/hieradata/common.yaml.dist
topuppet/hieradata/common.yaml
.cp puppet/hieradata/common.yaml.dist puppet/hieradata/common.yaml
-
Edit this file and change the value of
joindin::test::tests
to true. -
Re provision the VM. If the VM is not on, run
vagrant up
, if it's on, runvagrant provision
-
Wait for the testing tools to be installed. This will take a few minutes.
-
Run the joind.in tests with this command from inside the VM
cd /vagrant/joind.in && phing
- Run the joindin-api tests with this command from inside the VM
cd /vagrant/joindin-api && phing
- Run the joindin-web2 tests with this command from inside the VM
cd /vagrant/joindin-web2 && phing
If you get this error:
"The box 'centos-62-64-puppet' is still stored on disk in the Vagrant 1.0.x format. This box must be upgraded in order to work properly with this version of Vagrant.".
You can fix it by running the command vagrant box repackage centos-62-64-puppet virtualbox
and executing vagrant up
again.
If you get a warning about a mismatch between your version of the guest addition and the one in the VM. You can make sure that the guest additions in the VM are always up to date with this command:
vagrant plugin install vagrant-vbguest
If Vagrant complains that the command plugin does not exist, it's because your version of Vagrant is too old. You might need to upgrade it for the VM to work correctly.
On the latest Vagrant version, sometimes Vagrant stops before running Puppet. If if happens, you can run it manually.
vagrant provision
We use mailcatcher to grab emails before they leave the VM, and present them to you in a web interface so you can see what the system would be sending. To check the mails that have been sent, visit http://dev.joind.in:1080/ on your host machine.
To import the base box separately (e.g. for conference hackathons):
-
Download the base box from http://cdn.19ft.com/joindin-development.1.0.0.box.
-
Import the base box:
vagrant box add joindin/development /path/to/joindin-development.1.0.0.box
That's it; just follow the steps in Getting Started.
Xdebug is setup on the dev VM, with remote_start enabled, by default. To start
using this, visit http://www.jetbrains.com/phpstorm/marklets/, generate the
bookmarklets with IDE key PHPSTORM
, and the 'Start debugger' and 'Stop
debugger' bookmarklets to your browsers bookmark bar. These bookmarklets set
the required cookies to trigger or stop triggering remote debugging of scripts.
To test all is working OK, open the entry point index.php file for the relevant repo and add a breakpoint (Cmd+F8 on Mac), and visit a public URL for the relevant repo. If all is setup correctly, PHPStorm should prompt you to select the local file that the remote file maps to. Simply select the local index.php file for the repo and you should be good to go.