diff --git a/tools/docker-dev/build.sh b/tools/docker-dev/build.sh index 838470b0..4b9dc59b 100755 --- a/tools/docker-dev/build.sh +++ b/tools/docker-dev/build.sh @@ -1,7 +1,6 @@ #!/bin/bash - +set -e cd "$(dirname "$0")" - docker-compose down -docker-compose build --no-cache -docker image prune \ No newline at end of file +docker-compose build +docker image prune diff --git a/tools/docker-dev/docker-compose.yml b/tools/docker-dev/docker-compose.yml index 3db5e48d..7d0d426e 100644 --- a/tools/docker-dev/docker-compose.yml +++ b/tools/docker-dev/docker-compose.yml @@ -1,22 +1,25 @@ -version: "3.9" +networks: + default: + name: unity_dev_network services: identity: hostname: identity build: identity ports: - "8010:80" - web: - hostname: web - build: web - ports: - - "8000:80" - volumes: - - ../../:/var/www/unity-web-portal + - "389:389" + healthcheck: + test: ["CMD-SHELL", "if [ -f /tmp/up ]; then (nc -z localhost 389 && touch /tmp/up); else true; fi"] + interval: 1s sql: hostname: sql build: sql ports: - "8020:80" + - "3306:3306" + healthcheck: + test: ["CMD-SHELL", "if [ -f /tmp/up ]; then (nc -z localhost 3306 && touch /tmp/up); else true; fi"] + interval: 1s smtp: hostname: smtp image: schickling/mailcatcher @@ -24,7 +27,25 @@ services: - "8030:1080" redis: hostname: redis - image: redis -networks: - default: - name: unity_dev_network \ No newline at end of file + build: redis + ports: + - "6379:6379" + healthcheck: + test: ["CMD-SHELL", "if [ -f /tmp/up ]; then (nc -z localhost 6379 && touch /tmp/up); else true; fi"] + interval: 1s + web: + hostname: web + build: web + ports: + - "8000:80" + volumes: + - ../../:/var/www/unity-web-portal + depends_on: + identity: + condition: service_healthy + sql: + condition: service_healthy + smtp: + condition: service_started + redis: + condition: service_healthy diff --git a/tools/docker-dev/identity/Dockerfile b/tools/docker-dev/identity/Dockerfile index 794079f7..dbf22e40 100644 --- a/tools/docker-dev/identity/Dockerfile +++ b/tools/docker-dev/identity/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 # OpenLDAP Server ARG DEBIAN_FRONTEND=noninteractive @@ -6,7 +6,8 @@ RUN apt-get update && apt-get install -y \ slapd \ ldap-utils \ apache2 \ - phpldapadmin + phpldapadmin \ + netcat-openbsd RUN rm -rf /var/lib/ldap RUN mkdir /var/lib/ldap RUN chown openldap:openldap /var/lib/ldap @@ -32,8 +33,9 @@ COPY phpldapadmin-apache.conf /etc/apache2/sites-available/phpldapadmin.conf RUN a2dissite 000-default RUN a2ensite phpldapadmin RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf +RUN sed -i '/memory_limit/c\memory_limit = -1' /etc/php/8.3/apache2/php.ini EXPOSE 80 EXPOSE 389 -CMD apache2ctl -D FOREGROUND & slapd -h "ldap:/// ldapi:///" -u openldap -g openldap -d 0 \ No newline at end of file +CMD apache2ctl -D FOREGROUND & slapd -h "ldap:/// ldapi:///" -u openldap -g openldap -d 0 diff --git a/tools/docker-dev/redis/Dockerfile b/tools/docker-dev/redis/Dockerfile new file mode 100644 index 00000000..a45f7196 --- /dev/null +++ b/tools/docker-dev/redis/Dockerfile @@ -0,0 +1,4 @@ +FROM redis + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y netcat-openbsd diff --git a/tools/docker-dev/run.sh b/tools/docker-dev/run.sh index 1f6a3363..9c673941 100755 --- a/tools/docker-dev/run.sh +++ b/tools/docker-dev/run.sh @@ -1,5 +1,4 @@ #!/bin/bash - +set -e cd "$(dirname "$0")" - -docker-compose up \ No newline at end of file +docker-compose up diff --git a/tools/docker-dev/sql/Dockerfile b/tools/docker-dev/sql/Dockerfile index e000bde8..355fe1ae 100644 --- a/tools/docker-dev/sql/Dockerfile +++ b/tools/docker-dev/sql/Dockerfile @@ -1,15 +1,17 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ mariadb-server \ mariadb-client \ apache2 \ - phpmyadmin + php8.3 \ + phpmyadmin \ + netcat-openbsd RUN sed -i '/bind-address/c\bind-address = 0.0.0.0' /etc/mysql/mariadb.conf.d/50-server.cnf COPY bootstrap.sql /tmp/bootstrap.sql -RUN service mysql start; \ +RUN service mariadb start; \ mariadb -e "CREATE DATABASE unity"; \ mariadb -e "CREATE USER 'unity'@'%' IDENTIFIED BY 'password'"; \ mariadb -e "GRANT ALL PRIVILEGES ON unity.* TO 'unity'@'%'"; \ @@ -28,4 +30,4 @@ RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf EXPOSE 80 EXPOSE 3306 -CMD apache2ctl -D FOREGROUND & mysqld \ No newline at end of file +CMD apache2ctl -D FOREGROUND & mysqld --user=root diff --git a/tools/docker-dev/web/Dockerfile b/tools/docker-dev/web/Dockerfile index 5f171085..dc95aa98 100644 --- a/tools/docker-dev/web/Dockerfile +++ b/tools/docker-dev/web/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 # Web Server Setup ARG DEBIAN_FRONTEND=noninteractive @@ -12,16 +12,22 @@ RUN apt-get update && apt-get install -y \ php-ldap \ php-pdo \ php-redis \ - php-cli + php-cli \ + php-mbstring \ + php-xml COPY htpasswd /etc/apache2/.htpasswd +RUN chown www-data /etc/apache2/.htpasswd COPY unity-apache.conf /etc/apache2/sites-available/unity.conf RUN a2dissite 000-default RUN a2ensite unity RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf -RUN sed -i '/display_errors/c\display_errors = on' /etc/php/7.4/apache2/php.ini +RUN sed -i '/display_errors/c\display_errors = on' /etc/php/8.3/apache2/php.ini +RUN sed -i '/zend.assertions/c\zend.assertions = 1' /etc/php/8.3/apache2/php.ini +RUN sed -i '/zend.assertions/c\zend.assertions = 1' /etc/php/8.3/cli/php.ini +RUN sed -i '/memory_limit/c\memory_limit = -1' /etc/php/8.3/apache2/php.ini # Start apache2 server EXPOSE 80 -CMD ["apache2ctl", "-D", "FOREGROUND"] +CMD ["bash", "-c", "pushd /var/www/unity-web-portal/workers >/dev/null && echo 'updating LDAP cache...' && php ./update-ldap-cache.php && popd >/dev/null && apache2ctl -D FOREGROUND"]