diff --git a/.env.example.docker-development b/.env.example.docker-development deleted file mode 100644 index 0f5f193db..000000000 --- a/.env.example.docker-development +++ /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 diff --git a/app/Config/database.php b/app/Config/database.php index 98063942d..93a44854f 100644 --- a/app/Config/database.php +++ b/app/Config/database.php @@ -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 index 52386691e..000000000 --- a/database/seeds/DummyContentSeeder.php +++ /dev/null @@ -1,61 +0,0 @@ -name = 'Admin User'; - $adminUser->email = 'admin@test.local'; - $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(); - } -} diff --git a/docker-compose.yml b/docker-compose.yml index 63aa2b0c7..26f783cb6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/readme.md b/readme.md index ede6e5aa5..9587529da 100644 --- 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 `admin@test.local` and `admin` as password on `localhost:8080` (or another port if specified) +6. You can now login with `admin@admin.com` and `password` as password on `localhost:8080` (or another port if specified) ## Translations