Overview
CompuTécnicos uses Docker for containerized deployment, providing a consistent environment across development and production. The application stack includes:- App Container: PHP 8.2 + Apache web server
- Database Container: MySQL 8.0 with persistent storage
- phpMyAdmin: Database management tool (development only)
Prerequisites
Before deploying with Docker, ensure you have:- Docker Desktop installed
- Docker Compose (included with Docker Desktop)
- Git for cloning the repository
- Basic knowledge of command line operations
Quick Start
Configure Environment Variables
Create your environment configuration file:Edit the
.env file with your preferred text editor:Build and Start Services
Build the Docker images and start all services:The
-d flag runs containers in detached mode (background), and --build ensures images are rebuilt with the latest code.Verify Deployment
Check that all services are running:View application logs:Press
Ctrl+C to exit log viewing.Access the Application
Open your browser and navigate to:
- Application: http://localhost:8080
- phpMyAdmin (dev mode): http://localhost:8081
Environment Variables
Configure these variables in your.env file:
Application Ports
| Variable | Default | Description |
|---|---|---|
APP_PORT | 8080 | Port for accessing the web application |
DB_PORT | 3306 | External port for MySQL database |
PMA_PORT | 8081 | Port for phpMyAdmin interface |
Database Configuration
| Variable | Default | Description |
|---|---|---|
DB_NAME | computecnicos | Database name |
DB_USER | computecnicos_user | Application database user |
DB_PASS | computecnicos_secret | Application database password |
MYSQL_ROOT_PASSWORD | root_secret | MySQL root password |
Payment Integration
| Variable | Default | Description |
|---|---|---|
PAYPAL_CLIENT_ID | - | PayPal API client ID |
PAYPAL_CLIENT_SECRET | - | PayPal API secret key |
PAYPAL_ENVIRONMENT | sandbox | PayPal environment (sandbox or live) |
Electronic Invoicing
| Variable | Default | Description |
|---|---|---|
FE_PROVIDER | alegra | Invoicing provider (alegra or siigo) |
FE_SIMULATE | true | Enable simulation mode for testing |
ALEGRA_TOKEN | - | Alegra API authentication token |
ALEGRA_EMAIL | - | Alegra account email |
SIIGO_CLIENT_ID | - | Siigo OAuth client ID |
SIIGO_CLIENT_SECRET | - | Siigo OAuth client secret |
SIIGO_USERNAME | - | Siigo account username |
SIIGO_PASSWORD | - | Siigo account password |
Docker Commands
Service Management
Development Mode
Enable phpMyAdmin for database management:Monitoring and Logs
Container Access
Database Management
Manual SQL Import
Import SQL files directly into the database:The
-T flag disables pseudo-TTY allocation, which is required for piping input.Backup and Restore
Docker Architecture
The CompuTécnicos Docker setup consists of:Dockerfile (Dockerfile:1-93)
Multi-stage build configuration that:
- Uses PHP 8.2 with Apache as base image
- Installs required system dependencies and PHP extensions
- Enables Apache modules:
rewrite,headers,expires - Configures optimized PHP settings for production
- Installs Composer for dependency management
- Creates required directories with proper permissions
- Sets up custom entrypoint script for initialization
pdo,pdo_mysql,mysqli- Database connectivitygd- Image processingzip- Archive handlingintl- Internationalizationmbstring- Multibyte string supportopcache- PHP bytecode cachingxml- XML processing
Docker Compose (docker-compose.yml:1-105)
Orchestrates three services:
-
app - PHP/Apache application container
- Exposes port 8080 (configurable via
APP_PORT) - Mounts persistent volumes for uploads and logs
- Depends on healthy database connection
- Exposes port 8080 (configurable via
-
db - MySQL 8.0 database container
- Exposes port 3306 for external access
- Auto-imports SQL schema on first run
- Includes health check for service dependencies
- Uses persistent volume for data storage
-
phpmyadmin - Database management interface
- Only runs when
devprofile is active - Accessible on port 8081
- Automatically connects to database
- Only runs when
Persistent Volumes
Three volumes ensure data persistence:db_data- MySQL database filesuploads_data- User uploaded filesapp_logs- Application logs
Network
All services communicate through thecomputecnicos-net bridge network, providing isolation and service discovery.
Troubleshooting
Database Connection Issues
Check Container Status
Verify that the database container is healthy:Look for
healthy status on the db service.Permission Errors
If you encounter file permission errors in the uploads directory:Port Already in Use
If ports 8080, 3306, or 8081 are already in use:- Edit your
.envfile - Change the conflicting port variables (
APP_PORT,DB_PORT,PMA_PORT) - Restart services:
docker-compose up -d
Complete Reset
To rebuild everything from scratch:Container Won’t Start
Check detailed error messages:Next Steps
Production Setup
Configure CompuTécnicos for production deployment
Environment Variables
Configure environment variables for your deployment