Compare commits
13
Commits
f06a8fc205
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
341faec48b | ||
|
|
077c9a6253 | ||
|
|
811f9ee741 | ||
|
|
04d48abc85 | ||
|
|
e7932a2239 | ||
|
|
018ec9a694 | ||
|
|
674941939c | ||
|
|
2e4315dc68 | ||
|
|
17604e5f80 | ||
|
|
b924b0ea8e | ||
|
|
f62fd389b7 | ||
|
|
28c13399f4 | ||
|
|
97bd62fd47 |
@@ -0,0 +1,70 @@
|
|||||||
|
name: CI/CD Pipeline to Rancher - SIDATA
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# ============================================================
|
||||||
|
# Checkout
|
||||||
|
# ============================================================
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Login Registry
|
||||||
|
# ============================================================
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: registry-bpkd.drc-bpkd.data-center.id
|
||||||
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Build & Push
|
||||||
|
# ============================================================
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
registry-bpkd.drc-bpkd.data-center.id/${{ secrets.REGISTRY_USER }}/sidata:latest
|
||||||
|
registry-bpkd.drc-bpkd.data-center.id/${{ secrets.REGISTRY_USER }}/sidata:${{ gitea.sha }}
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Deploy ke Rancher
|
||||||
|
# ============================================================
|
||||||
|
- name: Deploy to Rancher Cluster
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "=== Download kubectl ==="
|
||||||
|
|
||||||
|
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
|
||||||
|
|
||||||
|
curl -fLO \
|
||||||
|
"https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
|
||||||
|
|
||||||
|
chmod +x kubectl
|
||||||
|
|
||||||
|
echo "kubectl version:"
|
||||||
|
./kubectl version --client
|
||||||
|
|
||||||
|
echo "=== Configure Rancher Kubeconfig ==="
|
||||||
|
|
||||||
|
./kubectl config set-cluster rancher-cluster \
|
||||||
|
--server="${{ secrets.RANCHER_URL }}/k8s/clusters/${{ secrets.RANCHER_CLUSTER_ID }}" \
|
||||||
|
--insecure-skip-tls-verify=true
|
||||||
|
|
||||||
|
./kubectl config set-credentials rancher-user \
|
||||||
|
--token="${{ secrets.RANCHER_TOKEN }}"
|
||||||
|
|
||||||
|
./
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/node_modules
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/public/uploadFiles
|
||||||
|
/public/downloadFiles
|
||||||
|
/storage/*.key
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.phpunit.result.cache
|
||||||
|
docker-compose.override.yml
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
/.idea
|
||||||
|
/.vscode
|
||||||
+80
-87
@@ -1,88 +1,81 @@
|
|||||||
FROM 10.15.39.186:8083/php74-fpm-oci8-lengkap:1.0
|
FROM registry-nexus-bpkd.drc-bpkd.data-center.id/php74-fpm-oci8-lengkap:1.0
|
||||||
|
|
||||||
ARG http_proxy
|
ARG http_proxy
|
||||||
ARG https_proxy
|
ARG https_proxy
|
||||||
|
|
||||||
ENV http_proxy=${http_proxy}
|
ENV http_proxy=${http_proxy}
|
||||||
ENV https_proxy=${https_proxy}
|
ENV https_proxy=${https_proxy}
|
||||||
ENV HTTP_PROXY=${http_proxy}
|
ENV HTTP_PROXY=${http_proxy}
|
||||||
ENV HTTPS_PROXY=${https_proxy}
|
ENV HTTPS_PROXY=${https_proxy}
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
# System dependencies & Extensions
|
# System dependencies & Extensions
|
||||||
# =========================================================
|
# =========================================================
|
||||||
|
|
||||||
RUN echo "deb [trusted=yes] http://10.15.39.186:8081/repository/debian-proxy/ bullseye main" > /etc/apt/sources.list \
|
RUN echo "deb [trusted=yes] http://10.15.39.186:8081/repository/debian-proxy/ bullseye main" > /etc/apt/sources.list \
|
||||||
&& echo "deb [trusted=yes] http://10.15.39.186:8081/repository/debian-proxy/ bullseye-updates main" >> /etc/apt/sources.list \
|
&& echo "deb [trusted=yes] http://10.15.39.186:8081/repository/debian-proxy/ bullseye-updates main" >> /etc/apt/sources.list \
|
||||||
&& rm -rf /etc/apt/sources.list.d/* \
|
&& rm -rf /etc/apt/sources.list.d/* \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
nginx \
|
nginx \
|
||||||
redis-server \
|
redis-server \
|
||||||
procps \
|
procps \
|
||||||
vim \
|
vim \
|
||||||
wget \
|
wget \
|
||||||
curl \
|
curl \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
libjpeg-dev \
|
libjpeg-dev \
|
||||||
libfreetype6-dev \
|
libfreetype6-dev \
|
||||||
libzip-dev \
|
libzip-dev \
|
||||||
libaio1 \
|
libaio1 \
|
||||||
libaio-dev \
|
libaio-dev \
|
||||||
unzip \
|
unzip \
|
||||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
&& docker-php-ext-install gd pdo pdo_mysql zip \
|
&& docker-php-ext-install gd pdo pdo_mysql zip \
|
||||||
&& curl --noproxy "*" -fsSL http://10.15.39.186:8081/repository/raw-assets/storage/app/uploads/redis-5.3.7.tgz -o redis.tgz \
|
&& curl --noproxy "*" -fsSL http://10.15.39.186:8081/repository/raw-assets/storage/app/uploads/redis-5.3.7.tgz -o redis.tgz \
|
||||||
&& pecl install redis.tgz \
|
&& pecl install redis.tgz \
|
||||||
&& docker-php-ext-enable redis \
|
&& docker-php-ext-enable redis \
|
||||||
&& rm -f redis.tgz \
|
&& rm -f redis.tgz \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
# Salin source code aplikasi
|
# Salin source code aplikasi
|
||||||
COPY . /var/www/html
|
COPY . /var/www/html
|
||||||
|
|
||||||
# Buat file .env dari .env.example jika .env belum ada di repositori
|
# Buat file .env dari .env.example jika .env belum ada di repositori
|
||||||
RUN if [ ! -f .env ]; then \
|
RUN if [ ! -f .env ]; then \
|
||||||
if [ -f .env.example ]; then \
|
if [ -f .env.example ]; then \
|
||||||
cp .env.example .env; \
|
cp .env.example .env; \
|
||||||
else \
|
else \
|
||||||
echo "APP_NAME=Sidata\nAPP_ENV=production\nAPP_KEY=\nAPP_DEBUG=true\nAPP_URL=https://dashboard-bpkd.drc-bpkd.data-center.id/sidata" > .env; \
|
echo "APP_NAME=Sidata\nAPP_ENV=production\nAPP_KEY=\nAPP_DEBUG=true\nAPP_URL=https://dashboard-bpkd.drc-bpkd.data-center.id/sidata" > .env; \
|
||||||
fi \
|
fi \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Atur hak akses folder web, storage, dan cache Laravel
|
# Atur hak akses folder web, storage, dan cache Laravel
|
||||||
RUN chown -R www-data:www-data /var/www/html \
|
RUN chown -R www-data:www-data /var/www/html \
|
||||||
&& chmod -R 775 /var/www/html/storage \
|
&& chmod -R 775 /var/www/html/storage \
|
||||||
&& chmod -R 775 /var/www/html/bootstrap/cache
|
&& chmod -R 775 /var/www/html/bootstrap/cache
|
||||||
|
|
||||||
# Konfigurasi Nginx presisi untuk subpath /sidata dan PHP-FPM
|
# Konfigurasi Nginx Standar Laravel (Merespons di Root /)
|
||||||
RUN echo 'server { \
|
RUN echo 'server { \
|
||||||
listen 80; \
|
listen 80; \
|
||||||
index index.php index.html; \
|
index index.php index.html; \
|
||||||
root /var/www/html/public; \
|
root /var/www/html/public; \
|
||||||
\
|
\
|
||||||
location /sidata { \
|
location / { \
|
||||||
try_files $uri $uri/ /sidata/index.php?$query_string; \
|
try_files $uri $uri/ /index.php?$query_string; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
location / { \
|
location ~ \.php$ { \
|
||||||
try_files $uri $uri/ /index.php?$query_string; \
|
fastcgi_pass 127.0.0.1:9000; \
|
||||||
} \
|
fastcgi_index index.php; \
|
||||||
\
|
include fastcgi_params; \
|
||||||
location ~ \.php$ { \
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; \
|
||||||
fastcgi_pass 127.0.0.1:9000; \
|
} \
|
||||||
fastcgi_index index.php; \
|
}' > /etc/nginx/sites-available/default
|
||||||
include fastcgi_params; \
|
|
||||||
fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php; \
|
EXPOSE 80
|
||||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name; \
|
|
||||||
} \
|
# Script startup: Buat .env dari variabel environment Helm, lalu jalankan service
|
||||||
}' > /etc/nginx/sites-available/default
|
|
||||||
|
|
||||||
# ... (bagian atas Dockerfile tetap sama) ...
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
# Script startup: Buat .env dari variabel environment Helm jika .env belum ada, lalu jalankan service
|
|
||||||
CMD ["sh", "-c", "env | grep -E '^(APP_|DB_|MYSQL_|ORA_|REDIS_|MAIL_|SESSION_|SOA_)' > /var/www/html/.env && redis-server --daemonize yes && php-fpm -D && exec nginx -g 'daemon off;'"]
|
CMD ["sh", "-c", "env | grep -E '^(APP_|DB_|MYSQL_|ORA_|REDIS_|MAIL_|SESSION_|SOA_)' > /var/www/html/.env && redis-server --daemonize yes && php-fpm -D && exec nginx -g 'daemon off;'"]
|
||||||
@@ -16,7 +16,7 @@ class Authenticate extends Middleware
|
|||||||
{
|
{
|
||||||
if (! $request->expectsJson()) {
|
if (! $request->expectsJson()) {
|
||||||
// Paksa redirect membawa prefix /sidata agar tidak terlempar ke root domain
|
// Paksa redirect membawa prefix /sidata agar tidak terlempar ke root domain
|
||||||
return url('/sidata/login');
|
return redirect()->guest(route('login'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,22 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class TrustProxies extends Middleware
|
class TrustProxies extends Middleware
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The trusted proxies for this application.
|
|
||||||
*
|
|
||||||
* @var array|string|null
|
|
||||||
*/
|
|
||||||
protected $proxies = '*';
|
protected $proxies = '*';
|
||||||
|
|
||||||
/**
|
protected $headers = [
|
||||||
* The headers that should be used to detect proxies.
|
\Illuminate\Http\Request::HEADER_X_FORWARDED_ALL,
|
||||||
*
|
];
|
||||||
* @var int
|
}
|
||||||
*/
|
|
||||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const HOME = '/sidata/home';
|
public const HOME = '/home';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The controller namespace for the application.
|
* The controller namespace for the application.
|
||||||
|
|||||||
Submodule
+1
Submodule gitea-test added at 6b0ee8ee4b
@@ -6,4 +6,4 @@
|
|||||||
# spec:
|
# spec:
|
||||||
# stripPrefix:
|
# stripPrefix:
|
||||||
# prefixes:
|
# prefixes:
|
||||||
# - /sidata
|
# - /sidataprod
|
||||||
@@ -13,14 +13,16 @@ service:
|
|||||||
|
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
className: nginx
|
className: traefik
|
||||||
annotations:
|
annotations:
|
||||||
# HAPUS rewrite-target agar URL /sidata diteruskan utuh ke Pod
|
traefik.ingress.kubernetes.io/router.middlewares: sidata-prod-fix-sidata-prefix@kubernetescrd
|
||||||
# Nginx di dalam Pod kita sudah punya 'location /sidata'
|
traefik.ingress.kubernetes.io/service.sticky.cookie: "true"
|
||||||
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
traefik.ingress.kubernetes.io/service.sticky.cookie.name: SIDATA_STICKY
|
||||||
host: dashboard-bpkd.drc-bpkd.data-center.id
|
hosts:
|
||||||
path: /sidata
|
- host: dashboard-bpkd.drc-bpkd.data-center.id
|
||||||
pathType: Prefix
|
paths:
|
||||||
|
- path: /sidata
|
||||||
|
pathType: Prefix
|
||||||
|
|
||||||
env:
|
env:
|
||||||
APP_NAME: "SIDATA"
|
APP_NAME: "SIDATA"
|
||||||
|
|||||||
Vendored
Executable → Regular
Vendored
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Reference in New Issue
Block a user