I am using latest docker image with dynamic parameters for a feed and I see sometimes the resulf of one parameter given in the other one.
Here I attach a bash shell script with
- a docker-compose sample project with a flask web application which gives a previsible result.
- a loop asking html2css web different previsible results.
Briefly, when I run it I find a results like from the second query.
The output results just the first one repeated.
+ curl -s 'http://localhost:3001/failer.rss?id=1otherstring'
<description>2023-04-16 15:34:23.958242 - foo random description</description>
while the output should be:
+ curl -s 'http://localhost:3001/failer.rss?id=1otherstring'
<description>2023-04-16 15:34:23.958242 - 1otherstring random description</description>
Letme know if you need further information,
thanks in advance,
[ edit: WEB_MAX_THREADS=1, WEB_CONCURRENCY=1 ]
script launch
. ./the_script_from_details.sh
Test Script:
Details
#!/bin/bash
set -x
cd `mktemp -d`
mkdir -p templates/
cat <<EOF >app.py
from flask import Flask
from flask import render_template
from datetime import datetime
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def hello(name=None):
return render_template('hello.html', name=name, date=datetime.now())
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000)
EOF
cat <<EOF >templates/hello.html
<!DOCTYPE html>
<html>
<head>
{% if name %}
<title>Title for {{ name }}</title>
{% else %}
<title>Title {{ name }}</title>
{% endif %}
</head>
<body>
<div class="foo">
{% if name %}
<h1><a href="https://google.com/search?q={{ date}}">Hello {{ name }}! at {{ date }}</a></h1>
<div class="item">{{ date }} - {{ name }} random description</div>
{% else %}
<h1>Hello, World!</h1>
<div class="item">nada - nada random description</div>
{% endif %}
</div>
</body>
</html>
EOF
cat <<'EOF' >Dockerfile
FROM python:3.10-alpine AS builder
WORKDIR /app
RUN pip3 install Flask==2.2.3
RUN mkdir -p /app/templates
COPY . /app
ENTRYPOINT ["python3"]
CMD ["app.py"]
FROM builder as dev-envs
RUN \
apk update && \
apk add git
EOF
cat <<'EOF' >docker-compose.yml
version: "3.2"
services:
web:
build:
context: ./
image: local/someflask
stop_signal: SIGINT
ports:
- '8000:8000'
html2rss-web:
image: gilcreator/html2rss-web
ports:
- "3001:3000"
volumes:
- type: bind
source: ./feeds.yml
target: /app/config/feeds.yml
read_only: true
environment:
- RACK_ENV=production
- HEALTH_CHECK_USERNAME=health
- HEALTH_CHECK_PASSWORD=please-set-YOUR-OWN-veeeeeery-l0ng-aNd-h4rd-to-gue55-Passw0rd
- WEB_MAX_THREADS=1
- WEB_CONCURRENCY=1
EOF
cat <<'EOF' >feeds.yml
stylesheets:
- href: "/rss.xsl"
media: "all"
type: "text/xsl"
headers:
"User-Agent": "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
feeds:
failer:
channel:
url: http://web:8000/%<id>s
title: Test web - %<id>s
ttl: 120
selectors:
items:
selector: "div.foo"
title:
selector: "h1"
link:
selector: "h1 > a"
extractor: "href"
description:
selector: "div.item"
EOF
docker-compose up --build -d
while sleep 1; do curl -s http://localhost:3001/ >/dev/null && break ; done
sleep 3
curl -s http://localhost:3001/failer.rss?id=foo | grep 'description' | tail -n 1
curl -s http://localhost:3001/failer.rss?id=foo | grep 'description' | tail -n 1
for item in {1..10}
do
curl -s http://localhost:3001/failer.rss?id=${item}otherstring | grep 'description' | tail -n 1
sleep 10
done
I am using latest docker image with dynamic parameters for a feed and I see sometimes the resulf of one parameter given in the other one.
Here I attach a bash shell script with
Briefly, when I run it I find a results like from the second query.
The output results just the first one repeated.
while the output should be:
Letme know if you need further information,
thanks in advance,
[ edit:
WEB_MAX_THREADS=1, WEB_CONCURRENCY=1]script launch
Test Script:
Details