GithubHelp home page GithubHelp logo

optionalg / guestbook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibm-watson-data-lab/guestbook

0.0 3.0 0.0 11.2 MB

Guestbook application where unregistered users can leave their name and a comment. Includes webhook functionality.

Shell 1.32% PHP 67.02% HTML 16.05% JavaScript 15.60%

guestbook's Introduction

Guestbook

Simple application to accept and store visitors comments. Uses CouchDB 2.0 for storage and also offers webhooks for realtime updates of new comments via RabbitMQ.

Deploying to Cloud

Deploy the guestbook from src/web directory - cf push.

It relies on a CloudantNoSQLDB called "guestbook-db" and a RabbitMQ service called "guestbook-messages"; these services need to be created before you deploy. In the CloudantNoSQLDB the databases comments and webhooks also need to be created in advance.

The two workers are also deployable, in the src/worker directory, use cf push commentWorker and cf push notificationWorker respectively (each has their own specific manifest file).

Instructions for Local Installation and Setup

It's vagrant and ansible. Type vagrant up and your machine will be on 192.168.121.8.

Start some services:

  • `sudo systemctl start couchdb.service
  • `sudo systemctl start requestbin.service
  • `sudo systemctl start guestbook-web.service
  • `sudo systemctl start guestbook-comment-worker.service
  • `sudo systemctl start guestbook-notification-worker.service
  • `sudo systemctl start couchdb-haproxy.service

You now have a web interface http://192.168.121.8:8080/ and fauxton http://192.168.121.8:5984/_utils/# and rabbit http://192.168.121.8:15672 and requestbin http://192.168.121.8:8001.

Set up two new tables in CouchDB: comments and webhooks.

CouchDB setup came from here http://couchdb.apache.org/developer-preview/2.0/

To Show Incoming Webhooks with NGrok

There's a file called receive2.php in the webroot of the guestbook frontend, so curl to http://192.168.121.8:8080/receive.php to see an empty array is output. If you send form data, it dumps $_POST, if you send JSON then it decodes that first.

SSH into vagrant and go to /vagrant. There you will find a script that runs the local binary of ngrok with an associated config file that makes the dashboard available on the host machine run-ngrok-locally.sh. Now hit that (optionally from github).

Use receive3.php to write the incoming data to CouchDB as a poor-man's queueing option.

guestbook's People

Contributors

lornajane avatar mattcollins84 avatar

Watchers

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