From 9480d38ca43e5e084db073606ced315b2c8095bc Mon Sep 17 00:00:00 2001 From: Yi-Ting Shih Date: Mon, 7 Apr 2025 00:06:41 +0800 Subject: [PATCH] Feat(judgehost): test legacy with debian11 --- README.md | 13 ++++++++++++- group_vars/judgehost/main.yml | 3 +++ hosts | 2 +- playbooks/judgehost.yml | 4 ++-- roles/configure_judgehost/tasks/main.yml | 6 +----- .../tasks/domjudge.yml | 13 +++++++++++++ roles/install_packages_debian11/tasks/main.yml | 18 ++++++++++++++++++ 7 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 roles/configure_judgehost_legacy/tasks/domjudge.yml create mode 100644 roles/install_packages_debian11/tasks/main.yml diff --git a/README.md b/README.md index d2facfb..8bed580 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,20 @@ ## Usage +0. Install Arch Linux for domserver and **Debian 11** for judgehost. 1. Fill in the vars in `group_vars`. -2. Fill in `domserver` and `judgehost` machine ips in `hosts` file. +2. Fill in `domserver` and `judgehost` groups in `hosts` file. 3. Run `ansible-playbook playbooks/domserver`. 4. Run `ansible-playbook playbooks/judgehost`. 5. Put web cert and key to `/etc/haproxy/cert.pem` on domserver. 6. Check if judgehost been registered. + +## Trouble shooting + +### Judgehost cannot startup + +The cgroups v2 support had been patched since October, 2024. However the latest +release of domjudge is 8.3.1, which was published on September, 2024. + +Therefore, before cgroups v2 patch came out as a stable release, we still have +to use a older release, like Debian 11, to make things work. diff --git a/group_vars/judgehost/main.yml b/group_vars/judgehost/main.yml index 46b5e91..9ebb15a 100644 --- a/group_vars/judgehost/main.yml +++ b/group_vars/judgehost/main.yml @@ -1,2 +1,5 @@ --- judgehost_version: 8.3.1 + +# For legacy support +domjudge_tarball_url: https://www.domjudge.org/releases/domjudge-8.3.1.tar.gz diff --git a/hosts b/hosts index b7e6d42..8ee69cf 100644 --- a/hosts +++ b/hosts @@ -10,4 +10,4 @@ localhost ansible_connection=local 10.4.2.228 [all:vars] -ansible_python_interpreter=/usr/bin/python +ansible_python_interpreter=/usr/bin/python3 diff --git a/playbooks/judgehost.yml b/playbooks/judgehost.yml index 855b997..50ab8aa 100644 --- a/playbooks/judgehost.yml +++ b/playbooks/judgehost.yml @@ -2,5 +2,5 @@ - name: Install judgehost hosts: judgehost roles: - - role: install_packages - - role: configure_judgehost + - role: install_packages_debian11 + - role: configure_judgehost_legacy diff --git a/roles/configure_judgehost/tasks/main.yml b/roles/configure_judgehost/tasks/main.yml index 092a9f4..ed724a1 100644 --- a/roles/configure_judgehost/tasks/main.yml +++ b/roles/configure_judgehost/tasks/main.yml @@ -3,11 +3,7 @@ ansible.builtin.lineinfile: path: /boot/loader/entries/arch.conf line: >- - options - cgroup_enable=memory - swapaccount=1 - SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1 - systemd.unified_cgroup_hierarchy=0 + options cgroup_enable=memory notify: Reboot - name: Flush handlers ansible.builtin.meta: flush_handlers diff --git a/roles/configure_judgehost_legacy/tasks/domjudge.yml b/roles/configure_judgehost_legacy/tasks/domjudge.yml new file mode 100644 index 0000000..3fd959a --- /dev/null +++ b/roles/configure_judgehost_legacy/tasks/domjudge.yml @@ -0,0 +1,13 @@ +- name: Download domjudge tarball + ansible.builtin.get_url: + url: "{{ domjudge_tarball_url }}" + dest: /opt/ + mode: '0644' + owner: root + group: root + register: downloaded_tarball +- name: Extract domjudge tarball + ansible.builtin.unarchive: + src: "{{ downloaded_tarball.dest }}" + dest: "{{ (downloaded_tarball.dest | basename).split('.') | first }}" + remote_src: true diff --git a/roles/install_packages_debian11/tasks/main.yml b/roles/install_packages_debian11/tasks/main.yml new file mode 100644 index 0000000..ed80e83 --- /dev/null +++ b/roles/install_packages_debian11/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: Install packages + ansible.builtin.apt: + pkg: + - make + - pkg-config + - sudo + - debootstrap + - libcgroup-dev + - php-cli + - php-curl + - php-json + - php-xml + - php-zip + - lsof + - procps + - gcc + - g++