- Clone the repository
- Install poetry
- Run
poetry install
in thebackend
directory - If necessary, install PostgreSQL
- Create a new database. If desired, an existing database can also be used, provided there are no name conflicts with this application, though this is not recommended
- In your chosen database, run all
.sql
files in thesql/
directory, starting withtables.sql
- Wherever the environment for the desired user is configured, set the
DATABASE_URL
variable to the connection URI for your database. Note thatDATABASE_URL
follows the variable used in heroku applications
NOTE: If the server is handling a large number of simultaneous connections, it will be limited by the system open file limit, which may be set to a small value by default on your system. If you are exceeding the limit, you will see error messages like the following:
OSError: [Errno 24] Too many open files
You can check the current value on linux with ulimit -n
and set it for the
current session with ulimit -n limit
, up to any limits
described in /etc/security/limits.conf
. See this
page for
additional details.
NOTE: As database connections are made via TCP/IP, a password is
required for all users by default. If you intend to connect without a password,
you must edit pg_hba.conf
to trust the desired user on the loopback address by
adding a line like
# TYPE DATABASE USER ADDRESS METHOD
host my_db postgres 127.0.0.1/32 trust
If you don't know the location of pg_hba.conf
, connect to the database and run
show hba_file;
≥ 3.9
13.3 tested, but all supported versions will likely work
Run poetry run python -m igo.gameserver
from the root directory. If running
the AI server, separately run poetry run python -m igo.aiserver
. Use the
--help
option on either for additional options. You will also need an instance
of the frontend server running in order to play.
- aiofiles for reading local files asynchronously
- asyncinit for writing
async
__init__
methods - asyncpg for performant, asynchronous communication with the PostgreSQL store
- dataclassy for an
auto-slotting
reimplementation of python
dataclasses that allows
default attribute values and mutable defaults.
__slots__
is especially useful for classes with many instances being created and destroyed, e.g. the message containers that are used in this codebase - PostgreSQL for a highly scalable store with asynchronous pub/sub capabilities for message passing
- tornado for highly scalable, asynchronous WebSockets to communicate with the frontend and between the game and AI servers
- uvloop for improved
asyncio
performance
- black for formatting
- coverage for code coverage
- cProfile for performance analysis
- iPython for interactive exploration and testing
- numpy for performance test result munging
- poetry for dependency and virtual environment management
- testing.postgresql for testing with a live database