Skip to content

A btc/nxt dice game built on node.js + socket.io + react.js + mongodb

Notifications You must be signed in to change notification settings

popmanhe/Node_Dice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo site: http://neohe.com
Donation: 1ANFLKVy37ZMnbzhYHEqhgHcxEbFnQh7kE

The site is built on

  • Backend: node.js + socket.io + mongodb
  • Frontend: bootstrap + jquery + react.js

Before you run this site, please set up connection to mongodb in config/developement.js or production.js.

  • 2015-02-24: First commit; Basic features added.
  • 2015-03-11: Add chat functionality. Chat messages can be saved to database and kept for a week(using mongodb TTL index).
  • 2015-03-18: Get bitcoin address from Blockchain.info and can be saved to user account.
  • 2015-03-21: Update balance for deposit every 30 seconds once BTC address is generated; User name has to be unique(using unique index of mongodb);
  • 2015-03-22: Bitcoin faucet implemented. Use google reCaptcha to verify user is not rebot.
    Amount of faucet and interval can be adjusted in config file.
  • 2015-03-29: Move to ubuntu and use nginx as web server.
  • 2017-01-25: Start rewriting in ES6 and react. Use babel to transform ES6 to ES5. Node.js acts as restful api/socket.io server and does not render front-end html any more. Will use docker to host application in the future.
  • 2017-04-07: Use docker containers to deploy a working beta.
  • 2018-01-15: Support multiple languages.
  • 2018-01-21: Add user management, forget pasword, country blocker, 2FA, back office and more features. Send me email for back office access.
  • 2018-02-01: Bug fixes.

The whole site uses three docker containers. One is for front-end, hosted by nginx images. The second one is for back-end, hosted by node 7.8 and socket.io. The third one is using mongo db images. You can see three containers in docker-compose.yml.

How to setup the site?

NOTE: If you are on windows to build docker container, read below before setting up the site.

Before step 1, you may need to disable IIS or change the port mapping of web section in docker-compose.yml. eg.

80:80 -> 8080:80

Before step 3, you may need to open up docker settings and set the share drive. And may need to comment out volumes for mongo in docker-compose.yml

	volumes:
      - ./mongodb/db:/data/dbvolumn
      

Steps:

  1. Install node.js and npm
  2. Install docker
  3. Go to the root folder of source code where docker-compose.yml resides.
  4. Build client: cd client && npm run prod && cd ..
  5. Build server: cd server && npm run prod && cd ..
  6. docker-compose build
  7. docker-compose up -d
  8. Open browser: http://localhost

Or just run build.bat. It does steps 3-6 for you.

How to update the site?

The physical files are not actually in the containers, as you can see volumes in each section of docker-compose.yml. volumes maps host path to the internal path of container. So you just need to update files in host. After you test and build your local souce code by using npm run prod for client or server, push the changes to github. Then in your host machine, just type git pull and get the changes from github. That's it. You update you site.

If you have any questions, contact me at: [email protected].

About

A btc/nxt dice game built on node.js + socket.io + react.js + mongodb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages