Skip to content

Commit 66000b7

Browse files
committed
Pre-release tweaks
Signed-off-by: alexmerlin <[email protected]>
1 parent 4dbadc9 commit 66000b7

File tree

15 files changed

+158
-2142
lines changed

15 files changed

+158
-2142
lines changed

README.md

Lines changed: 68 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Dotkernel Admin is an application (skeleton) intended for quickly setting up an
44
It's a fast and reliable way to manage records in your database with a simple table-based approach, and also to build reports and graphs to monitor your platform.
55
The many graphical components at your disposal ensure an intuitive user experience.
66

7-
> Check out our [demo](https://admin5.dotkernel.net/).
7+
> Check out our [demo](https://admin6.dotkernel.net/).
88
>
99
> Submit user `admin` and password `dotadmin` to authenticate yourself.
1010
@@ -27,137 +27,104 @@ Documentation is available at: https://docs.dotkernel.org/admin-documentation/
2727
[![Qodana](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml/badge.svg?branch=6.0)](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml)
2828
[![PHPStan](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml/badge.svg?branch=6.0)](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml)
2929

30-
## Installing Dotkernel `admin`
30+
## Getting Started
3131

32-
## Tools
32+
### Clone the project
3333

34-
Dotkernel can be installed through a single command that utilizes [Composer](https://getcomposer.org/).
35-
Because of that, Composer is required to install Dotkernel Admin.
36-
37-
### Composer
38-
39-
Installation instructions:
40-
41-
- [Composer Installation - Linux/Unix/OSX](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx)
42-
- [Composer Installation - Windows](https://getcomposer.org/doc/00-intro.md#installation-windows)
43-
44-
> If you have never used composer before make sure you read the [`Composer Basic Usage`](https://getcomposer.org/doc/01-basic-usage.md) section in Composer's documentation.
45-
46-
## Choosing an installation path for Dotkernel Admin
47-
48-
Example:
49-
50-
- absolute path `/var/www/dk-admin`
51-
- or relative path `dk-admin` (equivalent with `./dk-admin`)
52-
53-
## Installing Dotkernel Admin
54-
55-
After choosing the path for Dotkernel (`dk-admin` will be used for the remainder of this example) it must be installed.
56-
There are two installation methods.
57-
58-
### I. Installing Dotkernel Admin using Composer
59-
60-
> please use the below CLI commands in terminal, do NOT use the PhpStorm buttons
61-
62-
The advantage of using this command is that it runs through the whole installation process. Run the following command:
34+
Using your terminal, navigate inside the directory you want to download the project files into.
35+
Make sure that the directory is empty before proceeding to the download process.
36+
Once there, run the following command:
6337

6438
```shell
65-
composer create-project dotkernel/admin -s dev dk
39+
git clone https://github.com/dotkernel/admin.git .
6640
```
6741

68-
The above command downloads the `admin` package, then downloads and installs the `dependencies`.
69-
70-
The setup script prompts for some configuration settings, for example the lines below:
42+
### Install the project dependencies
7143

72-
```text
73-
Please select which config file you wish to inject 'Laminas\Diactoros\ConfigProvider' into:
74-
[0] Do not inject
75-
[1] config/config.php
76-
Make your selection (default is 1):
44+
```shell
45+
composer install
7746
```
7847

79-
Simply select `[0] Do not inject`, because Dotkernel includes its own configProvider which already contains the prompted configurations.
80-
81-
If you choose `[1] config/config.php` Laminas' `ConfigProvider` from `session` will be injected.
48+
### Development mode
8249

83-
The next question is:
50+
If you're installing the project for development, you should **enable** development mode, by running:
8451

8552
```shell
86-
Remember this option for other packages of the same type? (y/N)
53+
composer development-enable
8754
```
8855

89-
Type `y` here, and hit `Enter`.
90-
91-
### II. Installing Dotkernel Admin using git clone
92-
93-
This method requires more manual input, but it ensures that the default branch is installed, even if it is not released.
94-
Run the following command:
56+
You can **disable** development mode by running:
9557

9658
```shell
97-
git clone https://github.com/dotkernel/admin.git .
59+
composer development-disable
9860
```
9961

100-
The dependencies have to be installed separately, by running this command
62+
You can **check** development status by running:
10163

10264
```shell
103-
composer install
65+
composer development-status
10466
```
10567

106-
Just like when [Installing Dotkernel admin using Composer](#i-installing-dotkernel-admin-using-composer), the setup asks for configuration settings regarding injections (type `0` and hit `enter`) and the confirmation to use this setting for other packages (type `y` and hit `Enter`).
68+
### Prepare config files
69+
70+
* duplicate `config/autoload/cors.local.php.dist` as `config/autoload/cors.local.php` <- if another application will send requests to this application, make sure configure the `allowed_origins`
71+
* duplicate `config/autoload/local.php.dist` as `config/autoload/local.php`
72+
* **optional**: in order to run/create tests, duplicate `config/autoload/local.test.php.dist` as `config/autoload/local.test.php` <- this creates a new in-memory database that your tests will run on
10773

108-
## Configuration - First Run
74+
### Setup database
10975

110-
- Remove the `.dist` extension from the files `config/autoload/local.php.dist`
111-
- Edit `config/autoload/local.php` according to your dev machine and fill in the `database` configuration
76+
Use an existing empty one or create a new **MariaDB**/**MySQL** database.
11277

113-
> Charset recommendation: utf8mb4_general_ci
78+
> Recommended collation: `utf8mb4_general_ci`.
11479
115-
Run the migrations and seeds with these commands:
80+
#### Running migrations
81+
82+
* fill out the database connection params in `config/autoload/local.php` under `$databases['default']`
83+
* run the database migrations by using the following command:
11684

11785
```shell
11886
php ./bin/doctrine-migrations migrate
11987
```
12088

121-
```shell
122-
php ./bin/doctrine fixtures:execute
123-
```
89+
This command will prompt you to confirm that you want to run it:
90+
91+
> WARNING! You are about to execute a migration in database "_<database-name>_" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
12492
125-
- If you use `composer create-project`, the project will go into development mode automatically after installing.
93+
Hit `Enter` to confirm the operation.
12694

127-
The development mode status can be checked and toggled by using the below Composer commands:
95+
#### Executing fixtures
12896

129-
Check development status by running:
97+
> Fixtures are used to seed the database with initial values and must be executed after migrating the database.
98+
99+
To list all the fixtures, run:
130100

131101
```shell
132-
composer development-status
102+
php ./bin/doctrine fixtures:list
133103
```
134104

135-
Enable development mode by running:
105+
This will output all the fixtures in the order of execution.
106+
107+
To execute all fixtures, run:
136108

137109
```shell
138-
composer development-enable
110+
php ./bin/doctrine fixtures:execute
139111
```
140112

141-
Disable development mode by running:
113+
To execute a specific fixture, run:
142114

143115
```shell
144-
composer development-disable
116+
php ./bin/doctrine fixtures:execute --class=FixtureClassName
145117
```
146118

147-
- If not already done on installation, remove the `.dist` extension from `config/autoload/development.global.php.dist`.
119+
More details on how fixtures work can be found in `dotkernel/dot-data-fixtures` [documentation](https://github.com/dotkernel/dot-data-fixtures#creating-fixtures).
148120

149-
This will enable dev mode by turning debug flag to `true` and turning configuration caching to `off`.
150-
It will also make sure that any existing config cache is cleared.
121+
### Mail configuration
151122

152-
## Manage GeoLite2 database
123+
If your application will send emails, you must configure an outgoing mail server under `config/autoload/mail.global.php`.
153124

154-
You can download/update a specific GeoLite2 database, by running the following command:
125+
### Sync GeoLite2 databases
155126

156-
```shell
157-
php ./bin/cli.php geoip:synchronize -d {DATABASE}
158-
```
159-
160-
Where _{DATABASE}_ takes one of the following values: `asn`, `city`, `country`.
127+
#### Full sync
161128

162129
You can download/update all GeoLite2 databases at once, by running the following command:
163130

@@ -173,6 +140,16 @@ city: n/a -> 2015-10-21 04:29:00
173140
country: n/a -> 2015-10-21 04:29:00
174141
```
175142

143+
#### Selective sync
144+
145+
You can download/update a specific GeoLite2 database, by running the following command:
146+
147+
```shell
148+
php ./bin/cli.php geoip:synchronize -d <database>
149+
```
150+
151+
Where `<database>` takes one of the following values: **asn**, **city**, **country**.
152+
176153
Get help for this command by running:
177154

178155
```shell
@@ -181,83 +158,30 @@ php ./bin/cli.php help geoip:synchronize
181158

182159
> If you set up the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output data only if an error has occurred.
183160
184-
## NPM Commands
161+
### NPM Commands
185162

186-
To install dependencies into the `node_modules` directory run this command.
163+
To install dependencies into the `node_modules` directory run this command:
187164

188165
```shell
189166
npm install
190167
```
191168

192-
If `npm install` fails, this could be caused by user permissions of npm.
169+
If the above command fails, it could be caused by user permissions of `npm`.
193170
Recommendation is to install npm through `Node Version Manager`.
194171

195-
The watch command compiles the components then watches the files and recompiles when one of them changes.
172+
The watch command looks for JavaScript/CSS file changes and recompiles the assets under the public assets:
196173

197174
```shell
198175
npm run watch
199176
```
200177

201-
After all updates are done, this command compiles the assets locally, minifies them and makes them ready for production.
178+
Once finished working on the JavaScript/CSS files, run the below command to minify the public assets and prepare them for production:
202179

203180
```shell
204181
npm run prod
205182
```
206183

207-
## Authorization Guards
208-
209-
The packages responsible for restricting access to certain parts of the application are [dot-rbac-guard](https://github.com/dotkernel/dot-rbac-guard) and [dot-rbac](https://github.com/dotkernel/dot-rbac).
210-
These packages work together to create an infrastructure that is customizable and diversified to manage user access to the platform by specifying the type of role the user has.
211-
212-
The `authorization.global.php` file provides multiple configurations specifying multiple roles as well as the types of permissions to which these roles have access.
213-
214-
```php
215-
'roles' => [
216-
'superuser' => [
217-
'permissions' => [
218-
'authenticated',
219-
'edit',
220-
'delete',
221-
//etc..
222-
]
223-
],
224-
'admin' => [
225-
'permissions' => [
226-
'authenticated',
227-
//etc..
228-
]
229-
]
230-
]
231-
```
232-
233-
The `authorization-guards.global.php` file provides configuration to restrict access to certain actions based on the permissions defined in `authorization.global.php` so basically we have to add the permissions in the dot-rbac configuration file first to specify the action restriction permissions.
234-
235-
```php
236-
'rules' => [
237-
[
238-
'route' => 'account',
239-
'actions' => [//list of actions to apply , or empty array for all actions
240-
'unregister',
241-
'avatar',
242-
'details',
243-
'changePassword'
244-
],
245-
'permissions' => ['authenticated']
246-
],
247-
[
248-
'route' => 'admin',
249-
'actions' => [
250-
'deleteAccount'
251-
],
252-
'permissions' => [
253-
'delete'
254-
//list of roles to allow
255-
]
256-
]
257-
]
258-
```
259-
260-
## Testing (Running) the application
184+
### Test the installation
261185

262186
> **Do not enable dev mode in production**
263187
@@ -267,23 +191,17 @@ The `authorization-guards.global.php` file provides configuration to restrict ac
267191
php -S 0.0.0.0:8080 -t public
268192
```
269193

270-
> Running command `composer serve` will do the exact same, but the above is faster.
271-
272-
`0.0.0.0` means that the server is open to all incoming connections
273-
`127.0.0.1` means that the server can only be accessed locally (localhost only)
274-
`8080` the port on which the server is started (the listening port for the server)
194+
> Running command `composer serve` will do the same thing, but the server might get closed after a couple of minutes.
275195
276196
> If you are still getting exceptions or errors regarding some missing services, try running the following command:
277197
278198
```shell
279199
php ./bin/clear-config-cache.php
280200
```
281201

282-
> If `config-cache.php` is present that config will be loaded regardless of the `ConfigAggregator::ENABLE_CACHE` in `config/autoload/mezzio.global.php`
283-
284202
- Open a web browser and visit `http://localhost:8080/`
285203

286-
You should see the `Dotkernel admin` login page.
204+
You should see the **Dotkernel Admin** login page.
287205
If you ran the migrations you will have an admin user in the database with the following credentials:
288206

289207
- **User**: `admin`
@@ -301,4 +219,4 @@ If you ran the migrations you will have an admin user in the database with the f
301219
];
302220
```
303221

304-
Do not change this in `local.php.dist` as well because this value should remain `true` on production.
222+
> Do not change this in `local.php.dist` as well because this value should remain `true` on production.

0 commit comments

Comments
 (0)