Skip to content

Remove attribute restart: always from docker compose config file #267

@josecelano

Description

@josecelano

The docker compose.yaml file includes a mysql service. Since this configuration is intended to be used for development only, I think we could remove the MySQL service option restart: always

It has the undesirable effect (for development) of starting the MySQL service when you restart your development machine.

$ docker ps
CONTAINER ID   IMAGE       COMMAND                  CREATED        STATUS                  PORTS                                                  NAMES
0bfeffbddd74   mysql:8.0   "docker-entrypoint.s…"   3 months ago   Up 10 hours (healthy)   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   torrust-mysql-1

The current compose.yml file:

name: torrust
services:

  tracker:
    build:
      context: .
      target: development
    user: ${TORRUST_TRACKER_USER_UID:-1000}:${TORRUST_TRACKER_USER_UID:-1000}
    tty: true
    networks:
      - server_side
    ports:
      - 6969:6969/udp
      - 7070:7070
      - 1212:1212
    volumes:
      - ./:/app
      - ~/.cargo:/home/appuser/.cargo
    depends_on:
      - mysql

  mysql:
    image: mysql:8.0
    command: '--default-authentication-plugin=mysql_native_password'
    restart: always
    healthcheck:
      test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --password="$$(cat /run/secrets/db-password)" --silent']
      interval: 3s
      retries: 5
      start_period: 30s    
    environment:
      - MYSQL_ROOT_HOST=%
      - MYSQL_ROOT_PASSWORD=root_secret_password
      - MYSQL_DATABASE=torrust_tracker
      - MYSQL_USER=db_user
      - MYSQL_PASSWORD=db_user_secret_password
    networks:
      - server_side
    ports:
      - 3306:3306
    volumes:
      - mysql_data:/var/lib/mysql

networks:
  server_side: {}

volumes:
  mysql_data: {}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions