Git Product home page Git Product logo

vagrant's Introduction

Lightweight Vagrant Script

This simple script is use to boot vagrant which is a tool for building and managing virtual machine environments in a single workflow. About the vagrant, please read the more details at vagrant intro.

Installation

git clone https://github.com/tocjack/vagrant.git
cp -R vagrant root_path_your_project

Configuration

cd root_path_your_project/vagrant
vim config.json

Once you open the config.json, you will see following json:

{
    "ip": "172.16.6.6",
    "memory": 2048,
    "cpus": 2,
    "box": "ubuntu/xenial64",
    "name": "cjvagrant",
    "provider": "virtualbox",
    "authorize": "~/.ssh/id_rsa.pub",
    "keys": [
        "~/.ssh/id_rsa"
    ],
    /**
     * public fold within your project root path on the host machine
     * will map to /var/www/public within the guest machine.
     * Use options to specify the owner, group and write permission of the shared fold in guest machine.
     */
    "folders": [
        {
            "map": "./public",
            "to": "/var/www/public",
            "options": {
                 "owner": "ubuntu",
                 "group": "www-data",
                 "mount_options": [
                     "dmode=775",
                     "fmode=774"
                 ]
            }
        }
    ],
    /**
     * Set the virutal host and root directory for the site
     */
    "sites": [
        {
            "map": "cjvagrant.me",
            "to": "/var/www/public"
        }
    ],
    /**
     * Install the nginx, php7, mysql, redis in the guest machine.
     * If you want to install other dependencies, please put a bash script in the provision fold. 
     * Then add the script file name in the provisions list.
     */
    "provisions": [
        "install-nginx",
        "install-php7",
        /**
         * mysql -h 172.16.6.6 -uadmin -padmin to access the mysql in the guest machine
         */
        "install-mysql",
        "install-redis"
    ],
    /**
     * Vagrant forwarded ports allow you to access a port on your host machine 
     * and have all data forwarded to a port on the guest machine, over either TCP or UDP.  
     */
    ports: [
        {
            "send": 8080,
            "to": 80
        },
        {
            "send": 3360,
            "to": 3306
        }
    ]
}
  • There is a init.sh in the vagrant fold to write some init script.
  • There is a booted.sh in the vagrant fold to write some terminate script.

Available Provision

  • Install mysql
  • Install nginx
  • Install php7
  • Install redis
  • Create nginx virtual host

I will add more provisions into it.

Boot the guest machine

cd root_path_your_project
vagrant up

If you prefer to contribute something. Please make a pull request.

That's it.

vagrant's People

Contributors

oscjack avatar tocjack avatar

Stargazers

 avatar  avatar Robert Lilly avatar

Watchers

James Cloos avatar  avatar

Forkers

ecpanda

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.