All Projects → idestis → gort

idestis / gort

Licence: GPL-3.0 License
Simple HTTP handler to receive remote calls to run scripts bundled in Docker containers

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to gort

FastTunnel
expose a local server to the internet. 高性能跨平台的内网穿透解决方案 远程内网计算机 域名访问内网站点 反向代理内网服务 端口转发 http代理
Stars: ✭ 815 (+3443.48%)
Mutual labels:  http-proxy
node-htmlmetaparser
A `htmlparser2` handler for parsing rich metadata from HTML. Includes HTML metadata, JSON-LD, RDFa, microdata, OEmbed, Twitter cards and AppLinks.
Stars: ✭ 44 (+91.3%)
Mutual labels:  handler
AndroidProjects
个人总结归纳Android知识点。1.Data Binding框架MVVM;2. BaseView;3.CollapseView;4.Notification;5.MultiChannelBuild;6.SwipeBack;7.CustomTabs;8.HandlerCourse;9.VolleyStudy;10.OkHttpStudy;11.PermissionManage;12.InterView;13.KotlinLearning
Stars: ✭ 32 (+39.13%)
Mutual labels:  handler
mps
MPS is a high-performance HTTP(S) proxy library that supports forward proxies, reverse proxies, man-in-the-middle proxies, tunnel proxies, Websocket proxies. MPS 是一个高性能HTTP(s)中间代理库,它支持正向代理、反向代理、中间人代理、隧道代理、Websocket代理
Stars: ✭ 64 (+178.26%)
Mutual labels:  http-proxy
FullProxy
Bind and reverse connection based, SOCKS5, HTTP and PortForward based portable proxy
Stars: ✭ 22 (-4.35%)
Mutual labels:  http-proxy
proxy-list
A curated list of free public proxy servers
Stars: ✭ 70 (+204.35%)
Mutual labels:  http-proxy
poseidon-medusa
HTTP proxy module based on Poseidon
Stars: ✭ 15 (-34.78%)
Mutual labels:  http-proxy
AspNetCore.Weixin
An ASP.NET Core middleware for Wechat/Weixin message handling and apis. (微信公众平台/接口调用服务)
Stars: ✭ 24 (+4.35%)
Mutual labels:  handler
fastify-gateway
A Node.js API gateway that just works!
Stars: ✭ 88 (+282.61%)
Mutual labels:  http-proxy
fireball
Go web framework with a natural feel
Stars: ✭ 57 (+147.83%)
Mutual labels:  handler
ApexTriggerHandler
Another library implements Apex trigger handler design pattern.
Stars: ✭ 40 (+73.91%)
Mutual labels:  handler
ssltun
simple secure http proxy server with automic https
Stars: ✭ 33 (+43.48%)
Mutual labels:  http-proxy
http-tunnel
HTTP(S) Tunnel and TCP Proxy
Stars: ✭ 70 (+204.35%)
Mutual labels:  http-proxy
Mirror
Deploy Google and Wikipedia mirror with one command using now.sh.
Stars: ✭ 93 (+304.35%)
Mutual labels:  http-proxy
sockhttp
A HTTP&HTTPS proxy over SOCK5
Stars: ✭ 46 (+100%)
Mutual labels:  http-proxy
http proxy
http proxy with Elixir. wait request with multi port and forward to each URIs
Stars: ✭ 55 (+139.13%)
Mutual labels:  http-proxy
userscript-proxy
HTTP proxy to inject scripts and stylesheets into existing sites.
Stars: ✭ 66 (+186.96%)
Mutual labels:  http-proxy
httoop
HTTOOP - a fully object oriented HTTP protocol library written in python
Stars: ✭ 15 (-34.78%)
Mutual labels:  http-proxy
localhostd
Run and serve your web apps in .test domains on your develop machine.
Stars: ✭ 27 (+17.39%)
Mutual labels:  http-proxy
dePAC
seamless Proxy Auto-Config (a.k.a. Web Proxy Auto Discovery) for CLI apps
Stars: ✭ 26 (+13.04%)
Mutual labels:  http-proxy

