Skip to content

Commit

Permalink
Merge branch 'develop' into feature/communication/Add-answer-post-to-…
Browse files Browse the repository at this point in the history
…course-wide-search
  • Loading branch information
cremertim authored Nov 1, 2024
2 parents e287a7e + 2dba3ce commit b9286b1
Show file tree
Hide file tree
Showing 19 changed files with 284 additions and 128 deletions.
4 changes: 4 additions & 0 deletions docs/admin/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This section describes some additional steps that are of interest for production
For information on how to set up extension services to activate additional functionality in your Artemis instance, see
:ref:`their respective documentation <extensions_setup>`.

We recommend using the `Artemis Ansible Collection <https://github.com/ls1intum/artemis-ansible-collection>`_ for
setting up Artemis in production. The collection provides a set of Ansible roles that automate the setup of Artemis,
including the required external system with sane configuration defaults.

.. toctree::
:includehidden:
:maxdepth: 2
Expand Down
52 changes: 24 additions & 28 deletions docs/admin/setup/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,45 +126,41 @@ For Artemis to find the key set `artemis.version-control.ssh-host-key-path` to t
Adapting Nginx to Enable SSH Routing
""""""""""""""""""""""""""""""""""""

To enable SSH routing through Nginx, you can set up an SSH proxy. However, Nginx by itself does
not support SSH, but you can use Nginx to reverse proxy an SSH service (e.g., using sslh to multiplex SSH and HTTPS).
To enable SSH routing through Nginx, you can set up an SSH proxy.

Configure sslh to listen on port 443 (to handle both HTTPS and SSH), by editing the sslh configuration
file (e.g., /etc/default/sslh):

.. code-block:: text
RUN=yes
DAEMON=/usr/sbin/sslh
DAEMON_OPTS="--user sslh --listen 0.0.0.0:443 --ssh 127.0.0.1:22 --ssl 127.0.0.1:8443"
Configure Nginx to proxy HTTPS traffic, by adapting the configuration file to listen on port 8443 for HTTPS:
Configure Nginx to proxy HTTPS traffic on port 443 and SSH traffic on port 7921.

