Skip to content

Commit

Permalink
Add frontend service
Browse files Browse the repository at this point in the history
  • Loading branch information
nrybowski committed Oct 22, 2022
1 parent fe246b2 commit 1e1df6f
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 5 deletions.
16 changes: 16 additions & 0 deletions configuration.deploy.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion deploy/agent-docker.containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/"]
12 changes: 12 additions & 0 deletions deploy/frontend.containerfile
Original file line number Diff line number Diff line change
@@ -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"]
50 changes: 50 additions & 0 deletions deploy/frontend.setup
Original file line number Diff line number Diff line change
@@ -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"],
},
)
32 changes: 31 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
7 changes: 4 additions & 3 deletions inginious/frontend/arch_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1e1df6f

Please sign in to comment.