This commit is contained in:
Alfin Afif 2025-08-22 11:04:15 +07:00
parent 15b1e8af19
commit b811249815
7 changed files with 211 additions and 411 deletions

View File

@ -1,36 +0,0 @@
stages:
- build
- deploy
variables:
IMAGE_NAME: purwakarta-diskominfo-simedkom
IMAGE_TAG: v1.0.1
CONTAINER_NAME: purwakarta-diskominfo-simedkom
DOCKER_REGISTRY: registry.mango.local
DOCKER_IMAGE_FULL_PATH: $DOCKER_REGISTRY/pratama/$IMAGE_NAME:$IMAGE_TAG
DOCKER_DRIVER: overlay2
build:
stage: build
image: docker:latest
tags:
- docker
services:
- docker:dind
script:
# - docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD $DOCKER_REGISTRY
- docker build -t $IMAGE_NAME:$IMAGE_TAG .
- docker tag $IMAGE_NAME:$IMAGE_TAG $DOCKER_IMAGE_FULL_PATH
- docker push $DOCKER_IMAGE_FULL_PATH
deploy:
stage: deploy
image: docker:latest
tags:
- docker
services:
- docker:dind
script:
- docker compose down || true
- docker compose build
- docker compose up -d --build

View File

@ -1,34 +0,0 @@
FROM dunglas/frankenphp:1.1-php8.2
ENV SERVER_NAME=:80
WORKDIR /app
# Install extension yang dibutuhkan Laravel
RUN apt-get update && apt-get install -y \
git \
unzip \
zip \
curl \
libzip-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
pkg-config \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install zip pdo pdo_mysql gd bcmath \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install composer
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer
COPY . /app
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -18,193 +18,194 @@
// }
// if(env('FILESYSTEM_DISK') === 's3'){
// if (! function_exists('store_file')) {
// function store_file($file = null, $path, $disk = null)
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (! function_exists('store_file')) {
// function store_file($file = null, $path, $disk = null)
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (filled($file) && $file instanceof \Illuminate\Http\UploadedFile) {
// $randomFilename = Str::random(35) . time() . '.' . $file->getClientOriginalExtension();
// $originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)) . '.' . $file->getClientOriginalExtension();
// if (filled($file) && $file instanceof \Illuminate\Http\UploadedFile) {
// $randomFilename = Str::random(35) . time() . '.' . $file->getClientOriginalExtension();
// $originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)) . '.' . $file->getClientOriginalExtension();
// $stored = $file->storeAs($path, $randomFilename, $disk);
// $stored = $file->storeAs($path, $randomFilename, $disk);
// if ($stored) {
// $url = Storage::disk($disk)->url($stored);
// if ($stored) {
// $url = Storage::disk($disk)->url($stored);
// return [
// 'randomFileName' => $randomFilename,
// 'originalFileName' => $originalFileName,
// 'url' => $url,
// 'isSuccess' => true,
// ];
// }
// }
// return [
// 'randomFileName' => $randomFilename,
// 'originalFileName' => $originalFileName,
// 'url' => $url,
// 'isSuccess' => true,
// ];
// }
// }
// return [
// 'randomFileName' => null,
// 'originalFileName' => null,
// 'url' => null,
// 'isSuccess' => false,
// ];
// }
// }
// return [
// 'randomFileName' => null,
// 'originalFileName' => null,
// 'url' => null,
// 'isSuccess' => false,
// ];
// }
// }
// if (!function_exists('display_file')) {
// function display_file($dir, $filename, $disk = null, $expirationMinutes = 60): string
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (!function_exists('display_file')) {
// function display_file($dir, $filename, $disk = null, $expirationMinutes = 60): string
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (!filled($filename)) {
// return '<p class="text-center">Belum ditambahkan.</p>';
// }
// if (!filled($filename)) {
// return '<p class="text-center">Belum ditambahkan.</p>';
// }
// $path = "uploads/{$dir}/{$filename}";
// $path = "uploads/{$dir}/{$filename}";
// try {
// $fileExists = is_file_exists($path, $disk);
// try {
// $fileExists = is_file_exists($path, $disk);
// if (!$fileExists) {
// return '<p class="text-center">File tidak ditemukan.</p>';
// }
// if (!$fileExists) {
// return '<p class="text-center">File tidak ditemukan.</p>';
// }
// if ($disk === 's3') {
// $fileUrl = Storage::disk($disk)->temporaryUrl($path, now()->addMinutes($expirationMinutes));
// } else {
// $fileUrl = Storage::disk($disk)->url($path);
// }
// if ($disk === 's3') {
// $fileUrl = Storage::disk($disk)->temporaryUrl($path, now()->addMinutes($expirationMinutes));
// } else {
// $fileUrl = Storage::disk($disk)->url($path);
// }
// $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
// $mimeType = match ($ext) {
// 'jpg', 'jpeg', 'png', 'gif', 'webp' => 'image/' . $ext,
// 'pdf' => 'application/pdf',
// default => 'unknown',
// };
// $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
// $mimeType = match ($ext) {
// 'jpg', 'jpeg', 'png', 'gif', 'webp' => 'image/' . $ext,
// 'pdf' => 'application/pdf',
// default => 'unknown',
// };
// if (str_contains($mimeType, 'image')) {
// return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
// } elseif ($mimeType === 'application/pdf') {
// return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
// }
// if (str_contains($mimeType, 'image')) {
// return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
// } elseif ($mimeType === 'application/pdf') {
// return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
// }
// return '<p class="text-center">Format file tidak didukung</p>';
// } catch (\Exception $e) {
// return '<p class="text-center text-danger">Terjadi kesalahan saat menampilkan file.</p>';
// }
// }
// }
// return '<p class="text-center">Format file tidak didukung</p>';
// } catch (\Exception $e) {
// return '<p class="text-center text-danger">Terjadi kesalahan saat menampilkan file.</p>';
// }
// }
// }
// if (! function_exists('delete_file')) {
// function delete_file($path, $disk = null): bool
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (! function_exists('delete_file')) {
// function delete_file($path, $disk = null): bool
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// try {
// if(is_file_exists($path)){
// return Storage::disk($disk)->delete($path);
// }else{
// return false;
// }
// } catch (\Exception $e) {
// return false;
// }
// }
// }
// try {
// if(is_file_exists($path)){
// return Storage::disk($disk)->delete($path);
// }else{
// return false;
// }
// } catch (\Exception $e) {
// return false;
// }
// }
// }
// if (!function_exists('is_file_exists')) {
// function is_file_exists($path, $disk = null): bool
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (!function_exists('is_file_exists')) {
// function is_file_exists($path, $disk = null): bool
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// try {
// $file = Storage::disk($disk)->get($path);
// return !empty($file);
// } catch (\Throwable $e) {
// return false;
// }
// }
// }
// try {
// $file = Storage::disk($disk)->get($path);
// return !empty($file);
// } catch (\Throwable $e) {
// return false;
// }
// }
// }
// }else if(env('FILESYSTEM_DISK') === 'local'){
if (! function_exists('store_file')) {
function store_file($file = null, $path, $disk = 'public')
{
if (filled($file) && $file && $file instanceof \Illuminate\Http\UploadedFile) {
$randomFilename = Str::random(35).time().'.'.$file->getClientOriginalExtension();
$originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)).'.'.$file->getClientOriginalExtension();
if (! function_exists('store_file')) {
function store_file($file = null, $path = null, $disk = 'public')
{
if (filled($file) && $file && $file instanceof \Illuminate\Http\UploadedFile) {
$randomFilename = Str::random(35) . time() . '.' . $file->getClientOriginalExtension();
$originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)) . '.' . $file->getClientOriginalExtension();
$file->storeAs($path, $randomFilename, $disk);
$file->storeAs($path, $randomFilename, $disk);
return [
'randomFileName' => $randomFilename,
'originalFileName' => $originalFileName,
'isSuccess' => true,
];
} else {
return [
'randomFileName' => null,
'originalFileName' => null,
'isSuccess' => false,
];
}
return [
'randomFileName' => $randomFilename,
'originalFileName' => $originalFileName,
'isSuccess' => true,
];
} else {
return [
'randomFileName' => null,
'originalFileName' => null,
'isSuccess' => false,
];
}
}
}
if (!function_exists('display_file')) {
function display_file($dir, $filename)
{
$path = storage_path("app/public/uploads/{$dir}/{$filename}");
if (!function_exists('display_file')) {
function display_file($dir, $filename)
{
$path = storage_path("app/public/uploads/{$dir}/{$filename}");
if(!filled($filename)){
return '<p class="text-center">Belum ditambahkan.</p>';
}
if (!file_exists($path)) {
return '<p class="text-center">File tidak ditemukan.</p>';
}
$mimeType = mime_content_type($path);
$fileUrl = asset("storage/uploads/{$dir}/{$filename}");
if (str_contains($mimeType, 'image')) {
return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
} elseif ($mimeType === 'application/pdf') {
return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
}
return '<p class="text-center">Format file tidak didukung</p>';
if (!filled($filename)) {
return '<p class="text-center">Belum ditambahkan.</p>';
}
}
if (! function_exists('delete_file')) {
function delete_file($path)
{
// Menggunakan public_path untuk file yang berada di dalam storage/public
$fullPath = public_path('storage/' . $path);
if (File::exists($fullPath)) {
File::delete($fullPath);
return true;
}
return false;
if (!file_exists($path)) {
return '<p class="text-center">File tidak ditemukan.</p>';
}
}
if (! function_exists('is_file_exists')) {
function is_file_exists($path)
{
return File::exists(public_path('storage/' . $path));
$mimeType = mime_content_type($path);
$fileUrl = asset("storage/uploads/{$dir}/{$filename}");
if (str_contains($mimeType, 'image')) {
return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
} elseif ($mimeType === 'application/pdf') {
return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
}
return '<p class="text-center">Format file tidak didukung</p>';
}
}
if (! function_exists('delete_file')) {
function delete_file($path)
{
// Menggunakan public_path untuk file yang berada di dalam storage/public
$fullPath = public_path('storage/' . $path);
if (File::exists($fullPath)) {
File::delete($fullPath);
return true;
}
return false;
}
}
if (! function_exists('is_file_exists')) {
function is_file_exists($path)
{
return File::exists(public_path('storage/' . $path));
}
}
if (!function_exists('get_role_name')) {
function get_role_name($role = null) {
function get_role_name($role = null)
{
if($role === null){
if ($role === null) {
$role = Auth::user()->role_id;
}
switch($role) {
switch ($role) {
case '1':
return "Administrator";
case '2':
@ -222,7 +223,8 @@ function get_role_name($role = null) {
}
if (!function_exists('shorten_text')) {
function shorten_text($text, $maxLength = 100) {
function shorten_text($text, $maxLength = 100)
{
if (strlen($text) > $maxLength) {
return substr($text, 0, $maxLength) . '...';
}
@ -232,7 +234,8 @@ function shorten_text($text, $maxLength = 100) {
}
if (! function_exists('is_role')) {
function is_role($roles) {
function is_role($roles)
{
if (Auth::check()) {
return in_array(Auth::user()->role_id, (array) $roles) || Auth::user()->role_id === '4';
}
@ -267,7 +270,7 @@ function idn_date($tanggal, $format = 'd F Y')
if (!function_exists('get_user_status')) {
function get_user_status($status)
{
switch($status){
switch ($status) {
case '0':
return 'Menunggu';
case '1':
@ -283,7 +286,7 @@ function get_user_status($status)
if (!function_exists('get_edit_status')) {
function get_edit_status($status)
{
switch($status){
switch ($status) {
case '0':
return 'Tidak Ada';
case '1':
@ -299,56 +302,58 @@ function get_edit_status($status)
}
if (! function_exists('get_cooperation_notif')) {
function get_cooperation_notif() {
function get_cooperation_notif()
{
$user = User::findOrFail(Auth::id());
if($user->role_id === 3){
if ($user->role_id === 3) {
$mediaId = $user->company->media->id;
$media = Media::with('cooperations')->findOrFail($mediaId);
return $media->cooperations()
->where('start_date', '<=', Carbon::now()->locale('id')->toDateString())
->where('end_date', '>=', Carbon::now()->locale('id')->toDateString())
->count();
}else{
->where('start_date', '<=', Carbon::now()->locale('id')->toDateString())
->where('end_date', '>=', Carbon::now()->locale('id')->toDateString())
->count();
} else {
return 0;
}
}
}
if (! function_exists('slugify')) {
function slugify($param) {
function slugify($param)
{
return Str::slug($param);
}
}
if (! function_exists('get_unread_announcements')) {
function get_unread_announcements() {
function get_unread_announcements()
{
$user = User::findOrFail(Auth::id());
if($user->role_id === 3){
if ($user->role_id === 3) {
$userId = $user->id;
$user = User::with('announcements')->findOrFail($userId);
return $user->announcements()
->wherePivot('status', '=', '0')
->count();
}else{
->wherePivot('status', '=', '0')
->count();
} else {
return 0;
}
}
}
if (! function_exists('display_image')) {
function display_image($name, $dir = 'defaults', $default = 'default.jpg') {
function display_image($name, $dir = 'defaults', $default = 'default.jpg')
{
$path = "uploads/{$dir}/{$name}";
$defaultPath = "assets/defaults/{$default}";
if (Storage::disk('public')->exists($path)) {
try {
if(Storage::disk('public')->get($path)){
if (Storage::disk('public')->get($path)) {
return "storage/{$path}";
}else{
} else {
return $defaultPath;
}
} catch (\Exception $e) {
@ -409,9 +414,10 @@ function get_user_agent($userAgentParam): array
}
if (! function_exists('change_status')) {
function change_status($status, $category) {
if(in_array($category, ['company_edit', 'media_edit'])){
switch($status){
function change_status($status, $category)
{
if (in_array($category, ['company_edit', 'media_edit'])) {
switch ($status) {
case '0':
return '1';
case '1':
@ -426,19 +432,21 @@ function change_status($status, $category) {
}
if (! function_exists('titlefy')) {
function titlefy($text) {
if(filled($text)){
function titlefy($text)
{
if (filled($text)) {
return Str::title($text);
}else{
} else {
return false;
}
}
}
if (!function_exists('get_activity_log_name')) {
function get_activity_log_name($name) {
function get_activity_log_name($name)
{
switch($name) {
switch ($name) {
case 'airing_proof_theme':
return [
'name' => 'Tema Bukti Tayang',

24
config/view.php Normal file
View File

@ -0,0 +1,24 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

View File

@ -1,22 +0,0 @@
services:
app:
container_name: purwakarta-diskominfo-simedkom
image: ${DOCKER_REGISTRY}/pratama/${IMAGE_NAME}:${IMAGE_TAG}
# build: .
ports:
- "8992:80"
env_file:
- slack.env
networks:
- gitlab-repo
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
networks:
gitlab-repo:
external: true

View File

@ -1,71 +0,0 @@
#!/bin/sh
cd /app
# Install dependency jika belum ada vendor/
if [ ! -d vendor ]; then
echo "Installing dependencies..."
composer install --no-interaction --prefer-dist --optimize-autoloader
fi
# Jika file .env tidak ada, copy dari slack.env
if [ ! -f .env ]; then
echo "Copying slack.env to .env"
cp slack.env .env
fi
php artisan cache:table
php artisan migrate
# Generate app key jika belum ada
if ! grep -q "APP_KEY=" .env || [ -z "$(php artisan key:generate --show 2>/dev/null)" ]; then
echo "Generating app key..."
php artisan key:generate
fi
# echo "Generating app key..."
# php artisan key:generate
# # Cek apakah database sudah terhubung
# if ! php artisan migrate:status > /dev/null 2>&1; then
# echo "Database connection failed. Please check your .env file."
# exit 1
# fi
# # Cek apakah optimize sudah bersih
# if ! php artisan optimize:clear > /dev/null 2>&1; then
# echo "Clearing optimize..."
# php artisan optimize:clear || {
# echo "Optimize clear failed. Please check your Laravel setup."
# exit 1
# }
# fi
# Cek apakah config sudah bersih
# if ! php artisan config:clear > /dev/null 2>&1; then
# echo "Clearing config cache..."
# php artisan config:clear || {
# echo "Config clear failed. Please check your Laravel setup."
# exit 1
# }
# fi
# Cek apakah route sudah bersih
# if ! php artisan route:clear > /dev/null 2>&1; then
# echo "Clearing route cache..."
# php artisan route:clear || {
# echo "Route clear failed. Please check your Laravel setup."
# exit 1
# }
# fi
# Jalankan migrasi
echo "Running migrations..."
#php artisan migrate --force || true
php artisan migrate:fresh --seed --force || true
echo "Seeding database..."
php artisan db:seed --force || true
# Start server
echo "Starting Laravel server..."
exec frankenphp php-server --root public

View File

@ -1,69 +0,0 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:PfCPtSPUU+C+slwgUm0TeUzy4sOcDslf0QEYtMt56bs=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=10.10.30.253
DB_PORT=3306
DB_DATABASE=simedkom
DB_USERNAME=simedkom
DB_PASSWORD=l2d7YsJm1EdWT4GvDk6B1URpLAm0Bu9h
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
S3_ACCESS_KEY=GCLSD4PCBWV9JJ09X6KB
S3_SECRET_KEY=+ABULfHK6uJ2nUQnymfQtxyssrZmCpGp6uSz7o3b
S3_REGION=pratama-live
S3_BUCKET_NAME=purwakarta-diskominfo-simedkom
S3_ENDPOINT_URL=http://s3.pratama.live
AWS_USE_PATH_STYLE_ENDPOINT=true
VITE_APP_NAME="${APP_NAME}"
RECAPTCHA_SITE_KEY=6Lcy9uEoAAAAALWxQu-0kuS_YAjGpDVpdk1FxPL8
RECAPTCHA_SECRET_KEY=6Lcy9uEoAAAAAIc54Fi8fPEbbJ9kYi9odkmUfdNy