GithubHelp home page GithubHelp logo

operable / go-relay Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 9.0 8.17 MB

Cog Relay written in Go supporting Docker and native command bundles

License: Other

Go 94.47% Makefile 1.82% Shell 3.10% Ruby 0.61%
bot-framework chatbot-framework chatops docker

go-relay's Introduction

Relay

Build Status Coverage Status Ebert Docker Build Statu

Dependencies

  • Go v1.9+
  • Docker v1.10.3+

Getting up and running

  1. Clone go-relay to $GOPATH/src/github.com/operable/go-relay

    mkdir -p $GOPATH/src/github.com/operable
    git clone [email protected]:operable/go-relay.git $GOPATH/src/github.com/operable
    
  2. Install preqrequisites

go get -u github.com/kardianos/govendor
  1. Download deps and compile an executable

    make
    
  2. Set environment variables and run relay.

    You'll need to have a docker machine running and have environment variables set for the docker client to connect to it. If you haven't already, run the following. (See more details at https://docs.docker.com/machine/get-started)

    docker-machine create --driver virtualbox default
    docker-machine start default
    eval $(docker-machine env default)`
    

    Then start relay:

    RELAY_DOCKER_USE_ENV=true _build/relay -file example_cog_relay.conf
    

Docker Images

Release images are available from the operable/relay repository on Docker Hub.

The latest code from the master branch is always available in the operable/relay-preview repository. The only tag in this repository is latest, and it "floats".

Building your own image can be done with make docker.

go-relay's People

Contributors

agis avatar christophermaier avatar ctrochalakis avatar imbriaco avatar jesselang avatar mpeck avatar nmohoric avatar ohaiwalt avatar vanstee avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

go-relay's Issues

Add support for Amazon's EC2 Container Registry (ECR) to Relay

From @christophermaier on December 30, 2016 19:25

Cog users wishing to access container images stored in Amazon's EC2 Container Registry from Relay will run into issues because a docker login yields a token that is effective for only 12 hours. With Relay's current implementation, you'd likely need to resort to things like restart the Relay process on a schedule in order for it to continue working.

Relay should have some smarts to contend with this use case. @kevsmith suggested exposing ECR support as a new engine within Relay.

Copied from original issue: operable/cog#1281

Segfault with managed dynamic configs

After upgrading the relay to ab7647a (the latest master, as of now), it started throwing segfaults:

Aug 13 14:00:32 foo relay[557]: time="2018-08-13T14:00:32+03:00" level=info msg="Using config file '/etc/relay.conf'."
Aug 13 14:00:32 foo relay[557]: time="2018-08-13T14:00:32+03:00" level=info msg="Relay 8b3dcfd8-41ec-44f7-a5ac-a3c1652fe9c1 is initializing."
Aug 13 14:00:32 foo relay[557]: time="2018-08-13T14:00:32+03:00" level=info msg="Started 16 request workers."
Aug 13 14:00:33 foo relay[557]: time="2018-08-13T14:00:33+03:00" level=info msg="Managed bundle dynamic configs enabled."
Aug 13 14:00:33 foo relay[557]: time="2018-08-13T14:00:33+03:00" level=info msg="Refreshing bundle dynamic configs every 5s."
Aug 13 14:00:35 foo relay[557]: panic: runtime error: invalid memory address or nil pointer dereference
Aug 13 14:00:35 foo relay[557]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x7404e8]
Aug 13 14:00:35 foo relay[557]: goroutine 1 [running]:
Aug 13 14:00:35 foo relay[557]: github.com/operable/go-relay/relay.(*DynamicConfigUpdater).refreshConfigs(0xc4203e0000)
Aug 13 14:00:35 foo relay[557]: /Users/agis/dev/go/src/github.com/operable/go-relay/relay/dynamic_config.go:104 +0xd8
Aug 13 14:00:35 foo relay[557]: github.com/operable/go-relay/relay.(*DynamicConfigUpdater).Run(0xc4203e0000, 0x24, 0xc420016009)
Aug 13 14:00:35 foo relay[557]: /Users/agis/dev/go/src/github.com/operable/go-relay/relay/dynamic_config.go:55 +0x19c
Aug 13 14:00:35 foo relay[557]: github.com/operable/go-relay/relay.(*cogRelay).handleBusEvents(0xc420010540, 0x87a600, 0xc420296d80, 0x0)
Aug 13 14:00:35 foo relay[557]: /Users/agis/dev/go/src/github.com/operable/go-relay/relay/relay.go:133 +0x5bc
Aug 13 14:00:35 foo relay[557]: github.com/operable/go-relay/relay.(*cogRelay).(github.com/operable/go-relay/relay.handleBusEvents)-fm(0x87a600, 0xc420296d80, 0x0)
Aug 13 14:00:35 foo relay[557]: /Users/agis/dev/go/src/github.com/operable/go-relay/relay/relay.go:79 +0x48
Aug 13 14:00:35 foo relay[557]: github.com/operable/go-relay/relay/bus.(*MQTTConnection).Connect(0xc420296d80, 0xc42025b920, 0x2e, 0xc420018010, 0x10, 0xc42001603f, 0x15, 0x75b, 0x0, 0x0, ...)
Aug 13 14:00:35 foo relay[557]: /Users/agis/dev/go/src/github.com/operable/go-relay/relay/bus/mqtt.go:51 +0x3b0
Aug 13 14:00:35 foo relay[557]: github.com/operable/go-relay/relay.(*cogRelay).Start(0xc420010540, 0x878240, 0xc420010540)
Aug 13 14:00:35 foo relay[557]: /Users/agis/dev/go/src/github.com/operable/go-relay/relay/relay.go:91 +0x4f9
Aug 13 14:00:35 foo relay[557]: main.main()
Aug 13 14:00:35 foo relay[557]: /Users/agis/dev/go/src/github.com/operable/go-relay/main.go:182 +0x214

After bisecting, it's apparent that 6a9d3ec caused this.

We do have the managed dynamic configuration mode enabled.

Cannot pull circuit-driver when running against a private registry

Log output is

8/28/2017 4:56:31 PMtime="2017-08-28T20:56:31Z" level=debug msg="Retrieving operable/circuit-driver:0.13 from upstream Docker registry."
8/28/2017 4:56:31 PMtime="2017-08-28T20:56:31Z" level=error msg="Error ocurred pulling image operable/circuit-driver: Error response from daemon: Get https://registry-1.docker.io/v2/operable/circuit-driver/manifests/0.13: unauthorized: incorrect username or password."
8/28/2017 4:56:31 PMtime="2017-08-28T20:56:31Z" level=error msg="Error response from daemon: Get https://registry-1.docker.io/v2/operable/circuit-driver/manifests/0.13: unauthorized: incorrect username or password"

I have a relay set up to pull from GitLab's registry for container images and as such it has the RELAY_DOCKER_REGISTRY_EMAIL, RELAY_DOCKER_REGISTRY_HOST, RELAY_DOCKER_REGISTRY_PASSWORD, and RELAY_DOCKER_REGISTRY_USER set as environment variables. However, this appears to be preventing the relay from pulling from registry-1.docker.io as it's trying to use the username and password from the GitLab registry.

If another relay has launched on this host and the circuit-driver container image is cached, then it launches fine.

Add Relay CLI tool to run commands as if you were talking to Cog

From @imbriaco on February 29, 2016 18:51

Cog commands are simple executables that are executed by Relay, with their arguments and options validated and populated in a specially designed environment. We should explore creating standalone utilities for executing these on the command line in the event that Cog is unavailable for any reason (chat provider outage, database failure, etc).

High level notes:

  • Simple CLI tool converts command line arguments for use by Cog and populates the environment accordingly. e.g. cogexec mist:ec2-find --region=us-east-1.
  • Other functions: list bundles, show help for a bundle. We have the necessary information available in the bundle configuration files.
  • Pipelines are explicitly out of scope. Single command invocations only.
  • No permission validation. Permission is assumed If users can login to the Relay host and have necessary system permissions to execute cogexec and access bundles, command_config, and related files.
  • Any action performed by cogexec should be logged to the audit log.

Much more definition is necessary, but this captures the essence of the problem we're trying to solve.

Copied from original issue: operable/cog#321

Tests failing

Looks like we need to update the go version to fix this as 1.8 isn't supported anymore.
Will look into this when I have a chance.

relay smoke test

From @mpeck on November 22, 2016 21:7

Note: This will most likely be one of several issues for smoke testing communications between the various components of Cog.

Cog admins need an easy way to smoke test a Cog installation. Previously we were using Docker's healthcheck hook to provide some insight into Cog's status, but that proved to be a bit too broad to be useful. So instead we will provide a simple smoke test script to be installed alongside relay. This should give admins a bit more flexibility and provide a sanity check during installation and/or troubleshooting.

The smoke test script should be easily accessible via docker exec so we should copy it to somewhere in the path when building the image.

Checks

  • the host running Cog is accessible
  • the services endpoint in accessible

Done Criteria

  • write a simple smoke test script
  • update Dockerfile to install the script in the path (admins should be able to run the script with something like docker exec cog_smoke_test
  • Add usage documentation to Cog book

Copied from original issue: operable/cog#1176

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.