Skip to content

Commit

Permalink
initial push
Browse files Browse the repository at this point in the history
  • Loading branch information
pinclau committed Jul 30, 2024
0 parents commit 40e7a93
Show file tree
Hide file tree
Showing 15 changed files with 305 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Continuous Integration"

on:
pull_request:
push:
branches:
tags:

jobs:
ci:
uses: laminas/workflow-continuous-integration/.github/workflows/[email protected]
16 changes: 16 additions & 0 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: docs-build

on:
release:
types: [published]
workflow_dispatch:

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Build Docs
uses: dotkernel/documentation-theme/github-actions/docs@main
env:
DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea
docs/html
documentation-theme

composer.phar
composer.lock
vendor
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 DotKernel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "dotkernel/admin-documentation",
"description": "DotKernel Admin documentation markdown files.",
"type": "metapackage",
"license": "MIT",
"authors": [
{
"name": "DotKernel Team",
"email": "[email protected]"
}
],
"require": {}
}
1 change: 1 addition & 0 deletions docs/book/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ../../README.md
27 changes: 27 additions & 0 deletions docs/book/v5/installation/composer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Composer Installation of Packages

## Install dependencies

```shell
composer install
```

## Development mode

If you're installing the project for development, make sure you have development mode enabled, by running:

```shell
composer development-enable
```

You can disable development mode by running:

```shell
composer development-disable
```

You can check if you have development mode enabled by running:

```shell
composer development-status
```
16 changes: 16 additions & 0 deletions docs/book/v5/installation/configuration-files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configuration Files

## Prepare config files

Check failure on line 3 in docs/book/v5/installation/configuration-files.md

View workflow job for this annotation

