Coder Social home page Coder Social logo

vagrant-php-nginx-mysql-cake's Introduction

PHP/NGINX/MySQL VAGRANT BOX

Be patient with the vagrant up as it can take up to an hour depending on your connection.

Simple vagrant build for a general php/mysql setup on nginx. This will boot up an nginx/php/mysql ubuntu box for a single instance. It uses host manager for easy local DNS configuration.

This particular box also installs some CakePHP and Capistrano dependencies.

Requirements

Troubleshooting

Please note that running vagrant up for the first time can come with some issues to fix up. If you run into any issues please refer to the troubleshooting documentation and if you have a new remedy to add please do.

Installation

  1. Navigate inside the vagrant folder and create the guest machine cd vagrant && vagrant up

  2. After the installation finishes, visit the chosen domain: http://rehab.vagrant.local

Customisation

A single YAML configuration file can be found in vagrant/config.yml which will contain the majority of common settings that you will wish to tweak per project.

The Vagrantfile vagrant/Vagrantfile and main puppet manifest vagrant/puppet/manifests/init.pp have a variety of configuration options at the top of their files that should be tweaked per project. Some of the configuration options affect things such as the bound ip address of the box, vhost settings, nginx log locations, database users, php settings and much more.

By default, MySQL has a root user whose password is j1h34SADjh134n - this is random and not used in any non-local instance. A project-specific user is also created, whose credentials can be set via the supplied configuration options. A schema is also imported on your behalf which can be found at vagrant/files/db_schema.sql. Replace the existing schemawith your own, or, repoint the schema path to a different one. It is important to ensure your schema uses IF NOT EXISTS statements to ensure data is not overwritten when reprovisioning your box.

Alongside PHP being installed, PHPUnit and Composer are already present. PHP settings are changed using a tool known as Augeas which has a specific syntax to follow. This should be taken into consideration if you are wanting to change ini settings other than those already listed/changed. You can also change the installed extensions by finding the php::extension declaration.

It should also be noted that this is just a base for you to build upon. These scripts should be adapted to best suit your project and to mirror your live location as closely as possible.

Adding Modules

This vagrant setup utilises Librarian-Puppet as a package manager for the Puppet modules. All modules should be added to the repository using this method.

MySQL Access

MySQL can be accessed internally on the box by SSHing into it using vagrant ssh, or, by using a desktop client (or command-line) from your host machine. The MySQL server package has been pre-configured to allow access from your remote machine using a combination of the private IP address from vagrant and the generated users credentials. You can connect using a command (from your host machine) like the following:

mysql --host=192.168.33.10 --user=username --password=password

Node Dependencies

There is a statement included in the puppet files to search your $siteRoot for a package.json file. If one is found, then the command npm install will be run on your behalf. The longer a project runs the more likely its dependencies will change. If you add or remove packages from your package.json file, simply run vagrant provision to have it re-run the npm install command.

Composer Dependencies

Similar to Node, puppet will search your $siteRoot for a composer.json file. If one is found, then the command composer install will be run on your behalf. If there are any changes throughout the lifetime of the project, be sure to manually delete any composer lock files before re-provisioning using the command vagrant provision.

Note: please create an OAUTH token and place it in the config.yml. GitHub has rate limiting which can cause the vagrant up to break if the limit has been reached. See http://developer.github.com/v3/#rate-limiting

Note: if the composer install is too large you may run into memory allocation problems. To get around this you can increase the amount of RAM that the box has, in config.yml.

vagrant-php-nginx-mysql-cake's People

Contributors

pemcconnell avatar rickydunlop avatar

Stargazers

Thanh Nguyen Dac avatar Pablo Caldentey avatar Peter McConnell avatar

Watchers

Patrick Carey avatar Connor Bunting avatar Josh Noble avatar Chris Grant avatar James Cloos avatar Ricky McAlister avatar Steven McCullagh avatar Roger Simms avatar Mark McConnell avatar Pablo Caldentey avatar Kirsty McCrystal avatar  avatar

vagrant-php-nginx-mysql-cake's Issues

fastcgi_params array doesnt seem to work

The array doesn't seem to import the values into the vhost as expected. It seems to implode the array without adding semi-colons or newlines (resulting in all params going onto one line, which breaks nginx). To get around it I have explicitly stated semi-colons, 'fastcgi_params' and new-lines where necessary. Ugly, but it works.

https://github.com/rehabstudio/vagrant-php-nginx-mysql-cake/blob/master/vagrant/puppet/manifests/nginx.pp

References to location_cfg arrays:
voxpupuli/puppet-nginx#147
voxpupuli/puppet-nginx#201

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.