Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.
/ ubuntu Public archive

A easy-to-use, flexible vagrant setup for php which runs on virtualbox and vmware uses ansible.

Notifications You must be signed in to change notification settings

vagrant-php/ubuntu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vagrant-php/ubuntu

Based on: Ubuntu 20.04

Features

  • blackfire
  • clamav
  • docker
  • elasticsearch (7)
  • kafka (2.5)
  • mariadb (10.3-original, 10.3)
  • memcached
  • mongodb (4.2)
  • nginx
  • nodejs (12)
  • php (7.4-original, 7.4, 8.0)
  • postfix
  • postgresql (12-original, 12)
  • rabbitmq (3.8)
  • redis

Installation

Virtualbox

  • MacOSX and Windows: Download and install the newest version of virtualbox.
  • Linux: Download and install the newest version of virtualbox or add a package mirror for your distribution.

Vagrant

Download and install the newest version of vagrant.

Install plugins

Vagrant plugins

vagrant plugin install vagrant-hostmanager
vagrant plugin install vagrant-vbguest

Needed to use disksize option:

vagrant plugin install vagrant-disksize

Project

Add vagrant-php to your project

needs to be done once

cd /path/to/my/project
git submodule add -b 20.04 https://github.com/vagrant-php/ubuntu.git vagrant-php

Intialize the submodule

needs to be done after clone the project

cd /path/to/my/project
git submodule update --init -- vagrant-php

Update the submodule

needs to be done, when you want to upgrade vagrant-php in your project

cd /path/to/my/project
git submodule update --remote -- vagrant-php

Configuration

.vagrant-default-user.yml

Add generic user specific settings, for example git email which are relevant for all projects using vagrant-php. Overrides the settings of vagrant-default.yml.

cd ~
(code|nano|vi) .vagrant-default-user.yml
git:
    config:
        user:
            email: john.doe@gmail.com
            name: "'John Doe'"

vagrant.yml

Add project specific settings, for example the hostname. Overrides the settings of vagrant-default.yml and ~/.vagrant-default-user.yml.

cd /path/to/my/project
(code|nano|vi) vagrant.yml
hostname: &hostname projectname.development
network:
    ip: 10.11.12.13
role:
    nginx: true
nginx:
    server:
        -
            root: /vagrant
            server_name: *hostname
            template: default

vagrant-user.yml

Add user and project specific settings. Overrides the settings of vagrant-default.yml, ~/.vagrant-default-user.yml and vagrant.yml. Add this file to .gitignore.*

cd /path/to/my/project
(code|nano|vi) vagrant-user.yml
memory: 2048

Run

cd /path/to/my/project
cd vagrant-php
vagrant up
vagrant ssh

SSL

There are 2 possibilities:
 * Generate SSL cert with 'mkcert' and add it to vagrant machine
 * Let the vagrant machine generate your certificates and import them to your local environment

SSL - Vagrant machine generated certificates:

After provisioning all vhost certificates are generated in vagrant-php/certs

MacOS
* Open your key-chain application and import all certificates in vagrant-php/certs
* set all certificates to trusted
* enjoy ssl on your local dev environment
Linux
Add certificate
$ sudo apt-get install libnss3-tools
* for each cert file run:
  $ certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n CERT_FILE -i CERT_FILE
* enjoy ssl on your local dev environment
List trusted certificates
$ certutil -d sql:$HOME/.pki/nssdb -L
Remove trusted certificates
$ certutil -D -d sql:$HOME/.pki/nssdb -n -.lee.dev

SSL - local generated certificates with mkcert:

Before provisioning add your .crt and .key files to vagrant-php/certs-import

e.g. domain.tld.crt and domain.tld.key - notation matters!

  • generate your files to vagrant-php/certs-import with:

    mkcert --cert-file=HOSTNAME.crt --key-file=HOSTNAME.key HOSTNAME

  • run vagrant provision:

  • Enjoy SSH

Include external defined ansible roles

It's possible to include additional ansible roles defined per project.

  • Create a folder for your additional roles on PROJECT_ROOT eg. ansible_roles
  • Add as many roles in your vagrant.yml as you want like this:
include_roles:
    - "ansible_roles/dependencies/main.yml"

About

A easy-to-use, flexible vagrant setup for php which runs on virtualbox and vmware uses ansible.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages