# 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 └─────────────┘ ``` ### 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 ## 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_IMAGE` | Docker image for Tryton | `gitea.onecluster.org/oneteam/naliia:1.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` | | `SMTP_*` | SMTP configuration for email | See `.env.example` | ### 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 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.