|
42 | 42 | fi
|
43 | 43 |
|
44 | 44 | # Generate secrets
|
45 |
| -if [[ -f etc/gen_all_secrets ]] |
46 |
| -then |
47 |
| - # DOMjudge >= 7.2.1 |
48 |
| - (cd etc && ./gen_all_secrets) |
49 |
| - # (Note: running 'etc/gen_all_secrets' does not work before commit DOMjudge/domjudge@9bac55144600) |
50 |
| -elif [[ -f webapp/config/load_db_secrets.php ]] |
51 |
| -then |
52 |
| - # DOMjudge 7.2.0 |
53 |
| - # This version does not install gen_all_secrets and gensymfonysecret, so we have to inline them here (fixed in commit DOMjudge/domjudge@d523a965f8e0) |
54 |
| - if [[ ! -f etc/restapi.secret ]]; then |
55 |
| - etc/genrestapicredentials | (umask 077 && cat > etc/restapi.secret) |
56 |
| - fi |
57 |
| - if [[ ! -f etc/initial_admin_password.secret ]]; then |
58 |
| - etc/genadminpassword | (umask 077 && cat > etc/initial_admin_password.secret) |
59 |
| - fi |
60 |
| - if [[ ! -f etc/symfony_app.secret ]]; then |
61 |
| - { |
62 |
| - # From etc/gensymfonysecret |
63 |
| - head -c20 /dev/urandom | base64 | head -c20 | tr '/+' 'Aa' |
64 |
| - echo |
65 |
| - } | (umask 077 && cat > etc/symfony_app.secret) |
66 |
| - fi |
67 |
| -else |
68 |
| - # DOMjudge 7.1 |
69 |
| - if [[ ! -f etc/restapi.secret ]]; then |
70 |
| - etc/genrestapicredentials | (umask 077 && cat > etc/restapi.secret) |
71 |
| - fi |
72 |
| - if [[ ! -f etc/initial_admin_password.secret ]]; then |
73 |
| - etc/genadminpassword | (umask 077 && cat > etc/initial_admin_password.secret) |
74 |
| - fi |
75 |
| - # This version needs the database settings and app secret to be in webapp/.env.local |
76 |
| - # It is generated using etc/gensymfonyenv on DOMjudge 7.1, but that script is not installed so we inline it here |
77 |
| - if [[ ! -f webapp/.env.local ]]; then |
78 |
| - { |
79 |
| - SECRET=$(head -c20 /dev/urandom | base64 | head -c20 | tr '/+' 'Aa') |
80 |
| - echo "# Generated on $(hostname), $(date)." |
81 |
| - echo |
82 |
| - echo "# Uncomment the following line to run the application in development mode" |
83 |
| - echo "#APP_ENV=dev" |
84 |
| - echo "APP_SECRET=$SECRET" |
85 |
| - echo "DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}" |
86 |
| - } | (umask 077 && cat > webapp/.env.local) |
87 |
| - fi |
88 |
| -fi |
| 45 | +(cd etc && ./gen_all_secrets) |
| 46 | +# (Note: running 'etc/gen_all_secrets' does not work before commit DOMjudge/domjudge@9bac55144600) |
89 | 47 |
|
90 | 48 | # Add the Docker gateway as a trusted proxy
|
91 | 49 | if grep -q TRUSTED_PROXIES webapp/.env.local > /dev/null 2>&1
|
@@ -163,20 +121,6 @@ done
|
163 | 121 | echo "real_ip_header X-Forwarded-For;" >> ${NGINX_CONFIG_FILE}
|
164 | 122 | echo "real_ip_recursive on;" >> ${NGINX_CONFIG_FILE}
|
165 | 123 |
|
166 |
| -if [[ ! -f webapp/config/load_db_secrets.php ]] |
167 |
| -then |
168 |
| - # DOMjudge 7.1 dumps the environment into webapp/.env.local.php for improved speed |
169 |
| - # We also do that here (with some additional setup to get composer to work) |
170 |
| - echo '{"config": {"vendor-dir": "lib/vendor"}, "extra": {"symfony": {"root-dir": "webapp/"}}}' > composer.json |
171 |
| - touch webapp/.env |
172 |
| - composer symfony:dump-env prod |
173 |
| - rm composer.json |
174 |
| - if [[ ! -s webapp/.env ]]; then |
175 |
| - rm webapp/.env |
176 |
| - fi |
177 |
| - chmod og= webapp/.env.local.php |
178 |
| -fi |
179 |
| - |
180 | 124 | # Set up permissions
|
181 | 125 | chown -R www-data: webapp/public/images
|
182 | 126 | chown www-data: etc/dbpasswords.secret
|
|
0 commit comments