Skip to content
This repository has been archived by the owner. It is now read-only.
The place where you battle your snakes
CSS Python HTML JavaScript Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
charts/play
cypress
docs
play
.dockerignore
.env.example
.flake8
.gitignore
.pre-commit-config.yaml
.travis.yml
CODE-OF-CONDUCT.md
CONTRIBUTING.md
Dockerfile
LICENSE
Makefile
README.md
cloudbuild.yaml
deploybuild.yaml
entrypoint.sh
requirements.dev.txt
requirements.txt

README.md

play

"Where I go to do battlesnake." - @bvanvugt

This is the platform that allows users to sign up, register snakes, and run games.

Getting Started

Prerequisites

Setup

  1. Clone the repo to your machine: git clone git@github.com:battlesnakeio:play

  2. Install python3.x

    • on a Mac: brew install python3
    • on Linux: apt-get install python3
  3. Install the project dependencies:

    pip3 install -r requirements.txt
    • Using pyenv? Use pip supplied by your virtualenv instead of pip3
    • optionally install via pyenv
      pyenv install 3.7
      pyenv virtualenv 3.7 play
      pyenv activate play
      
  4. From inside the project play folder, run the migrations:

    ENV=local \
    PYTHONPATH=~/path/to/play/play \
    ./manage.py migrate
  5. Start the server with:

    ENV=local \
    PYTHONPATH=~/path/to/play/play \
    ./manage.py runserver
  6. Visit the app running at http://localhost:8000

Tests

To run tests:

cd play
ENV=local pytest

Github OAuth App Configuration

Go here: https://github.com/settings/applications/new

Fill in the following:

Copy the generated secrets in to your .env (described below)

Secrets

Your .env file should contain the following:

ENV=local

BATTLESNAKEIO_SECRET=battlesnakeio
BATTLESNAKEIO_GITHUB_CLIENT_ID=...
BATTLESNAKEIO_GITHUB_CLIENT_SECRET=...

If using postgres locally (instead of SQLite), you'll also need:

POSTGRES_HOST=...
POSTGRES_PORT=...
POSTGRES_DB=...
POSTGRES_USER=...
POSTGRES_PASSWORD=...

Docker

Docker is used to build the production image that gets deployed. You can also use it to build an image you can run yourself:

  1. Build the image: docker build -t battlesnakeio/play .
  2. Run databases: docker run -it -d --env-file=.env -p 5432:5432 --name=battlesnakeio.play.pg postgres:10.4
  3. Run server: docker run -it -d --env-file=.env -p 8000:8000 --name=battlesnakeio.play battlesnakeio/play
You can’t perform that action at this time.