diff --git a/configuration.deploy.yaml b/configuration.deploy.yaml new file mode 100644 index 000000000..0860e696c --- /dev/null +++ b/configuration.deploy.yaml @@ -0,0 +1,16 @@ +backend: tcp://inginious-backend:2000 +backup_directory: /inginious/backups +local-config: {} +mongo_opt: + database: INGInious + host: inginious-db +plugins: [] +session_parameters: + ignore_change_ip: false + secret_key: 96f4628a2e4d0ce26b6352713f8ac8359b838f4800f1972790622899664bd0f4 + secure: false + timeout: 86400 +superadmins: +- superadmin +tasks_directory: /inginious/tasks +use_minified_js: true diff --git a/deploy/agent-docker.containerfile b/deploy/agent-docker.containerfile index 2ed968583..f9834904b 100644 --- a/deploy/agent-docker.containerfile +++ b/deploy/agent-docker.containerfile @@ -7,4 +7,4 @@ COPY inginious-agent-docker . COPY deploy/agent-docker.setup setup.py RUN pip3 install . -CMD ["sh", "-c", "python3 inginious-agent-docker ${BACKEND}"] +CMD ["sh", "-c", "python3 inginious-agent-docker ${BACKEND} --tmpdir=/tmp/agent_data/"] diff --git a/deploy/frontend.containerfile b/deploy/frontend.containerfile new file mode 100644 index 000000000..d1a868015 --- /dev/null +++ b/deploy/frontend.containerfile @@ -0,0 +1,12 @@ +FROM inginious/inginious-base + +COPY inginious/frontend inginious/frontend/ +COPY inginious/client inginious/client/ +COPY inginious-webapp . + +COPY deploy/frontend.setup setup.py +RUN pip3 install . + +RUN apt-get install -y git + +CMD ["sh", "-c", "python3 inginious-webapp"] diff --git a/deploy/frontend.setup b/deploy/frontend.setup new file mode 100644 index 000000000..95d5dae8b --- /dev/null +++ b/deploy/frontend.setup @@ -0,0 +1,50 @@ +from setuptools import setup, find_packages + +install_requires = [ + "pyzmq>=15.3.0", + "msgpack >= 1.0.0", + "Werkzeug >= 1.0.0", + "PyYAML>=3.11", + "Flask >= 1.1.0", + "Flask-Mail >= 0.9.1", + "pymongo>=3.2.2", + "oauth2>=1.9.0.post1", + + #"docker>=2.5.0", + #"docutils>=0.14", + "pymongo>=3.2.2", + "PyYAML>=3.11", + "Jinja2 >= 2.10", + "lti>=0.9.0", + "oauth2>=1.9.0.post1", + "httplib2>=0.9", + "watchdog >= 0.8.3", + "msgpack >= 1.0.0", + "pyzmq >= 15.3.0", + "natsort >= 5.0.1", + "psutil >= 4.4.2", + "zipstream >= 1.1.4", + "WsgiDAV >= 3.0.0", + "Werkzeug >= 1.0.0", + "itsdangerous >= 1.1.0", + "Flask >= 1.1.0", + "Flask-Mail >= 0.9.1", + "importlib_metadata >= 3.7.0", + 'dataclasses >= 0.8; python_version < "3.7.0"', + "pytidylib>=0.2.4", + "sphinx-autodoc-typehints>=1.12.0", + "sh" +] + +setup( + name="INGInious", + packages=find_packages(), + install_requires=install_requires, + include_package_data=True, + extras_require={ + "cgi": ["flup>=1.0.3.dev"], + "ldap": ["ldap3"], + "saml2": ["python3-saml"], + "uwsgi": ["uwsgi"], + }, +) diff --git a/docker-compose.yml b/docker-compose.yml index 1f047f155..4573e8093 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,12 @@ services: environment: BACKEND: "tcp://inginious-backend:2001" volumes: - - /var/run/docker.sock:/var/run/docker.sock + - /var/run/docker.sock:/var/run/docker.sock + # See https://github.com/UCL-INGI/INGInious/issues/352 + - ./tasks/:/inginious/tasks + - ./backups/:/inginious/backups + # See https://github.com/UCL-INGI/INGInious/issues/799 + - /tmp/agent_data/:/tmp/agent_data/ networks: - inginious @@ -40,6 +45,31 @@ services: dockerfile: deploy/agent-mcq.containerfile environment: BACKEND: "tcp://inginious-backend:2001" + volumes: + # See https://github.com/UCL-INGI/INGInious/issues/352 + - ./tasks/:/inginious/tasks + - ./backups/:/inginious/backups + # See https://github.com/UCL-INGI/INGInious/issues/799 + - /tmp/agent_data/:/tmp/agent_data/ + networks: + - inginious + + inginious-frontend: + image: inginious/inginious-frontend + build: + dockerfile: deploy/frontend.containerfile + depends_on: + - inginious-backend + - inginious-agent-docker + - inginious-agent-mcq + environment: + - INGINIOUS_WEBAPP_HOST=0.0.0.0 + volumes: + - ./configuration.deploy.yaml:/inginious/configuration.yaml + - ./tasks/:/inginious/tasks + - ./backups/:/inginious/backups + ports: + - 9000:8080 networks: - inginious diff --git a/inginious/frontend/arch_helper.py b/inginious/frontend/arch_helper.py index 6015fdf0a..51d9b7197 100644 --- a/inginious/frontend/arch_helper.py +++ b/inginious/frontend/arch_helper.py @@ -10,9 +10,6 @@ from zmq.asyncio import ZMQEventLoop, Context -from inginious.agent.docker_agent import DockerAgent -from inginious.agent.mcq_agent import MCQAgent -from inginious.backend.backend import Backend from inginious.client.client import Client def start_asyncio_and_zmq(debug_asyncio=False): @@ -88,6 +85,10 @@ def create_arch(configuration, tasks_fs, context, course_factory): else: debug_ports = range(64100, 64111) + from inginious.agent.docker_agent import DockerAgent + from inginious.agent.mcq_agent import MCQAgent + from inginious.backend.backend import Backend + client = Client(context, "inproc://backend_client") backend = Backend(context, "inproc://backend_agent", "inproc://backend_client") agent_docker = DockerAgent(context, "inproc://backend_agent", "Docker - Local agent", concurrency, tasks_fs, debug_host, debug_ports, tmp_dir, ssh_allowed=True)