You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DotKernel can be installed through a single command that utilizes [Composer](https://getcomposer.org/). Because of that, Composer is required to install DotKernel `admin`.
36
-
23
+
DotKernel can be installed through a single command that utilizes [Composer](https://getcomposer.org/). Because of that,
24
+
Composer is required to install DotKernel `admin`.
>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
46
-
33
+
>If you have never used composer before make sure you read
34
+
>the [`Composer Basic Usage`](https://getcomposer.org/doc/01-basic-usage.md) section in Composer's documentation
47
35
48
-
## Choosing an installation path for DotKernel `admin`
36
+
## Choosing an installation path for DotKernel `admin`
49
37
50
38
Example:
51
39
52
40
- absolute path `/var/www/dk-admin`
53
41
- or relative path `dk-admin` (equivalent with `./dk-admin`)
54
42
55
-
56
43
## Installing DotKernel `admin`
57
44
58
-
After choosing the path for DotKernel (`dk-admin` will be used for the remainder of this example) it must be installed. There are two installation methods.
59
-
45
+
After choosing the path for DotKernel (`dk-admin` will be used for the remainder of this example) it must be installed.
46
+
There are two installation methods.
60
47
61
-
####I. Installing DotKernel `admin` using composer
48
+
### I. Installing DotKernel `admin` using composer
62
49
63
-
#### NOTE
64
-
> please use the below CLI commands in terminal, do NOT use the PhpStorm buttons
50
+
>please use the below CLI commands in terminal, do NOT use the PhpStorm buttons
65
51
66
52
The advantage of using this command is that it runs through the whole installation process. Run the following command:
67
53
68
54
composer create-project dotkernel/admin -s dev dk
69
55
70
-
71
56
The above command downloads the `admin` package, then downloads and installs the `dependencies`.
72
57
73
58
The setup script prompts for some configuration settings, for example the lines below:
@@ -77,8 +62,8 @@ The setup script prompts for some configuration settings, for example the lines
77
62
[1] config/config.php
78
63
Make your selection (default is 1):
79
64
80
-
81
-
Simply select `[0] Do not inject`, because DotKernel includes its own configProvider which already contains the prompted configurations.
65
+
Simply select `[0] Do not inject`, because DotKernel includes its own configProvider which already contains the prompted
66
+
configurations.
82
67
83
68
If you choose `[1] config/config.php` Laminas's `ConfigProvider` from `session` will be injected.
84
69
@@ -88,48 +73,44 @@ The next question is:
88
73
89
74
Type `y` here, and hit `enter`
90
75
76
+
### II. Installing DotKernel `admin` using git clone
91
77
92
-
#### II. Installing DotKernel `admin` using git clone
93
-
94
-
This method requires more manual input, but it ensures that the default branch is installed, even if it is not released. Run the following command:
78
+
This method requires more manual input, but it ensures that the default branch is installed, even if it is not released.
The dependencies have to be installed separately, by running this command
100
84
101
85
composer install
102
86
103
-
104
-
Just like for `II Installing DotKernel admin using composer` (see above), the setup asks for configuration settings regarding injections (type `0` and hit `enter`) and a confirmation to use this setting for other packages (type `y` and hit `enter`)
105
-
87
+
Just like for `II Installing DotKernel admin using composer` (see above), the setup asks for configuration settings
88
+
regarding injections (type `0` and hit `enter`) and a confirmation to use this setting for other packages (type `y` and
89
+
hit `enter`)
106
90
107
91
## Configuration - First Run
108
92
109
93
- Remove the `.dist` extension from the files `config/autoload/local.php.dist`
110
94
- Edit `config/autoload/local.php` according to your dev machine and fill in the `database` configuration
111
95
112
96
Run the migrations and seeds with these commands:
113
-
```shell
114
-
php bin/doctrine-migrations migrate
115
-
```
116
-
```shell
117
-
php bin/doctrine fixtures:execute
118
-
```
119
-
120
-
- If you use `composer create-project`, the project will go into development mode automatically after installing. The development mode status can be checked and toggled by using these composer commands:
121
-
```shell
122
-
composer development-status
123
-
```
124
-
```shell
125
-
composer development-enable
126
-
```
127
-
```shell
128
-
composer development-disable
129
-
```
97
+
98
+
php bin/doctrine-migrations migrate
99
+
100
+
php bin/doctrine fixtures:execute
101
+
102
+
- If you use `composer create-project`, the project will go into development mode automatically after installing. The
103
+
development mode status can be checked and toggled by using these composer commands:
104
+
105
+
composer development-status
106
+
107
+
composer development-enable
108
+
109
+
composer development-disable
130
110
131
111
- If not already done on installation, remove the `.dist` extension from `config/autoload/development.global.php.dist`.
132
-
This will enable dev mode by turning debug flag to `true` and turning configuration caching to `off`. It will also make sure that any existing config cache is cleared.
112
+
This will enable dev mode by turning debug flag to `true` and turning configuration caching to `off`. It will also
113
+
make sure that any existing config cache is cleared.
133
114
134
115
> Charset recommendation: utf8mb4_general_ci
135
116
@@ -139,56 +120,55 @@ You can download/update a specific GeoLite2 database, by running the following c
139
120
140
121
php bin/cli.php geoip:synchronize -d {DATABASE}
141
122
142
-
143
123
Where _{DATABASE}_ takes one of the following values: `asn`, `city`, `country`.
144
124
145
125
You can download/update all GeoLite2 databases at once, by running the following command:
146
126
147
127
php bin/cli.php geoip:synchronize
148
128
149
-
150
-
The output should be similar to the below, displaying per row: `database identifier`: `previous build datetime` -> `current build datetime`.
129
+
The output should be similar to the below, displaying per
**Tip**: If you setup the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output data only if an error has occurred.
164
-
142
+
**Tip**: If you setup the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output
143
+
data only if an error has occurred.
165
144
166
145
## NPM Commands
167
146
168
147
To install dependencies into the `node_modules` directory run this command.
169
148
170
149
npm install
171
150
172
-
173
-
If `npm install` fails, this could be caused by user permissions of npm. Recommendation is to install npm through `Node Version Manager`.
151
+
If `npm install` fails, this could be caused by user permissions of npm. Recommendation is to install npm
152
+
through `Node Version Manager`.
174
153
175
154
The watch command compiles the components then watches the files and recompiles when one of them changes.
176
155
177
156
npm run watch
178
157
179
-
180
-
After all updates are done, this command compiles the assets locally, minifies them and makes them ready for production.
158
+
After all updates are done, this command compiles the assets locally, minifies them and makes them ready for production.
181
159
182
160
npm run prod
183
161
184
-
185
162
## Authorization Guards
186
-
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). 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.
187
163
188
-
The `authorization.global.php` file provides multiple configurations specifying multiple roles as well as the types of permissions to which these roles have access.
164
+
The packages responsible for restricting access to certain parts of the application
165
+
are [dot-rbac-guard](https://github.com/dotkernel/dot-rbac-guard) and [dot-rbac](https://github.com/dotkernel/dot-rbac).
166
+
These packages work together to create an infrastructure that is customizable and diversified to manage user access to
167
+
the platform by specifying the type of role the user has.
168
+
169
+
The `authorization.global.php` file provides multiple configurations specifying multiple roles as well as the types of
170
+
permissions to which these roles have access.
189
171
190
-
```php
191
-
//example of a flat RBAC model that specifies two types of roles as well as their permission
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.
189
+
The `authorization-guards.global.php` file provides configuration to restrict access to certain actions based on the
190
+
permissions defined in `authorization.global.php` so basically we have to add the permissions in the dot-rbac
191
+
configuration file first to specify the action restriction permissions.
211
192
212
-
```php
213
-
//example of configuration example to restrict certain actions of some routes based on the permissions specified in the dot-rbac configuration file
214
193
'rules' => [
215
-
[
216
-
'route' => 'account',
217
-
'actions' => [//list of actions to apply , or empty array for all actions
218
-
'unregister',
219
-
'avatar',
220
-
'details',
221
-
'changePassword'
222
-
],
223
-
'permissions' => ['authenticated']
224
-
],
225
-
[
226
-
'route' => 'admin',
227
-
'actions' => [
228
-
'deleteAccount'
229
-
],
230
-
'permissions' => [
231
-
'delete'
232
-
//list of roles to allow
233
-
]
234
-
]
194
+
[
195
+
'route' => 'account',
196
+
'actions' => [//list of actions to apply , or empty array for all actions
197
+
'unregister',
198
+
'avatar',
199
+
'details',
200
+
'changePassword'
201
+
],
202
+
'permissions' => ['authenticated']
203
+
],
204
+
[
205
+
'route' => 'admin',
206
+
'actions' => [
207
+
'deleteAccount'
208
+
],
209
+
'permissions' => [
210
+
'delete'
211
+
//list of roles to allow
212
+
]
213
+
]
235
214
]
236
-
```
237
215
238
216
## Testing (Running)
239
217
240
218
Note: **Do not enable dev mode in production**
241
219
242
220
- Run the following command in your project's directory to start PHPs built-in server:
243
-
```shell
244
-
php -S 0.0.0.0:8080 -t public
245
-
```
221
+
222
+
php -S 0.0.0.0:8080 -t public
246
223
247
224
> Running command `composer serve` will do the exact same, but the above is faster.
248
225
@@ -255,8 +232,8 @@ If you are still getting exceptions or errors regarding some missing services, t
255
232
256
233
php bin/clear-config-cache.php
257
234
258
-
259
-
> If `config-cache.php` is present that config will be loaded regardless of the `ConfigAggregator::ENABLE_CACHE`in `config/autoload/mezzio.global.php`
235
+
> If `config-cache.php` is present that config will be loaded regardless of the `ConfigAggregator::ENABLE_CACHE`
236
+
> in `config/autoload/mezzio.global.php`
260
237
261
238
- Open a web browser and visit `http://localhost:8080/`
262
239
@@ -268,16 +245,14 @@ If you ran the migrations you will have an admin user in the database with the f
268
245
-**Password**: `dotadmin`
269
246
270
247
**NOTE:**
248
+
271
249
-**Production only**: Make sure you modify the default admin credentials.
272
250
-**Development only**: `session.cookie_secure` does not work locally so make sure you modify your `local.php`, as per the following:
273
-
```php
274
-
# other code
275
-
276
-
return [
277
-
# other configurations...
278
-
'session_config' => [
279
-
'cookie_secure' => false,
280
-
],
281
-
];
282
-
```
251
+
252
+
return [
253
+
'session_config' => [
254
+
'cookie_secure' => false,
255
+
]
256
+
];
257
+
283
258
Do not change this in `local.php.dist` as well because this value should remain `true` on production.
0 commit comments