Giter VIP home page Giter VIP logo

meteor-mysql-leaderboard's Introduction

MySQL Leaderboard Example

The familiar Meteor Leaderboard example modified to use a MySQL backend, reactively!

This example uses the following new package for MySQL integration:

Quick start

Using Embedded MySQL Server

The numtel:mysql-server Meteor Package can be used to embed a MySQL server into your Meteor application, just as Mongo is embedded by default. At this time there is not yet Windows support but Linux (32 and 64 bit) as well as Mac OSX are supported.

When using numtel:mysql-server, the configuration settings will be read from leaderboard.mysql.json.

$ git clone https://github.com/numtel/meteor-mysql-leaderboard.git
$ cd meteor-mysql-leaderboard

# Install mysql-server package
$ meteor add numtel:mysql-server

$ meteor

Using Externally Configured MySQL Server

This example requires a MySQL server configured to output the binary log in row mode.

See the mysql-live-select installation instructions for more details...

$ git clone https://github.com/numtel/meteor-mysql-leaderboard.git
$ cd meteor-mysql-leaderboard

# Create `leaderboard` database and import sample tables and data
$ mysql -uUSERNAME -pPASSWORD < leaderboard.sql

# Update database connection settings in your favorite editor (line 60)
$ ed leaderboard.js

$ meteor

meteor-mysql-leaderboard's People

Contributors

cdolek avatar numtel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

meteor-mysql-leaderboard's Issues

Does This Need Particular Table Structure

Hi
This meteor-mysql-leaderboard works fine on the table structure provided. So in this you have a mysql master-slave configuration, but where is the slave maintained.

But I am trying to listen to another table in the same database, the update is not showing up. Do you need the mysql database of a particular format.

The entire database has binary output enabled. The only difference that I could see is the utf8_general_ci and latin1_swedish_ci in the collation leaderboard example but this should not affect this.....The other difference being the table is too large.

I am getting the following exception:
I20160731-02:58:21.031(-7)? Exception from sub playerScore id mBxu34cBMbqWLrS9f Error: triggers array required
I20160731-02:58:21.031(-7)? at LiveMysql.select (/root/.meteor/packages/numtel_mysql/.1.0.3.14i03be++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysql.js:74:11)
I20160731-02:58:21.031(-7)? at [object Object].Meteor.methods.incScore as _handler
I20160731-02:58:21.032(-7)? at maybeAuditArgumentChecks (livedata_server.js:1698:12)
I20160731-02:58:21.032(-7)? at [object Object]._.extend.runHandler (livedata_server.js:1023:17)
I20160731-02:58:21.032(-7)? at [object Object].
.extend.startSubscription (livedata_server.js:842:9)
I20160731-02:58:21.033(-7)? at [object Object].
.extend.protocol_handlers.sub (livedata_server.js:614:12)
I20160731-02:58:21.033(-7)? at livedata_server.js:548:43

Client side Stub?

Wondering why is this client-side stub needed (here)?

I removed that client side stub and seems like the app is working fine. Anything I am missing?

Reactivity?

Hi Ben
I've got the leaderboard example working .... to some extent.
I can add points to a scientist and see the players table being updated.

However if I manually insert a record to the players table, the leaderboard will only show the new scientist on CTRL C and restart the application.

Additionally if I open a second window, the leaderboards are not kept in sync. It displays the data as if no changes have happened.

players table
leaderboards not in sync

How to do a simple non reactive query

how would you do the equivalent of var variable = mongoquery; for a one time query that does not need to be reactive? Sorry to ask it here but no one seems to know how and I can't find documentation for it. thanks in advanced.

Client Updates Not Sticking / Server Updates Not Propagating

Client Updates Not Sticking
When I add points to a player, the points appear on the screen and the change is propagated to the server but when I hard reload or open a new tab the page, the change disappears.

Server Updates Not Propagating
When I insert a new row into the players table, that player does not appear on the client immediately. That new player also does not appear even when I hard reload the browser or open a new tab.

Error: Cannot engueue Query after fatal error.

