Skip to content

Commit 6dd89ba

Browse files
committed
Split out some development-specific readme parts to own pages
1 parent bf56254 commit 6dd89ba

File tree

3 files changed

+125
-111
lines changed

3 files changed

+125
-111
lines changed

dev/docs/development.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Development & Testing
2+
3+
All development on BookStack is currently done on the `development` branch.
4+
When it's time for a release the `development` branch is merged into release with built & minified CSS & JS then tagged at its version. Here are the current development requirements:
5+
6+
* [Node.js](https://nodejs.org/en/) v16.0+
7+
8+
This project uses SASS for CSS development and this is built, along with the JavaScript, using a range of npm scripts. The below npm commands can be used to install the dependencies & run the build tasks:
9+
10+
``` bash
11+
# Install NPM Dependencies
12+
npm install
13+
14+
# Build assets for development
15+
npm run build
16+
17+
# Build and minify assets for production
18+
npm run production
19+
20+
# Build for dev (With sourcemaps) and watch for changes
21+
npm run dev
22+
```
23+
24+
BookStack has many integration tests that use Laravel's built-in testing capabilities which makes use of PHPUnit. There is a `mysql_testing` database defined within the app config which is what is used by PHPUnit. This database is set with the database name, username and password all defined as `bookstack-test`. You will have to create that database and that set of credentials before testing.
25+
26+
The testing database will also need migrating and seeding beforehand. This can be done by running `composer refresh-test-database`.
27+
28+
Once done you can run `composer test` in the application root directory to run all tests. Tests can be ran in parallel by running them via `composer t`. This will use Laravel's built-in parallel testing functionality, and attempt to create and seed a database instance for each testing thread. If required these parallel testing instances can be reset, before testing again, by running `composer t-reset`.
29+
30+
## Code Standards
31+
32+
PHP code standards are managed by [using PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
33+
Static analysis is in place using [PHPStan](https://phpstan.org/) & [Larastan](https://github.com/nunomaduro/larastan).
34+
The below commands can be used to utilise these tools:
35+
36+
```bash
37+
# Run code linting using PHP_CodeSniffer
38+
composer lint
39+
40+
# As above, but show rule names in output
41+
composer lint -- -s
42+
43+
# Auto-fix formatting & lint issues via PHP_CodeSniffer phpcbf
44+
composer format
45+
46+
# Run static analysis via larastan/phpstan
47+
composer check-static
48+
```
49+
50+
If submitting a PR, formatting as per our project standards would help for clarity but don't worry too much about using/understanding these tools as we can always address issues at a later stage when they're picked up by our automated tools.
51+
52+
## Development using Docker
53+
54+
This repository ships with a Docker Compose configuration intended for development purposes. It'll build a PHP image with all needed extensions installed and start up a MySQL server and a Node image watching the UI assets.
55+
56+
To get started, make sure you meet the following requirements:
57+
58+
- Docker and Docker Compose are installed
59+
- Your user is part of the `docker` group
60+
61+
If all the conditions are met, you can proceed with the following steps:
62+
63+
1. **Copy `.env.example` to `.env`**, change `APP_KEY` to a random 32 char string and set `APP_ENV` to `local`.
64+
2. Make sure **port 8080 is unused** *or else* change `DEV_PORT` to a free port on your host.
65+
3. **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.
66+
4. **Run `docker-compose up`** and wait until the image is built and all database migrations have been done.
67+
5. You can now login with `admin@admin.com` and `password` as password on `localhost:8080` (or another port if specified).
68+
69+
If needed, You'll be able to run any artisan commands via docker-compose like so:
70+
71+
```bash
72+
docker-compose run app php artisan list
73+
```
74+
75+
The docker-compose setup runs an instance of [MailHog](https://github.com/mailhog/MailHog) and sets environment variables to redirect any BookStack-sent emails to MailHog. You can view this mail via the MailHog web interface on `localhost:8025`. You can change the port MailHog is accessible on by setting a `DEV_MAIL_PORT` environment variable.
76+
77+
### Running tests
78+
79+
After starting the general development Docker, migrate & seed the testing database:
80+
81+
```bash
82+
# This only needs to be done once
83+
docker-compose run app php artisan migrate --database=mysql_testing
84+
docker-compose run app php artisan db:seed --class=DummyContentSeeder --database=mysql_testing
85+
```
86+
87+
Once the database has been migrated & seeded, you can run the tests like so:
88+
89+
```bash
90+
docker-compose run app php vendor/bin/phpunit
91+
```
92+
93+
### Debugging
94+
95+
The docker-compose setup ships with Xdebug, which you can listen to on port 9090.
96+
NB : For some editors like Visual Studio Code, you might need to map your workspace folder to the /app folder within the docker container for this to work.

dev/docs/release-process.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Release Versioning & Process
2+
3+
### BookStack Version Number Scheme
4+
5+
BookStack releases are each assigned a date-based version number in the format `v<year>.<month>[.<optional_patch_number>]`. For example:
6+
7+
- `v20.12` - New feature released launched during December 2020.
8+
- `v21.06.2` - Second patch release upon the June 2021 feature release.
9+
10+
Patch releases are generally fairly minor, primarily intended for fixes and therefore are fairly unlikely to cause breakages upon update.
11+
Feature releases are generally larger, bringing new features in addition to fixes and enhancements. These releases have a greater chance of introducing breaking changes upon update, so it's worth checking for any notes in the [update guide](https://www.bookstackapp.com/docs/admin/updates/).
12+
13+
### Release Planning Process
14+
15+
Each BookStack release will have a [milestone](https://github.com/BookStackApp/BookStack/milestones) created with issues & pull requests assigned to it to define what will be in that release. Milestones are built up then worked through until complete at which point, after some testing and documentation updates, the release will be deployed.
16+
17+
### Release Announcements
18+
19+
Feature releases, and some patch releases, will be accompanied by a post on the [BookStack blog](https://www.bookstackapp.com/blog/) which will provide additional detail on features, changes & updates otherwise the [GitHub release page](https://github.com/BookStackApp/BookStack/releases) will show a list of changes. You can sign up to be alerted to new BookStack blog posts (once per week maximum) [at this link](https://updates.bookstackapp.com/signup/bookstack-news-and-updates).
20+
21+
### Release Technical Process
22+
23+
Deploying a release, at a high level, simply involves merging the development branch into the release branch before then building & committing any release-only assets.
24+
A helper script [can be found in our](https://github.com/BookStackApp/devops/blob/main/meta-scripts/bookstack-release-steps) devops repo which provides the steps and commands for deploying a new release.

readme.md

Lines changed: 5 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -59,126 +59,20 @@ Note: Listed services are not tested, vetted nor supported by the official BookS
5959

6060
## 🛣️ Road Map
6161

62-
Below is a high-level road map view for BookStack to provide a sense of direction of where the project is going. This can change at any point and does not reflect many features and improvements that will also be included as part of the journey along this road map. For more granular detail of what will be included in upcoming releases you can review the project milestones as defined in the "Release Process" section below.
62+
Below is a high-level road map view for BookStack to provide a sense of direction of where the project is going. This can change at any point and does not reflect many features and improvements that will also be included as part of the journey along this road map. For more granular detail of what will be included in upcoming releases you can review the project milestones as defined in our [Release Process](dev/docs/release-process.md) documentation.
6363

6464
- **Platform REST API** - *(Most actions implemented, maturing)*
6565
- *A REST API covering, at minimum, control of core content models (Books, Chapters, Pages) for automation and platform extension.*
66-
- **Editor Alignment & Review** - *(Done)*
67-
- *Review the page editors with the goal of achieving increased interoperability & feature parity while also considering collaborative editing potential.*
6866
- **Permission System Review** - *(In Progress)*
6967
- *Improvement in how permissions are applied and a review of the efficiency of the permission & roles system.*
70-
- **Installation & Deployment Process Revamp**
71-
- *Creation of a streamlined & secure process for users to deploy & update BookStack with reduced development requirements (No git or composer requirement).*
72-
73-
## 🚀 Release Versioning & Process
74-
75-
BookStack releases are each assigned a date-based version number in the format `v<year>.<month>[.<optional_patch_number>]`. For example:
76-
77-
- `v20.12` - New feature released launched during December 2020.
78-
- `v21.06.2` - Second patch release upon the June 2021 feature release.
79-
80-
Patch releases are generally fairly minor, primarily intended for fixes and therefore are fairly unlikely to cause breakages upon update.
81-
Feature releases are generally larger, bringing new features in addition to fixes and enhancements. These releases have a greater chance of introducing breaking changes upon update, so it's worth checking for any notes in the [update guide](https://www.bookstackapp.com/docs/admin/updates/).
82-
83-
Each BookStack release will have a [milestone](https://github.com/BookStackApp/BookStack/milestones) created with issues & pull requests assigned to it to define what will be in that release. Milestones are built up then worked through until complete at which point, after some testing and documentation updates, the release will be deployed.
84-
85-
Feature releases, and some patch releases, will be accompanied by a post on the [BookStack blog](https://www.bookstackapp.com/blog/) which will provide additional detail on features, changes & updates otherwise the [GitHub release page](https://github.com/BookStackApp/BookStack/releases) will show a list of changes. You can sign up to be alerted to new BookStack blog posts (once per week maximum) [at this link](https://updates.bookstackapp.com/signup/bookstack-news-and-updates).
8668

8769
## 🛠️ Development & Testing
8870

89-
All development on BookStack is currently done on the `development` branch. When it's time for a release the `development` branch is merged into release with built & minified CSS & JS then tagged at its version. Here are the current development requirements:
90-
91-
* [Node.js](https://nodejs.org/en/) v14.0+
92-
93-
This project uses SASS for CSS development and this is built, along with the JavaScript, using a range of npm scripts. The below npm commands can be used to install the dependencies & run the build tasks:
94-
95-
``` bash
96-
# Install NPM Dependencies
97-
npm install
98-
99-
# Build assets for development
100-
npm run build
101-
102-
# Build and minify assets for production
103-
npm run production
104-
105-
# Build for dev (With sourcemaps) and watch for changes
106-
npm run dev
107-
```
108-
109-
BookStack has many integration tests that use Laravel's built-in testing capabilities which makes use of PHPUnit. There is a `mysql_testing` database defined within the app config which is what is used by PHPUnit. This database is set with the database name, user name and password all defined as `bookstack-test`. You will have to create that database and that set of credentials before testing.
110-
111-
The testing database will also need migrating and seeding beforehand. This can be done by running `composer refresh-test-database`.
112-
113-
Once done you can run `composer test` in the application root directory to run all tests. Tests can be ran in parallel by running them via `composer t`. This will use Laravel's built-in parallel testing functionality, and attempt to create and seed a database instance for each testing thread. If required these parallel testing instances can be reset, before testing again, by running `composer t-reset`.
114-
115-
### 📜 Code Standards
116-
117-
PHP code standards are managed by [using PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
118-
Static analysis is in place using [PHPStan](https://phpstan.org/) & [Larastan](https://github.com/nunomaduro/larastan).
119-
The below commands can be used to utilise these tools:
120-
121-
```bash
122-
# Run code linting using PHP_CodeSniffer
123-
composer lint
124-
125-
# As above, but show rule names in output
126-
composer lint -- -s
127-
128-
# Auto-fix formatting & lint issues via PHP_CodeSniffer phpcbf
129-
composer format
130-
131-
# Run static analysis via larastan/phpstan
132-
composer check-static
133-
```
134-
135-
If submitting a PR, formatting as per our project standards would help for clarity but don't worry too much about using/understanding these tools as we can always address issues at a later stage when they're picked up by our automated tools.
136-
137-
### 🐋 Development using Docker
138-
139-
This repository ships with a Docker Compose configuration intended for development purposes. It'll build a PHP image with all needed extensions installed and start up a MySQL server and a Node image watching the UI assets.
140-
141-
To get started, make sure you meet the following requirements:
142-
143-
- Docker and Docker Compose are installed
144-
- Your user is part of the `docker` group
145-
146-
If all the conditions are met, you can proceed with the following steps:
147-
148-
1. **Copy `.env.example` to `.env`**, change `APP_KEY` to a random 32 char string and set `APP_ENV` to `local`.
149-
2. Make sure **port 8080 is unused** *or else* change `DEV_PORT` to a free port on your host.
150-
3. **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.
151-
4. **Run `docker-compose up`** and wait until the image is built and all database migrations have been done.
152-
5. You can now login with `admin@admin.com` and `password` as password on `localhost:8080` (or another port if specified).
153-
154-
If needed, You'll be able to run any artisan commands via docker-compose like so:
155-
156-
```bash
157-
docker-compose run app php artisan list
158-
```
159-
160-
The docker-compose setup runs an instance of [MailHog](https://github.com/mailhog/MailHog) and sets environment variables to redirect any BookStack-sent emails to MailHog. You can view this mail via the MailHog web interface on `localhost:8025`. You can change the port MailHog is accessible on by setting a `DEV_MAIL_PORT` environment variable.
161-
162-
#### Running tests
163-
164-
After starting the general development Docker, migrate & seed the testing database:
165-
166-
```bash
167-
# This only needs to be done once
168-
docker-compose run app php artisan migrate --database=mysql_testing
169-
docker-compose run app php artisan db:seed --class=DummyContentSeeder --database=mysql_testing
170-
```
171-
172-
Once the database has been migrated & seeded, you can run the tests like so:
173-
174-
```bash
175-
docker-compose run app php vendor/bin/phpunit
176-
```
71+
Please see our [development docs](dev/docs/development.md) for full details regarding work on the BookStack source code.
17772

178-
#### Debugging
73+
If you're just looking to customize or extend your own BookStack instance, take a look at our [Hacking BookStack documentation page](https://www.bookstackapp.com/docs/admin/hacking-bookstack/) for details on various options to achieve this without altering the BookStack source code.
17974

180-
The docker-compose setup ships with Xdebug, which you can listen to on port 9090.
181-
NB : For some editors like Visual Studio Code, you might need to map your workspace folder to the /app folder within the docker container for this to work.
75+
Details about BookStack's versioning scheme and the general release process [can be found here](dev/docs/release-process.md).
18276

18377
## 🌎 Translations
18478

@@ -212,7 +106,7 @@ We want BookStack to remain accessible to as many people as possible. We aim for
212106

213107
## 🖥️ Website, Docs & Blog
214108

215-
The website which contains the project docs & Blog can be found in the [BookStackApp/website](https://github.com/BookStackApp/website) repo.
109+
The website which contains the project docs & blog can be found in the [BookStackApp/website](https://github.com/BookStackApp/website) repo.
216110

217111
## ⚖️ License
218112

0 commit comments

Comments
 (0)