Coder Social home page Coder Social logo

bara's Introduction

Bara

Simply Docker base multi version app test environment.

**It's only a reference implementation, strongly embedded in our process. **

How to run

简体中文版使用说明

日本語紹介

Configuration files

Docker daemon

Edit config/initializers/docker.rb

Nginx server

Edit config/initializers/nginx.rb

.env file

cp .env.example .env

# settings for SMTP/Token
vi .env
source .env

Start server

RAILS_ENV=production rake assets:precompile
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rails s -b 0.0.0.0

Create an account and login

Create Nginx Configuration's template

Login and go to /templates/new to create template file. In the nginx.conf file, you kan use placeholder {{upstream}}, this will be substituted by running containers info.

For example:

{{upstream}}

server {

    location /{
      add_header u $u;
      proxy_pass http://backend_$u;
    } 

Pull an image

In http://localhost:3000/iamges page, pull an image

Deploy an container

In http://localhost:3000/containers page, create a new conatiner.

Generate Nginx config files and reload

If you have to containers are running:

CONTAINER ID        IMAGE               COMMAND              CREATED             STATUS              PORTS                     NAMES
0e738babaf33        busybox             "httpd -p 8080 -f"   About an hour ago   Up About an hour    0.0.0.0:32770->8080/tcp   app-v2
4348bed6e1c9        busybox             "httpd -p 8080 -f"   About an hour ago   Up About an hour    0.0.0.0:32769->8080/tcp   app-v1

Click Create Config File button will generate somethins like this:

  upstream backend_app-v2
  {
    server localhost:32770;
  }

  upstream backend_app-v1
  {
    server localhost:32769;
  }

  map $http_v, $u{
    ~app-v2 app-v2;
    ~app-v1 app-v1;
    default app-v1;
  }

server {

    location /{
      add_header u $u;
      proxy_pass http://backend_$u;
    }

Limitations and restrictions

  • Can't mount local volumes
  • Will expose all ports defined in Dockerfile
  • You can specify only container name and CMD params when deploy new containers.
  • Can process only one Nginx config file, normally it should be /etc/nginx/nginx.conf

Issues or Questions

please create issue in GitHub.

Author & Licensing

The MIT License (MIT), Copyright 2015 Bin Liu [email protected]

bara's People

Contributors

liubin avatar

Watchers

william 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.