0

I'm trying to figure out how to pass the root MySQL password into an ECS Fargate luanch type WordPress deployment. I'm working with this official AWS tutorial which provides this sample docker-compose.yml file:

version: '3'
services:
  wordpress:
    image: wordpress
    ports:
      - "80:80"
    logging:
      driver: awslogs
      options: 
        awslogs-group: tutorial
        awslogs-region: us-east-1
        awslogs-stream-prefix: wordpress

Note how there's no second "mysql" service defined (the way it would be for the EC2 launch type). This approach does work; I get the "Welcome to WordPress" page, but then I'm asked "Before getting started, we need some information on the database" - which means that WordPress has no idea how to connect to the database. On a regular Docker deployment, I'd SSH into the container and manually set up a DB password etc. But that's not possible on Fargate. I've tried adding environment values to the docker-compose.yml file using variations of this:

environment:
  - 'WORDPRESS_DB_USER=$wpadmin'
  - 'WORDPRESS_DB_NAME=$wpdb'
  - 'WORDPRESS_DB_PASSWORD=$secret'

and this:

environment:
   MYSQL_ROOT_PASSWORD: password

And, of course, I've tried exporting it to my host env and referencing it in docker-compose.yml like this:

environment:
   MYSQL_ROOT_PASSWORD:

But nothing has worked. Any ideas?

dlanced
  • 227
  • 1
  • 4
  • 12

0 Answers0