Name: express_local
Owner: University of Colorado Boulder
Description: Vagrant and Ansible based local development environment for Web Express at the University of Colorado Boulder.
Created: 2015-10-09 17:25:25.0
Updated: 2017-08-22 21:43:00.0
Pushed: 2017-12-06 17:13:32.0
Homepage:
Size: 501
Language: HTML
GitHub Committers
User | Most Recent Commit | # Commits |
Other Committers
User | Email | Most Recent Commit | # Commits |
README
If you don't care how it works, you just want it to work now; checkout the short version
Express Local
A local development environment for Cu Boulder's Web Express Platform. The playbooks require a vault password file to run properly.
You will need
- git
- Ansible 2.3.x
- Vagrant > 1.9 (tested with 1.9.7)
- VirtualBox 5.1.16
- Python 2.7
Installation
Ubuntu Installations
sudo apt-get install git ansible nfs-kernel-server
OSX
- Install Python 2.7 (Can be with Homebrew)
- Install ansible
pip install ansible
All operating systems
- Install Vagrant (https://www.vagrantup.com/downloads.html)
- Install VirtualBox (https://www.virtualbox.org/wiki/Downloads)
- Clone this repository
- Edit your hosts file (located at
/etc/hosts
) to include the following (DEV, TEST, and PROD eveuri values are only applicable to CU Boulder):press_local VMs
168.33.20 express.local
168.33.21 inventory.local
168.33.22 logs.local
168.33.23 d8.local
e API URI
cal
2.168.33.21 eveuri
V
20.62.19 eveuri
ST
.20.62.49 eveuri
OD
.20.62.87 eveuri
- Edit your SSH config (
~/.ssh/config
) to include the following (NOTE: if no file exists, manual generate an SSH key.)nnection information for express_local VMs
192.168.33.* express.local inventory.local logs.local d8.local
ctHostKeyChecking no
KnownHostsFile=/dev/null
osr_web_deploy
evel ERROR
- Copy the ssh keys for the deployment user to
ansible/keys
. Keys need to be passwordless and to be able to read all relevant repositories. When working with multiple developers, consider create a machine account with a ssh key per user.
Installation Troubleshooting
Logging (Commented out for now)
- Logs are viewable from logs.local:5601
- After each time the VM is provisioned you will need to setup index patterns.
- Choose 'Use event times to create index names'
- Index Pattern Interval:
Daily
- Index name or pattern:
[logstash-drupal_syslog]-YYYY.MM.DD
- Create a similar index pattern for [logstash-parsefailure]-YYYY.MM.DD. This pattern will catch log entries that fail to parse correctly.
- Create an index pattern for
logstash*
, do not choose 'Use event times to create index names'. This pattern will match all incoming logs.
XDebug via PHPStorm
- Once you have PHPStorm installed, go to PHPStorm > Preferences > PHP and click on the ellipsis in the “Interpreter” section.
- This will bring up another screen where your PHP interpreters are listed. You want to click the “+” icon to add a “remote” interpreter.
- On the next screen, you'll have the option of configuring via SSH or Vagrant, and you'll want to choose Vagrant.
- Now you have to add the “Vagrant Instance Folder”. The location where be where you setup your vm, for me it was “~/vms/express_local”.
- If you see the “vagrant host URL” line populate with an address, then you've successfully setup the remote PHP interpreter.
- If you get an error message saying that the “VboxManage binary” can't be found and needs adding to the PATH variable, then you need to debug that, and there are several ways you could fix your issue. For me, I just had to create a symbolic link to fix the issue.
ln -s /usr/local/bin/VBoxManage /usr/bin/VBoxManage
so may need to use this line while SSHing into your VM
t VBOX_INSTALL_PATH=%VBOX_MSI_INSTALL_PATH%
- Now that PHPStorm is connected to your VM, you need to setup XDebug. The Xdebug extension is already loaded on your machine, but you need to add it to the php.ini settings in order for Apache to load it. To find out where your extension is, you can type the following into your terminal:
/ -name 'xdebug.so' 2> /dev/null
- You will now need to add the extension to your php.ini settings. On a local Drupal installation, you can go to “/admin/reports/status/php” to see where the php.ini file is being loaded. You should also see a section for other .ini files being parsed and loaded. Look for “xdbug.ini” and open that file in a text editor.
- Your file will have options already declared in it, but you need to add a line to the top of where your Xdebug extension is located. My xdebug.ini file looks like this:
_extension=/usr/lib64/php/modules/xdebug.so
ug.remote_enable=1
ug.remote_port=9000
ug.remote_handler="dbgp"
ug.remote_connect_back = 1
ug.profiler_enable=0
ug.profiler_output_dir=/tmp/xdebug_profiles
ug.profiler_enable_trigger=1
ug.profiler_output_name=cachegrind.out.%p
ug.max_nesting_level=200
- Once you change that file, you'll need to restart Apache “sudo apachectl restart”, and you should see Xdebug now on “/admin/reports/status/php”.
- The last thing to do is to map the folders on your machine to the paths on your VM, PHPStorm > Preferences > PHP > Servers. Because of the symbolic links used in DSLM, the paths will reside in the “dslm_base” and “packages_base” folders. your root level project folder should map to a Drupal core, e.g. “/data/code/dslm_base/cores/drupal-7.41”, and the profile path to whichever profile you are using, e.g. “/data/code/dslm_base/profiles/express”
- Once your path mapping is setup, you should be able to turn on debugging in PHPStorm, Run > Start Listening for PHP Connections, set a breakpoint, and use XDebug from within PHPStorm.
To Dos:
- xprof
- Make sure every package has a version
- Combine apache roles
Notes
- If are on OSX you don't like typing your password each time you start the VMs add the following to
/etc/sudoers
. See https://docs.vagrantup.com/v2/synced-folders/nfs.html for other OSs.llows us to run Vagrant (using NFS mount) without having to enter a password.
_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
_Alias VAGRANT_NFSD = /sbin/nfsd restart
_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
in ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE
- If you want to add your github keys to the vm, copy any keys from ~/.ssh on you your laptop to ~/.ssh that are linked to your github account. If you are concerned about the security of the VM, you can generate new keys and register those with github specifically for this purpose. You may need to rename the key file names. DO NOT delete the existing id_rsa/id_rsa.pub files. Those keys are used by osr_web_deploy. To add the additional keys, run
`eval `ssh-agent -s`
and then ``
ssh-add ~/.ssh/[filename_rsa]```. Once the additional key has been added, update the git username and email (https://help.github.com/articles/setting-your-username-in-git/). You should now be able to make commits and push code form the vm as yourself.