This microservice intended to consume url and return json with snippet metadata (see picture for more details). Also it provides image width and height (exact answer structure will be available later).
Lets say you are building chat application, social network, or just plain old comment system. You will need some service, that fetch metadata from urls for json for snippet creation. This service provide this functionality.
Example snippet (this illustrates what are we talking about):
cp .env.dist .env
- change environment variables in
.env
to desired state (check values lower) - run service like this:
docker run\ --env-file .env micro-snippet-maker\ -v /srv/host_storage/:/srv/storage/\ microservice-snippet:latest\ bin/app/run.sh
If you run stock service, you need to use it somehow. This section describes
- Send request
/?source_url=<desired url>
; - Get answer with json with desired metadata. Answer will be available after some period of time (while service is goind to source_url and parse data, time depends on various factors: network, source_url speed and many other things).
- Setup some settings (via env variable — will be announced later):
- desired flow;
- storage (default storage is no storage);
- Send request
/?source_url=<desired url>
; - Get answer immediately;
- Then loop:
- Wait some time (as you deside);
- Fetch
/?source_url=<desired url>
again; - If answer is empty, return to first loop step, else desired result is provided. Plus you will need timeout.
- Setup some settings (via env variable — will be announced later):
- desired flow;
- Send request
/?source_url=<desired url>
; - Get answer immediately;
- Wait answer on some url OR in MQ.
TODO
SNIPPET_WORKERS
— desired number of uvicorn + fastapi workers;SNIPPET_HTML_PARSER
— backend for extraction of meta tags;SNIPPET_STORAGE
— backend for storaging meta tags data.