• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    HTML
  • Created over 12 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a vagrant installation with all the necessary chef cookbooks to run a basic cakephp application

Vagrant Chef for CakePHP Build Status

Vagrant Chef creates a Vagrant installation for CakePHP using Chef with the following features:

  • Ubuntu 16.04 LTS Xenial Xerus
  • Nginx 1.10 (via ppa)
  • PHP 7.0 (via ppa)
  • Ruby 2.3 (via ppa)
  • Percona MySQL 5.6 (via percona's apt repo)
  • Postgres 9.6 (via postgres's apt repo)
  • Redis 3.0 (via ppa)
  • Memcached 1.4
  • Git 2.9 (via ppa)
  • Composer
  • The ruby gems heroku, hub, and travis

Table Of Contents

Requirements

  • VirtualBox. Tested on 5.0.x.
  • Vagrant. Tested on 1.8+
  • Patience, and about an hour or so of your time
  • A fairly fast internet connection. Dial-up will take 3 days to get everything going ;)

Installation

Download and install both VirtualBox and Vagrant for your particular operating system. Should only take a few minutes on a DSL connection.

Once those are downloaded, open up a terminal. We'll need to clone this repository and setup vagrant:

git clone https://github.com/FriendsOfCake/vagrant-chef.git
cd vagrant-chef

Now we need to setup the vagrant installation. This is pretty easy:

vagrant up

Alternativly if you would like to make use of Vagrant Cloud you can simply run the following.

vagrant init friendsofcake/cakephp-baking

It may take a bit to download the Vagrant box, but once that is done, you will be prompted for your laptop password. This is so we can properly expose the IP of the vagrant instance to your machine. Type in your password and let it continue running.

You can grab a coffee or go out for a beer at this point. Takes about half an hour to an hour, depending upon your internet connection and laptop resources.

Of note is that typing vagrant ssh while your vagrant instance is up will ssh onto the instance so you can perform commands directly on it. For example, it might be useful to manually install some service, or run a script within the repository.

Once it is done, browse to http://192.168.13.37/ in your browser, and you should have some sort of It works! page! At this point you can set your virtualhosts to point at the instance for maximum win.

Usage

Developing your application

When you want to use vagrant instance for a development environment, you can create an app directory with the contents of your application. Within the vm, this would be an example of your directory structure:

|-/vagrant/app
| |-/vagrant/app/bin
| |-/vagrant/app/config
| |-/vagrant/app/logs
| |-/vagrant/app/plugins
| |-/vagrant/app/src
|   |-/vagrant/app/src/Console
|   |-/vagrant/app/src/Controller
|   |-/vagrant/app/src/Model
|   |-/vagrant/app/src/Shell
|   |-/vagrant/app/src/Template
|   |-/vagrant/app/src/View
|-/vagrant/app/tests
|-/vagrant/app/tmp
|-/vagrant/app/vendor
|-/vagrant/app/webroot

Anything in app/webroot/index.php will be served up, and all other index.php files ignored.

Note, we recommend using the FriendsOfCake/app-template for new applications.

Custom Domain Name

If you want to access the site using a custom domain name, edit your /etc/hosts file to have the following line:

192.168.13.37 www.app.test app.test

If you are the root user on your box, you can do something like:

echo "192.168.13.37 www.app.test app.test" >> "/etc/hosts"

Database Access

MySQL is available at 192.168.13.37:3306 with either of the following credentials:

  • root:bananas
  • user:password

Postgres is available at 192.168.13.37:5432 with either of the following credentials:

  • postgres:password
  • username:password

Multiple Repositories

If you want to use multiple repositories with this Vagrant setup, simply create an apps directory in the root of this repo:

cd path/to/vagrant-chef
mkdir -p apps

Next, copy your CakePHP repository to the apps directory. For instance, if you want to have a blog project, your directory structure would be similar to the following:

|-/vagrant/apps
| |-/vagrant/apps/blog
|   |-/vagrant/apps/blog/webroot

This application will be automatically available as blog.test. Updating your hosts /etc/hosts entry to include this will allow you to access it in a browser:

echo "192.168.13.37 www.app.test app.test blog.test" >> "/etc/hosts"

Using this method, you can host as many applications within a single VM instance as desired.

Interacting with the Virtual Machine

Starting/Stopping the Virtual Machine

You normally wont want to have the instance running full time. To pause it, simply perform the following in the command line:

vagrant suspend

You will no longer be able to access the instance after doing this. To continue working, issue the following command:

vagrant resume

You can also use vagrant halt and vagrant up for shutting down and booting the virtual machine.

Updating the Virtual Machine

Running vagrant provision will reprovision the instance. You won't normally need to do the things in the Installation section, but this will ensure your setup is as up-to-date as possible.

If there are any updates to the vagrant setup, such as a new feature, new site hosted within, or new service, simply do the following in a terminal:

git pull origin master
vagrant reload --provision

Destroying the Virtual Machine

We're sad to see you leave your work behind, but removing the virtual machine form your system isn't hard. Simply execute this command within the folder where Vagrantfile is located:

vagrant destroy

This will destroy your vagrant installation, and you can proceed to remove the project folder from your computer.

Bugs?

File a github issue.

License

MIT

Copyright (c) 2012 Jose Diaz-Gonzalez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

awesome-cakephp

A curated list of amazingly awesome CakePHP plugins, resources and shiny things.
908
star
2

cakephp-upload

CakePHP: Handle file uploading sans ridiculous automagic
PHP
551
star
3

CakePdf

CakePHP plugin for creating and/or rendering PDFs, supporting several popular PDF engines.
PHP
375
star
4

crud

Production-grade rapid controller development with built in love for API and Search
PHP
374
star
5

bootstrap-ui

CakePHP: Transparently use Bootstrap
PHP
338
star
6

cakephp-csvview

CakePHP: A view class for generating CSV
PHP
175
star
7

search

CakePHP: Easy model searching
PHP
170
star
8

Authenticate

Deprecated CakePHP3: plugin with authentication classes for AuthComponent
PHP
81
star
9

app-template

CakePHP2: An empty application template, for use with composer
PHP
71
star
10

crud-json-api

Build advanced JSON API Servers with almost no code.
PHP
56
star
11

crud-view

CakePHP: Automated admin backend based on your CRUD configuration
PHP
49
star
12

travis

Easy travis setup for CakePHP plugins
Shell
39
star
13

vagrant-ansible

a vagrant installation with all the necessary ansible roles to run a basic cakephp application
39
star
14

Authorize

CakePHP2: Authorize classes for AuthComponent
PHP
23
star
15

fixturize

CakePHP: Improve performance of your fixture based tests on MySQL.
PHP
23
star
16

crud-users

CakePHP: Users plugin based on the CRUD action classes
PHP
17
star
17

cakephp-test-utilities

CakePHP: Plugin with support classes for easing unit testing
PHP
12
star
18

crud-demo-app

Demo app for CRUD, CRUD-View and Search
PHP
9
star
19

FriendsOfCake.github.io

FriendsOfCake.com website
JavaScript
4
star
20

process-mq

CakePHP3: A RabbitMQ connection class and worker shell
PHP
3
star
21

process-manager

CakePHP3: A shell task class to help handling external signals gracefully
PHP
1
star
22

blog

The Awesome FriendsOfCake blog
Python
1
star