Giter Club home page Giter Club logo

plotbot's Introduction

The Plotly Bot -- A simple bot written in Go

Build Status

Local installation without docker container

You can either install locally the go environment, or simply use go docker image to create a go docker container. For the former approach, please read the following guide; jump to next section for the go docker image approach.

Setup your own Go environment

  • Install your Go environment, under Ubuntu, use this method:

    http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-go

  • Set your GOPATH:

    On Ubuntu see here

  • Install Ubuntu dependencies needed by various steps in this document:

    sudo apt-get install mercurial zip

  • Pull the bot and its dependencies:

    go get github.com/plotly/plotbot/plotbot

  • Install rice:

    go get github.com/GeertJohan/go.rice/rice

  • Run "npm install":

    cd $GOPATH/src/github.com/plotly/plotbot/web
    npm install
    
  • Run "npm run build":

    cd $GOPATH/src/github.com/plotly/plotbot/web
    npm run build
    

Local build and install

  • Copy the plotbot.sample.conf file to $HOME/.plotbot and tweak at will.

  • Build with:

    cd $GOPATH/src/github.com/plotly/plotbot/plotbot
    go build && ./plotbot
    
  • Note: It is also possible to build plotbot using the stable dependencies found within the Godeps directory. This can be done as follows:

      Install godep: 
      
         go get github.com/tools/godep
         
      Now build using the godep tool as follows:
      
         cd $GOPATH/src/github.com/plotly/plotbot/plotbot
         godep go build && ./plotbot
    
  • Inject static stuff (for the web app) in the binary with:

    cd $GOPATH/src/github.com/plotly/plotbot/web
    rice append --exec=../plotbot/plotbot
    
  • Enjoy! You can deploy the binary and it has all the assets in itself now.

Using Go docker container instead

Rename docker-compose.yml.example file to docker-compose.yml, and tweak at will. For example, change the go version. The GOPATH is set under container, so no need do it, the current working plotbot folder will be mounted inside container as /go/src/github.com/plotly/plotbot, so no need to set project path either. As docker container synchronizes such folder with your filesystem, so you can just edit files on your local filesystem.

  • Use docker-compose to run container, under project directory

    $ docker-compose up -d  # run container plotbot
    $ docker-compose stop   # stop container plotbot
    $ docker-compose start  # start stopped container plotbot
    $ docker-compose rm -f  # delete container plotbot

    PS: docker-compose rm -f will delete all efforts done inside container, while stop/start routine will keep all the changes.

  • To run inside container plotbot

    $ docker exec -ti plotbot /bin/bash
  • To install godep, inside container plotbot do

    # go get github.com/tools/godep
  • Compile plotbot source inside docker container,

    # cd /go/src/github.com/plotly/plotbot/plotbot
    # godep go install

    above commands will create a binary plotbot file under /go/bin inside docker container, as the GOPATH is already set, you can run plotbot anywhere inside docker container.

Writing your own plugin

Take inspiration by looking at the different plugins, like Funny, Healthy, Storm, Deployer, etc.. Don't forget to update your bot's plugins list, like plotbot/main.go

plotbot's People

Contributors

abourget avatar bpostlethwaite avatar bronsolo avatar etpinard avatar perigee avatar scjody 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.