简体   繁体   English

适用于Wordpress的AWS ECS服务

[英]AWS ECS Service for Wordpress

I created a service for wordpress on AWS ECS with the following container definitions 我使用以下容器定义在AWS ECS上为wordpress创建了服务

{
  "containerDefinitions": [
    {
      "name": "wordpress",
      "links": [
        "mysql"
      ],
      "image": "wordpress",
      "essential": true,
      "portMappings": [
        {
          "containerPort": 0,
          "hostPort": 80
        }
      ],
      "memory": 250,
      "cpu": 10
    },
    {
      "environment": [
        {
          "name": "MYSQL_ROOT_PASSWORD",
          "value": "password"
        }
      ],
      "name": "mysql",
      "image": "mysql",
      "cpu": 10,
      "memory": 250,
      "essential": true
    }
  ],
  "family": "wordpress"
}

Then went over to the public IP and completed the Wordpress installation. 然后转到公共IP并完成Wordpress安装。 I also added a few posts. 我还添加了一些帖子。

But now, when I update the service to use a an updated task definition (Updated mysql container image) 但是现在,当我更新服务以使用更新的任务定义时(更新的mysql容器映像)

"image": "mysql:latest"

I loose all the posts created and data and Wordpress prompts me to install again. 我松开了所有创建的帖子和数据,Wordpress提示我重新安装。

What am i doing wrong? 我究竟做错了什么?

I also tried to use host volumes but to no vail - creates a bind mount and a docker managed volume (Did a docker inspect on container). 我还尝试使用主机卷,但没有任何用处-创建绑定安装和docker管理的卷(docker对容器进行了检查)。

So, every time I update the task it resets Wordpress. 因此,每次更新任务时,它都会重置Wordpress。

If your container needs access to the original data each time it starts, you require a file system that your containers can connect to regardless of which instance they're running on. 如果容器每次启动时都需要访问原始数据,则需要一个文件系统,无论容器在哪个实例上运行,容器都可以连接到该文件系统。 That's where EFS comes in. 这就是EFS的用武之地。

EFS allows you to persist data onto a durable shared file system that all of the ECS container instances in the ECS cluster can use. EFS允许您将数据持久存储到ECS群集中所有ECS容器实例都可以使用的持久共享文件系统上。

Step-by-step Instructions to Setup an AWS ECS Cluster 设置AWS ECS集群的分步说明

Using Data Volumes in Tasks 在任务中使用数据量

Using Amazon EFS to Persist Data from Amazon ECS Containers 使用Amazon EFS保留Amazon ECS容器中的数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM