Skip to content
Snippets Groups Projects
Commit ff35c82e authored by Sastry, Nishanth Prof (Comp Sci & Elec Eng)'s avatar Sastry, Nishanth Prof (Comp Sci & Elec Eng)
Browse files

Update README.md

parent e6a5da7c
No related branches found
No related tags found
Loading
...@@ -49,7 +49,23 @@ $ curl 127.0.0.1:5002/showtimes/20151130 ...@@ -49,7 +49,23 @@ $ curl 127.0.0.1:5002/showtimes/20151130
``` ```
Try your best to solve it. If you need hints, you will find the solution for this in the branch `simpleservices`, which you can obtain by running `git checkout simpleservices`. Note that after checking out this branch, you will have to start both the `movies` and `showtimes` microservices and then issue the curl request. The showtimes microservice will talk to movies microservice to deliver the final result. Try your best to solve it. If you need hints, you will find the solution for this in the branch `simpleservices`, which you can obtain by running `git checkout simpleservices`. Note that after checking out this branch, you will have to start both the `movies` and `showtimes` microservices and then issue the curl request. The showtimes microservice will talk to movies microservice to deliver the final result.
The main change needed is simple. We just have to issue an HTTP GET request to the movies API endpoint. We do this by changing `showtime_record` as follows:
```python
movies_service = "http://127.0.0.1:5001/movies/{}" #we know this is where the service is running. We replace the {} with the actual ID of the movie we want.
def showtimes_record(date):
if date not in showtimes:
raise NotFound
print(showtimes[date])
result = []
for movie_id in showtimes[date]:
resp = requests.get(movies_service.format(movie_id))
result.append(resp.json()["title"])
return nice_json(result)
```
## Step 3: Dockerization of microservices ## Step 3: Dockerization of microservices
> We now have two microservices running on _localhost_ and talking to each other. If we need to move these services, it is not easy.
> Your next task is to wrap these microservices as a docker image and make them portable. Essentially, this involves specifying all the dependencies and running parameters explicitly in a `Dockerfile`. You can have a go at this by copying from this [tutorial](https://www.docker.com/blog/containerized-python-development-part-1/). Or, switch to the `dockerservices` branch where you will find the solution for steps 3 and 4.
## Step 4: How to make two dockerized microservices talk to each other ## Step 4: How to make two dockerized microservices talk to each other
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment