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
@@ -4,7 +4,7 @@ Dotkernel Admin is an application (skeleton) intended for quickly setting up an
4
4
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.
5
5
The many graphical components at your disposal ensure an intuitive user experience.
6
6
7
-
> Check out our [demo](https://admin5.dotkernel.net/).
7
+
> Check out our [demo](https://admin6.dotkernel.net/).
8
8
>
9
9
> Submit user `admin` and password `dotadmin` to authenticate yourself.
10
10
@@ -27,137 +27,104 @@ Documentation is available at: https://docs.dotkernel.org/admin-documentation/
> 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.
The dependencies have to be installed separately, by running this command
62
+
You can **check** development status by running:
101
63
102
64
```shell
103
-
composer install
65
+
composer development-status
104
66
```
105
67
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
107
73
108
-
##Configuration - First Run
74
+
### Setup database
109
75
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.
112
77
113
-
> Charset recommendation: utf8mb4_general_ci
78
+
> Recommended collation: `utf8mb4_general_ci`.
114
79
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:
116
84
117
85
```shell
118
86
php ./bin/doctrine-migrations migrate
119
87
```
120
88
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]:
124
92
125
-
- If you use `composer create-project`, the project will go into development mode automatically after installing.
93
+
Hit `Enter` to confirm the operation.
126
94
127
-
The development mode status can be checked and toggled by using the below Composer commands:
95
+
#### Executing fixtures
128
96
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:
130
100
131
101
```shell
132
-
composer development-status
102
+
php ./bin/doctrine fixtures:list
133
103
```
134
104
135
-
Enable development mode by running:
105
+
This will output all the fixtures in the order of execution.
- 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).
148
120
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
151
122
152
-
## Manage GeoLite2 database
123
+
If your application will send emails, you must configure an outgoing mail server under `config/autoload/mail.global.php`.
153
124
154
-
You can download/update a specific GeoLite2 database, by running the following command:
125
+
### Sync GeoLite2 databases
155
126
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
161
128
162
129
You can download/update all GeoLite2 databases at once, by running the following command:
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
+
176
153
Get help for this command by running:
177
154
178
155
```shell
@@ -181,83 +158,30 @@ php ./bin/cli.php help geoip:synchronize
181
158
182
159
> 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.
183
160
184
-
## NPM Commands
161
+
###NPM Commands
185
162
186
-
To install dependencies into the `node_modules` directory run this command.
163
+
To install dependencies into the `node_modules` directory run this command:
187
164
188
165
```shell
189
166
npm install
190
167
```
191
168
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`.
193
170
Recommendation is to install npm through `Node Version Manager`.
194
171
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:
196
173
197
174
```shell
198
175
npm run watch
199
176
```
200
177
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:
202
179
203
180
```shell
204
181
npm run prod
205
182
```
206
183
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
261
185
262
186
> **Do not enable dev mode in production**
263
187
@@ -267,23 +191,17 @@ The `authorization-guards.global.php` file provides configuration to restrict ac
267
191
php -S 0.0.0.0:8080 -t public
268
192
```
269
193
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.
275
195
276
196
> If you are still getting exceptions or errors regarding some missing services, try running the following command:
277
197
278
198
```shell
279
199
php ./bin/clear-config-cache.php
280
200
```
281
201
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
-
284
202
- Open a web browser and visit `http://localhost:8080/`
285
203
286
-
You should see the `Dotkernel admin` login page.
204
+
You should see the **Dotkernel Admin** login page.
287
205
If you ran the migrations you will have an admin user in the database with the following credentials:
288
206
289
207
-**User**: `admin`
@@ -301,4 +219,4 @@ If you ran the migrations you will have an admin user in the database with the f
301
219
];
302
220
```
303
221
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