Code Monkey home page Code Monkey logo

secret-reichstag-server's Introduction

Secret-Reichstag-Server

Secret Reichstag Server

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

This project is a web version of a modified version of the game "Secret Hitler"

Running your own server

Prebuilt .jar files are available under the releases section

After you've downloaded or built a server JAR, you can run it using Java 11 or higher. Upon first launch, the server will generate a config.yml file which you can edit. The default configuration looks like this:

### CustomConfig version: 2.0
ssl: 
  enable: false
  certificate-path: "pem/cert.pem"
  private-key-path: "pem/privkey.pem"
  certificate-password: ""
server: 
  insecure: 
    host: "0.0.0.0"
    port: 34642
  secure: 
    host: "0.0.0.0"
    port: 34643

You can also create the config file before running the server

Enabling SSL

The server supports using secure websockets (wss://) instead of insecure (ws://) ones. To enable them, make sure you have a valid certificate and private key for your domain name and edit the paths in the config accordingly. Optionally, you can enter the certificate's password (if it has one). Then, you can set ssl.enable to true and you should be able to connect to your server using wss://your.domain:port

Setting up a proxy using Apache2

If you want to integrate the server into your existing domain/webpage configuration using Apache2, you can do so by using a proxy. Please keep in mind that these instructions apply to using Apache2 on Linux. If you're running it on Windows, you might need to adapt some of the steps.

Note: If you plan on hosting the web client as well, please refer to the README of Secret-Reichstag-Web and follow the instructions there

Using an existing domain

To use an existing (sub-)domain for your server, you need to edit the site's config file and add the following lines to its VirtualHost

	# For insecure WebSockets. If you're using secure websockets, disable this
	ProxyPass "/reichstag" "ws://localhost:34642"
	
	# For secure WebSockets, enable these
	# Note: Internally, this will always use insecure websockets. You can change this if you want
	# SSLProxyEngine On
	# ProxyPass "/reichstag" "ws://localhost:34642"
	# SSLCertificateFile /path/to/your/certificate.pem
	# SSLCertificateKeyFile /path/to/your/privatekey.pem

Make sure you've enabled the correct modules for Apache using

a2enmod proxy proxy_http proxy_wstunnel

then restart Apache using

systemctl restart apache2.service

If everything went well, you should now be able to connect to your server using ws://your.domain/reichstag or wss://your.domain/reichstag (depending on whether you're using secure WebSockets) in the app

Using a dedicated subdomain

To use a dedicated subdomain for the server (e.g. sr.your.domain), you first need to create a new site configuration.

Under /etc/apache2/sites-available/ create a new configuration file (e.g. secretreichstag.conf) with the following contents:

<VirtualHost *:443>
	ServerName sr.your.domain

	ServerAdmin [email protected]

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
	
	SSLCertificateFile /path/to/your/certificate.pem
	SSLCertificateKeyFile /path/to/your/privatekey.pem
	
	# For insecure WebSockets. If you're using secure websockets, disable this
	ProxyPass "/" "ws://localhost:34642"
	
	# For secure WebSockets, enable these
	# Note: Internally, this will always use insecure websockets. You can change this if you want
	# SSLProxyEngine On
	# ProxyPass "/" "ws://localhost:34642"
</VirtualHost>

If you don't want to use https, make sure to change the *:443 to *:80 and remove the SSLCertificateFile and SSLCertificateKeyFile

Before enabling the new site, you need to make sure you've enabled the right modules for Apache2 to proxy the WebSockets. To do so, use

a2enmod proxy proxy_http proxy_wstunnel

You can then enable the site using

a2ensite secretreichstag

and restart Apache using

systemctl restart apache2.service

Make sure you have a valid DNS entry for the new subdomain pointing to your server.

If everything went well, you should now be able to connect to your server using ws://sr.your.domain or wss://sr.your.domain (depending on whether you're using secure WebSockets) in the app

Building the server yourself

If you don't want to use the prebuilt .jar files or want to modify the server before building, you can do so using Maven. Just clone the repo, make your changes, then run

mvn package

Make sure you have installed Java 11+ correctly before trying to build

secret-reichstag-server's People

Contributors

dependabot[bot] avatar mrletsplay2003 avatar

Watchers

 avatar  avatar  avatar

Forkers

sakhma-dyck

secret-reichstag-server's Issues

Discord Login

Log in with Discord and then display the user's Discord name.

Add automatic match finding

  • Add an option (when creating a room?) to set it to public, allowing other people to join it using either a match finding button or by selecting it from a list

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.