mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-21 23:35:09 +00:00
KAN-63: fix maria db user ip issue after rebuild
This commit is contained in:
parent
8454c000f3
commit
c5db3f0a0d
4 changed files with 120 additions and 21 deletions
|
|
@ -70,7 +70,7 @@ docker compose exec backend bench new-site academy.local \
|
||||||
docker compose exec backend bench --site academy.local install-app lms
|
docker compose exec backend bench --site academy.local install-app lms
|
||||||
|
|
||||||
# Install the AI Tutor Chat app
|
# Install the AI Tutor Chat app
|
||||||
docker compose exec backend bench --site academy.local install-app academy_ai_tutor_chat
|
docker compose exec backend bench --site academy.local install-app ai_tutor_chat
|
||||||
|
|
||||||
# Set the site as default
|
# Set the site as default
|
||||||
docker compose exec backend bench use academy.local
|
docker compose exec backend bench use academy.local
|
||||||
|
|
@ -111,6 +111,32 @@ This means the image hasn't been built yet. Either:
|
||||||
|
|
||||||
Ensure your `.env` file exists and contains all required variables. Use `.env.example` as reference.
|
Ensure your `.env` file exists and contains all required variables. Use `.env.example` as reference.
|
||||||
|
|
||||||
|
### Cannot access the site / 404 errors on assets
|
||||||
|
|
||||||
|
If you see 404 errors for CSS/JS files:
|
||||||
|
|
||||||
|
1. **Rebuild assets**:
|
||||||
|
```bash
|
||||||
|
docker compose exec backend bench --site academy.local build
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Clear cache**:
|
||||||
|
```bash
|
||||||
|
docker compose exec backend bench --site academy.local clear-cache
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Set current site**:
|
||||||
|
```bash
|
||||||
|
docker compose exec backend sh -c "echo 'academy.local' > /home/frappe/frappe-bench/sites/currentsite.txt"
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Restart services**:
|
||||||
|
```bash
|
||||||
|
docker compose restart backend frontend nginx-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Hard refresh your browser** (Ctrl+F5 or Cmd+Shift+R)
|
||||||
|
|
||||||
### Cannot access the site
|
### Cannot access the site
|
||||||
|
|
||||||
1. Check if all services are running: `docker compose ps`
|
1. Check if all services are running: `docker compose ps`
|
||||||
|
|
@ -122,6 +148,26 @@ Ensure your `.env` file exists and contains all required variables. Use `.env.ex
|
||||||
1. Ensure MariaDB is fully started before creating sites
|
1. Ensure MariaDB is fully started before creating sites
|
||||||
2. Check the password in `.env` matches what you use in commands
|
2. Check the password in `.env` matches what you use in commands
|
||||||
|
|
||||||
|
### LangChain service errors (student_ai_profiles table missing)
|
||||||
|
|
||||||
|
If you get errors about missing database tables in the LangChain service:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create the required tables
|
||||||
|
docker compose exec langchain-service sh -c "cd /app && PYTHONPATH=/app python app/create_tables.py"
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create all necessary tables including:
|
||||||
|
- `student_ai_profiles`
|
||||||
|
- `chat_conversations`
|
||||||
|
- `chat_messages`
|
||||||
|
|
||||||
|
### Login issues
|
||||||
|
|
||||||
|
Default credentials after site creation:
|
||||||
|
- Username: `Administrator`
|
||||||
|
- Password: The password you set with `--admin-password` flag
|
||||||
|
|
||||||
## Stopping the services
|
## Stopping the services
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
52
compose.yaml
52
compose.yaml
|
|
@ -19,23 +19,6 @@ x-backend-defaults: &backend_defaults
|
||||||
- langchain-network
|
- langchain-network
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Nginx reverse proxy for multi-site support
|
|
||||||
nginx-proxy:
|
|
||||||
image: nginx:alpine
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
volumes:
|
|
||||||
- ./nginx/conf.d:/etc/nginx/conf.d:ro
|
|
||||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
||||||
- sites:/var/www/html/sites:ro
|
|
||||||
- ./ssl:/etc/nginx/ssl:ro
|
|
||||||
depends_on:
|
|
||||||
- frontend
|
|
||||||
networks:
|
|
||||||
- frappe-network
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
# MariaDB database (from academy-lms)
|
# MariaDB database (from academy-lms)
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.8
|
image: mariadb:10.8
|
||||||
|
|
@ -73,6 +56,24 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- langchain-network
|
- langchain-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD-SHELL", "pg_isready -U ${LANGCHAIN_DB_USER:-langchain_user}" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
# Initialize LangChain database tables
|
||||||
|
langchain-db-init:
|
||||||
|
image: ${LANGCHAIN_IMAGE:-ghcr.io/exarlabs/academy-langchain}:${LANGCHAIN_TAG:-latest}
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgresql://${LANGCHAIN_DB_USER:-langchain_user}:${LANGCHAIN_DB_PASSWORD:-langchain_pass}@postgres:5432/${LANGCHAIN_DB_NAME:-langchain_db}
|
||||||
|
networks:
|
||||||
|
- langchain-network
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: on-failure
|
||||||
|
command: sh -c "cd /app && PYTHONPATH=/app python app/create_tables.py"
|
||||||
|
|
||||||
# LangChain service for AI functionality
|
# LangChain service for AI functionality
|
||||||
langchain-service:
|
langchain-service:
|
||||||
|
|
@ -88,11 +89,21 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- langchain-network
|
- langchain-network
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
postgres:
|
||||||
- redis
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_started
|
||||||
|
langchain-db-init:
|
||||||
|
condition: service_completed_successfully
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "8001:8000" # Expose on different port to avoid conflict
|
- "8001:8000" # Expose on different port to avoid conflict
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "-f", "http://localhost:8000/health" ]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
start_period: 40s
|
||||||
|
|
||||||
configurator:
|
configurator:
|
||||||
<<: *backend_defaults
|
<<: *backend_defaults
|
||||||
|
|
@ -131,6 +142,9 @@ services:
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
command:
|
command:
|
||||||
- nginx-entrypoint.sh
|
- nginx-entrypoint.sh
|
||||||
|
ports:
|
||||||
|
- "80:8080"
|
||||||
|
- "443:443"
|
||||||
environment:
|
environment:
|
||||||
BACKEND: backend:8000
|
BACKEND: backend:8000
|
||||||
SOCKETIO: websocket:9000
|
SOCKETIO: websocket:9000
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
root /workspace/development/frappe-bench/sites;
|
root /var/www/html/sites;
|
||||||
|
|
||||||
# Health check endpoint
|
# Health check endpoint
|
||||||
location /health {
|
location /health {
|
||||||
|
|
|
||||||
39
scripts/create-site-production.sh
Normal file
39
scripts/create-site-production.sh
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Production-ready site creation script
|
||||||
|
|
||||||
|
SITE_NAME=$1
|
||||||
|
ADMIN_PASSWORD=$2
|
||||||
|
DB_ROOT_PASSWORD=$3
|
||||||
|
|
||||||
|
if [ -z "$SITE_NAME" ] || [ -z "$ADMIN_PASSWORD" ] || [ -z "$DB_ROOT_PASSWORD" ]; then
|
||||||
|
echo "Usage: $0 <site-name> <admin-password> <db-root-password>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Creating site: $SITE_NAME"
|
||||||
|
|
||||||
|
# Create the site with proper database configuration
|
||||||
|
docker compose exec backend bench new-site $SITE_NAME \
|
||||||
|
--admin-password $ADMIN_PASSWORD \
|
||||||
|
--db-root-password $DB_ROOT_PASSWORD \
|
||||||
|
--db-host mariadb \
|
||||||
|
--mariadb-root-username root \
|
||||||
|
--no-mariadb-socket
|
||||||
|
|
||||||
|
# Install required apps
|
||||||
|
echo "Installing LMS app..."
|
||||||
|
docker compose exec backend bench --site $SITE_NAME install-app lms
|
||||||
|
|
||||||
|
echo "Installing AI Tutor Chat app..."
|
||||||
|
docker compose exec backend bench --site $SITE_NAME install-app ai_tutor_chat
|
||||||
|
|
||||||
|
# Set site configuration
|
||||||
|
echo "Configuring site..."
|
||||||
|
docker compose exec backend bench --site $SITE_NAME set-config db_host mariadb
|
||||||
|
docker compose exec backend bench --site $SITE_NAME set-config ai_tutor_api_url "http://langchain-service:8000"
|
||||||
|
|
||||||
|
# Set as default site (optional)
|
||||||
|
docker compose exec backend bench use $SITE_NAME
|
||||||
|
|
||||||
|
echo "Site $SITE_NAME created successfully!"
|
||||||
|
echo "Access it at: http://$SITE_NAME (make sure to add it to your hosts file or DNS)"
|
||||||
Loading…
Reference in a new issue