Skip to content
Ryan Domingue edited this page Sep 26, 2018 · 22 revisions

Getting Started

To use this box with an existing project, add the following to your Vagrantfile:

config.vm.box = "goodguyry/dreambox"

- or - initialize a new project using this box by running the following command:

vagrant init goodguyry/dreambox

Box Configuration

The .dreambox directory

Create a .dreambox directory in the same directory as the Vagrantfile. .dreambox will hold the config file, certs and keys, and is generally a good place to store files to be excluded from version control.

The reason you may want to exclude your config file from version control is because it contains usernames and paths for your site's setup, so it's probably a good idea to keep that info to yourself and authorized users.

The Config File

Dreambox is configured via a vm-config.yml file in the .dreambox directory.

However, if you'd prefer to place the configuration file elsewhere, or give it a different name, declare a config_file variable at the top of the Vagrantfile (outside of the Vagrant.configure block) and give it the path to your config file.

# Default: .dreambox/vm-config.yml
config_file = 'vm-config.yaml'

Vagrant.configure(2) do |config|
...
end

Vagrant Up

vagrant up

This will instantiate Dreambox and set up your sites, users, etc.

When Vagrant is done provisioning Dreambox, be sure to add dream.box to your /etc/hosts file. I recommend using the Vagrant::Ghost or similar plugin to automate the host names for your sites, including dream.box.

Example vm-config.yaml

php: '71'
ssl: true

sites:
  'dreambox':
    host: 'www.dreambox.test'
    root: 'dreambox.com'
    sync: 'web/'
    username: 'db_user'
    group: 'my_group'
    public: 'public_html'
    database: database_name
    aliases:
      - 'dreambox.test'
    subdomains:
      app: 'app/'
      help: 'app/help/'

See the test configurations for more examples.

Global Settings

These global settings can be overridden in the site settings (except for debug).

Name Type Default Description
php String or Number '70' The version of PHP to be used by all sites ('56', '70', '71')
ssl Boolean false Enable SSL for all sites
debug Boolean false Print config values to the terminal.

Site Settings

Site configuration is held in a sites dictionary, each representing one site to be created. The root of each dictionary is the site name.

These value will override any globally set values.

sites:
  'dreambox':
    host: 'www.dreambox.test' # required
    root: 'dreambox.com' # required
    sync: 'web/' # required
    username: 'db_user' # required
    group: 'db_group'
    public: 'public_html'
    database: database_name
    aliases:
      - 'dreambox.test'
    subdomains:
      app: 'app/'
      help: 'app/help/'
    ssl: true

Required

Name Type Example Description
host String 'www.dreambox.test' The main hostname for the site; used as the virutal host's ServerName.
If SSL is enabled, this will also be added to the SSL certificate.
root String 'dreambox.com' The site's root directory, generally the site's full domain.
Used as the destination parameter for the Vagrant synced folder.
sync String 'web/' The local path to the site files, relative to the project root.
Used as the source parameter for the Vagrant synced folder.
username String 'db_user' The site's DreamHost username.

Optional

Name Type Default Description
php String or Number '70' The version of PHP to be used for this site ('56', '70', '71').
ssl Boolean false Enable/disable SSL for this site.
See Trust SSL Certificates for additional setup.
database String false The name for the site's database.
aliases List [] A list of values used as the virtual host's ServerAlias. If SSL is enabled, these will also be added to the SSL certificate.
public String '' The name of the directory from which the site's files will be served, if different from root.
subdomains Dictionary {} A dictionary of key:value pairs describing the subdomains to create for the site, with the key being the subdomain name and the value being the directory path relative to root.
If SSL is enabled, subdomains will be added to the SSL certificate.
group String '' The group to which username belongs.