Giter Site home page Giter Site logo

spiral / app-keeper Goto Github PK

View Code? Open in Web Editor NEW
46.0 10.0 7.0 4.97 MB

Skeleton Application on Spiral Framework: Keeper Admin Panel

License: MIT License

PHP 30.09% Hack 55.07% JavaScript 6.88% Dockerfile 0.94% Batchfile 0.42% Shell 2.56% SCSS 0.86% TypeScript 0.76% HTML 0.02% CSS 2.29% Makefile 0.11%
spiral php keeper

app-keeper's Introduction

Spiral Framework

Rapid Admin Panel Application Skeleton Latest Stable Version

Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components. The Framework execution model based on a hybrid runtime where some services (GRPC, Queue, WebSockets, etc.) handled by Application Server RoadRunner and the PHP code of your application stays in memory permanently (anti-memory leak tools included).

App Skeleton (CLI, GRPC) | Documentation | Twitter | CHANGELOG | Contributing


Server Requirements

Make sure that your server is configured with following PHP version and extensions:

  • PHP 8.0+, 64bit
  • mb-string extension
  • PDO Extension with desired database drivers (default SQLite)
  • For FrontEnd build yarn and nodejs are required.

Application Bundle

Application bundle includes the following components:

  • High-performance HTTP, HTTP/2 server based on RoadRunner
  • Console commands via Symfony/Console
  • Translation support by Symfony/Translation
  • Queue support for AMQP, Beanstalk, Amazon SQS, in-Memory
  • Stempler template engine
  • Security, validation, filter models
  • PSR-7 HTTP pipeline, session, encrypted cookies
  • DBAL and migrations support
  • Monolog, Dotenv
  • Prometheus metrics
  • Cycle DataMapper ORM
  • Keeper Admin panel

Demo Screenshot

Keeper Demo

Installation

composer create-project spiral/app-keeper --stability dev
cd app-keeper
yarn && yarn build

Application server will be downloaded automatically (php-curl and php-zip required).

Once the application is installed you can ensure that it was configured properly by executing:

$ php app.php configure -vv

Migrate the database:

$ php app.php migrate:init
$ php app.php migrate

Seed user accounts:

$ php app.php user:seed

Create super admin account:

$ php app.php user:create {First-Name} {Last-Name} {email-address} {password}

To start application server execute:

$ ./rr serve -d

On Windows:

$ ./rr.exe serve -d

Application will be available on http://localhost:8080. Keeper control panel available at http://localhost:8080/keeper.

Read more about application server configuration here. Make sure to turn DEBUG off in .env to enable view caching.

Testing:

To test an application:

$ ./vendor/bin/phpunit

Cloning:

Make sure to properly configure project if you cloned the existing repository.

$ copy .env.sample .env
$ composer install
$ php app.php encrypt:key -m .env
$ php app.php configure -vv
$ php app.php migrate:init
$ php app.php migrate
$ ./vendor/bin/rr get
$ yarn build

Make sure to create super-admin account.

Docker:

Requirements: Docker engine 19.03.0+

To launch Keeper in Docker create env file if needed.

    copy .env.sample .env

Build and run for Linux and MacOS

./dockerInit.sh

Build and run for Windows

./dockerInit.bat

It will build a local container, configure encryption key and set up Sqlite database.

Docker scenarios

In this repository you can find several docker-compose files, you can use them in combination to handle different scenarios.

You can launch Spiral application with Roadrunner in one container and frontend build with Nginx in another (it will serve static files and proxy dynamic requests to application container). No file sync, no worker reload: will work with the code version you have on the moment of container build on http://localhost:8080

docker-compose -f docker-compose.yml up -d

Or just

docker-compose up -d

Docker local development

For local development you would like file changes to appear in a container, and make Roadrunner workers to re-launch with updated code.

docker-compose -f docker-compose.yml -f docker-compose-local.yml up -d

Make sure you have vendor directory copied on host machine in this case, otherwise you'll mount code without vendor and autoload into a container and it will not work. You can do it like this:

