Passer au contenu principal

Cyberlearn

Le centre e-learning de la HES-SO, il a été créé en 2004. Il propose aux professeur-e-s de la HES-SO un soutien actif pour les aider à enrichir leurs cours présentiels avec des solutions technologiques favorisant l'apprentissage.

CYBERLEARN CYBERLEARN
Français ‎(fr)‎
Deutsch ‎(de)‎ English ‎(en)‎ Français ‎(fr)‎
Vous êtes connecté anonymement
Connexion
  • Accueil
  • Support
  • CyberLearn
  • HES-SO numérique
  • Plus
Accueil Support CyberLearn HES-SO numérique
  1. Technologies de l'information et de la communication
  2. CLOUD 2019-2020 (MASTER)
  3. Exercise: Using docker-compose to deploy the FSE application
Devoir

Exercise: Using docker-compose to deploy the FSE application

Conditions d'achèvement
Ouvert le : lundi 14 octobre 2019, 23:37
À remettre : mardi 15 octobre 2019, 23:37

The aim of this exercise is to deploy the Festival Search Engine application  on Docker containers. Each module of the application will be deployed on a specific container: mongo, backend and frontend.

We will use the docker-compose command of Docker to deploy the FSE application.

The zipped file provided at the end of this page contains:

  • two folders, backend and frontend, which contain the Dockerfile of the two corresponding modules.
  • a yaml file: fse-compose.yaml which describes the workflow (how the three modules are "linked": port, IP addresses) and the virtual network infrastructure on which the application is deployed. 

The yaml file is used by docker-compose to deploy the application.

Structure of the Yaml file

The first section - services section -  describes the three containers (services): mongo, backend and frontend modules:

mongodb:
   image: mongo:latest
   expose:
     - "27017"

This container relies on the last version of the mongo image (Docker repository).

"expose" informs Docker that the container listens on the specified network ports at runtime. "expose" does not make the ports of the container accessible to the host.

In other words, "expose" opens the port in the container, making it accessible by other containers.

The second service describes the backend module:

backend:
    build: backend/
    links:
     - mongodb
    expose:
     - "3000"
    networks:
       vpcbr:
          ipv4_address: 10.5.0.6

When deployed, this container will have the private address: 10.5.0.6 and will listen on port 3000.

The third service describes the frontend module:

frontend:
   build: frontend
   links:
      - backend
   expose:
      - "8080"
   ports:
      - 8080:8080
   networks:
      vpcbr:
      ipv4_address: 10.5.0.7
   command: "--serverPublic=http://10.5.0.6:3000"

The "ports" option establishes a link between a container port and a host port, making the container port accessible from the host.

"command" provides the arguments to pass to the Docker ENTRYPOINT command (see Dockerfile file)

The last section of the fse-compose.yaml file (networks section) describes the virtual network on top of which the three containers will be deployed:

vpcbr:
   driver: bridge
ipam:
   config:
      - subnet: 10.5.0.0/16
        gateway: 10.5.0.1

To deploy the application, type : docker-compose -f fse-compose.yml up

To access the FSE application, type: http://localhost:8080

  • docker-compose.zip docker-compose.zip
    14 octobre 2019, 23:45
◄ Virtualisation
Object storage Lab ►
Support
Contacter l'assistance du site
cyberlearn@hes-so.ch
+41 58 606 90 1709.00-12.00 13.30-17.00
Vous êtes connecté anonymement (Connexion)
Obtenir l'app mobile
Rejoignez-nous!
Obtenir l'app mobile