258 lines
6.8 KiB
Markdown
258 lines
6.8 KiB
Markdown
# NaliiaPro
|
|
|
|
A Docker-based ERP system built on Tryton, designed for business management with a modular architecture including web server, background workers, and scheduled tasks.
|
|
|
|
## Overview
|
|
|
|
NaliiaPro is an enterprise resource planning (ERP) application powered by [Tryton](https://www.tryton.org/), a powerful open-source ERP framework written in Python. The project uses Docker containerization for easy deployment and scaling.
|
|
|
|
## Technology Stack
|
|
|
|
| Component | Technology |
|
|
|-----------|------------|
|
|
| **ERP Framework** | Tryton |
|
|
| **Database** | PostgreSQL |
|
|
| **Web Server** | Nginx (Reverse Proxy) |
|
|
| **Containerization** | Docker & Docker Compose |
|
|
| **Backend** | Python |
|
|
| **Task Queue** | Tryton Worker (Celery-like) |
|
|
| **Scheduler** | Tryton Cron |
|
|
|
|
## Architecture
|
|
|
|
The application consists of multiple Docker services:
|
|
|
|
```
|
|
┌─────────────┐
|
|
│ Nginx │ Port: 10000 (configurable)
|
|
└──────┬──────┘
|
|
│
|
|
┌──────▼──────┐
|
|
│ Tryton │ Main application server (Port 8000)
|
|
└──────┬──────┘
|
|
│
|
|
┌──────▼──────┐
|
|
│ PostgreSQL │ Database
|
|
└─────────────┘
|
|
|
|
┌─────────────┐
|
|
│ Worker │ Background task processor
|
|
└─────────────┘
|
|
|
|
┌─────────────┐
|
|
│ Cron │ Scheduled tasks
|
|
└─────────────┘
|
|
|
|
┌─────────────┐
|
|
│ Bot │ AI Bot service (Port 8010)
|
|
└─────────────┘
|
|
|
|
┌─────────────┐
|
|
│tryton_mcp │ Tryton MCP server (Port 3001)
|
|
└─────────────┘
|
|
```
|
|
|
|
### Services
|
|
|
|
- **db**: PostgreSQL database container
|
|
- **tryton**: Tryton server handling HTTP requests
|
|
- **worker**: Background worker for async tasks
|
|
- **cron**: Scheduled task runner
|
|
- **nginx**: Reverse proxy handling external requests
|
|
- **bot**: AI Bot service with LLM integration
|
|
- **tryton_mcp**: Tryton MCP server for AI integration
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
NaliiaPro/
|
|
├── docker-compose.yaml # Docker Compose configuration
|
|
├── nginx.conf # Nginx reverse proxy configuration
|
|
├── .env.example # Environment variables template
|
|
├── .gitignore # Git ignore patterns
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Prerequisites
|
|
|
|
- Docker
|
|
- Docker Compose
|
|
- Access to the Naliia Docker image registry
|
|
|
|
## Configuration
|
|
|
|
### Environment Variables
|
|
|
|
Copy `.env.example` to `.env` and configure the following variables:
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `NALIIA` | Docker image for Tryton | `gitea.onecluster.org/oneteam/naliia:1.0.0_pro` |
|
|
| `NALIIA_BOT` | Docker image for Bot | `gitea.onecluster.org/oneteam/naliia_bot:v1.0.0_pro` |
|
|
| `NALIIA_TRYTON_MCP` | Docker image for Tryton MCP | `gitea.onecluster.org/oneteam/naliia_tryton_mcp:v1.0.0_pro` |
|
|
| `DB_HOSTNAME` | Database hostname | `db` |
|
|
| `POSTGRES_DB` | Database name | `database` |
|
|
| `POSTGRES_USER` | Database user | `postgres` |
|
|
| `POSTGRES_PASSWORD` | Database password | `SUp3r-pass*DB` |
|
|
| `TRYTOND_DATABASE_URI` | Tryton database connection URI | `postgresql://user:pass@db:5432/` |
|
|
| `EMAIL` | Admin email | `admin@admin.org` |
|
|
| `TRYTON_PORT` | Tryton server port | `8000` |
|
|
| `SERVER_NAME` | Domain name for Nginx | `tryton.domain.com` |
|
|
| `NGINX_PORT` | Nginx listening port | `10000` |
|
|
| `DEEPSEEK_API_KEY` | DeepSeek API key for Bot | `sk-...` |
|
|
| `ANTHROPIC_API_KEY` | Anthropic API key for Bot | `sk-...` |
|
|
| `LLM_MODEL` | LLM model to use | `deepseek` |
|
|
| `TRYTON_HOSTNAME` | Tryton hostname for MCP | `tryton` |
|
|
| `TRYTON_DATABASE` | Tryton database for MCP | `naliia` |
|
|
| `TRYTON_USERNAME` | Tryton username for MCP | `admin` |
|
|
| `TRYTON_PASSWORD` | Tryton password for MCP | `S0p0rt3f1n4l*` |
|
|
| `MCP_PORT` | MCP server port | `3001` |
|
|
| `SMTP_*` | SMTP configuration for email | See `.env.example` |
|
|
|
|
### Ports
|
|
|
|
| Service | Port | Description |
|
|
|---------|------|-------------|
|
|
| Nginx | 10000 | Reverse proxy (configurable) |
|
|
| Tryton | 8000 | Tryton server |
|
|
| Bot | 8010 | AI Bot service |
|
|
| MCP | 3001 | Tryton MCP server |
|
|
|
|
### SMTP Configuration
|
|
|
|
Configure SMTP settings for email notifications:
|
|
|
|
```
|
|
SMTP=True
|
|
SMTP_TYPE=smtps+ssl
|
|
SMTP_USER=user
|
|
SMTP_PASSWORD=password
|
|
SMTP_DOMAIN=domain.com
|
|
SMTP_PORT=465
|
|
SMTP_FROM=Company CO
|
|
SMTP_EMAIL=domain@domain.com
|
|
```
|
|
|
|
## Setup & Installation
|
|
|
|
### 1. Clone the Repository
|
|
|
|
```bash
|
|
git clone <repository-url>
|
|
cd NaliiaPro
|
|
```
|
|
|
|
### 2. Configure Environment Variables
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
# Edit .env with your configuration
|
|
```
|
|
|
|
### 3. Start the Application
|
|
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
### 4. Verify Services
|
|
|
|
```bash
|
|
docker-compose ps
|
|
```
|
|
|
|
The application should be accessible at `http://localhost:10000` (or the port specified in `NGINX_PORT`).
|
|
|
|
## Usage
|
|
|
|
### Basic Commands
|
|
|
|
```bash
|
|
# Start all services
|
|
docker-compose up -d
|
|
|
|
# Stop all services
|
|
docker-compose down
|
|
|
|
# View logs
|
|
docker-compose logs -f
|
|
|
|
# View logs for specific service
|
|
docker-compose logs -f tryton
|
|
|
|
# Restart a specific service
|
|
docker-compose restart tryton
|
|
```
|
|
|
|
### Accessing Tryton
|
|
|
|
After starting the services, access Tryton through the Nginx proxy:
|
|
|
|
- **URL**: `http://localhost:10000` (or configured `NGINX_PORT`)
|
|
- **Protocol**: Tryton XML-RPC/SOAP
|
|
|
|
### Database Management
|
|
|
|
The PostgreSQL data is persisted in a Docker volume. To reset the database:
|
|
|
|
```bash
|
|
docker-compose down -v # Warning: This deletes all data
|
|
docker-compose up -d
|
|
```
|
|
|
|
## Development
|
|
|
|
### Volume Mounts
|
|
|
|
The following volumes are mounted for development:
|
|
|
|
- `var`: Tryton var directory
|
|
- `attachment`: File attachments storage
|
|
|
|
### Health Checks
|
|
|
|
Each service includes health checks:
|
|
- **db**: Checks PostgreSQL availability
|
|
- **tryton**: Checks HTTP response on port 8000
|
|
- **worker/cron**: Started after tryton is healthy
|
|
|
|
## Troubleshooting
|
|
|
|
### Check Service Logs
|
|
|
|
```bash
|
|
docker-compose logs db
|
|
docker-compose logs tryton
|
|
docker-compose logs worker
|
|
docker-compose logs cron
|
|
```
|
|
|
|
### Common Issues
|
|
|
|
1. **Database connection failed**: Verify `POSTGRES_PASSWORD` and `DB_HOSTNAME` in `.env`
|
|
2. **Nginx 502 Bad Gateway**: Ensure Tryton service is running and healthy
|
|
3. **Port conflicts**: Change `NGINX_PORT` in `.env` if port 10000 is in use
|
|
|
|
### Reset Everything
|
|
|
|
```bash
|
|
docker-compose down -v
|
|
docker-compose up -d
|
|
```
|
|
|
|
## Security Notes
|
|
|
|
- Change default passwords in production
|
|
- Use strong database passwords
|
|
- Configure SSL/TLS in Nginx for production
|
|
- Keep Docker images updated
|
|
- Never commit `.env` files to version control
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
|
## Support
|
|
|
|
For issues and questions, please contact the development team.
|