Code Monkey home page Code Monkey logo

pont's Introduction

About

pont is an online game based on Qwirkle (by Mindware Games)

Screenshot

Notably, both the client and server are written in Rust; the only Javascript is a shim to load the WebAssembly module.

Hosting

It's easiest to run the whole application on a single VM, using NGINX to both serve static content and to act as a secure proxy for websocket communication. The latter means we don't need SSL support in the game server itself.

The system looks something like this:

Screenshot

I'm hosting a copy of the game at https://pont.mattkeeter.com, using a $5/month droplet from Digital Ocean and Dreamhost for domain registration.

Initial setup

sudo apt update
sudo apt install build-essentials libssl-dev pkg-config
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

Installing NGINX and setting up Let's Encrypt

sudo apt install nginx
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx

sudo certbot --nginx

(read and follow certbot's instructions)

Turn on a firewall to improve security

sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 8081
sudo ufw enable

Building the client WebAssembly file

git clone https://github.com/mkeeter/pont.git
cd pont/pont-client
wasm-pack build --target web

Deploy the nginx config

sudo cp pont.conf /etc/nginx/sites-enabled/pont.conf
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -s reload

This won't work out of the box, because the configuration assumes the url is pont.mattkeeter.com, which won't be true for you; edit it accordingly.

Running the server

cd pont/pont-server
cargo run --release

(leave this in a screen session for easy persistence!)

License

© 2020 Matthew Keeter

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

pont's People

Contributors

mkeeter avatar gjeuken avatar

Watchers

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