fix: COPY init.sql into DB image, remove Next.js basePath for Traefik prefix stripping
This commit is contained in:
+3
-2
@@ -37,7 +37,9 @@ services:
|
||||
|
||||
# 3. MySQL Database Service
|
||||
db:
|
||||
image: mysql:8.0
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/db/Dockerfile
|
||||
container_name: gis_db
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
# No host port mapping - DB is only accessible internally via gis-network
|
||||
@@ -46,7 +48,6 @@ services:
|
||||
- MYSQL_DATABASE=spbu_db
|
||||
volumes:
|
||||
- db-data:/var/lib/mysql
|
||||
- ./docker/db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
networks:
|
||||
- gis-network
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
FROM mysql:8.0
|
||||
|
||||
# Copy the SQL initialization script into the MySQL entrypoint directory.
|
||||
# MySQL will automatically run all .sql files here on first startup (when data volume is empty).
|
||||
COPY docker/db/init.sql /docker-entrypoint-initdb.d/init.sql
|
||||
+4
-3
@@ -429,10 +429,11 @@
|
||||
window.location.hostname === '127.0.0.1' ||
|
||||
window.location.hostname.endsWith('.test')
|
||||
) {
|
||||
nextjsLink.href = 'http://localhost:3000/sistem-km-next';
|
||||
nextjsLink.href = 'http://localhost:3000';
|
||||
} else {
|
||||
// In production/campus server deployment, use the relative subfolder path
|
||||
nextjsLink.href = './sistem-km-next';
|
||||
// In production (Coolify): Traefik routes /sistem-km-next -> next-app container.
|
||||
// next-app now serves at root /, so we use the path-based URL on this same host.
|
||||
nextjsLink.href = window.location.origin + '/sistem-km-next';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
basePath: '/sistem-km-next',
|
||||
/* config options here */
|
||||
// basePath removed: Coolify's Traefik strips the /sistem-km-next prefix before
|
||||
// forwarding to this container, so Next.js must respond at root /.
|
||||
// The Traefik path /sistem-km-next -> container / mapping handles routing.
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ export default function Dashboard() {
|
||||
|
||||
const fetchUsers = async () => {
|
||||
try {
|
||||
const res = await fetch('/sistem-km-next/api/users');
|
||||
const res = await fetch('/api/users');
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
setUsersList(data.users || []);
|
||||
@@ -123,7 +123,7 @@ export default function Dashboard() {
|
||||
e.preventDefault();
|
||||
setIsSubmittingUser(true);
|
||||
try {
|
||||
const res = await fetch('/sistem-km-next/api/users', {
|
||||
const res = await fetch('/api/users', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(userFormData)
|
||||
@@ -149,7 +149,7 @@ export default function Dashboard() {
|
||||
onConfirm: async () => {
|
||||
setConfirmDialog(null);
|
||||
try {
|
||||
const res = await fetch(`/sistem-km-next/api/users?id=${id}`, { method: 'DELETE' });
|
||||
const res = await fetch(`/api/users?id=${id}`, { method: 'DELETE' });
|
||||
if (res.ok) {
|
||||
showToastNotification('Pengguna berhasil dihapus!');
|
||||
fetchUsers();
|
||||
@@ -171,7 +171,7 @@ export default function Dashboard() {
|
||||
onConfirm: async () => {
|
||||
setConfirmDialog(null);
|
||||
try {
|
||||
const res = await fetch(`/sistem-km-next/api/hubs?id=${id}`, { method: 'DELETE' });
|
||||
const res = await fetch(`/api/hubs?id=${id}`, { method: 'DELETE' });
|
||||
if (res.ok) {
|
||||
showToastNotification('Rumah ibadah dan akun terikat berhasil dihapus!');
|
||||
fetchData();
|
||||
@@ -541,7 +541,7 @@ const [isEditMode, setIsEditMode] = useState(false);
|
||||
setHouseholds(formattedHh);
|
||||
} else {
|
||||
setHouseholds([]);
|
||||
fetch('/sistem-km-next/api/stats')
|
||||
fetch('/api/stats')
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (!isMountedRef.current) return;
|
||||
|
||||
Reference in New Issue
Block a user