Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jperez77775/ProyectoDocker/llms.txt

Use this file to discover all available pages before exploring further.

The database service runs MySQL 8.0 and is the source of truth for all CV data in ProyectoDocker. On the first startup, MySQL automatically runs the init.sql initialization script, which creates the schema and inserts the seed records. Data is stored in a named Docker volume so it persists across container restarts.

Service configuration

SettingValue
Imagemysql:8.0
Container namecv_database
Host port3306
Container port3306
Root passwordrootpassword
Database namecv_db

Database schema

The cv_db database uses the utf8mb4 character set with utf8mb4_spanish_ci collation, which correctly sorts and stores Spanish accented characters. It contains two tables:

persona

Stores the CV owner’s personal information.
database/init.sql
CREATE TABLE persona (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nombre VARCHAR(100),
    apellido VARCHAR(100),
    ciudad VARCHAR(100),
    foto VARCHAR(255)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;

formacion

Stores the education history, linked to a persona record via a foreign key.
database/init.sql
CREATE TABLE formacion (
    id INT AUTO_INCREMENT PRIMARY KEY,
    titulo VARCHAR(100),
    institucion VARCHAR(100),
    anio VARCHAR(50),
    persona_id INT,
    FOREIGN KEY (persona_id) REFERENCES persona(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci;

Seeded data

The initialization script inserts one persona record and five education entries on first startup:
database/init.sql
INSERT INTO persona (nombre, apellido, ciudad, foto)
VALUES ('Juan Eduardo', 'Pérez Orellana', 'Santa Cruz', '/perfil.jpg');

INSERT INTO formacion (titulo, institucion, anio, persona_id)
VALUES ('Diplomado FullStack Developer Backend y Frontend ', 'USIP', '2026', 1),
       ('Gestión de Proyectos', 'Millicom University', '2014', 1),
       ('Arquitectura Enterprise: Oracle SOA Suite, WebLogic Server y Java EE', 'Oracle', '2011', 1),
       ('Maestría en Ciencias de la Computación ', 'UAGRM', '2006', 1),
       ('Ingeniería Informática', 'UAGRM', '1999', 1);

Initialization

The init.sql file is mounted into the container at /docker-entrypoint-initdb.d/init.sql via a bind mount in docker-compose.yml:
docker-compose.yml
volumes:
  - mysql_data:/var/lib/mysql
  - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
MySQL automatically executes every .sql file placed in /docker-entrypoint-initdb.d/ when the data directory is empty — that is, on the very first startup. If the mysql_data volume already contains data, the script is skipped.

Persistent volume

The mysql_data named volume stores all database files at /var/lib/mysql inside the container. This means your data survives docker compose stop, docker compose down, and container restarts.
Running docker compose down -v deletes all named volumes, including mysql_data. This permanently destroys all data in the database. The next docker compose up will re-run init.sql and start fresh with only the seed data.

Health check

The service declares a health check in docker-compose.yml that polls MySQL until it is ready to accept connections:
docker-compose.yml
healthcheck:
  test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"]
  interval: 5s
  timeout: 5s
  retries: 10
The backend service uses depends_on: database: condition: service_healthy, so Docker will not start the backend container until this health check passes. This prevents the backend from attempting to query the database before MySQL has finished initializing.

Build docs developers (and LLMs) love