Code Monkey home page Code Monkey logo

devbox's Introduction

DevBox

Introduction

DevBox provides a PHP development environment using Vagrant and VirtualBox. The development VM created is built on Ubuntu with Apache, Nginx, PHP and MySQL. The VM can be configured to use different versions of Ubuntu, PHP and MySQL. It can also be configured to use either Apache or Nginx.

Configuration

DevBox can be configured using the config.yaml configuration file.

VM

By default, the name for the VM is 'devbox', this can be changed by adding the name property. The default hostname for the VM is also 'devbox', this can be changed by adding the hostname property.

name: vmname
hostname: vmhostname

Networks

By default, DevBox will create a private network with an automatically assigned IP address. Use ifconfig on the VM to determine the IP address. To create a bridged (public) network, add a networks array with a type property of bridged.

networks:
    - type: bridged

A static IP address for the VM can also be given by adding an ip property and assigning an address from the reserved private address space.

networks:
    - type: private
      ip: "192.168.178.40"
networks:
    - type: bridged
      ip: "192.168.178.40"

By default, DevBox will forward ports 80 and 3306 on the guest machine to ports 8000 and 33060 on the host. To forward additional ports, add a ports array with guest and host properties set to the ports you want to forward.

ports:
    - guest: 443
      host: 44300

Folders

By default, DevBox will share your project folder . with the /vagrant folder on the guest machine. To share additional folders with the guest machine map the host folder to the guest folder in the folders array.

folders:
    - map: ~/code
      to: /vagrant/code

To use NFS for a shared folder, add the type property.

folders:
    - map: ~/code
      to: /vagrant/code
      type: nfs

Ubuntu

By default, DevBox uses Ubuntu 16.04. To use a different version, add the ubuntu property. Supported versions are 14.04 and 16.04.

ubuntu: "14.04"

Webserver

By default, DevBox uses Nginx as the web server. To use a different web server, add the webserver property. Supported servers are nginx and apache.

webserver: apache

PHP

The VM includes the following PHP modules:

  • cli
  • curl
  • fpm
  • mysql
  • xdebug

By default, DevBox uses PHP 7.2. To use a different version for PHP CLI, add the php-cli property. Supported versions are 5.6, 7.0, 7.1 and 7.2.

php-cli: "5.6"

Note: PHP version 5.5 is also supported for legacy systems. Use 5 as the php-cli property.

Additional Packages

If you require additional PHP modules or any other Ubuntu packages then they can be added to the apt-packages array as follows:

apt-packages:
    - php7.0-gd
    - php7.1-mbstring
    - php7.2-xml

Note: Additional packages are installed via Ubuntu's Advanced Packaging Tool (APT)

Website

You can set up multiple sites by mapping a url to a root folder on the VM. Sites are configured in the sites array. The url is set via the url property and the root folder set via the root property.

sites:
    - url: site1.test
      root: /path/to/root/folder/on/vm
    - url: site2.test
      root: /path/to/root/folder/on/vm

By default, DevBox uses PHP 7.2. To use a different version for a site, add the php property. Supported versions are 5.6, 7.0, 7.1 and 7.2.

sites:
    - url: site1.test
      root: /path/to/root/folder/on/vm
      php: "7.0"
    - url: site2.test
      root: /path/to/root/folder/on/vm
      php: "7.1"

Note: PHP version 5.5 is also supported for legacy systems. Add 5 to the php sites property.

The url must be added to your machines hosts file. Example:

192.168.22.18   site1.test
192.168.22.18   site2.test

A self-signed SSL certificate is created for each site, so sites can be accessed via HTTP and HTTPS.

MySQL

By default, DevBox uses MySQL 5.7. To install an alternative version, add the mysql property. Supported versions are 5.5, 5.6 and 5.7.

mysql: "5.5"

Note: These alternative versions are only supported with Ubuntu 14.04.

Databases

You can create multiple MySQL databases by adding the name for the database to the databases array.

databases:
    - name: dbname1
    - name: dbname2

The default MySQL root user's password is secret. As well as the default root user a specific user is created for each database. The default username for this specific user is damianlewis with the password secret. To change this, add the user and password properties to the database array.

databases:
    - name: dbname1
      user: user1
      password: secret
    - name: dbname2
      user: tester
      password: secret

Composer

Composer is included with DevBox. When configuring the VM you can include Composer packages to install globally.

composer-packages:
    - laravel/envoy

Post provisioning

Use the post file to run any further provisions that you require for your VM.

Bash aliases

A number of default bash aliases are created for the VM. These can be found in the aliases file. Add any further aliases you require to this file before creating the VM.

Other software included

  • Git
  • NVM and Node
  • Yarn

devbox's People

Contributors

damianlewis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

devbox's Issues

Problem with mounting VB shared folders

Hi!
I tried to use your devbox and i have some error.

"Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o actimeo=1,nolock,uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

fmask = umask of regular files"

I tried with:
vagrant plugin install vagrant-vbguest
vagrant vbguest

and it doesnt help.

VB Guest Additions 5.2.1
VB 5.2.0

Do you know how to fix it?

Permission trouble?

Hi there!
Looks like I'm too blind but I can't figure out why I can't upload or create files/folders via FTP.
I also can't access the website via browser.

  • Sync folder is running and syncing
  • everything else seems to work well

Thanks guys!

Host system is Win10 64
Vagrant and VBox are most recent versions

Multisite property

Hi, @damianlewis

I like your vagrant box image.

I am not a vagrant expert myself. However, I created a fork of your devbox repository for workaround an issue that vagrant has when is run from an usb drive. Vagrant does not work nicely in usb drives. Maybe, the workaround is not an elegant way to do it but it works for me.

But the main purpose, I forked your repo was to add a multisite property. It works nicely for apache but fails for nginx. As I said, it is only for personal use and it could have some caveats.

Maybe you can take a look what's going on. I appreciate any help.

Anyway, thank a lot for your job.

Best,
Julio

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.