Skip to content

Commit

Permalink
Support of Lunar 1.x (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
lguichard authored Jul 5, 2024
1 parent 0bc35d8 commit 84eaf3c
Show file tree
Hide file tree
Showing 105 changed files with 1,167 additions and 6,426 deletions.
71 changes: 71 additions & 0 deletions .env.docker.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
APP_NAME=DemoStore
APP_ENV=local
APP_KEY=base64:xXSJ4LcR6e/0M6o8eK6RGhkbPT1W9UNmY6PP5UK+q0w=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=demostore
DB_USERNAME=demostore
DB_PASSWORD=password

ADMIN_FIRSTNAME=admin
ADMIN_LASTNAME=admin
[email protected]
ADMIN_PASSWORD=password

## Laravel media disk
FILESYSTEM_DISK=public
## Spatie media disk
MEDIA_DISK=public
## Filament system disk
FILAMENT_FILESYSTEM_DISK=public

BROADCAST_DRIVER=log
CACHE_DRIVER=redis
QUEUE_CONNECTION=sync
SESSION_DRIVER=redis
SESSION_LIFETIME=120

REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SCOUT_DRIVER=meilisearch
SCOUT_PREFIX='demostore_'
MEILISEARCH_PORT=7700
MEILISEARCH_HOST=http://meilisearch:${MEILISEARCH_PORT}
MEILISEARCH_KEY=jyjW99LxM28kG4
MEILISEARCH_UI_PORT=7701

STRIPE_KEY=
STRIPE_SECRET=
27 changes: 22 additions & 5 deletions .env.lando.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=laravel

ADMIN_FIRSTNAME=admin
ADMIN_LASTNAME=admin
[email protected]
ADMIN_PASSWORD=password

## Laravel media disk
FILESYSTEM_DISK=public
## Spatie media disk
MEDIA_DISK=public
## Filament system disk
FILAMENT_FILESYSTEM_DISK=public

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
CACHE_DRIVER=redis
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=cache
REDIS_PASSWORD=null
REDIS_PORT=6379
Expand Down Expand Up @@ -51,4 +60,12 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SCOUT_DRIVER=database_index
SCOUT_DRIVER=meilisearch
SCOUT_PREFIX='demostore_'
MEILISEARCH_PORT=7700
MEILISEARCH_HOST=http://meilisearch:${MEILISEARCH_PORT}
MEILISEARCH_KEY=jyjW99LxM28kG4
MEILISEARCH_UI_PORT=7701

STRIPE_KEY=
STRIPE_SECRET=
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/node_modules
/public/hot
/public/css/filament
/public/css/awcodes
/public/css/lunarphp
/public/js/filament
/public/js/app/components
/public/storage
/storage/*.key
/vendor
Expand All @@ -15,3 +20,9 @@ yarn-error.log
/.vscode
.DS_Store
.lando.local.yml
composer.lock
package-lock.json
yarn.lock
config/lunar
public/build
meilisearch/
24 changes: 22 additions & 2 deletions .lando.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
name: demostore
recipe: laravel

config:
webroot: public
php: '8.0'
php: '8.2'
via: nginx
cache: redis
xdebug: false

services:
database:
portforward: 3306

meilisearch:
type: compose
app_mount: false
services:
image: getmeili/meilisearch:latest
command: tini -- /bin/sh -c /bin/meilisearch
ports:
- '7700'
volumes:
- meilisearch:/meili_data
volumes:
meilsearch:

mailhog:
type: mailhog
portforward: true
hogfrom:
- appserver

node:
type: node:16
type: node:20

tooling:
npm:
service: node
14 changes: 0 additions & 14 deletions .styleci.yml

This file was deleted.

61 changes: 61 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
ARG PHP_VERSION=8.2
ARG COMPOSER_VERSION=2.4

### COMPOSER ###
FROM composer:${COMPOSER_VERSION} AS composer

### PHP-FPM ###
FROM php:${PHP_VERSION}-fpm-alpine AS php-fpm

WORKDIR /var/www

COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
COPY --from=ghcr.io/shyim/gnu-libiconv:v3.14 /gnu-libiconv-1.15-r3.apk /gnu-libiconv-1.15-r3.apk

RUN apk add --no-cache \
unzip \
wget \
sudo \
bash \
sudo \
supervisor \
npm \
aws-cli

RUN apk add --no-cache --allow-untrusted /gnu-libiconv-1.15-r3.apk
RUN rm /gnu-libiconv-1.15-r3.apk
RUN install-php-extensions \
bcmath \
gd \
intl \
mysqli \
pdo_mysql \
curl \
dom \
fileinfo \
filter \
hash \
mbstring \
openssl \
pcre \
session \
xml \
redis \
opcache \
zip \
exif

RUN export COMPOSER_PROCESS_TIMEOUT=9000

COPY docker/php-fpm/dev/php.ini $PHP_INI_DIR/php.ini

# SETUP PHP-FPM CONFIG SETTINGS (max_children / max_requests)
RUN echo 'pm.max_children = 15' >> /usr/local/etc/php-fpm.d/zz-docker.conf && \
echo 'pm.max_requests = 500' >> /usr/local/etc/php-fpm.d/zz-docker.conf

COPY ./docker/php-fpm/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint

ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,25 @@ This repository is provided as a reference to learn how to use Lunar Laravel E-C
# Installation

For full installation instructions please visit https://docs.lunarphp.io/core/starter-kits.html

## Installation with Docker

> Make sure you have Docker installed on your local machine.
### Environment Demo store

You can execute it via the `docker compose up` command in your favorite terminal.
Please note that the speed of building images and initializing containers depends on your local machine and internet connection - it may take some time.

```bash
cp .env.docker.example .env
docker-compose up
```

The demo store will be available to `http://localhost` in your browser.

#### Log into Lunar panel

Once the project is prepared, the Lunar panel will start and available to `http://localhost/lunar`.

Default admin user is username `[email protected]` and password `password`
8 changes: 2 additions & 6 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@ class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @return void
*/
protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

Expand Down
22 changes: 1 addition & 21 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@

class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];

/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed to the session on validation exceptions.
*
Expand All @@ -38,10 +20,8 @@ class Handler extends ExceptionHandler

/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests, ValidatesRequests;
}
11 changes: 6 additions & 5 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,27 @@ class Kernel extends HttpKernel

'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
* The application's middleware aliases.
* *
* * Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
Expand Down
Loading

0 comments on commit 84eaf3c

Please sign in to comment.