Alibaba Cloud ECS instance can potentially serve more than one website with Docker Compose and a Reverse Proxy, there are multiple solutions to handle different content in one single instance ECS:
Now you can gain deep insights on ECS and integrate the best practices on the cloud to empower your business on our Academy Day Online Conference in March 5th, 2020 with free ACA Cloud Computing certification exams. Sign up free now!
The best (and more elegant) solution here is to use Name-based Virtual Hosting, as it helps you to use better naming for your sites. And nowadays, software such as Docker performs operating-system-level virtualization also known as containerization, where, from the running programs point of view, they look like real computers. The benefit of using this is the isolation that occurs between services running in different containers, as a website running in one container won’t have any connection (by default) with a website running in another container.
But containerization itself still doesn’t solve the problem of handling the HTTP Requests to give the proper website to the visitors of each site. That's why we need a Reverse Proxy, a service that can also run as a container and intercepts the requests to send them to the correct place, making it the main part for handling Virtual Hosting.
So we need a Name-based Virtual Host solution which will run on Docker, having a Reverse Proxy and at least 2 websites running on it.
Each container in a
docker-compose.yml config file is called "service", and goes into the services array in a YAML format. The services in our file will be:
For simplicity’s sake, I’m using the standard and unmodified official image of PHP 7.2 with Apache (php:7.2-apache) in both web services. "web1" and "web2" will show, therefore, the generic message from Apache telling you that "It works!". Something that you can just change by entering by command line into the container with
docker exec -it web1 bash.
Then after you installed Docker on your ECS instance following the official documentation, you can create a file called "docker-compose.yml" with the contents being shown in the following section and run it like a normal Docker Compose project.
version: '3.6' services: proxy: image: neilpang/nginx-proxy network_mode: bridge container_name: proxy restart: on-failure ports: - "80:80" - "443:443" environment: - ENABLE_IPV6=true volumes: - ./certs:/etc/nginx/certs - /var/run/docker.sock:/tmp/docker.sock:ro web1: image: php:7.2-apache network_mode: bridge container_name: web1 restart: on-failure environment: - VIRTUAL_HOST=web1.com web2: image: php:7.2-apache network_mode: bridge container_name: web2 restart: on-failure environment: - VIRTUAL_HOST=web2.com
But if you don't have an ECS instance yet, then I recommend you to do it with Terraform, then please check the details here.
Alibaba Cloud's Elastic Compute Service (ECS) is a range of elastic cloud-based server products that are simpler and more efficient to manage than physical servers. You can create instances, add memory to scale up when required, build out connected VPCs in different regions, and use them as essential components of Alibaba Cloud's vast range of cloud products and services.
Docker is a management tool that allows you to develop, deploy, and run applications inside containers. This process is known as containerization.
You can run many containers at the same time on the same host machine. These containers are managed by Docker instead of the OS hypervisor. Containerization means that applications run in total isolation from each other. However, you can also configure ports for communication between running containers. In contrast, Virtual Machines take up significant computational power from the host machine and most often have far too many resources than required.
In this tutorial, we'll show you how to set up, install, and run Docker on an Alibaba Cloud Elastic Compute Service (ECS) instance.
Mastodon is an open source decentralized social network that allows anyone to host their own server node in the network. In this tutorial, I will install and set up Mastodon on Alibaba Cloud Elastic Compute Service (ECS) with Docker on Ubuntu 16.04.
You can add an existing ECS instance in the following ways:
In a distributed system, the service availability is frequently checked by using the health check to avoid exceptions when being called by other services. Docker introduced native health check implementation after version 1.12. This document introduces the health check of Docker containers.
Alibaba Cloud Elastic Compute Service (ECS) provides fast memory and the latest Intel CPUs to help you to power your cloud applications and achieve faster results with low latency. All ECS instances come with Anti-DDoS protection to safeguard your data and applications from DDoS and Trojan attacks.
Deploy ECS instances with just a few clicks from the easy-to-use console and scale capacity up or down based on real-time demands. This means you only pay for the resources you use and avoid the need to procure expensive IT infrastructure and hire large network teams.
Container Service is a high-performance and scalable container application management service that enables you to use Docker and Kubernetes to manage the lifecycle of containerized applications.
Container Service offers a variety of application publishing methods and continuous delivery capabilities and supports microservice architectures.
Container Service simplifies establishment of container management clusters and integrates Alibaba Cloud virtualization, storage, network, and security capabilities to create the optimal container-running environment on the cloud.
This course introduces the basic concepts and features of docker container technology, then showes the steps of basic installation and some frequently used commands. At the same time introduces the the basic concepts and architecture of container service on alibaba cloud, and then shows the steps of container based application creation procedure from scratch.
Alibaba Cloud offers easy-to-use high-performance virtual machines with data transfer plan starting from $2.50 a month now.
Alibaba Clouder - May 25, 2018
Alibaba Clouder - July 19, 2019
Marketplace - November 23, 2018
Alibaba Clouder - February 25, 2020
Alibaba Cloud_Academy - July 10, 2020
Alibaba Clouder - December 14, 2017
More Posts by Alibaba Clouder