diff --git a/.gitignore b/.gitignore index 4285565..cb1afed 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ src .ruby-version .bundle +docker-compose/.env \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 796b859..6cd51ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,23 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased](https://github.com/passbolt/passbolt_docker/compare/v3.7.3...HEAD) +## [Unreleased](https://github.com/passbolt/passbolt_docker/compare/v3.7.5...HEAD) + +## [3.7.5](https://github.com/passbolt/passbolt_docker/compare/v3.7.4...v3.7.5) - 2022-12-01 + +### Added + +- Improved logging for cron tasks + +## [3.7.4](https://github.com/passbolt/passbolt_docker/compare/v3.7.3...v3.7.4) - 2022-11-17 + +### Added + +- Directory sync commands on docker-compose pro + +### Fixed + +- Multiple merge request from community. Thanks a lot to all of you who contributed! ## [3.7.3](https://github.com/passbolt/passbolt_docker/compare/v3.0.2...v3.7.3) - 2022-11-04 @@ -15,7 +31,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add new subscription file machinery - Add pro dependencies -### Changed +### Changed - Default key length from 2048 to 3072 - Bump php version to 8 on dev Dockerfile - PB-14373 fix composer files diff --git a/debian/Dockerfile b/debian/Dockerfile index 45b2c36..9988673 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -35,13 +35,12 @@ RUN apt-get update \ && sed -i '/listen \[\:\:\]\:443 ssl http2;/a listen 443 ssl http2;' /etc/nginx/snippets/passbolt-ssl.conf \ && sed -i 's,__CERT_PATH__,/etc/ssl/certs/certificate.crt;,' /etc/nginx/snippets/passbolt-ssl.conf \ && sed -i 's,__KEY_PATH__,/etc/ssl/certs/certificate.key;,' /etc/nginx/snippets/passbolt-ssl.conf \ - && sed -i 's,www-data.*$,www-data exec /bin/bash -c ". /etc/environment \&\& $PASSBOLT_BASE_DIR/bin/cron",' /etc/cron.d/$PASSBOLT_PKG \ + && sed -i 's,www-data.*$,root su -s /bin/bash -c ". /etc/environment \&\& $PASSBOLT_BASE_DIR/bin/cron" www-data >/proc/1/fd/1 2>\&1,' /etc/cron.d/$PASSBOLT_PKG \ && sed -i 's/# server_tokens/server_tokens/' /etc/nginx/nginx.conf \ && ln -sf /dev/stdout /var/log/nginx/passbolt-access.log \ && ln -sf /dev/stderr /var/log/nginx/passbolt-error.log \ && ln -sf /dev/stderr /var/log/passbolt/error.log \ - && ln -sf /dev/stderr /var/log/php$PHP_VERSION-fpm.log \ - && crontab /etc/cron.d/$PASSBOLT_PKG + && ln -sf /dev/stderr /var/log/php$PHP_VERSION-fpm.log COPY conf/supervisor/cron.conf /etc/supervisor/conf.d/cron.conf COPY conf/supervisor/nginx.conf /etc/supervisor/conf.d/nginx.conf diff --git a/dev/Dockerfile b/dev/Dockerfile index e3d78d7..c2bda24 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -1,3 +1,5 @@ +FROM composer:2.4 AS composer + FROM php:8-fpm LABEL maintainer="Passbolt SA " @@ -8,6 +10,7 @@ ARG PASSBOLT_CURL_HEADERS="" ARG PASSBOLT_FLAVOUR="ce" ARG PHP_EXTENSIONS="gd \ + zip \ intl \ pdo_mysql \ opcache \ @@ -24,6 +27,8 @@ ARG PASSBOLT_DEV_PACKAGES="libgpgme11-dev \ libicu-dev \ libxslt1-dev \ libmcrypt-dev \ + libzip-dev \ + zip \ unzip \ libldap2-dev" @@ -40,6 +45,9 @@ ENV PHP_EXT_DIR="/usr/src/php/ext" ENV PASSBOLT_FLAVOUR=$PASSBOLT_FLAVOUR WORKDIR /var/www/passbolt + +COPY --from=composer /usr/bin/composer /usr/bin/composer + RUN apt-get update \ && apt-get -y install --no-install-recommends \ $PASSBOLT_DEV_PACKAGES \ @@ -56,31 +64,18 @@ RUN apt-get update \ && docker-php-ext-install -j4 $PHP_EXTENSIONS $PECL_PASSBOLT_EXTENSIONS \ && docker-php-ext-enable $PHP_EXTENSIONS $PECL_PASSBOLT_EXTENSIONS \ && docker-php-source delete \ - && EXPECTED_SIGNATURE=$(curl -s https://composer.github.io/installer.sig) \ - && curl -o composer-setup.php https://getcomposer.org/installer \ - && ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');") \ - && if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then \ - >&2 echo 'ERROR: Invalid installer signature'; \ - rm composer-setup.php; \ - exit 1; \ - fi \ - && php composer-setup.php \ - && mv composer.phar /usr/local/bin/composer \ - && rm composer-setup.php \ && curl -sSL -H "$PASSBOLT_CURL_HEADERS" "$PASSBOLT_URL" | tar zxf - -C . --strip-components 1 \ - && composer install -n --no-dev --optimize-autoloader \ + && composer install --no-ansi --no-interaction \ && chown -R www-data:www-data . \ && chmod 775 $(find /var/www/passbolt/tmp -type d) \ && chmod 664 $(find /var/www/passbolt/tmp -type f) \ && chmod 775 $(find /var/www/passbolt/webroot/img/public -type d) \ && chmod 664 $(find /var/www/passbolt/webroot/img/public -type f) \ && rm /etc/nginx/sites-enabled/default \ - && apt-get purge -y --auto-remove $PASSBOLT_DEV_PACKAGES \ && rm -rf /var/lib/apt/lists/* \ - && rm /usr/local/bin/composer \ && echo 'php_flag[expose_php] = off' > /usr/local/etc/php-fpm.d/expose.conf \ && sed -i 's/# server_tokens/server_tokens/' /etc/nginx/nginx.conf \ - && mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ + && mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" \ && echo "* * * * * su -c \"source /etc/environment ; /var/www/passbolt/bin/cake EmailQueue.sender\" -s /bin/bash www-data >> /var/log/cron.log 2>&1" >> /etc/cron.d/passbolt_email \ && crontab /etc/cron.d/passbolt_email \ && ln -s $(which php-fpm) $(which php-fpm)7.3 diff --git a/docker-compose/.env.example b/docker-compose/.env.example new file mode 100644 index 0000000..6831184 --- /dev/null +++ b/docker-compose/.env.example @@ -0,0 +1 @@ +PASSBOLT_API_PATH="/path/to/passbolt_api" diff --git a/docker-compose/docker-compose-dev.yaml b/docker-compose/docker-compose-dev.yaml index 03f33a4..007456e 100644 --- a/docker-compose/docker-compose-dev.yaml +++ b/docker-compose/docker-compose-dev.yaml @@ -1,13 +1,16 @@ version: '3.9' + services: db: image: mariadb:10.3 + container_name: passbolt-db-dev env_file: - env/mysql.env volumes: + - ./mysql/init.sql:/docker-entrypoint-initdb.d/init.sql - database_volume:/var/lib/mysql ports: - - "127.0.0.1:3306:3306" + - "3306:3306" passbolt: build: @@ -15,12 +18,14 @@ services: dockerfile: dev/Dockerfile args: PECL_PASSBOLT_EXTENSIONS: "redis gnupg xdebug" + container_name: passbolt-app-dev depends_on: - db + - mailhog env_file: - env/passbolt.env volumes: - #- :/var/www/passbolt + - ${PASSBOLT_API_PATH}:/var/www/passbolt - gpg_volume:/var/www/passbolt/config/gpg - images_volume:/var/www/passbolt/webroot/img/public/images command: ["/usr/bin/wait-for.sh", "db:3306", "--", "/docker-entrypoint.sh"] @@ -28,6 +33,29 @@ services: - 80:80 - 443:443 + #################### + # Dev tools starts # + #################### + adminer: + image: adminer + container_name: passbolt-adminer-dev + restart: always + ports: + - "9501:8080" + depends_on: + - db + + mailhog: + image: mailhog/mailhog:latest + container_name: passbolt-mailhog-dev + restart: always + # Mailhog logs are noisy so not logging it + logging: + driver: none + ports: + - "1025:1025" # SMTP server + - "9502:8025" # Web UI + volumes: database_volume: gpg_volume: diff --git a/docker-compose/env/passbolt.env b/docker-compose/env/passbolt.env index 21be0fc..837765e 100644 --- a/docker-compose/env/passbolt.env +++ b/docker-compose/env/passbolt.env @@ -1,4 +1,4 @@ -# URL +DEBUG=true APP_FULL_BASE_URL=https://passbolt.local # Database settings @@ -8,6 +8,15 @@ DATASOURCES_DEFAULT_PASSWORD=P4ssb0lt DATASOURCES_DEFAULT_DATABASE=passbolt DATASOURCES_DEFAULT_PORT=3306 DATASOURCES_QUOTE_IDENTIFIER=true +# Test Database +DATASOURCES_TEST_HOST=db +DATASOURCES_TEST_USERNAME=passbolt +DATASOURCES_TEST_PASSWORD=P4ssb0lt +DATASOURCES_TEST_DATABASE=test_passbolt +DATASOURCES_TEST_PORT=3306 # Registration PASSBOLT_REGISTRATION_PUBLIC=false + +# Email settings +EMAIL_TRANSPORT_DEFAULT_URL="smtp://:@mailhog:1025" diff --git a/docker-compose/mysql/init.sql b/docker-compose/mysql/init.sql new file mode 100644 index 0000000..519e257 --- /dev/null +++ b/docker-compose/mysql/init.sql @@ -0,0 +1,3 @@ +CREATE DATABASE IF NOT EXISTS `test_passbolt`; +GRANT ALL PRIVILEGES ON test_passbolt.* TO 'passbolt'@'%'; +FLUSH PRIVILEGES;