|
| 1 | +# Dotkernel Admin |
| 2 | + |
| 3 | +Dotkernel Admin is an application (skeleton) intended for quickly setting up an administration site for your platform. |
| 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 | +The many graphical components at your disposal ensure an intuitive user experience. |
| 6 | + |
| 7 | +> Check out our [demo](https://admin6.dotkernel.net/). |
| 8 | +> |
| 9 | +> Submit user `admin` and password `dotadmin` to authenticate yourself. |
| 10 | +
|
| 11 | +## Documentation |
| 12 | + |
| 13 | +Documentation is available at: https://docs.dotkernel.org/admin-documentation/ |
| 14 | + |
| 15 | +## Badges |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +[](https://github.com/dotkernel/admin/issues) |
| 21 | +[](https://github.com/dotkernel/admin/network) |
| 22 | +[](https://github.com/dotkernel/admin/stargazers) |
| 23 | +[](https://github.com/dotkernel/admin/blob/6.0/LICENSE.md) |
| 24 | + |
| 25 | +[](https://github.com/dotkernel/admin/actions/workflows/continuous-integration.yml) |
| 26 | +[](https://codecov.io/gh/dotkernel/admin) |
| 27 | +[](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml) |
| 28 | +[](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml) |
| 29 | + |
| 30 | +## Getting Started |
| 31 | + |
| 32 | +### Clone the project |
| 33 | + |
| 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: |
| 37 | + |
| 38 | +```shell |
| 39 | +git clone https://github.com/dotkernel/admin.git . |
| 40 | +``` |
| 41 | + |
| 42 | +### Install the project dependencies |
| 43 | + |
| 44 | +```shell |
| 45 | +composer install |
| 46 | +``` |
| 47 | + |
| 48 | +You will be prompted with the below message to choose whether you want to inject ConfigProviders: |
| 49 | +```shell |
| 50 | + Please select which config file you wish to inject 'Laminas\Validator\ConfigProvider' into: |
| 51 | + [0] Do not inject |
| 52 | + [1] config/config.php |
| 53 | + Make your selection (default is 1): |
| 54 | +``` |
| 55 | +
|
| 56 | +Type `0` to select **[0] Do not inject** and hit `Enter`. |
| 57 | +
|
| 58 | +We choose not to inject any ConfigProvider because Dotkernel Admin comes with all the required ConfigProviders already injected in `config/config.php`. |
| 59 | +Choosing to inject any extra ConfigProvider would cause having duplicates which are not allowed and would crash the application. |
| 60 | +
|
| 61 | +### Development mode |
| 62 | +
|
| 63 | +> **Do not enable development mode in production!** |
| 64 | +
|
| 65 | +If you're installing the project for development, you should **enable** development mode, by running: |
| 66 | +
|
| 67 | +```shell |
| 68 | +composer development-enable |
| 69 | +``` |
| 70 | +
|
| 71 | +You can **disable** development mode by running: |
| 72 | +
|
| 73 | +```shell |
| 74 | +composer development-disable |
| 75 | +``` |
| 76 | +
|
| 77 | +You can **check** development status by running: |
| 78 | +
|
| 79 | +```shell |
| 80 | +composer development-status |
| 81 | +``` |
| 82 | +
|
| 83 | +### Prepare config files |
| 84 | +
|
| 85 | +* **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 |
| 86 | +
|
| 87 | +### Setup database |
| 88 | +
|
| 89 | +Use an existing empty one or create a new **MariaDB**/**MySQL** database. |
| 90 | +
|
| 91 | +> Recommended collation: `utf8mb4_general_ci`. |
| 92 | +
|
| 93 | +#### Running migrations |
| 94 | +
|
| 95 | +* fill out the database connection params in `config/autoload/local.php` under `$databases['default']` |
| 96 | +* run the database migrations by using the following command: |
| 97 | +
|
| 98 | +```shell |
| 99 | +php ./bin/doctrine-migrations migrate |
| 100 | +``` |
| 101 | +
|
| 102 | +This command will prompt you to confirm that you want to run it: |
| 103 | +
|
| 104 | +> WARNING! You are about to execute a migration in database "`<database>`" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]: |
| 105 | +
|
| 106 | +Hit `Enter` to confirm the operation. |
| 107 | +
|
| 108 | +#### Executing fixtures |
| 109 | +
|
| 110 | +Fixtures are used to seed the database with initial values and must be executed after migrating the database. |
| 111 | +
|
| 112 | +To list all the fixtures, run: |
| 113 | +
|
| 114 | +```shell |
| 115 | +php ./bin/doctrine fixtures:list |
| 116 | +``` |
| 117 | +
|
| 118 | +This will output all the fixtures in the order of execution. |
| 119 | +
|
| 120 | +To execute all fixtures, run: |
| 121 | +
|
| 122 | +```shell |
| 123 | +php ./bin/doctrine fixtures:execute |
| 124 | +``` |
| 125 | +
|
| 126 | +To execute a specific fixture, run: |
| 127 | +
|
| 128 | +```shell |
| 129 | +php ./bin/doctrine fixtures:execute --class=FixtureClassName |
| 130 | +``` |
| 131 | +
|
| 132 | +More details on how fixtures work can be found in `dotkernel/dot-data-fixtures` [documentation](https://github.com/dotkernel/dot-data-fixtures#creating-fixtures). |
| 133 | +
|
| 134 | +### Mail configuration |
| 135 | +
|
| 136 | +If your application will send emails, you must configure an outgoing mail server under `config/autoload/mail.global.php`. |
| 137 | +
|
| 138 | +### Sync GeoLite2 databases |
| 139 | +
|
| 140 | +#### Full sync |
| 141 | +
|
| 142 | +You can download/update all GeoLite2 databases at once, by running the following command: |
| 143 | +
|
| 144 | +```shell |
| 145 | +php ./bin/cli.php geoip:synchronize |
| 146 | +``` |
| 147 | +
|
| 148 | +The output should be similar to the below: |
| 149 | +
|
| 150 | +```shell |
| 151 | +asn: n/a -> 2015-10-21 04:29:00 |
| 152 | +city: n/a -> 2015-10-21 04:29:00 |
| 153 | +country: n/a -> 2015-10-21 04:29:00 |
| 154 | +``` |
| 155 | +
|
| 156 | +#### Selective sync |
| 157 | +
|
| 158 | +You can download/update a specific GeoLite2 database, by running the following command: |
| 159 | +
|
| 160 | +```shell |
| 161 | +php ./bin/cli.php geoip:synchronize -d <database> |
| 162 | +``` |
| 163 | +
|
| 164 | +Where `<database>` takes one of the following values: **asn**, **city**, **country**. |
| 165 | +
|
| 166 | +Get help for this command by running: |
| 167 | +
|
| 168 | +```shell |
| 169 | +php ./bin/cli.php help geoip:synchronize |
| 170 | +``` |
| 171 | +
|
| 172 | +> 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. |
| 173 | +
|
| 174 | +### NPM Commands |
| 175 | +
|
| 176 | +To install dependencies into the `node_modules` directory run this command: |
| 177 | +
|
| 178 | +```shell |
| 179 | +npm install |
| 180 | +``` |
| 181 | +
|
| 182 | +If the above command fails, it could be caused by user permissions of `npm`. |
| 183 | +Recommendation is to install npm through `Node Version Manager`. |
| 184 | +
|
| 185 | +The **watch** command looks for JavaScript/CSS file changes and recompiles the assets under the public assets: |
| 186 | +
|
| 187 | +```shell |
| 188 | +npm run watch |
| 189 | +``` |
| 190 | +
|
| 191 | +Once finished working on the JavaScript/CSS files, run the below command to minify the public assets and prepare them for production: |
| 192 | +
|
| 193 | +```shell |
| 194 | +npm run prod |
| 195 | +``` |
| 196 | +
|
| 197 | +### Test the installation |
| 198 | +
|
| 199 | +If you are using virtual hosts as described in the [Dotkernel documentation] (https://docs.dotkernel.org/development/) you need you modify the permissions of the `data`, `public/uploads` and `log` folders: |
| 200 | +
|
| 201 | +```shell |
| 202 | +chmod -R 777 data |
| 203 | +chmod -R 777 public/uploads |
| 204 | +chmod -R 777 log |
| 205 | +``` |
| 206 | +
|
| 207 | +Run the following command in your project's directory to start PHPs built-in server: |
| 208 | +
|
| 209 | +```shell |
| 210 | +php -S 0.0.0.0:8080 -t public |
| 211 | +``` |
| 212 | +
|
| 213 | +> Running command `composer serve` will do the same thing, but the server will time out after a couple of minutes. |
| 214 | +
|
| 215 | +If you are still getting exceptions or errors regarding some missing services, try running the following command: |
| 216 | +
|
| 217 | +```shell |
| 218 | +php ./bin/clear-config-cache.php |
| 219 | +``` |
| 220 | +
|
| 221 | +Open a web browser and visit `http://localhost:8080/`. |
| 222 | +
|
| 223 | +You should see the **Dotkernel Admin** login page. |
| 224 | +If you ran the migrations you will have an admin user in the database with the following credentials: |
| 225 | +
|
| 226 | +- **Identity**: `admin` |
| 227 | +- **Password**: `dotadmin` |
| 228 | +
|
| 229 | +> **Production only**: Make sure you modify the default admin credentials. |
| 230 | +
|
| 231 | +> **Development only**: `session.cookie_secure` does not work locally so make sure you modify your `local.php`, as per the following: |
| 232 | +
|
| 233 | +```php |
| 234 | + return [ |
| 235 | + 'session_config' => [ |
| 236 | + 'cookie_secure' => false, |
| 237 | + ] |
| 238 | + ]; |
| 239 | +``` |
| 240 | +
|
| 241 | +> Do not change this in `local.php.dist` as well because this value must remain `true` on production. |
0 commit comments