Giter Club home page Giter Club logo

lunchbot's Introduction

lunchbot

Simple Skype bot which helps to choose restaurant for lunch.

Configuration

Before start you need to obtain Application Id and password. Please check Register a bot with the Bot Framework.

Copy lunchbot.cfg.example to lunchbot.cfg and data.txt.example to data.txt.

Edit lunchbot.cfg and data.txt according to comments.

Development

Install package in development mode (recommended to use virtualenv):

python setup.py develop

Set environment variables:

export FLASK_APP=lunchbot
export FLASK_DEBUG=1
export LUNCHBOT_SETTINGS=lunchbot.cfg

Run application:

flask run

Deployment

To deploy lunchbot you will need Linux host with Docker and docker-compose installed.

Go to directory with project's sources copied. Create here lunchbot.cfg and data.txt files. Run:

docker-compose up -d

Service will listen on port 5000 on the loopback interface.

You will need to use some HTTP server as reverse proxy. For example Nginx:

upstream lunchbot-site {
        server localhost:5000;
}

server {
        listen 80;

        # Make site accessible from http://bot.example.com/
        server_name bot.example.com;

        location / {
            proxy_set_header        Host $http_host;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        X-Forwarded-Proto $scheme;

            client_max_body_size    10m;
            client_body_buffer_size 128k;
            proxy_connect_timeout   60s;
            proxy_send_timeout      90s;
            proxy_read_timeout      90s;
            proxy_buffering         off;
            proxy_temp_file_write_size 64k;
            proxy_pass http://lunchbot-site;
            proxy_redirect          off;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/bot.example.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/bot.example.com/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

        if ($scheme != "https") {
            return 301 https://$host$request_uri;
        } # managed by Certbot
}

License

Licensed under MIT License.

lunchbot's People

Watchers

 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.