version: "3.7"
services:
  db:
    image: mariadb:10.6.4-focal
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - litoralnotic_db_data:/var/lib/mysql
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      resources:
        limits:
          memory: 512M
          cpus: "0.5"
        reservations:
          memory: 256M
          cpus: "0.25"
    environment:
      - MYSQL_ROOT_PASSWORD=728b3917b891f41d89ef6061ac5be31a
      - MYSQL_DATABASE=0b9c8f7c8745ce0c0ec39b295766311c
      - MYSQL_USER=09859f16fdfb82ed9779857e06811fc4
      - MYSQL_PASSWORD=732ca3372d96e81d5db395cec50dc674
    networks:
      - litoralnotic_net
  wordpress:
    image: wordpress:latest
    volumes:
      - litoralnotic_wp_data:/var/www/html
    ports:
      - 50009:80
    deploy:
      replicas: 1
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=09859f16fdfb82ed9779857e06811fc4
      - WORDPRESS_DB_PASSWORD=732ca3372d96e81d5db395cec50dc674
      - WORDPRESS_DB_NAME=0b9c8f7c8745ce0c0ec39b295766311c
      - WP_LOCALE=pt_BR
    networks:
      - litoralnotic_net

volumes:
  litoralnotic_db_data:
  litoralnotic_wp_data:

networks:
  litoralnotic_net:

# Comando para alterar siteurl e home no WordPress
# mysql -u root -p -e "USE 0b9c8f7c8745ce0c0ec39b295766311c; UPDATE wp_options SET option_value='http://litoralnoticia.com.br' WHERE option_name IN ('siteurl', 'home');"
