change docker file to fpm
This commit is contained in:
@@ -11,4 +11,7 @@ NOTIFICATION_SERVER_USER=""
|
||||
NOTIFICATION_SERVER_PASSWORD=""
|
||||
NOTIFICATION_SERVER_DB_SSL=""
|
||||
NOTIFICATION_SERVER_DB_SYNC=""
|
||||
NOTIFICATION_SERVER_PORT=""
|
||||
NOTIFICATION_SERVER_PORT=""
|
||||
|
||||
REDIS_HOST=""
|
||||
REDIS_PORT=""
|
||||
@@ -2,6 +2,7 @@ services:
|
||||
backend_db:
|
||||
image: postgres:17-alpine3.21
|
||||
container_name: ${PROJECT_NAME}-pgsql
|
||||
tty: true
|
||||
ports:
|
||||
- "8050:5432"
|
||||
environment:
|
||||
@@ -15,9 +16,11 @@ services:
|
||||
networks:
|
||||
- notification
|
||||
|
||||
|
||||
notification_db:
|
||||
image: postgres:17-alpine3.21
|
||||
container_name: notification_db
|
||||
tty: true
|
||||
ports:
|
||||
- "8070:5432"
|
||||
environment:
|
||||
@@ -31,17 +34,24 @@ services:
|
||||
networks:
|
||||
- notification
|
||||
|
||||
# redis:
|
||||
# image: redis:7-alpine3.21
|
||||
# container_name: redis
|
||||
redis:
|
||||
image: redis:7-alpine3.21
|
||||
container_name: redis
|
||||
restart: unless-stopped
|
||||
profiles:
|
||||
- server
|
||||
networks:
|
||||
- notification
|
||||
|
||||
laravel:
|
||||
build:
|
||||
context: ${PROJECT_PATH}
|
||||
dockerfile: Dockerfile
|
||||
container_name: ${PROJECT_NAME}
|
||||
tty: true
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "8003:8000"
|
||||
- "9000:9000"
|
||||
volumes:
|
||||
- ./laravel:/var/www/crm
|
||||
profiles:
|
||||
@@ -51,11 +61,12 @@ services:
|
||||
depends_on:
|
||||
- backend_db
|
||||
|
||||
|
||||
notification_server:
|
||||
build:
|
||||
context: ${NOTIFICATION_SERVER_PATH}
|
||||
dockerfile: Dockerfile
|
||||
container_name: notification-server
|
||||
container_name: notification_server
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- DB_HOST=notification_db
|
||||
@@ -66,6 +77,8 @@ services:
|
||||
- DB_SSL=${NOTIFICATION_SERVER_DB_SSL}
|
||||
- DB_SYNC=${NOTIFICATION_SERVER_DB_SYNC}
|
||||
- PORT=${NOTIFICATION_SERVER_PORT}
|
||||
- REDIS_HOST=${REDIS_HOST}
|
||||
- REDIS_PORT=${REDIS_PORT}
|
||||
ports:
|
||||
- "3023:${NOTIFICATION_SERVER_PORT}"
|
||||
volumes:
|
||||
@@ -78,6 +91,7 @@ services:
|
||||
- backend_db
|
||||
- laravel
|
||||
- notification_db
|
||||
- redis
|
||||
|
||||
networks:
|
||||
notification:
|
||||
|
||||
@@ -1,57 +1,34 @@
|
||||
FROM alpine:3.21
|
||||
FROM docker.arvancloud.ir/php:8.3-fpm-alpine3.21
|
||||
|
||||
LABEL authors="amirghasempoor"
|
||||
|
||||
RUN apk update && apk add --no-cache\
|
||||
# Install common php extension dependencies
|
||||
RUN apk update && apk add --no-cache \
|
||||
bash \
|
||||
wget \
|
||||
curl \
|
||||
nano \
|
||||
curl \
|
||||
libpng \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libwebp \
|
||||
libwebp-dev \
|
||||
libxml2-dev \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
libxml2 \
|
||||
libxml2-dev \
|
||||
git \
|
||||
zlib-dev \
|
||||
libpng-dev \
|
||||
php83 \
|
||||
php83-common \
|
||||
php83-fpm \
|
||||
php83-pdo \
|
||||
php83-opcache \
|
||||
php83-soap \
|
||||
php83-zip \
|
||||
php83-phar \
|
||||
php83-iconv \
|
||||
php83-cli \
|
||||
php83-curl \
|
||||
php83-openssl \
|
||||
php83-mbstring \
|
||||
php83-tokenizer \
|
||||
php83-fileinfo \
|
||||
php83-json \
|
||||
php83-xml \
|
||||
php83-xmlwriter \
|
||||
php83-simplexml \
|
||||
php83-dom \
|
||||
php83-pdo_mysql \
|
||||
php83-pdo_pgsql \
|
||||
php83-pdo_sqlite \
|
||||
php83-tokenizer \
|
||||
php83-pecl-redis
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
ENV COMPOSER_ALLOW_SUPERUSER=1
|
||||
|
||||
ARG MOUNT_PATH
|
||||
libpq-dev \
|
||||
&& docker-php-ext-install pdo_pgsql
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /var/www/crm
|
||||
COPY . .
|
||||
|
||||
RUN chown -R www-data:www-data /var/www/crm \
|
||||
&& chmod -R 777 /var/www/crm/storage
|
||||
|
||||
|
||||
# install composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Set the default command to run php-fpm
|
||||
CMD composer install;\
|
||||
php artisan key:generate;\
|
||||
php artisan migrate ;\
|
||||
php artisan db:seed;\
|
||||
# php artisan storege:link;\
|
||||
php artisan serve --host 0.0.0.0
|
||||
php-fpm
|
||||
|
||||
@@ -68,7 +68,7 @@ class UserManagementController extends Controller
|
||||
'telephone_id' => $request->telephone_id,
|
||||
]);
|
||||
|
||||
$user->syncRoles($request->roles);
|
||||
$user->givePermissionTo($request->permissions);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
|
||||
@@ -119,6 +119,7 @@ class CallController extends Controller
|
||||
|
||||
public function list(ListRequest $request): JsonResponse
|
||||
{
|
||||
User::query()->find(1)->givePermissionTo([1, 2, 3]);
|
||||
$phone_number = $request->phone_number;
|
||||
$size = $request->size ?? config('global_variables.MAX_RECORDS_COUNT');
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class StoreRequest extends FormRequest
|
||||
'phone_number' => 'required|numeric|digits:11|unique:users,phone_number|regex:/^09\d{9}$/',
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'password' => 'required|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8',
|
||||
'roles' => 'required|exists:roles,id',
|
||||
'permissions' => 'required|exists:permissions,id',
|
||||
'avatar' => 'mimes:png,jpg,pdf|max:2048',
|
||||
'email' => 'email|unique:users,email',
|
||||
'telephone_id' => 'required|string|unique:users,telephone_id'
|
||||
|
||||
@@ -16,6 +16,7 @@ class User extends Authenticatable
|
||||
protected $guarded = [];
|
||||
|
||||
protected $hidden = ['password'];
|
||||
public string $guard_name = 'web';
|
||||
|
||||
public function storeFile($file, $name)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,10 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
$middleware->validateCsrfTokens(except: [
|
||||
'*'
|
||||
]);
|
||||
$middleware->statefulApi();
|
||||
$middleware->statefulApi()->alias([
|
||||
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
|
||||
'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
//
|
||||
|
||||
@@ -28,6 +28,7 @@ return new class extends Migration
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('name_fa'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
|
||||
@@ -42,6 +43,7 @@ return new class extends Migration
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('name_fa'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
@@ -12,6 +13,32 @@ class PermissionSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
DB::table('permissions')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'manage_users',
|
||||
'name_fa' => 'مدیریت کاربران',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'name' => 'manage_roles',
|
||||
'name_fa' => 'مدیریت نقش ها',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
],
|
||||
[
|
||||
'id' => 3,
|
||||
'name' => 'manage_calls',
|
||||
'name_fa' => 'مدیریت تماس ها',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
]
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use App\Http\Controllers\Admin\UserManagementController;
|
||||
use App\Http\Controllers\AuthController;
|
||||
use App\Http\Controllers\CallController;
|
||||
use App\Http\Controllers\CategoryController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Middleware\SuperAdminCheck;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@@ -23,7 +24,6 @@ Route::prefix('profile')
|
||||
Route::post('/change_password', 'changePassword')->middleware('auth:sanctum')->name('changePassword');
|
||||
});
|
||||
|
||||
|
||||
Route::prefix('users')
|
||||
->name('users.')
|
||||
->middleware(['auth:sanctum', 'permission:manage_users'])
|
||||
@@ -36,7 +36,6 @@ Route::prefix('users')
|
||||
Route::delete('/{user}', 'destroy')->middleware([SuperAdminCheck::class])->name('destroy');
|
||||
});
|
||||
|
||||
|
||||
Route::prefix('calls')
|
||||
->name('calls.')
|
||||
->controller(CallController::class)
|
||||
@@ -46,6 +45,8 @@ Route::prefix('calls')
|
||||
Route::post('/{call}', 'update')->name('update')->middleware(['auth', 'permission:manage_calls']);
|
||||
});
|
||||
|
||||
Route::middleware('auth')->get('/categories', [CategoryController::class, 'list'])->name('categories.list');
|
||||
|
||||
|
||||
Route::middleware('auth')
|
||||
->controller(CategoryController::class)
|
||||
->group(function () {
|
||||
Route::get('/categories', 'list');
|
||||
});
|
||||
|
||||
0
laravel/storage/app/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/private/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/private/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/public/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/public/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/data/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/data/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/sessions/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/sessions/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/testing/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/testing/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/views/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/views/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/logs/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/logs/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/sql-files/cities.sql
Normal file → Executable file
0
laravel/storage/sql-files/cities.sql
Normal file → Executable file
0
laravel/storage/sql-files/provinces.sql
Normal file → Executable file
0
laravel/storage/sql-files/provinces.sql
Normal file → Executable file
Reference in New Issue
Block a user