Coder Social home page Coder Social logo

socket-tcp-proxy's Introduction

socket-tcp-proxy

This repo was origin created for docker(tcp port)<------->nginx(unix socket) content transportation.

It works as :

nginx proxy -> use unix socket as upstream -> socket-tcp-proxy -> mapped to docker container.

To solve:

Container ip changes after docker restart. We do not want to spend time solving it. However, if you can get it done, the socker-tcp-proxy is useless for you.

Principle

Start with pre-defined json configuration /etc/socket-proxy/proxy.json.

The json configuration defined socket path, docker name and docker port,

The socket-tcp-proxy would get the docker ip automatically and generate the transportation.

the proxy.json example :

{
    "logfile":"/var/log/socket-proxy/proxy.log",
    "proxy":[
        {
            "socket":"/home/data/socket/gitlab.sock",
            "docker":"gitlab",
            "port":"80"
        }
    ]
}

the nginx configuration example :

upstream gitlab_upstream{
    server unix:/home/data/socket/gitlab.sock;
}

server {
    listen      80;
    server_name git.starstudio.org;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $http_x_real_ip;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://gitlab_upstream;
    }
    include conf.d/whiteips.conf;

    access_log /var/log/nginx/gitlab_access.log;
    error_log /var/log/nginx/gitlab_error.log;
}

socket-tcp-proxy's People

Contributors

qiukeren avatar

Watchers

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