Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
Merge 6b80ffe into 1a563cc
Browse files Browse the repository at this point in the history
  • Loading branch information
mossjacob authored Jul 25, 2018
2 parents 1a563cc + 6b80ffe commit 4509340
Show file tree
Hide file tree
Showing 19 changed files with 12,217 additions and 579 deletions.
2 changes: 1 addition & 1 deletion aimmo-game/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
eventlet
flask
flask-socketio
python-socketio==2.0.0
pykube
requests
six
Expand Down
23 changes: 9 additions & 14 deletions aimmo-game/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import sys
import eventlet
import flask
import socketio as SocketIO


from flask_socketio import SocketIO, emit
from flask_cors import CORS
from simulation import map_generator
from simulation.turn_manager import state_provider, ConcurrentTurnManager
Expand All @@ -22,7 +21,7 @@

app = flask.Flask(__name__)
CORS(app, supports_credentials=True)
socketio = SocketIO()
socketio = SocketIO.Server()

worker_manager = None

Expand Down Expand Up @@ -69,8 +68,8 @@ def get_game_state():


@socketio.on('connect')
def world_update_on_connect():
emit(
def world_update_on_connect(sid, environ):
socketio.emit(
'game-state',
get_game_state(),
)
Expand Down Expand Up @@ -122,12 +121,8 @@ def run_game(port):

if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
socketio.init_app(app, resource=os.environ.get('SOCKETIO_RESOURCE', 'socket.io'))
run_game(int(sys.argv[2]))
socketio.run(
app,
debug=False,
host=sys.argv[1],
port=int(sys.argv[2]),
use_reloader=False,
)
host, port = sys.argv[1], int(sys.argv[2])
app = SocketIO.Middleware(socketio, app, socketio_path=os.environ.get('SOCKETIO_RESOURCE', 'socket.io'))

run_game(port)
eventlet.wsgi.server(eventlet.listen((host, port)), app, debug=False)
2 changes: 1 addition & 1 deletion aimmo-game/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
install_requires=[
'eventlet',
'flask',
'flask-socketio',
'python-socketio==2.0.0',
'requests',
'six',
'pykube',
Expand Down
1 change: 0 additions & 1 deletion aimmo/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
install_requires=[
'eventlet',
'flask',
'flask-socketio',
'requests',
'six',
'pykube',
Expand Down
2 changes: 1 addition & 1 deletion aimmo_runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def run(use_minikube, server_wait=True, capture_output=False, test_env=False):
sys.path.append(os.path.join(ROOT_DIR_LOCATION, 'example_project'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_project.settings")

django.setup()
run_command(['pip', 'install', '-e', ROOT_DIR_LOCATION], capture_output=capture_output)

if not test_env:
run_command(['python', _MANAGE_PY, 'migrate', '--noinput'], capture_output=capture_output)
run_command(['python', _MANAGE_PY, 'collectstatic', '--noinput'], capture_output=capture_output)

django.setup()
create_superuser_if_missing(username='admin', password='admin')

server_args = []
Expand Down
Loading

0 comments on commit 4509340

Please sign in to comment.