version: "3.7"
services:
  db:
    image: mariadb:10.6.4-focal
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - nativosdemin_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=14b95ef247920eb9a9b6f36e6a59bad0
      - MYSQL_DATABASE=1590181ab8744957e272b1a19b3a0d24
      - MYSQL_USER=c930c2e2d685827fdb8b46acb41a817e
      - MYSQL_PASSWORD=f7014ca8d7cfcfe03569e946c7ebe1cb
    networks:
      - nativosdemin_net
  wordpress:
    image: wordpress:latest
    volumes:
      - nativosdemin_wp_data:/var/www/html
    ports:
      - 50012:80
    deploy:
      replicas: 1
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=c930c2e2d685827fdb8b46acb41a817e
      - WORDPRESS_DB_PASSWORD=f7014ca8d7cfcfe03569e946c7ebe1cb
      - WORDPRESS_DB_NAME=1590181ab8744957e272b1a19b3a0d24
      - WP_LOCALE=pt_BR
    networks:
      - nativosdemin_net

volumes:
  nativosdemin_db_data:
  nativosdemin_wp_data:

networks:
  nativosdemin_net:

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