DONE: use ip for frontend but point to domain for api
This commit is contained in:
@@ -64,10 +64,9 @@ jobs:
|
|||||||
IMAGE="git.koppkb.com/kopkb/qms-fe-admin"
|
IMAGE="git.koppkb.com/kopkb/qms-fe-admin"
|
||||||
TAGS="-t ${IMAGE}:${{ gitea.sha }}"
|
TAGS="-t ${IMAGE}:${{ gitea.sha }}"
|
||||||
API_URL="${{ secrets.VITE_API_URL }}"
|
API_URL="${{ secrets.VITE_API_URL }}"
|
||||||
CUSTOMER_URL="${{ secrets.VITE_CUSTOMER_APP_URL }}"
|
|
||||||
|
|
||||||
if [ -z "${API_URL}" ]; then
|
if [ -z "${API_URL}" ]; then
|
||||||
echo "ERROR: Set Gitea secret VITE_API_URL (e.g. http://YOUR_SERVER_IP:8080)"
|
echo "ERROR: Set Gitea secret VITE_API_URL (e.g. https://qms-api.erahn.com.my)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -76,10 +75,10 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building and pushing admin: ${TAGS}"
|
echo "Building and pushing admin: ${TAGS}"
|
||||||
|
echo "VITE_API_URL=${API_URL}"
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform linux/amd64 \
|
--platform linux/amd64 \
|
||||||
--build-arg VITE_API_URL="${API_URL}" \
|
--build-arg VITE_API_URL="${API_URL}" \
|
||||||
--build-arg VITE_CUSTOMER_APP_URL="${CUSTOMER_URL:-http://localhost:3000}" \
|
|
||||||
--cache-from type=registry,ref=${IMAGE}:buildcache,ignore-error=true \
|
--cache-from type=registry,ref=${IMAGE}:buildcache,ignore-error=true \
|
||||||
--cache-to type=registry,ref=${IMAGE}:buildcache,mode=max \
|
--cache-to type=registry,ref=${IMAGE}:buildcache,mode=max \
|
||||||
-f fe/web/admin-app/Dockerfile \
|
-f fe/web/admin-app/Dockerfile \
|
||||||
@@ -110,7 +109,7 @@ jobs:
|
|||||||
API_URL="${{ secrets.VITE_API_URL }}"
|
API_URL="${{ secrets.VITE_API_URL }}"
|
||||||
|
|
||||||
if [ -z "${API_URL}" ]; then
|
if [ -z "${API_URL}" ]; then
|
||||||
echo "ERROR: Set Gitea secret VITE_API_URL (e.g. http://YOUR_SERVER_IP:8080)"
|
echo "ERROR: Set Gitea secret VITE_API_URL (e.g. https://qms-api.erahn.com.my)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -155,7 +154,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${API_URL}" ]; then
|
if [ -z "${API_URL}" ]; then
|
||||||
echo "ERROR: Set Gitea secret NEXT_PUBLIC_API_URL or VITE_API_URL (e.g. http://YOUR_SERVER_IP:8080)"
|
echo "ERROR: Set Gitea secret NEXT_PUBLIC_API_URL or VITE_API_URL (e.g. https://qms-api.erahn.com.my)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
# Host ports (change these if they collide on your single server)
|
# Host ports (change these if they collide on your single server)
|
||||||
BACKEND_HOST_PORT=8080
|
BACKEND_HOST_PORT=8080
|
||||||
# MySQL is internal-only (not published to the host)
|
# Published for DBeaver/tools (container still uses 3306 internally)
|
||||||
|
MYSQL_HOST_PORT=3307
|
||||||
|
|
||||||
# MySQL
|
# MySQL
|
||||||
# Quote if the password contains special chars like ; # $
|
# Quote if the password contains special chars like ; # $
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
# Host ports (change these if they collide on your single server)
|
# Host ports (change these if they collide on your single server)
|
||||||
BACKEND_HOST_PORT=8080
|
BACKEND_HOST_PORT=8080
|
||||||
# MySQL is internal-only (not published to the host)
|
# Published for DBeaver/tools (container still uses 3306 internally)
|
||||||
|
MYSQL_HOST_PORT=3307
|
||||||
|
|
||||||
# MySQL
|
# MySQL
|
||||||
MYSQL_ROOT_PASSWORD="R8qjjBJDg9NtL2IwcnoFMkn8pktwAZ;wsl"
|
MYSQL_ROOT_PASSWORD="R8qjjBJDg9NtL2IwcnoFMkn8pktwAZ;wsl"
|
||||||
|
|||||||
+11
-3
@@ -3,15 +3,23 @@ services:
|
|||||||
image: mysql:8
|
image: mysql:8
|
||||||
container_name: qms-mysql
|
container_name: qms-mysql
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# Do not publish 3306 to the host — avoids clashes with host MySQL.
|
ports:
|
||||||
# Backend reaches it as hostname "mysql" on the internal Docker network.
|
- "${MYSQL_HOST_PORT:-3307}:3306"
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}
|
||||||
MYSQL_DATABASE: ${MYSQL_DATABASE:-qms}
|
MYSQL_DATABASE: ${MYSQL_DATABASE:-qms}
|
||||||
volumes:
|
volumes:
|
||||||
- qms-mysql-data:/var/lib/mysql
|
- qms-mysql-data:/var/lib/mysql
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${MYSQL_ROOT_PASSWORD:-password}"]
|
test:
|
||||||
|
[
|
||||||
|
"CMD",
|
||||||
|
"mysqladmin",
|
||||||
|
"ping",
|
||||||
|
"-h",
|
||||||
|
"localhost",
|
||||||
|
"-p${MYSQL_ROOT_PASSWORD:-password}",
|
||||||
|
]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Host ports (used until nginx terminates TLS on 443)
|
||||||
|
ADMIN_HOST_PORT=5000
|
||||||
|
TELLER_HOST_PORT=3001
|
||||||
|
CUSTOMER_HOST_PORT=3000
|
||||||
|
|
||||||
|
# Domains — also set these as Gitea secrets, then rebuild FE images
|
||||||
|
# VITE_API_URL / NEXT_PUBLIC_API_URL = https://qms-api.erahn.com.my
|
||||||
|
# VITE_CUSTOMER_APP_URL = https://qms-customer.erahn.com.my
|
||||||
|
VITE_API_URL=https://qms-api.erahn.com.my
|
||||||
|
VITE_CUSTOMER_APP_URL=https://qms-customer.erahn.com.my
|
||||||
|
NEXT_PUBLIC_API_URL=https://qms-api.erahn.com.my
|
||||||
|
|
||||||
|
# Public app URLs (reference for nginx / bookmarks)
|
||||||
|
# ADMIN: https://qms-admin.erahn.com.my
|
||||||
|
# TELLER: https://qms-teller.erahn.com.my
|
||||||
|
# CUSTOMER: https://qms-customer.erahn.com.my
|
||||||
|
# API: https://qms-api.erahn.com.my
|
||||||
|
|
||||||
|
# Runtime (customer Next.js server)
|
||||||
|
QR_TOKEN_SECRET=qms-branch-qr-v1
|
||||||
|
|
||||||
|
# Registry images (used by compose / deploy)
|
||||||
|
ADMIN_IMAGE=git.koppkb.com/kopkb/qms-fe-admin
|
||||||
|
TELLER_IMAGE=git.koppkb.com/kopkb/qms-fe-teller
|
||||||
|
CUSTOMER_IMAGE=git.koppkb.com/kopkb/qms-fe-customer
|
||||||
|
IMAGE_TAG=local
|
||||||
+2
-7
@@ -1,17 +1,12 @@
|
|||||||
# Host ports (change if they collide on the single server)
|
|
||||||
ADMIN_HOST_PORT=5000
|
ADMIN_HOST_PORT=5000
|
||||||
TELLER_HOST_PORT=3001
|
TELLER_HOST_PORT=3001
|
||||||
CUSTOMER_HOST_PORT=3000
|
CUSTOMER_HOST_PORT=3000
|
||||||
|
|
||||||
# Baked into images at build time (set matching Gitea secrets too)
|
VITE_API_URL=https://qms-api.erahn.com.my
|
||||||
VITE_API_URL=http://YOUR_SERVER_IP:8080
|
NEXT_PUBLIC_API_URL=https://qms-api.erahn.com.my
|
||||||
VITE_CUSTOMER_APP_URL=http://YOUR_SERVER_IP:3000
|
|
||||||
NEXT_PUBLIC_API_URL=http://YOUR_SERVER_IP:8080
|
|
||||||
|
|
||||||
# Runtime (customer Next.js server)
|
|
||||||
QR_TOKEN_SECRET=qms-branch-qr-v1
|
QR_TOKEN_SECRET=qms-branch-qr-v1
|
||||||
|
|
||||||
# Registry images (used by compose / deploy)
|
|
||||||
ADMIN_IMAGE=git.koppkb.com/kopkb/qms-fe-admin
|
ADMIN_IMAGE=git.koppkb.com/kopkb/qms-fe-admin
|
||||||
TELLER_IMAGE=git.koppkb.com/kopkb/qms-fe-teller
|
TELLER_IMAGE=git.koppkb.com/kopkb/qms-fe-teller
|
||||||
CUSTOMER_IMAGE=git.koppkb.com/kopkb/qms-fe-customer
|
CUSTOMER_IMAGE=git.koppkb.com/kopkb/qms-fe-customer
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
# Host ports (change if they collide on the single server)
|
|
||||||
ADMIN_HOST_PORT=5000
|
ADMIN_HOST_PORT=5000
|
||||||
TELLER_HOST_PORT=3001
|
TELLER_HOST_PORT=3001
|
||||||
CUSTOMER_HOST_PORT=3000
|
CUSTOMER_HOST_PORT=3000
|
||||||
|
|
||||||
VITE_API_URL=http://172.16.6.200:8080
|
VITE_API_URL=https://qms-api.erahn.com.my
|
||||||
VITE_CUSTOMER_APP_URL=http://172.16.6.200:3000
|
NEXT_PUBLIC_API_URL=https://qms-api.erahn.com.my
|
||||||
NEXT_PUBLIC_API_URL=http://172.16.6.200:8080
|
|
||||||
|
|
||||||
# Runtime (customer Next.js server)
|
|
||||||
QR_TOKEN_SECRET=qms-branch-qr-v1
|
QR_TOKEN_SECRET=qms-branch-qr-v1
|
||||||
|
|
||||||
# Registry images (used by compose / deploy)
|
|
||||||
ADMIN_IMAGE=git.koppkb.com/kopkb/qms-fe-admin
|
ADMIN_IMAGE=git.koppkb.com/kopkb/qms-fe-admin
|
||||||
TELLER_IMAGE=git.koppkb.com/kopkb/qms-fe-teller
|
TELLER_IMAGE=git.koppkb.com/kopkb/qms-fe-teller
|
||||||
CUSTOMER_IMAGE=git.koppkb.com/kopkb/qms-fe-customer
|
CUSTOMER_IMAGE=git.koppkb.com/kopkb/qms-fe-customer
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
VITE_API_URL=https://qms-api.erahn.com.my
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Baked into the admin image at build time (Gitea secret VITE_API_URL)
|
||||||
|
VITE_API_URL=https://qms-api.erahn.com.my
|
||||||
@@ -3,9 +3,7 @@ FROM node:20-bookworm AS build
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ARG VITE_API_URL=http://localhost:8080
|
ARG VITE_API_URL=http://localhost:8080
|
||||||
ARG VITE_CUSTOMER_APP_URL=http://localhost:3000
|
|
||||||
ENV VITE_API_URL=$VITE_API_URL
|
ENV VITE_API_URL=$VITE_API_URL
|
||||||
ENV VITE_CUSTOMER_APP_URL=$VITE_CUSTOMER_APP_URL
|
|
||||||
|
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
export const SERVER_URL =
|
export const SERVER_URL = import.meta.env.VITE_API_URL;
|
||||||
import.meta.env.VITE_API_URL ?? 'http://localhost:8080';
|
|
||||||
|
|
||||||
export const CUSTOMER_APP_URL =
|
export const CUSTOMER_APP_URL = 'https://qms-customer.erahn.com.my';
|
||||||
import.meta.env.VITE_CUSTOMER_APP_URL ?? 'http://localhost:3000';
|
|
||||||
|
|
||||||
export const ROLES = {
|
export const ROLES = {
|
||||||
ROLE_SUPER_ADMIN : "ROLE_SUPER_ADMIN",
|
ROLE_SUPER_ADMIN: 'ROLE_SUPER_ADMIN',
|
||||||
ROLE_BRANCH_ADMIN : "ROLE_BRANCH_ADMIN"
|
ROLE_BRANCH_ADMIN: 'ROLE_BRANCH_ADMIN',
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
VITE_API_URL: ${VITE_API_URL:-http://localhost:8080}
|
VITE_API_URL: ${VITE_API_URL:-http://localhost:8080}
|
||||||
VITE_CUSTOMER_APP_URL: ${VITE_CUSTOMER_APP_URL:-http://localhost:3000}
|
|
||||||
container_name: qms-fe-admin
|
container_name: qms-fe-admin
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user