diff --git a/app/Config/database.php b/app/Config/database.php index 6e7cf529c..170666ddb 100644 --- a/app/Config/database.php +++ b/app/Config/database.php @@ -81,7 +81,7 @@ return [ 'mysql_testing' => [ 'driver' => 'mysql', 'url' => env('TEST_DATABASE_URL'), - 'host' => $mysql_host, + 'host' => '127.0.0.1', 'database' => 'bookstack-test', 'username' => env('MYSQL_USER', 'bookstack-test'), 'password' => env('MYSQL_PASSWORD', 'bookstack-test'), diff --git a/dev/docker/Dockerfile b/dev/docker/Dockerfile index b55ec9e0a..895ad595a 100644 --- a/dev/docker/Dockerfile +++ b/dev/docker/Dockerfile @@ -3,14 +3,21 @@ FROM php:7.4-apache ENV APACHE_DOCUMENT_ROOT /app/public WORKDIR /app +# Install additional dependacnies and configure apache RUN apt-get update -y \ && apt-get install -y git zip unzip libpng-dev libldap2-dev wait-for-it \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \ && docker-php-ext-install pdo_mysql gd ldap \ && a2enmod rewrite \ && sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \ - && sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \ - && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ + && sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf + +# Install composer +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ && php composer-setup.php \ && mv composer.phar /usr/bin/composer \ && php -r "unlink('composer-setup.php');" + +# Use the default production configuration and update it as required +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ + && sed -i 's/memory_limit = 128M/memory_limit = 512M/g' "$PHP_INI_DIR/php.ini" \ No newline at end of file diff --git a/dev/docker/entrypoint.app.sh b/dev/docker/entrypoint.app.sh index 9709139ab..e91d34a71 100755 --- a/dev/docker/entrypoint.app.sh +++ b/dev/docker/entrypoint.app.sh @@ -10,7 +10,6 @@ else composer install wait-for-it db:3306 -t 45 php artisan migrate --database=mysql - php artisan migrate --database=mysql_testing chown -R www-data:www-data storage exec apache2-foreground fi diff --git a/docker-compose.yml b/docker-compose.yml index 037c5f67e..792025894 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,12 +23,14 @@ services: context: . dockerfile: ./dev/docker/Dockerfile environment: + APP_URL: http://localhost:${DEV_PORT:-8080} DB_CONNECTION: mysql DB_HOST: db DB_PORT: 3306 DB_DATABASE: bookstack-dev DB_USERNAME: bookstack-test DB_PASSWORD: bookstack-test + TEST_DATABASE_URL: mysql://bookstack-test:bookstack-test@db/bookstack-test MAIL_DRIVER: smtp MAIL_HOST: mailhog MAIL_PORT: 1025 diff --git a/readme.md b/readme.md index a039b108c..eb98ae6d4 100644 --- a/readme.md +++ b/readme.md @@ -102,7 +102,7 @@ If all the conditions are met, you can proceed with the following steps: If needed, You'll be able to run any artisan commands via docker-compose like so: -```shell script +```bash docker-compose run app php artisan list ``` @@ -110,16 +110,20 @@ The docker-compose setup runs an instance of [MailHog](https://github.com/mailho #### Running tests -After starting the general development Docker, seed the testing database: - ```shell script -# this is to be done only once +After starting the general development Docker, migrate & seed the testing database: + + ```bash +# This only needs to be done once +docker-compose run app php artisan migrate --database=mysql_testing docker-compose run app php artisan db:seed --class=DummyContentSeeder --database=mysql_testing ``` -Once the database has been seeded, you can run the tests by: - ```shell script +Once the database has been migrated & seeded, you can run the tests like so: + + ```bash docker-compose run app php vendor/bin/phpunit ``` + ## 🌎 Translations Translations for text within BookStack is managed through the [BookStack project on Crowdin](https://crowdin.com/project/bookstack). Some strings have colon-prefixed variables in such as `:userName`. Leave these values as they are as they will be replaced at run-time. Crowdin is the preferred way to provide translations, otherwise the raw translations files can be found within the `resources/lang` path.