Coder Social home page Coder Social logo

gaudi's Introduction

Gaudi Build Status

Gaudi is a generator of architecture written in Go and using Docker. You can use it to start any type of application, and link them together without knowledge of Docker or system configuration. Using Go, Gaudi can build and start your applications in parallel depending of they dependencies.

Gaudi screencast

Basic Usage

Describe any architecture with a simple YAML file (called .gaudi.yml). For instance, for a PHP+MySQL combo:

applications:
    front1:
        type: apache
        links: [app]
        volumes:
            .: /var/www
        custom:
            fastCgi: app

    app:
        type: php-fpm
        links: [db]
        ports:
            9000: 9000
        volumes:
            .: /var/www

    db:
        type: mysql
        ports:
            3306: 3306

Start this environment (with sudo privileges):

gaudi

Gaudi will try to find a .gaudi.yml file in the current folder, and start each application simultaneously, or sequentially if they depend on each other.

Installation

go get github.com/marmelab/gaudi

Check that your PATH includes $GOPATH/bin:

export PATH=$GOPATH/bin:/$PATH

The gaudi application starts containers with Docker's commands which requires sudo privileges. Make sure that the GOPATH and GOROOT environment variables are correctly set for the root user (or other user with root privileges).

Options

  • --config="" Specify the location of the configuration file
  • --stop Stop all applications
  • --check Check if all applications are running

How Does It Work?

Gaudi uses Docker to start all applications in a specific container. It builds Docker files and specific configuration files from different templates. All templates are listed in the templates/ folder, one for each application type.

Examples

You can find an example of how to start a Symfony application in the wiki.

Configuration

Common Configuration

The YML file describing the architecture should have a section called applications:.

Type

You can specify what kind of application you want to run:

applications:
    [Application name]:
        type: [one of the listed type below]

Application types are listed below.

Links

When an application depends on another, you can link them together:

applications:
    app1:
        type: varnish
        links: [front1, front2]
    front1:
        type: apache
    front2:
        type: apache

Here the app1 application receives environment variables for each link, as follows:

FRONT1_NAME=/front1/app1
FRONT1_PORT=tcp://172.17.0.215:80
FRONT1_PORT_3306_TCP_PORT=80
FRONT1_PORT_3306_TCP_PROTO=tcp
FRONT1_PORT_3306_TCP_ADDR=172.17.0.215
FRONT1_PORT_3306_TCP=tcp://172.17.0.215:80

Ports

To open some ports on an application:

applications:
    front1:
        type: apache
        ports:
            80: 8080

The port 80 in the host machine will be mapped to the 8080 in the container.

Volumes

You can add you own files by mounting volumes:

applications:
    front1:
        type: apache
        volumes:
            php: /app/php

The php/ folder (absolute or relative to the yml file) will be mounted in the /app/php folder in the application.

Apt packets

If you want to install other apt packets, use the apt_get parameter:

applications:
    app:
        type: apache
        apt_get: [php5-gd, php5-intl]

Remote Containers

If you want to run an application not yet supported by Gaudi, you can use a prebuilt image, or an image from the Docker index:

applications:
    server:
        type: nodejs
        links: [redis]
        ports:
            80: 80
        volumes:
            nodejs-redis: /app

    redis:
        type: remote
        image: gary/redis
        path: github.com/manuquentin/docker-redis
        ports:
            6379: 6379

Types

Each application uses a custom section to define its own custom configuration settings.

Varnish

applications:
    [name]:
        type: varnish
        links: [front1, front2]
    custom:
        backends: [front1, front2]

The backends custom parameter defines which applications are load balanced by Varnish. Theses applications have to be linked together using links.

Nginx

As a webserver:

applications:
    [name]:
        type: nginx
        links: [app]
    custom:
        fastCgi: app

As a load balancer:

applications:
    [name]:
        type: nginx
        links: [front1, front2]
    custom:
        backends: [front1, front2]

The backends custom parameter defines which applications are load balanced by Nginx. Theses applications have to be linked together using links.

Apache

applications:
    [name]:
        type: apache
    custom:
        fastCgi: app

The fastCgi custom parameter points out an application where to forward Fast-CGI scripts.

MySQL

applications:
    [name]:
        type: mysql
    custom:
        fastCgi: app

PHP

This application is a simple php5 service, if you want to use it with Apache or Nginx, use the PHP-FPM one.

applications:
    [name]:
        type: php

PHP-FPM

applications:
    [name]:
        type: php-fpm

Nodejs

To start a Node.js application, use the after_script parameter. If the after_script is not set, Node.js will run without arguments.

applications:
    [name]:
        type: nodejs
        after_script: node /app/server.js

Jackrabbit

applications:
    [name]:
        type: jackrabbit

Contributing

Your feedback about the usage of gaudi in your specific context is valuable, don't hesitate to open GitHub Issues for any problem or question you may have.

All contributions are welcome. New applications or options should be tested with go unit test tool.

License

Gaudi is licensed under the MIT Licence, courtesy of marmelab.

gaudi's People

Contributors

fzaninotto avatar manuquentin avatar pborreli avatar

Watchers

 avatar

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.