Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 40 additions & 24 deletions answers.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,64 @@
# Answers

Nom:
Prénom:
NB:
Nom: PIOVESAN
Prénom: Clément
NB: 2

## 1.3
command:
command: docker build -t cpiovesan/tp2 .
docker run -it --rm --name my-running-app my-python-app

## 1.4
answer:
command:
answer: L'addresse ne répond car nous avons pas autorisé la connection au port 8080
command: docker run -it --rm --name my-running-app -p 8080:8080/tcp -p 8080:8080/udp my-python-app

## 1.5
command:
command: docker run -it --rm --name my-running-app -p 8080:8080/tcp -p 8080:8080/udp -e ENVIRONMENT=dev my-python-app

## 1.6
answer:
command:
answer: Il faut changer le nom de son appli et le remplacer par le nom de son dépot Docker Hub (cpiovesan/tp2 dans mon cas)
command: docker login (login dans docker hub)
docker images (pour trouver l'id de mon image)
docker tag 5868e2a4e118 cpiovesan/tp2 (tag mon appli docker vers son id docker hub)
docker push cpiovesan/tp2 (push mon appli vers docker hub)

## 1.7
answer:
command:
command:
command:
answer:d
command: docker rmi -f XXXXXXX (id de l'image)
command: docker run -it --rm --name my-running-app -p 8080:8080/tcp -p 8080:8080/udp -e ENVIRONMENT=python:3-alpine cpiovesan/tp2
command: docker run -it --rm --name my-running-app -p 8080:8080/tcp -p 8080:8080/udp -e ENVIRONMENT=python:3-alpine -d cpiovesan/tp2

## 1.8
answer:
command:
command:
command: docker ps (nom de mon container: my-running-app, id: 8898504301e4)
command: docker container rename my-running-app tp2container
docker restart 8898504301e4

## 1.9
answer:
answer:
answer: docker exec -i -t 8199a0b3a0bf cat /etc/*release
answer: Il montre que nous utilisons l'OS Alpine Linux
answer: NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.8.1
PRETTY_NAME="Alpine Linux v3.8"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"


## 1.11
command:
command: docker run -it --rm -p 8081:8081 -e APP_PORT=8081 -e WS_BACK_URL=172.20.10.3 cpiovesan/tp2front
answer: You called at : 2018-11-08 13:50:20.982599 (dynamic)
On environment : python:3-alpine (from env variable)
With path : write (from URL path)
With front : 3cc71ce7cc48 (from real hostname of front service)
With back : 96c81aa0efee (from real hostname of back service)

## 2.1
command:
command: docker-compose up

## 2.6
command:
command:

## 2.9
command:
command: docker-compose up -d
command: docker-compose logs

## 2.9:
command: docker-compose up --scale back-service=2
11 changes: 11 additions & 0 deletions app/back/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3-alpine

WORKDIR /Users/cpiovesan/Documents/ECE/ING5/Microservices/tp2/

COPY . .

RUN pip install --no-cache-dir -r requirements.txt

RUN mkdir logs

CMD [ "python", "-u", "./webservice.py" ]
15 changes: 15 additions & 0 deletions app/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3'
services:
back-service:
environment:
- ENVIRONMENT=dev
image: cpiovesan/tp2back
front-service:
ports:
- "8081:8081"
environment:
- APP_PORT=8081
- WS_BACK_URL=backend
image: cpiovesan/tp2front
links:
- "back-service:backend"
9 changes: 9 additions & 0 deletions app/front/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3-alpine

WORKDIR /Users/cpiovesan/Documents/ECE/ING5/Microservices/tp2/front

COPY . .

RUN pip install --no-cache-dir -r requirements.txt

CMD [ "python", "-u", "./front.py" ]
3 changes: 2 additions & 1 deletion app/front/front.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import os
from aiohttp import web
from datetime import datetime
Expand All @@ -19,7 +20,7 @@ async def handle(request):
With front : {os.uname()[1]} (from real hostname of front service)
With back : {json_data['hostname']} (from real hostname of back service)
"""

return web.Response(text=resp)

async def write_to_file(request):
Expand Down