version: "3.7"
services:
  db:
    image: mariadb:10.6.4-focal
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - portalextran_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=f62083dccf2874ad157ccd116f98b234
      - MYSQL_DATABASE=d7ebc55d0fc4a4d4d3aea07f6c7f2783
      - MYSQL_USER=a8236e5d2ed7d97e6cd9a941a00a4de5
      - MYSQL_PASSWORD=b2caef123398ee617d05bc2cecc7c016
    networks:
      - portalextran_net
  wordpress:
    image: wordpress:latest
    volumes:
      - portalextran_wp_data:/var/www/html
    ports:
      - 50011:80
    deploy:
      replicas: 1
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=a8236e5d2ed7d97e6cd9a941a00a4de5
      - WORDPRESS_DB_PASSWORD=b2caef123398ee617d05bc2cecc7c016
      - WORDPRESS_DB_NAME=d7ebc55d0fc4a4d4d3aea07f6c7f2783
      - WP_LOCALE=pt_BR
    networks:
      - portalextran_net

volumes:
  portalextran_db_data:
  portalextran_wp_data:

networks:
  portalextran_net:

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