This site is currently live in alpha at: playarimaa.org
- Install sbt and nodejs.
- Clone this github repo to any desired directory and navigate to that directory.
- Run
npm install
to install the necessary nodejs packages. - Install gulp if gulp is not installed, by
npm install -g gulp
. - Copy
src/main/resources/application.conf.example
tosrc/main/resources/application.conf
, and edit the copy as desired to configure basic parameters for the server. - Run
gulp build
to compile the javascript and other frontend files. - Run
sbt
. - Within sbt, run
compile
to build the Scala backend and optionallytest
to run some local tests for the scala backend. - Within sbt, run
startServerTest
to start up the webserver using an in-memory database. - Go to site and use the site!
If you want to run the server in a production mode with persistent state (as opposed to an in-memory db that is erased when the server is restarted) and also have the email features of the site working properly:
- Set up an empty postgres database, (Google for how to do this), editing
src/main/resources/application.conf
with the values necessary to connect to the database. - Run the command
sbt -DisProd=true 'run-main org.playarimaa.server.CreateTables'
from the command line to create the necessary tables in the empty database. - Set up an email/smtp server, or register for an online service for smtp (such as Amazon SES if you're using Amazon Web Services), again editing
src/main/resources/application.conf
as needed so that the server can send email. - Run
gulp build
as necessary if you make any changes to the frontend in the process. - Within sbt, run
startServerProd
to start up the webserver in production mode.
To run the server separately, not within SBT, such as you might do on a production machine rather than one used for development:
- Download an appropriate Java servlet engine such as Jetty: http://www.eclipse.org/jetty/. For a quick lightweight start, consider Jetty Runner: http://www.eclipse.org/jetty/documentation/9.2.3.v20140905/runner.html
- Within sbt, run
clean
and thenpackage
to build a ".war" file in target/scala-2.11/. This is the packaged servlet that can then be run using Jetty or the servlet engine. Note thatclean
is often necessary here because if there are stale unused build files left over from development, they can sometimes actually get packaged in with the .war file and cause issues.
Note that to avoid memory leaks via Java's permanent generation in a long-running sbt process, you may need to edit your sbt configuration (i.e. the sbt script installed at ~/bin/sbt) if you have Java 1.7 or earlier. If you do encounter out-of-memory issues in sbt, try editing the script to call Java with the following flags:
-XX:+CMSClassUnloadingEnabled
-XX:+UseConcMarkSweepGC
-XX:MaxPermSize=1G
If during a compile in SBT you encounter the error filename too long
or similar, it may be due to sbt trying to generate a file whose name exceeds the max allowed filename length on your system. See if you can specify an override for your sbt install to cap the filename length it uses:
http://stackoverflow.com/questions/28565837/filename-too-long-sbt
If you see an error like java.net.BindException Address already in use
or similar, it may be because you already have some software or program or server running that is listening on port 8080, which is the port this server attempts to listen on. If you are running from within SBT, try locally editing the ++ jetty(port=8080)
in project/Build.scala to specify a different port not in use. If you are running using a servlet engine like Jetty with the packaged servlet as a ".war" file, see the documentation on that engine on how to specify the port.
See https://github.com/lightvector/arimaa-server/wiki/Arimaa-Game-Server-JSON-API for the current API.
As the site is new and major features are still being worked out, the API is subject to change, although most of the basic queries, such as those directly involved in joining and playing games are unlikely to change much more at this point (except for possibly the addition of new fields to the return values of the queries).
The contents of this repository are available under a BSD-style license. However, please note that this license alone does not grant usage for purposes related to the Arimaa game or any rights the Arimaa game itself - for that, please contact the creator of Arimaa at http://arimaa.com/.
See the included LICENSE.txt file for more details: https://github.com/lightvector/arimaa-server/blob/master/LICENSE.txt
- lightvector
- mattj256
- aaronyzhou