GORT

Build Status GoDoc Go Report Card Maintainability Test Coverage

Moving Gopher as GORT

GORT is a simple HTTP handler to receive remote calls to run scripts bundled in Docker containers. Why the name is gort - because the idea is "GO-Run-Things"

Safety notice: Until this tool doesn't have the authorization, you need to cover it using any firewalls or use it as internal service in your k8s cluster without exposing it outside.

Usage

Refer to Install for getting gort binary

To use gort in your Docker container download the latest version from Project Release Page

$ ./gort
2019/10/30 12:32:06 Gort is started on port 5000

GORT uses the following environment variables for a customized run

PORT as default will be handled over 5000 port

SCRIPTS_DIR by default will search scripts at ./dist in the same directory where the binary

GORT_RATE_LIMIT is a parameter to set Throttle Limit, Throttle is not a rate-limiter per user. Instead, it just puts a ceiling on the number of current in-flight requests

Endpoints

Health

Allows you to check the health of application/container

  • URL

    /v1/health

  • Method

    GET

  • Success Response

    • Code: 200
      Content: OK

List

List scripts directory

  • URL

    /v1/list-dist

  • Method

    GET

  • Success Response

    • Code: 200

Start

Allows you to start script from the scripts directory

  • URL

    /v1/start

  • Method

    POST

  • Data

    Requires JSON data as payload

    {
      "executor": "node",
      "script": "script.js",
      "env_vars": [
        "FOO=bar",
        "BAR=foo"
      ],
      "args": [
        "--foo=bar",
        "--bar=foo"
      ]
    }
  • Success Response

    • Code: 200
      Content: The function is executed in the background. Refer to container logs to see the output
  • Error Responses

    • Code: 400
      Content: Required parameters 'executor' and 'script' were not found in the payload

    • Code: 422
      Content: Not able to parse data as valid JSON

    • Code: 500
      Content: Requested executor is not installed

    • Code: 501
      Content: Requested script is not found in the scripts directory

  • Sample Call:

$ curl -X POST http://127.0.0.1:5000/v1/start -d '{"executor":"python", "script": "crawler.py"}'
The function will be executed in the background. Refer to container logs to see the output

Install

Binary

Binary are available for download on the Project Release Page

However, you also able to change something in the source code and build your Gort for yourself

$ go build ./...

Use cases

Dockerfile Example Usage

For instance, we have a few crawlers which should be executed on demand.

They was built by NPM

#
# STEP ONE: Build scripts
#
FROM node:10 AS builder
# Create app directory
WORKDIR /app
# Copy our files inside of the docker builder
COPY . .
# Install dependencies
RUN npm install && npm build
#
# STEP TWO: Build our images bundled with gort and copy scripts from builder
#
FROM alpine
# Create app directory
WORKDIR /app
# Install dependecies
RUN apk add --no-cache bash nodejs ca-certificates && \
    wget https://github.com/idestis/gort/releases/download/1.0.0/gort_1.0.0_linux_amd64 -O gort && \
    chmod +x gort
# Copy our scripts from builder step
COPY --from=builder /app/dist /app/dist
# PORT variable for Gort
ENV PORT 8080
# Expose outside
EXPOSE 8080
ENTRYPOINT ['gort']

After when we published and executed this docker container elsewhere, we can send requests to start any our function

$ curl -X POST https://address/v1/start -d '{"executor":"python", "script": "example.py"}'
The function will be executed in the background. Refer to container logs to see the output

In STDOUT of the container we will be able to see logs

2019/10/30 12:19:01 Just ran subprocess of example.py with PID 52177

For instance, you can schedule this runs using your services or any CI tool like Jenkins, drone.io

Contribute

Refer to CONTRIBUTING.md

Dependencies

TBD

  • Authorization method to protect your endpoints
  • Subprocesses list
  • Cleanup zombie subprocesses
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].