.. code-block:: nginx
server {
listen 8443 ssl;
server_name yourdomain.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
http {
server {
listen 443 ssl;
server_name yourdomain.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
stream {
server {
listen 7921;
proxy_pass 127.0.0.1:7921;
}
}
Restart sslh and Nginx:
Restart Nginx:

.. code-block:: bash
sudo systemctl restart sslh
sudo systemctl restart nginx
By following these steps, you ensure that your key pairs are properly generated and distributed across all
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ following dependencies/tools on your machine:
2. `MySQL Database Server 9 <https://dev.mysql.com/downloads/mysql>`__, or `PostgreSQL 17 <https://www.postgresql.org/>`_:
Artemis uses Hibernate to store entities in an SQL database and Liquibase to
automatically apply schema transformations when updating Artemis.
3. `Node.js <https://nodejs.org/en/download>`__: We use Node LTS (>=20.16.0 < 21) to compile
3. `Node.js <https://nodejs.org/en/download>`__: We use Node LTS (>=22.10.0 < 23) to compile
and run the client Angular application. Depending on your system, you
can install Node either from source or as a pre-packaged bundle.
4. `Npm <https://nodejs.org/en/download>`__: We use Npm (>=10.8.0) to
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rootProject.name=Artemis
profile=dev

# Build properties
node_version=20.16.0
node_version=22.10.0
npm_version=10.8.0

# Dependency versions
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"weak-napi": "2.0.2"
},
"engines": {
"node": ">=20.16.0"
"node": ">=22.10.0"
},
"scripts": {
"build": "npm run webapp:prod --",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/**
* Enum to define the different reasons why the confidence is above/below 1 in the {@link CompetencyProgress}.
* A confidence != 1 leads to a higher/lower mastery, which is displayed to the student together with the reason.
* Also see {@link CompetencyProgress#setConfidenceReason}.
* Also see {@link de.tum.cit.aet.artemis.atlas.service.competency.CompetencyProgressService#setConfidenceReason}.
*/
public enum CompetencyProgressConfidenceReason {
NO_REASON, RECENT_SCORES_LOWER, RECENT_SCORES_HIGHER, MORE_EASY_POINTS, MORE_HARD_POINTS, QUICKLY_SOLVED_EXERCISES
NO_REASON, RECENT_SCORES_LOWER, RECENT_SCORES_HIGHER, MORE_EASY_POINTS, MORE_HARD_POINTS, QUICKLY_SOLVED_EXERCISES, MORE_LOW_WEIGHTED_EXERCISES, MORE_HIGH_WEIGHTED_EXERCISES
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
import de.tum.cit.aet.artemis.exercise.domain.DifficultyLevel;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record CompetencyExerciseMasteryCalculationDTO(double maxPoints, DifficultyLevel difficulty, boolean isProgrammingExercise, Double lastScore, Double lastPoints,
Instant lastModifiedDate, long submissionCount) {
public record CompetencyExerciseMasteryCalculationDTO(long exerciseId, double maxPoints, DifficultyLevel difficulty, boolean isProgrammingExercise, double competencyLinkWeight,
Double lastScore, Double lastPoints, Instant lastModifiedDate, long submissionCount) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.tum.cit.aet.artemis.atlas.dto.metrics;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record CompetencyLectureUnitMasteryCalculationDTO(long lectureUnitId, boolean completed, double competencyLinkWeight) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import de.tum.cit.aet.artemis.atlas.domain.LearningObject;
import de.tum.cit.aet.artemis.atlas.domain.competency.CourseCompetency;
import de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyExerciseMasteryCalculationDTO;
import de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyLectureUnitMasteryCalculationDTO;
import de.tum.cit.aet.artemis.core.domain.User;
import de.tum.cit.aet.artemis.core.repository.base.ArtemisJpaRepository;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
Expand Down Expand Up @@ -106,9 +107,11 @@ default CourseCompetency findByIdWithExercisesAndLectureUnitsAndLecturesElseThro
*/
@Query("""
SELECT new de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyExerciseMasteryCalculationDTO(
e.id,
e.maxPoints,
e.difficulty,
CASE WHEN TYPE(e) = ProgrammingExercise THEN TRUE ELSE FALSE END,
el.weight,
COALESCE(sS.lastScore, tS.lastScore),
COALESCE(sS.lastPoints, tS.lastPoints),
COALESCE(sS.lastModifiedDate, tS.lastModifiedDate),
Expand All @@ -123,9 +126,34 @@ CASE WHEN TYPE(e) = ProgrammingExercise THEN TRUE ELSE FALSE END,
LEFT JOIN TeamScore tS ON tS.exercise = e AND :user MEMBER OF tS.team.students
WHERE c.id = :competencyId
AND e IS NOT NULL
GROUP BY e.maxPoints, e.difficulty, TYPE(e), sS.lastScore, tS.lastScore, sS.lastPoints, tS.lastPoints, sS.lastModifiedDate, tS.lastModifiedDate
GROUP BY e.id, e.maxPoints, e.difficulty, TYPE(e), sS.lastScore, tS.lastScore, sS.lastPoints, tS.lastPoints, sS.lastModifiedDate, tS.lastModifiedDate
""")
Set<CompetencyExerciseMasteryCalculationDTO> findAllExerciseInfoByCompetencyId(@Param("competencyId") long competencyId, @Param("user") User user);
Set<CompetencyExerciseMasteryCalculationDTO> findAllExerciseInfoByCompetencyIdAndUser(@Param("competencyId") long competencyId, @Param("user") User user);

/**
* Fetches all information related to the calculation of the mastery for lecture units in a competency.
* The complex grouping by is necessary for postgres
*
* @param competencyId the id of the competency for which to fetch the lecture unit information
* @param user the user for which to fetch the lecture unit information
* @return the lecture unit information for the calculation of the mastery in the competency
*/
@Query("""
SELECT new de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyLectureUnitMasteryCalculationDTO(
lu.id,
CASE WHEN u IS NOT NULL THEN TRUE ELSE FALSE END,
lul.weight
)
FROM CourseCompetency c
LEFT JOIN c.lectureUnitLinks lul
LEFT JOIN lul.lectureUnit lu
LEFT JOIN lu.completedUsers cu
LEFT JOIN cu.user u ON u = :user
WHERE c.id = :competencyId
AND lu IS NOT NULL
GROUP BY lu.id, u, lul.weight, u
""")
Set<CompetencyLectureUnitMasteryCalculationDTO> findAllLectureUnitInfoByCompetencyIdAndUser(@Param("competencyId") long competencyId, @Param("user") User user);

@Query("""
SELECT c
Expand Down
Loading

0 comments on commit b9286b1

Please sign in to comment.