Code Monkey home page Code Monkey logo

place's Introduction

place

This project was inspired by r/Place. It is an online shared canvas where you can draw individual pixels.

The project is online at pl.g7kk.com.

How to host a Place

  1. You need to compile place.go using the Go compiler.
    Run go build:

    cd ./place
    go build cmd/place/place.go

    alternatively, use go install:

    cd ./place
    go install cmd/place/place.go
  2. Run place and set the -root argument to the location of the web/root directory. You can also configure other settings when you run it (see below).

    place -root web/root -port :8080

Other configuration options:

-root string
The directory with the web files. (default "./root")

-count int
The maximum number of connections. (default 64)

-width int
The width to create the canvas. (default 1024)

-height int
The height to create the canvas. (default 1024)

-load string
A png to load as the canvas. (If not set it creates a blank canvas)

-save string
The name to save the canvas. (default "./place.png")

-log string
The log file to write to. (If not set it will log to the command line)

-port string
The port the server listens at. (default ":8080")

-sinterval int
Save interval in seconds. (default 180)

Maintenance

I recomend setting up some scripts to easily restart the server or rollback the canvas.

Restart the server

This script kills the server and restarts it with the old canvas. This does not reset the canvas.
On my server I have this script set up as a cron job to run nightly to remove any lingering websocket connections.

cd ~/go/src/place/web
pkill place
~/go/bin/place -port :80 -load place.png &>place.log &

Rollback the canvas

This script rolls back the canvas to a previously saved image.

cd ~/go/src/place/web
pkill place
cp place_rollback.png place.png
~/go/bin/place -port :80 -load place.png &>place.log &

place's People

Contributors

rbxb 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.