version: "3.7"
services:
  db:
    image: mariadb:10.6.4-focal
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - vempradoremi_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=5d46b80a1c5c75f18695efbfb4d024e1
      - MYSQL_DATABASE=45816bf9cbb984401605425cbc31d46f
      - MYSQL_USER=a3ab545610e35e5ff5781ebcd9cd7d36
      - MYSQL_PASSWORD=a1dcbc5494ff22ce395e3abc349fa43d
    networks:
      - vempradoremi_net
  wordpress:
    image: wordpress:latest
    volumes:
      - vempradoremi_wp_data:/var/www/html
    ports:
      - 50015:80
    deploy:
      replicas: 1
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=a3ab545610e35e5ff5781ebcd9cd7d36
      - WORDPRESS_DB_PASSWORD=a1dcbc5494ff22ce395e3abc349fa43d
      - WORDPRESS_DB_NAME=45816bf9cbb984401605425cbc31d46f
      - WP_LOCALE=pt_BR
    networks:
      - vempradoremi_net

volumes:
  vempradoremi_db_data:
  vempradoremi_wp_data:

networks:
  vempradoremi_net:

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