From 716caf845993005b276179e53414008b2929b078 Mon Sep 17 00:00:00 2001 From: Michael Vasseur Date: Sun, 4 Aug 2024 12:03:44 +0200 Subject: [PATCH] Drop support for building containers DOMjudge <8.0 We assume PHP8 already in the scripts, so I suspect this did not work anymore. When someone wants such an older version they can still check the history for the current files and alter the setup from there. --- docker/domserver/build.sh | 10 ---- docker/domserver/configure.sh | 5 -- .../domserver/scripts/start.d/50-domjudge.sh | 60 +------------------ 3 files changed, 2 insertions(+), 73 deletions(-) diff --git a/docker/domserver/build.sh b/docker/domserver/build.sh index 4ab23958..6c6bdd0b 100755 --- a/docker/domserver/build.sh +++ b/docker/domserver/build.sh @@ -11,22 +11,12 @@ sudo -u domjudge ./configure -with-baseurl=http://dj.chipcie.ch.tudelft.nl/ # Passwords should not be included in the built image. We create empty files here to prevent passwords from being generated. sudo -u domjudge touch etc/dbpasswords.secret etc/restapi.secret etc/symfony_app.secret etc/initial_admin_password.secret -if [ ! -f webapp/config/load_db_secrets.php ] -then - # DOMjudge 7.1 - sudo -u domjudge touch webapp/.env.local webapp/.env.local.php -fi sudo -u domjudge make domserver make install-domserver # Remove installed password files rm /opt/domjudge/domserver/etc/*.secret -if [ ! -f webapp/config/load_db_secrets.php ] -then - # DOMjudge 7.1 - rm /opt/domjudge/domserver/webapp/.env.local /opt/domjudge/domserver/webapp/.env.local.php -fi sudo -u domjudge sh -c '. /venv/bin/activate && make docs' make install-docs diff --git a/docker/domserver/configure.sh b/docker/domserver/configure.sh index 5bd82143..26c12412 100644 --- a/docker/domserver/configure.sh +++ b/docker/domserver/configure.sh @@ -5,11 +5,6 @@ useradd -m domjudge mkdir -p /run/php chown -R domjudge: /opt/domjudge chown -R www-data: /opt/domjudge/domserver/tmp -# for DOMjudge <= 7.2 (submitdir was removed in commit DOMjudge/domjudge@d66725038) -if [ -d /opt/domjudge/domserver/submissions ] -then - chown -R www-data: /opt/domjudge/domserver/submissions -fi chmod 755 /scripts/start.sh for script in /scripts/bin/* diff --git a/docker/domserver/scripts/start.d/50-domjudge.sh b/docker/domserver/scripts/start.d/50-domjudge.sh index dce582ad..64213e72 100755 --- a/docker/domserver/scripts/start.d/50-domjudge.sh +++ b/docker/domserver/scripts/start.d/50-domjudge.sh @@ -42,50 +42,8 @@ else fi # Generate secrets -if [[ -f etc/gen_all_secrets ]] -then - # DOMjudge >= 7.2.1 - (cd etc && ./gen_all_secrets) - # (Note: running 'etc/gen_all_secrets' does not work before commit DOMjudge/domjudge@9bac55144600) -elif [[ -f webapp/config/load_db_secrets.php ]] -then - # DOMjudge 7.2.0 - # This version does not install gen_all_secrets and gensymfonysecret, so we have to inline them here (fixed in commit DOMjudge/domjudge@d523a965f8e0) - if [[ ! -f etc/restapi.secret ]]; then - etc/genrestapicredentials | (umask 077 && cat > etc/restapi.secret) - fi - if [[ ! -f etc/initial_admin_password.secret ]]; then - etc/genadminpassword | (umask 077 && cat > etc/initial_admin_password.secret) - fi - if [[ ! -f etc/symfony_app.secret ]]; then - { - # From etc/gensymfonysecret - head -c20 /dev/urandom | base64 | head -c20 | tr '/+' 'Aa' - echo - } | (umask 077 && cat > etc/symfony_app.secret) - fi -else - # DOMjudge 7.1 - if [[ ! -f etc/restapi.secret ]]; then - etc/genrestapicredentials | (umask 077 && cat > etc/restapi.secret) - fi - if [[ ! -f etc/initial_admin_password.secret ]]; then - etc/genadminpassword | (umask 077 && cat > etc/initial_admin_password.secret) - fi - # This version needs the database settings and app secret to be in webapp/.env.local - # It is generated using etc/gensymfonyenv on DOMjudge 7.1, but that script is not installed so we inline it here - if [[ ! -f webapp/.env.local ]]; then - { - SECRET=$(head -c20 /dev/urandom | base64 | head -c20 | tr '/+' 'Aa') - echo "# Generated on $(hostname), $(date)." - echo - echo "# Uncomment the following line to run the application in development mode" - echo "#APP_ENV=dev" - echo "APP_SECRET=$SECRET" - echo "DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}" - } | (umask 077 && cat > webapp/.env.local) - fi -fi +(cd etc && ./gen_all_secrets) +# (Note: running 'etc/gen_all_secrets' does not work before commit DOMjudge/domjudge@9bac55144600) # Add the Docker gateway as a trusted proxy if grep -q TRUSTED_PROXIES webapp/.env.local > /dev/null 2>&1 @@ -163,20 +121,6 @@ done echo "real_ip_header X-Forwarded-For;" >> ${NGINX_CONFIG_FILE} echo "real_ip_recursive on;" >> ${NGINX_CONFIG_FILE} -if [[ ! -f webapp/config/load_db_secrets.php ]] -then - # DOMjudge 7.1 dumps the environment into webapp/.env.local.php for improved speed - # We also do that here (with some additional setup to get composer to work) - echo '{"config": {"vendor-dir": "lib/vendor"}, "extra": {"symfony": {"root-dir": "webapp/"}}}' > composer.json - touch webapp/.env - composer symfony:dump-env prod - rm composer.json - if [[ ! -s webapp/.env ]]; then - rm webapp/.env - fi - chmod og= webapp/.env.local.php -fi - # Set up permissions chown -R www-data: webapp/public/images chown www-data: etc/dbpasswords.secret