GitHub Actions / ci / QA Checks (Documentation Linting [8.0, latest], ubuntu-latest, laminas/laminas-continuous-integra...

Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Prepare config files"]
* duplicate `config/autoload/local.php.dist` as `config/autoload/local.php`

Check failure on line 4 in docs/book/v5/installation/configuration-files.md

View workflow job for this annotation

GitHub Actions / ci / QA Checks (Documentation Linting [8.0, latest], ubuntu-latest, laminas/laminas-continuous-integra...

Lists should be surrounded by blank lines [Context: "* duplicate `config/autoload/l..."]

* duplicate `config/autoload/mail.local.php.dist` as `config/autoload/mail.local.php`

### Note

> if your API will send emails, make sure to fill in SMTP connection params
* **optional**: in order to run/create tests, duplicate `config/autoload/local.test.php.dist` as `config/autoload/local.test.php`

### Note

> this creates a new in-memory database that your tests will run on.
47 changes: 47 additions & 0 deletions docs/book/v5/installation/doctrine-orm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Doctrine ORM

## Setup database

Make sure you fill out the database credentials in `config/autoload/local.php` under `$databases['default']`.

Create a new MySQL database - set collation to `utf8mb4_general_ci`

## Running migrations

Run the database migrations by using the following command:

```shell
php bin/doctrine-migrations migrate
```

This command will prompt you to confirm that you want to run it.

> WARNING! You are about to execute a migration in database "..." that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
Hit `Enter` to confirm the operation.

## Executing fixtures

**Fixtures are used to seed the database with initial values and should be executed after migrating the database.**

To list all the fixtures, run:

```shell
php bin/doctrine fixtures:list
```

This will output all the fixtures in the order of execution.

To execute all fixtures, run:

```shell
php bin/doctrine fixtures:execute
```

To execute a specific fixture, run:

```shell
php bin/doctrine fixtures:execute --class=FixtureClassName
```

More details on how fixtures work can be found here: https://github.com/dotkernel/dot-data-fixtures#creating-fixtures
13 changes: 13 additions & 0 deletions docs/book/v5/installation/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Clone the project

## Recommended development environment

> If you are using Windows as OS on your machine, you can use WSL2 as development environment.
> Read more here: [PHP-Mariadb-on-WLS2](https://www.dotkernel.com/php-development/almalinux-9-in-wsl2-install-php-apache-mariadb-composer-phpmyadmin/)
Using your terminal, navigate inside the directory you want to download the project files into. Make sure that the
directory is empty before proceeding to the download process. Once there, run the following command:

```shell
git clone https://github.com/dotkernel/admin.git .
```
27 changes: 27 additions & 0 deletions docs/book/v5/installation/manage-geolite2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Manage GeoLite2 database

You can download/update a specific GeoLite2 database, by running the following command:

php bin/cli.php geoip:synchronize -d {DATABASE}

Where _{DATABASE}_ takes one of the following values: `asn`, `city`, `country`.

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

php bin/cli.php geoip:synchronize

The output should be similar to the below, displaying per
row: `database identifier`: `previous build datetime` -> `current build datetime`.

> asn: n/a -> 2021-07-01 02:09:34
>
> city: n/a -> 2021-07-01 02:09:20
>
> country: n/a -> 2021-07-01 02:05:12
Get help for this command by running:

php bin/cli.php help geoip:synchronize

**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.
43 changes: 43 additions & 0 deletions docs/book/v5/installation/test-the-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Testing (Running)

Note: **Do not enable dev mode in production**

- Run the following command in your project's directory to start PHPs built-in server:

php -S 0.0.0.0:8080 -t public

> Running command `composer serve` will do the exact same, but the above is faster.
`0.0.0.0` means that the server is open to all incoming connections
`127.0.0.1` means that the server can only be accessed locally (localhost only)
`8080` the port on which the server is started (the listening port for the server)

**NOTE:**
If you are still getting exceptions or errors regarding some missing services, try running the following command

php bin/clear-config-cache.php

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

You should see the `DotKernel admin` login page.

If you ran the migrations you will have an admin user in the database with the following credentials:

- **User**: `admin`
- **Password**: `dotadmin`

**NOTE:**

- **Production only**: Make sure you modify the default admin credentials.
- **Development only**: `session.cookie_secure` does not work locally so make sure you modify your `local.php`, as per the following:

return [
'session_config' => [
'cookie_secure' => false,
]
];

Do not change this in `local.php.dist` as well because this value should remain `true` on production.

Check failure on line 43 in docs/book/v5/installation/test-the-installation.md

View workflow job for this annotation

GitHub Actions / ci / QA Checks (Documentation Linting [8.0, latest], ubuntu-latest, laminas/laminas-continuous-integra...

Files should end with a single newline character
1 change: 1 addition & 0 deletions docs/book/v5/introduction/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DotKernel web starter package suitable for admin applications.

Check failure on line 1 in docs/book/v5/introduction/introduction.md

View workflow job for this annotation

GitHub Actions / ci / QA Checks (Documentation Linting [8.0, latest], ubuntu-latest, laminas/laminas-continuous-integra...

First line in a file should be a top-level heading [Context: "DotKernel web starter package ..."]
36 changes: 36 additions & 0 deletions docs/book/v5/introduction/server-requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Server Requirements

For production, we highly recommend a *nix based system.

## Webserver

* Apache >= 2.2 **or** Nginx
* mod_rewrite
* .htaccess support `(AllowOverride All)`

## PHP >= 8.2

Both mod_php and FCGI (FPM) are supported.

## Required Settings and Modules & Extensions

* memory_limit >= 128M
* upload_max_filesize and post_max_size >= 100M (depending on your data)
* mbstring
* CLI SAPI (for Cron Jobs)
* Composer (added to $PATH)

## RDBMS

* MariaDB >= 10.11 LTS

## Recommended extensions

* opcache
* pdo_mysql or mysqli (if using MySQL or MariaDB as RDBMS)
* dom - if working with markup files structure (html, xml, etc)
* simplexml - working with xml files
* gd, exif - if working with images
* zlib, zip, bz2 - if compessing files
* curl (required if APIs are used)
* sqlite3 - for tests
26 changes: 26 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
docs_dir: docs/book
site_dir: docs/html
extra:
project: API
current_version: v5
versions:
- v4
- v5
nav:
- Home: index.md
- v5:
- Introduction: v5/introduction/introduction.md
- Overview:
- "Server Requirements": v5/introduction/server-requirements.md
- Installation:
- "Getting Started": v5/installation/getting-started.md
- "Composer": v5/installation/composer.md
- "Configuration Files": v5/installation/configuration-files.md
- "Doctrine ORM": v5/installation/doctrine-orm.md
- "Manage Geolite2": v5/installation/manage-geolite2.md
- "Test the Installation": v5/installation/test-the-installation.md
site_name: api
site_description: "DotKernel API"
repo_url: "https://github.com/dotkernel/api"
plugins:
- search

0 comments on commit 40e7a93

Please sign in to comment.