/PAD-151-Proxy-Server

Task for lab2 at PAD, FAF-151

Primary LanguageRuby

Proxy server

Working with containers

If you choose to run containers individually, use

docker build -t <image-name> .
docker --rm -it -p <host-port>:<container-port> <image-name> bash

But when your container depends on another one, you could issue docker-compose up --build command to build and run them.

When making new changes in the source files the images does not sync with them, therefore you're expected to restart the desired service with docker-compose restart <service-name>.

If you want to scale up an image e.g. warehouse image, you can issue docker-compose scale <service-name>=<number-of-replicas>.

Communication

A client can communicate with servers using the following API:

  • get /api/v1/joke/<id> - get a specific joke
<joke>
	<joke_id></joke_id>
	<author></author>
	<text></text>
	<joke_rating></joke_rating>
	<extra>
		<!-- some extra stuff here -->
	</extra>
</joke>
  • get /api/v1/jokes - get a list of jokes
<joke_list>
	<joke>
		<!-- joke body -->
	</joke>
	<!-- more jokes -->
</joke_list>
  • get /api/v1/jokescount - get the number of jokes
<joke_number>
	<!-- some number here -->
</joke_number>
  • post /api/v1/joke - post a new funny joke
<joke>
	<text></text>
	<author></author>
	<extra>
		<!-- some extra stuff here -->
	</extra>
</joke>