Changes
This commit is contained in:
@@ -28,9 +28,6 @@ RUN apt-get update && apt-get install -y zlib1g-dev libicu-dev g++
|
||||
RUN docker-php-ext-configure intl
|
||||
RUN docker-php-ext-install intl
|
||||
|
||||
# Установка Supervisor
|
||||
RUN apt-get update && apt-get install -y supervisor
|
||||
|
||||
# Копирование конфигурационного файла PHP
|
||||
COPY ./_docker/app/php.ini /usr/local/etc/php/conf.d/php.ini
|
||||
|
||||
@@ -38,8 +35,6 @@ COPY ./_docker/app/php.ini /usr/local/etc/php/conf.d/php.ini
|
||||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
||||
RUN apt-get install -y nodejs npm
|
||||
|
||||
# Копирование конфигурации Supervisor
|
||||
COPY ./_docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
EXPOSE 6001
|
||||
EXPOSE 5173
|
||||
@@ -50,3 +45,4 @@ RUN curl -sS https://getcomposer.org/installer | php -- \
|
||||
--install-dir=/usr/local/bin
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
server {
|
||||
client_max_body_size 200M;
|
||||
large_client_header_buffers 8 256k;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
large_client_header_buffers 4 128k;
|
||||
|
||||
|
||||
root /var/www/public;
|
||||
location / {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
FROM php:8.2-fpm
|
||||
|
||||
# Установка Supervisor и необходимых пакетов
|
||||
RUN apt-get update && \
|
||||
apt-get install -y supervisor curl gnupg2 && \
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Копирование конфигурации Supervisor
|
||||
COPY ./_docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Установка рабочего каталога
|
||||
WORKDIR /var/www
|
||||
|
||||
EXPOSE 13714
|
||||
|
||||
|
||||
# Команда для запуска Supervisor
|
||||
CMD ["/usr/bin/supervisord"]
|
||||
@@ -1,7 +1,7 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:laravel-worker]
|
||||
[program:laravel-queue]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php /var/www/artisan queue:work --sleep=3 --tries=3
|
||||
autostart=true
|
||||
@@ -9,14 +9,12 @@ autorestart=true
|
||||
user=www-data
|
||||
numprocs=1
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/var/www/storage/logs/worker.log
|
||||
stdout_logfile=/var/www/storage/logs/queue.log
|
||||
|
||||
[program:inertia-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
[program:inertia-ssr]
|
||||
command=php /var/www/artisan inertia:start-ssr
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=www-data
|
||||
numprocs=1
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/var/www/storage/logs/inertia-worker.log
|
||||
stdout_logfile=/var/www/storage/logs/inertia-ssr.log
|
||||
|
||||
@@ -60,10 +60,11 @@ class PostResource extends Resource implements HasShieldPermissions
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('title')->label('Заголовок')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('status')->label('Статус')->badge()
|
||||
])->defaultSort('created_at', 'desc')
|
||||
Tables\Columns\TextColumn::make('title')->label('Заголовок')->searchable(),
|
||||
Tables\Columns\TextColumn::make('status')->label('Статус')->badge(),
|
||||
Tables\Columns\TextColumn::make('publish_at')->sortable(),
|
||||
|
||||
])->defaultSort('publish_at', 'desc')
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
|
||||
@@ -61,8 +61,11 @@ class CreatePost extends CreateRecord
|
||||
if ($rowData === null) {
|
||||
$rowData = $this->getFirstBlockByName('paragraph', $data['content']);
|
||||
}
|
||||
if ($rowData !== null) {
|
||||
$description = strip_tags($rowData['data']['content']);
|
||||
$image = ($data['preview'] !== null) ? $data['preview'] : null;
|
||||
} else {
|
||||
$description = null;
|
||||
} $image = ($data['preview'] !== null) ? $data['preview'] : null;
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
|
||||
@@ -24,6 +24,7 @@ class EditPost extends EditRecord
|
||||
$this->seoData = $this->generateSeo($data);
|
||||
$this->publicationAgreements = $data['publication'];
|
||||
unset($data['publication']);
|
||||
unset($data['publish_setting']);
|
||||
$data['preview_text'] = $this->setPreviewText($data);
|
||||
$data['publish_at'] = $this->setPublishDateTime($data['status'], $this->record->publish_at);
|
||||
$data['search_data'] = $this->generateSearchData($data['content']);
|
||||
@@ -38,14 +39,19 @@ class EditPost extends EditRecord
|
||||
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, Carbon::parse($this->record->publish_at)->timestamp);
|
||||
}
|
||||
|
||||
private function setPreviewText(array $data) : string
|
||||
private function setPreviewText(array $data) : string|null
|
||||
{
|
||||
$rowData = $this->getBlockBySeoActiveState('paragraph', $data['content']);
|
||||
if ($rowData === null) {
|
||||
$rowData = $this->getFirstBlockByName('paragraph', $data['content']);
|
||||
}
|
||||
if ($rowData !== null) {
|
||||
$preview_text = strip_tags($rowData['data']['content']);
|
||||
return Str::limit($preview_text, 160);
|
||||
} else {
|
||||
$preview_text = null;
|
||||
return $preview_text;
|
||||
}
|
||||
}
|
||||
|
||||
private function getBlockBySeoActiveState(string $name, array $content) : array|null
|
||||
@@ -72,7 +78,11 @@ class EditPost extends EditRecord
|
||||
if ($rowData === null) {
|
||||
$rowData = $this->getFirstBlockByName('paragraph', $data['content']);
|
||||
}
|
||||
if ($rowData !== null) {
|
||||
$description = strip_tags($rowData['data']['content']);
|
||||
} else {
|
||||
$description = null;
|
||||
}
|
||||
$image = ($this->record->preview !== null) ? $this->record->preview : null;
|
||||
|
||||
return [
|
||||
|
||||
@@ -58,7 +58,7 @@ class PostFactory extends Factory
|
||||
'reading_time' => $reading_time,
|
||||
'category_id' => $category_id,
|
||||
'user_id' => $user_id,
|
||||
'publish_at' => ($status == PostStatus::PUBLISHED) ? now() : null,
|
||||
'publish_at' => ($status === PostStatus::PUBLISHED) ? now() : null,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
];
|
||||
|
||||
+5
-1
@@ -20,7 +20,10 @@ services:
|
||||
container_name: ntspi-php
|
||||
ports:
|
||||
- '5173'
|
||||
command: ["/usr/bin/supervisord"]
|
||||
depends_on:
|
||||
- db
|
||||
command: >
|
||||
sh -c "php artisan inertia:start-ssr & php-fpm"
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
@@ -35,3 +38,4 @@ services:
|
||||
- MYSQL_PASSWORD=secret
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
||||
|
||||
+493
-493
File diff suppressed because it is too large
Load Diff
@@ -81,7 +81,7 @@
|
||||
</Link>
|
||||
</li>
|
||||
<li class="text-sm">
|
||||
<Link :href="$inertia.page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-blue-600">
|
||||
<Link :href="$page.props.ziggy.location" class="flex items-center text-gray-500 hover:text-blue-600">
|
||||
{{ postTitle }}
|
||||
</Link>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user