]> BookStack Code Mirror - bookstack/commitdiff
Remove additional database connections and seeders in docker env
authorTimo Schwarzer <redacted>
Mon, 12 Aug 2019 14:59:51 +0000 (16:59 +0200)
committerTimo Schwarzer <redacted>
Mon, 12 Aug 2019 14:59:51 +0000 (16:59 +0200)
.env.example.docker-development [deleted file]
app/Config/database.php
database/seeds/DummyContentSeeder.php [deleted file]
docker-compose.yml
readme.md

diff --git a/.env.example.docker-development b/.env.example.docker-development
deleted file mode 100644 (file)
index 0f5f193..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# Application key
-# Used for encryption where needed.
-# Run `php artisan key:generate` to generate a valid key.
-APP_KEY=SomeRandomString
-DEV_PORT=8080
-APP_ENV=development
-APP_DEBUG=true
-
-# Application URL
-# Remove the hash below and set a URL if using BookStack behind
-# a proxy, if using a third-party authentication option.
-# This must be the root URL that you want to host BookStack on.
-# All URL's in BookStack will be generated using this value.
-#APP_URL=https://example.com
-
-# Database details
-DB_CONNECTION=mysql_docker_dev
-
-# Mail system to use
-# Can be 'smtp', 'mail' or 'sendmail'
-MAIL_DRIVER=smtp
-
-# SMTP mail options
-MAIL_HOST=localhost
-MAIL_PORT=1025
-MAIL_USERNAME=null
-MAIL_PASSWORD=null
-MAIL_ENCRYPTION=null
-
-
-# A full list of options can be found in the '.env.example.complete' file.
\ No newline at end of file
index 98063942d3d05950f560c13b0c93e3f5f236b008..93a44854f092a8d166b9ce994a41da9dacb67a99 100644 (file)
@@ -92,18 +92,6 @@ return [
             'strict'    => false,
         ],
 
-        'mysql_docker_dev' => [
-            'driver'    => 'mysql',
-            'host'      => 'db',
-            'database'  => 'bookstack-test',
-            'username'  => 'bookstack-test',
-            'password'  => 'bookstack-test',
-            'charset'   => 'utf8',
-            'collation' => 'utf8_unicode_ci',
-            'prefix'    => '',
-            'strict'    => false,
-        ],
-
         'pgsql' => [
             'driver'   => 'pgsql',
             'host'     => env('DB_HOST', 'localhost'),
diff --git a/database/seeds/DummyContentSeeder.php b/database/seeds/DummyContentSeeder.php
deleted file mode 100644 (file)
index 5238669..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-use Illuminate\Database\Seeder;
-
-class DummyContentSeeder extends Seeder
-{
-    /**
-     * Run the database seeds.
-     *
-     * @return void
-     */
-    public function run()
-    {
-        // Create admin user
-        $adminUser = new \BookStack\Auth\User();
-        $adminUser->name = 'Admin User';
-        $adminUser->email = '[email protected]';
-        $adminUser->password = Hash::make('admin');
-        $adminUser->email_confirmed = true;
-        $adminUser->setRememberToken(str_random(10));
-        $adminUser->save();
-        $adminRole = \BookStack\Auth\Role::getRole('admin');
-        $adminUser->attachRole($adminRole);
-
-        // Create an editor user
-        $editorUser = factory(\BookStack\Auth\User::class)->create();
-        $editorRole = \BookStack\Auth\Role::getRole('editor');
-        $editorUser->attachRole($editorRole);
-
-        // Create a viewer user
-        $viewerUser = factory(\BookStack\Auth\User::class)->create();
-        $role = \BookStack\Auth\Role::getRole('viewer');
-        $viewerUser->attachRole($role);
-
-        $byData = ['created_by' => $editorUser->id, 'updated_by' => $editorUser->id];
-
-        factory(\BookStack\Entities\Book::class, 5)->create($byData)
-            ->each(function($book) use ($editorUser, $byData) {
-                $chapters = factory(\BookStack\Entities\Chapter::class, 3)->create($byData)
-                    ->each(function($chapter) use ($editorUser, $book, $byData){
-                        $pages = factory(\BookStack\Entities\Page::class, 3)->make(array_merge($byData, ['book_id' => $book->id]));
-                        $chapter->pages()->saveMany($pages);
-                    });
-                $pages = factory(\BookStack\Entities\Page::class, 3)->make($byData);
-                $book->chapters()->saveMany($chapters);
-                $book->pages()->saveMany($pages);
-            });
-
-        $largeBook = factory(\BookStack\Entities\Book::class)->create(array_merge($byData, ['name' => 'Large book' . str_random(10)]));
-        $pages = factory(\BookStack\Entities\Page::class, 200)->make($byData);
-        $chapters = factory(\BookStack\Entities\Chapter::class, 50)->make($byData);
-        $largeBook->pages()->saveMany($pages);
-        $largeBook->chapters()->saveMany($chapters);
-
-        $shelves = factory(\BookStack\Entities\Bookshelf::class, 10)->create($byData);
-        $largeBook->shelves()->attach($shelves->pluck('id'));
-
-        app(\BookStack\Auth\Permissions\PermissionService::class)->buildJointPermissions();
-        app(\BookStack\Entities\SearchService::class)->indexAllEntities();
-    }
-}
index 63aa2b0c752aaafad9ac38256ffde7b207934625..26f783cb6986564ffd90d1144cfde4e73221e33f 100644 (file)
@@ -21,6 +21,13 @@ services:
     build:
       context: .
       dockerfile: docker/dev/Dockerfile
+    environment:
+      DB_CONNECTION: mysql
+      DB_HOST: db
+      DB_PORT: 3306
+      DB_DATABASE: bookstack-test
+      DB_USER: bookstack-test
+      DB_PASSWORD: bookstack-test
     ports:
       - ${DEV_PORT}:80
     volumes:
index ede6e5aa5b97afb8220f577b80823258523045cd..9587529daf79a4c161f00363286ec003acd8b57b 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -88,15 +88,11 @@ To get started, make sure you meet the following requirements:
 If all the conditions are met, you can proceed with the following steps:
 
 1. Install Composer dependencies with **`docker-compose run app composer install`** (first time can take a while because the image has to be built)
-2. **Copy `.env.example.docker-development` to `.env`** and change `APP_KEY` to a random 32 char string
+2. **Copy `.env.example` to `.env`** and change `APP_KEY` to a random 32 char string
 3. Make sure **port 8080 is unused** *or else* change `DEV_PORT` to a free port on your host
 4. **Run `chgrp -R docker storage`**. The development container will chown the `storage` directory to the `www-data` user inside the container so BookStack can write to it. You need to change the group to your host's `docker` group here to not lose access to the `storage` directory
 5. **Run `docker-compose up`** and wait until all database migrations have been done
-6. **If you're starting the server for the first time**, seed the database in a separate terminal session:
-   ```php
-   docker-compose exec app php artisan db:seed --class=DummyContentSeeder --database=mysql_docker_dev
-   ```
-7. You can now login with `[email protected]` and `admin` as password on `localhost:8080` (or another port if specified)
+6. You can now login with `[email protected]` and `password` as password on `localhost:8080` (or another port if specified)
 
 ## Translations