docker-compose up -d
docker cp keeper:/var/www/vendor .
docker-compose -f docker-compose.yml -f docker-compose-local.yml up -d

Custom Frontend Build

For local development add one more docker compose file to sync local files into Nginx container:

docker-compose -f docker-compose.yml -f docker-compose-custom-front-local.yml up  -d

In this case you will need to run yarn build locally to create frontend build, otherwise empty directory public/generated will be mounted in nginx container

Frontend local development is supported in 2 modes:

1. Watch mode.

Launch yarn watch to watch ./front directory for changes and recompile them on go. Refresh page to see changes.

2. Hot reload mode.

Set up env variable FRONT_END_PUBLIC_URL to point at local server URL, this package is configured to use http://localhost:3030 Change scripts in webpack and server folders to change that.

After that launch yarn start. This will start dev server at http://localhost:3030

If you are seeing 404 on your scripts, ensure they are included like so

    @if(env('FRONT_END_PUBLIC_URL'))
        <script type="text/javascript" src="{{ env('FRONT_END_PUBLIC_URL') }}/generated/keeper.js"></script>
    @endif
    @if(!env('FRONT_END_PUBLIC_URL'))
        <script type="text/javascript" src="/generated/keeper.js"></script>
    @endif

Local development for both frontend and backend

To enable all file sync you'll need all docker-compose files at once:

docker-compose -f docker-compose.yml -f docker-compose-local.yml -f docker-compose-custom-front-local.yml up  -d

License:

MIT License (MIT). Please see LICENSE for more information. Maintained by Spiral Scout.

app-keeper's People

Contributors

alexndr-novikov avatar andrewkirkovski avatar anlamas avatar butschster avatar dependabot[bot] avatar evgenybarinov avatar msmakouz avatar serafimarts avatar vvval avatar wolfy-j avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

app-keeper's Issues

Database related errors in app.

php app.php configure -vv has error:
• keeper:bundle: syntax error, unexpected 'elements' (T_STRING), expecting '[' at line 10 [27 ms]

After creating sqlite file with proper schema, php app.php user:seed command has error:
[App\Service\Exception\PersistException] Unable to persist entity

And if I run app, i've got:
Spiral\Views\Exception\RenderException: Unable to find Entity role for repository Spiral\Writeaway\Repository\PieceRepository in /var/www/spiral/app-keeper/vendor/spiral/framework/src/Framework/Cycle/RepositoryInjector.php at line 56 • caused by Cycle\ORM\Exception\ORMException: Unable to find Entity role for repository Spiral\Writeaway\Repository\PieceRepository in /var/www/spiral/app-keeper/vendor/spiral/framework/src/Framework/Cycle/RepositoryInjector.php at line 56
Here is full screen:

Error screenshot

app_error

app-keeper incompatible with PHP 8 because of writeaway

Command composer create-project spiral/app-keeper --stability dev with PHP8 causes the following:

bash$ composer create-project spiral/app-keeper --stability dev
Creating a "spiral/app-keeper" project at "./app-keeper"
Installing spiral/app-keeper (dev-master 9c911c0cad5504463dca2cef83d040ddde98acf9)
  - Syncing spiral/app-keeper (dev-master 9c911c0) into cache
  - Installing spiral/app-keeper (dev-master 9c911c0): Cloning 9c911c0cad from cache
Created project in /Users/aleksandrnovikov/spiral/spiral2021/app-keeper
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires spiral/writeaway ^0.3 -> satisfiable by spiral/writeaway[v0.3.0].
    - spiral/writeaway v0.3.0 requires php ^7.4 -> your php version (8.0.0) does not satisfy that requirement.
  Problem 2
    - spiral/helpers[v1.0.0, ..., v1.0.1] require php ^7.1 -> your php version (8.0.0) does not satisfy that requirement.
    - Root composer.json requires spiral/helpers ^1.0 -> satisfiable by spiral/helpers[v1.0.0, v1.0.1].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.