]> BookStack Code Mirror - bookstack/commitdiff
Updated dev-docker setup to not alter phpunit.xml
authorDan Brown <redacted>
Sun, 21 Mar 2021 17:42:10 +0000 (17:42 +0000)
committerDan Brown <redacted>
Sun, 21 Mar 2021 17:42:10 +0000 (17:42 +0000)
Tested on my machine via fresh dev instance with tests passing.
May need old users to drop their old volume data.

app/Config/database.php
dev/docker/Dockerfile
dev/docker/entrypoint.app.sh
docker-compose.yml
readme.md

index 6e7cf529cf7527133c1ebd0d832addac0b68fe65..170666ddba86465e0b0a8a66b972116eab52b524 100644 (file)
@@ -81,7 +81,7 @@ return [
         'mysql_testing' => [
             'driver'    => 'mysql',
             'url' => env('TEST_DATABASE_URL'),
         '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'),
             'database'  => 'bookstack-test',
             'username'  => env('MYSQL_USER', 'bookstack-test'),
             'password'  => env('MYSQL_PASSWORD', 'bookstack-test'),
index b55ec9e0a6c30d5920a0cf525b78a6bf8a675da9..895ad595ae7b73cf4077a76bf717092c5146a2ff 100644 (file)
@@ -3,14 +3,21 @@ FROM php:7.4-apache
 ENV APACHE_DOCUMENT_ROOT /app/public
 WORKDIR /app
 
 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 \
 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');"
     && 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
index 9709139ab4a9606c660bc4ea3d7509f154b67364..e91d34a713377a7e579a6594000c01fb5c98ba57 100755 (executable)
@@ -10,7 +10,6 @@ else
     composer install
     wait-for-it db:3306 -t 45
     php artisan migrate --database=mysql
     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
     chown -R www-data:www-data storage
     exec apache2-foreground
 fi
index 037c5f67eb5baf14bd5c764cf6b9592335786445..7920258944694e6b0d1af757ba9fd3bef5b45e57 100644 (file)
@@ -23,12 +23,14 @@ services:
       context: .
       dockerfile: ./dev/docker/Dockerfile
     environment:
       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
       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
       MAIL_DRIVER: smtp
       MAIL_HOST: mailhog
       MAIL_PORT: 1025
index a039b108cb86c46a5d6d5da93c5e1cf63f9c426d..eb98ae6d47dc819cd2de34547b8e885e2b599456 100644 (file)
--- 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:
 
 
 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
 ```
 
 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
 
 
 #### 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
 ```
 
 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
 ```
 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.
 ## ðŸŒŽ 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.