first commit

This commit is contained in:
sbb45
2026-06-02 20:35:48 +05:00
parent d6441abdd2
commit b81ab27553
11 changed files with 649 additions and 380 deletions
+12
View File
@@ -0,0 +1,12 @@
.git
.env
.env.*
node_modules
vendor
storage/logs/*
storage/framework/cache/*
storage/framework/sessions/*
storage/framework/views/*
public/build
*.md
.DS_Store
+19 -46
View File
@@ -1,59 +1,32 @@
APP_NAME=Laravel
APP_ENV=local
APP_NAME=AirService
APP_ENV=production
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_DEBUG=false
APP_URL=https://example.ru
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
LOG_CHANNEL=stderr
LOG_LEVEL=error
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_DATABASE=airservice
DB_USERNAME=airservice
DB_PASSWORD=
DB_ROOT_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_DRIVER=database
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
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_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# S3 (опционально, если нужно хранение файлов)
# FILESYSTEM_DISK=s3
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=
# AWS_DEFAULT_REGION=us-east-1
# AWS_BUCKET=airservice
# AWS_ENDPOINT=http://10.20.0.40:8333
# AWS_USE_PATH_STYLE_ENDPOINT=true
+42
View File
@@ -0,0 +1,42 @@
# Stage 1: build frontend assets
FROM node:20-alpine AS frontend
WORKDIR /app
COPY package*.json ./
RUN npm ci --no-audit
COPY . .
RUN npm run build
# Stage 2: PHP-FPM app
FROM php:8.2-fpm-alpine AS app
WORKDIR /var/www/html
RUN apk add --no-cache \
libpng-dev libjpeg-turbo-dev freetype-dev libzip-dev \
zip unzip git mysql-client
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo pdo_mysql gd zip opcache pcntl
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY docker/php/php.ini $PHP_INI_DIR/conf.d/app.ini
COPY . .
COPY --from=frontend /app/public/build ./public/build
RUN composer install --no-dev --optimize-autoloader --no-interaction
RUN chown -R www-data:www-data storage bootstrap/cache \
&& chmod -R 775 storage bootstrap/cache
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 9000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
# Stage 3: nginx with baked-in static assets
FROM nginx:1.27-alpine AS web
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=app /var/www/html/public /var/www/html/public
+107 -45
View File
@@ -1,66 +1,128 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
# AirService
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
Система управления заявками на техническое обслуживание (Service Desk). Сотрудники создают заявки, назначают приоритеты и отслеживают статус выполнения.
## About Laravel
**Стек:** Laravel 10, Livewire, Tailwind CSS, MySQL, Vite
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
---
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
## Локальная разработка
Laravel is accessible, powerful, and provides tools required for large, robust applications.
**Требования:** PHP >= 8.2, Composer, Node.js >= 18, MySQL
## Learning Laravel
```bash
git clone <repo-url>
cd AirService
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
composer install
npm install
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
cp .env.example .env
# Поменять APP_ENV=local, APP_DEBUG=true, APP_URL=http://localhost
# Поменять DB_HOST=127.0.0.1, DB_USERNAME=root, убрать DB_ROOT_PASSWORD
php artisan key:generate
php artisan migrate --seed
```
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
Запустить в двух терминалах:
## Laravel Sponsors
```bash
# Терминал 1
php artisan serve
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
# Терминал 2
npm run dev
```
### Premium Partners
Приложение: [http://127.0.0.1:8000](http://127.0.0.1:8000)
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**
---
## Contributing
## Деплой на сервер (flamy / docker-runtime)
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
**Требования:** Docker, Docker Compose на `docker-runtime` (`10.20.0.20`).
## Code of Conduct
### 1. Скопировать проект на сервер
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
```bash
ssh -i /root/.ssh/docker_vm_ed25519 crimson@10.20.0.20
sudo mkdir -p /opt/docker-apps/airservice
```
## Security Vulnerabilities
Скопировать файлы (с локальной машины):
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
```bash
rsync -avz --exclude='.git' --exclude='node_modules' --exclude='vendor' \
./ crimson@10.20.0.20:/opt/docker-apps/airservice/
```
## License
### 2. Создать `.env` на сервере
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
```bash
cd /opt/docker-apps/airservice
cp .env.example .env
nano .env
```
Обязательно заполнить:
```env
APP_KEY= # php artisan key:generate --show
APP_URL=https://your-domain.ru
DB_PASSWORD= # придумать
DB_ROOT_PASSWORD= # придумать
```
### 3. Запустить
```bash
docker compose up -d --build
docker compose ps
docker compose logs -f --tail=100
```
Проверить локально на сервере:
```bash
curl -I http://10.20.0.20:18201
```
### 4. Открыть домен через Caddy (edge-proxy)
```bash
ssh -i /root/.ssh/edge_vm_ed25519 crimson@192.168.0.80
sudo nano /etc/caddy/Caddyfile
```
Добавить блок:
```caddyfile
http://www.your-domain.ru, https://www.your-domain.ru {
redir https://your-domain.ru{uri} 308
}
your-domain.ru {
encode zstd gzip
reverse_proxy 10.20.0.20:18201 {
header_up Host {host}
header_up X-Real-IP {remote_host}
}
}
```
```bash
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
```
---
## Структура Docker-сервисов
| Сервис | Описание |
|--------------------|-----------------------------------|
| `airservice_app` | PHP-FPM (Laravel) |
| `airservice_nginx` | nginx, публикует порт `18201` |
| `airservice_mysql` | MySQL 8.0, только внутри сети |
| `airservice_queue` | Queue worker (`queue:work`) |
Generated
+302 -287
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -59,7 +59,7 @@ return [
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
(PHP_VERSION_ID >= 80400 ? \Pdo\Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
+101
View File
@@ -0,0 +1,101 @@
name: airservice
services:
app:
build:
context: .
dockerfile: Dockerfile
target: app
container_name: airservice_app
restart: unless-stopped
env_file:
- .env
expose:
- "9000"
volumes:
- storage_uploads:/var/www/html/storage/app/public
- storage_logs:/var/www/html/storage/logs
networks:
- backend
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "php-fpm -t 2>&1 | grep -q 'successful' && echo ok || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
queue:
build:
context: .
dockerfile: Dockerfile
target: app
container_name: airservice_queue
restart: unless-stopped
env_file:
- .env
command: ["php", "artisan", "queue:work", "--sleep=3", "--tries=3", "--max-time=3600"]
volumes:
- storage_uploads:/var/www/html/storage/app/public
- storage_logs:/var/www/html/storage/logs
networks:
- backend
depends_on:
app:
condition: service_healthy
mysql:
image: mysql:8.0
container_name: airservice_mysql
restart: unless-stopped
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_USER: ${DB_USERNAME}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
expose:
- "3306"
volumes:
- mysql_data:/var/lib/mysql
networks:
- backend
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-u", "root", "--password=${DB_ROOT_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
nginx:
build:
context: .
dockerfile: Dockerfile
target: web
container_name: airservice_nginx
restart: unless-stopped
ports:
- "10.20.0.20:18201:80"
volumes:
- storage_uploads:/var/www/html/public/storage:ro
networks:
- backend
depends_on:
app:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/health || exit 1"]
interval: 30s
timeout: 5s
retries: 5
start_period: 10s
networks:
backend:
driver: bridge
volumes:
mysql_data:
storage_uploads:
storage_logs:
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
set -e
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
exec "$@"
+17
View File
@@ -0,0 +1,17 @@
[PHP]
display_errors = Off
log_errors = On
error_log = /proc/self/fd/2
max_execution_time = 60
max_input_time = 60
memory_limit = 256M
post_max_size = 64M
upload_max_filesize = 64M
[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 10000
opcache.validate_timestamps = 0
opcache.save_comments = 1
+38
View File
@@ -0,0 +1,38 @@
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php;
client_max_body_size 64m;
location = /health {
access_log off;
return 200 "ok\n";
add_header Content-Type text/plain;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.(css|js|mjs|png|jpg|jpeg|gif|webp|svg|ico|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, immutable";
try_files $uri =404;
access_log off;
}
location ~ \.php$ {
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
fastcgi_read_timeout 60;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "computer-service",
"name": "AirService",
"lockfileVersion": 3,
"requires": true,
"packages": {