I20150527-11:33:33.293(-7)? Exception from sub D4gei3iHQSunzCTDt Error: Cannot enqueue Query after fatal error.
I20150527-11:33:33.295(-7)?     at Protocol._validateEnqueue (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql/lib/protocol/Protocol.js:193:16)
I20150527-11:33:33.295(-7)?     at Protocol._enqueue (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql/lib/protocol/Protocol.js:129:13)
I20150527-11:33:33.295(-7)?     at Connection.query (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql/lib/Connection.js:185:25)
I20150527-11:33:33.295(-7)?     at _update (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:111:18)
I20150527-11:33:33.295(-7)?     at LiveMysqlSelect.update (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:124:5)
I20150527-11:33:33.296(-7)?     at new LiveMysqlSelect (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:27:10)
I20150527-11:33:33.296(-7)?     at LiveMysql.select (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysql.js:90:19)
I20150527-11:33:33.296(-7)?     at [object Object].Meteor.publish.liveDb.select.table [as _handler] (app/leaderboard.js:83:19)
I20150527-11:33:33.296(-7)?     at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1599:1)
I20150527-11:33:33.296(-7)?     at [object Object]._.extend._runHandler (packages/ddp/livedata_server.js:943:1)
I20150527-11:33:33.296(-7)? Exception from sub g8yByAEhHdZktiRcB Error: Cannot enqueue Query after fatal error.
I20150527-11:33:33.297(-7)?     at Protocol._validateEnqueue (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql/lib/protocol/Protocol.js:193:16)
I20150527-11:33:33.297(-7)?     at Protocol._enqueue (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql/lib/protocol/Protocol.js:129:13)
I20150527-11:33:33.297(-7)?     at Connection.query (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql/lib/Connection.js:185:25)
I20150527-11:33:33.298(-7)?     at _update (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:111:18)
I20150527-11:33:33.298(-7)?     at LiveMysqlSelect.update (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:124:5)
I20150527-11:33:33.298(-7)?     at new LiveMysqlSelect (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysqlSelect.js:27:10)
I20150527-11:33:33.299(-7)?     at LiveMysql.select (/home/jjackson/.meteor/packages/numtel_mysql/.0.1.3.1ewnr4w++os+web.browser+web.cordova/npm/node_modules/mysql-live-select/lib/LiveMysql.js:90:19)
I20150527-11:33:33.299(-7)?     at [object Object].Meteor.methods.incScore [as _handler] (app/leaderboard.js:90:19)
I20150527-11:33:33.299(-7)?     at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1599:1)
I20150527-11:33:33.299(-7)?     at [object Object]._.extend._runHandler (packages/ddp/livedata_server.js:943:1)

I did a fresh install, the app loads but whenever I refresh the console shows this error.

Error while installing "meteor add numtel:mysql-server" on meteor 1.4

am trying to install this package but i am getting following error.
Need help please.

4 warnings and 13 errors generated. make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1 gyp ERR! build error gyp ERR! stack Error:make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit
(/Users/umair/.meteor/packages/meteor-tool/.1.4.1_1.10jgzqm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 16.1.0
gyp ERR! command "/Users/umair/.meteor/packages/meteor-tool/.1.4.1_1.10jgzqm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node"
"/Users/umair/.meteor/packages/meteor-tool/.1.4.1_1.10jgzqm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
"rebuild"
gyp ERR! cwd /Users/umair/.meteor/packages/numtel_mysql-server/.1.0.1.gnzz6e++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/.temp-4udg2u/node_modules/bcrypt
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

npm ERR! Darwin 16.1.0
npm ERR! argv "/Users/umair/.meteor/packages/meteor-tool/.1.4.1_1.10jgzqm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node"
"/Users/umair/.meteor/packages/meteor-tool/.1.4.1_1.10jgzqm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm" "rebuild" "--no-bin-links" "--update-binary"
npm ERR! node v4.5.0
npm ERR! npm v3.10.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/umair/.meteor/packages/numtel_mysql-server/.1.0.1.gnzz6e++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/.temp-4udg2u/npm-debug.log

Cannot enqueue Query after fatal error.

Hi Numtel,

I'm trying to run the example in a development server with node v0.12.3 in it. I've downloaded and updated to meteor 1.2 the project. After launching the project I get the following error:

Exception from sub allPlayers id pdYh3qd3YoBG6tphG Error: Cannot enqueue Query after fatal error.
at Object.Future.wait (/var/www/html/meteor-test.com/bundle/programs/server/ node_modules/fibers/future.js:398:15)
at LiveMysqlSelect.LiveMysql.LiveMysqlSelect._publishCursor (packages/numtel mysql/packages/numtel_mysql.js:55:1)
at [object Object].
.extend.runHandler (livedata_server.js:1059:13)
at [object Object].
.extend.startSubscription (livedata_server.js:842:9)
at [object Object].
.extend.protocol_handlers.sub (livedata_server.js:614:12)
at livedata_server.js:548:43

The database configuration on the leaderboard.js that i've used seems to be ok. I'm able to connect using a mysql client.

For the building of the targz i did:

meteor build ~/build-output-directory --server=********:8080

Thank you!

ReferenceError: mysql is not defined

Hi Numtel.
I got issue when trying connect mysql in my windows:
if (Meteor.isServer) {
var db = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'demo'
});
}

But it throw error "ReferenceError: mysql is not defined."
I'm using xampp.
Can you please help me check it?
Thank you

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.