Compare commits
5 Commits
39999f5128
...
0641b8bf20
Author | SHA1 | Date |
---|---|---|
simon | 0641b8bf20 | |
simon | 6126ac8674 | |
simon | d195d5e272 | |
simon | f91f8e5be8 | |
simon | c1b4e720d0 |
|
@ -53,11 +53,11 @@ services:
|
||||||
- flask
|
- flask
|
||||||
# backend postgres
|
# backend postgres
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:14
|
image: postgres:15
|
||||||
container_name: postgres
|
container_name: postgres
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./volume/postgres14:/var/lib/postgresql/data/
|
- ./volume/postgres15:/var/lib/postgresql/data/
|
||||||
env_file:
|
env_file:
|
||||||
- ./env/postgres.env
|
- ./env/postgres.env
|
||||||
expose:
|
expose:
|
||||||
|
@ -77,11 +77,10 @@ services:
|
||||||
- umami-db
|
- umami-db
|
||||||
restart: always
|
restart: always
|
||||||
umami-db:
|
umami-db:
|
||||||
image: postgres:14
|
image: postgres:15
|
||||||
container_name: umami-db
|
container_name: umami-db
|
||||||
env_file:
|
env_file:
|
||||||
- ./env/umami.env
|
- ./env/umami.env
|
||||||
volumes:
|
volumes:
|
||||||
- ./volume/umami/schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
|
- ./volume/umami/postgres15:/var/lib/postgresql/data
|
||||||
- ./volume/umami/db:/var/lib/postgresql/data
|
|
||||||
restart: always
|
restart: always
|
||||||
|
|
|
@ -25,11 +25,11 @@ services:
|
||||||
- flask
|
- flask
|
||||||
# backend postgres
|
# backend postgres
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:14
|
image: postgres:15
|
||||||
container_name: postgres
|
container_name: postgres
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./volume/postgres14:/var/lib/postgresql/data/
|
- ./volume/postgres15:/var/lib/postgresql/data/
|
||||||
env_file:
|
env_file:
|
||||||
- ./env/postgres.env
|
- ./env/postgres.env
|
||||||
expose:
|
expose:
|
||||||
|
|
115
versioncheck.py
115
versioncheck.py
|
@ -1,115 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
""" check requirements.txt for outdated packages """
|
|
||||||
|
|
||||||
import pathlib
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
class Requirements:
|
|
||||||
"""handle requirements.txt"""
|
|
||||||
|
|
||||||
FILE_PATH = "web/requirements.txt"
|
|
||||||
LOCK = "/tmp/air-requirements.lock"
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.exists = self.checked_today()
|
|
||||||
self.all_requirements = False
|
|
||||||
self.all_updates = False
|
|
||||||
|
|
||||||
def checked_today(self):
|
|
||||||
"""skip requirements check when lock file exists"""
|
|
||||||
exists = pathlib.Path(self.LOCK).exists()
|
|
||||||
return exists
|
|
||||||
|
|
||||||
def look_for_updates(self):
|
|
||||||
"""look through requirements and check for updates"""
|
|
||||||
self.all_requirements = self.get_dependencies()
|
|
||||||
self.all_updates = self.check_packages()
|
|
||||||
|
|
||||||
def get_dependencies(self):
|
|
||||||
"""read out requirements.txt"""
|
|
||||||
|
|
||||||
all_requirements = []
|
|
||||||
with open(self.FILE_PATH, "r", encoding="utf-8") as f:
|
|
||||||
dependencies = f.readlines()
|
|
||||||
|
|
||||||
for dependency in dependencies:
|
|
||||||
package, version = dependency.split("==")
|
|
||||||
all_requirements.append((package, version.strip()))
|
|
||||||
|
|
||||||
all_requirements.sort(key=lambda x: x[0].lower())
|
|
||||||
|
|
||||||
return all_requirements
|
|
||||||
|
|
||||||
def check_packages(self):
|
|
||||||
"""compare installed with remote version"""
|
|
||||||
|
|
||||||
total = len(self.all_requirements)
|
|
||||||
print(f"checking versions for {total} packages...")
|
|
||||||
|
|
||||||
all_updates = {}
|
|
||||||
|
|
||||||
for dependency in self.all_requirements:
|
|
||||||
package, version_installed = dependency
|
|
||||||
url = f"https://pypi.org/pypi/{package}/json"
|
|
||||||
response = requests.get(url).json()
|
|
||||||
version_remote = response["info"]["version"]
|
|
||||||
homepage = response["info"]["home_page"]
|
|
||||||
if version_remote != version_installed:
|
|
||||||
to_update = {
|
|
||||||
package: {"from": version_installed, "to": version_remote}
|
|
||||||
}
|
|
||||||
all_updates.update(to_update)
|
|
||||||
message = (
|
|
||||||
f"update {package} {version_installed}"
|
|
||||||
+ f"==> {version_remote}\n {homepage}"
|
|
||||||
)
|
|
||||||
print(message)
|
|
||||||
|
|
||||||
if not all_updates:
|
|
||||||
print("no updates found")
|
|
||||||
|
|
||||||
# remember that
|
|
||||||
pathlib.Path(self.LOCK).touch()
|
|
||||||
|
|
||||||
return all_updates
|
|
||||||
|
|
||||||
def apply_updates(self):
|
|
||||||
"""update requirements.txt file with new versions"""
|
|
||||||
|
|
||||||
to_write = []
|
|
||||||
|
|
||||||
for requirement in self.all_requirements:
|
|
||||||
package, old_version = requirement
|
|
||||||
|
|
||||||
if package in self.all_updates.keys():
|
|
||||||
package_version = self.all_updates[package]["to"]
|
|
||||||
else:
|
|
||||||
package_version = old_version
|
|
||||||
|
|
||||||
to_write.append(f"{package}=={package_version}\n")
|
|
||||||
|
|
||||||
with open(self.FILE_PATH, "w", encoding="utf-8") as f:
|
|
||||||
f.writelines(to_write)
|
|
||||||
|
|
||||||
print("requirements.txt updates")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""main to check for updates"""
|
|
||||||
handler = Requirements()
|
|
||||||
if handler.exists:
|
|
||||||
return
|
|
||||||
|
|
||||||
handler.look_for_updates()
|
|
||||||
if handler.all_updates:
|
|
||||||
input_response = input("\nupdate requirements.txt? [y/n] ")
|
|
||||||
if input_response == "y":
|
|
||||||
handler.apply_updates()
|
|
||||||
else:
|
|
||||||
print("skip update...")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.10.8-slim-bullseye
|
FROM python:3.11.3-slim-bullseye
|
||||||
|
|
||||||
RUN apt-get clean && apt-get -y update && \
|
RUN apt-get clean && apt-get -y update && \
|
||||||
apt-get -y install --no-install-recommends build-essential
|
apt-get -y install --no-install-recommends build-essential
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
APScheduler==3.10.0
|
APScheduler==3.10.1
|
||||||
Flask_HTTPAuth==4.7.0
|
Flask==2.3.2
|
||||||
|
Flask_HTTPAuth==4.8.0
|
||||||
Flask_Table==0.5.0
|
Flask_Table==0.5.0
|
||||||
Flask==2.2.2
|
ipython==8.13.2
|
||||||
ipython==8.9.0
|
matplotlib==3.7.1
|
||||||
matplotlib==3.6.3
|
numpy==1.24.3
|
||||||
numpy==1.24.2
|
pandas==2.0.1
|
||||||
pandas==1.5.3
|
psycopg2-binary==2.9.6
|
||||||
psycopg2-binary==2.9.5
|
requests==2.30.0
|
||||||
requests==2.28.2
|
scipy==1.10.1
|
||||||
scipy==1.10.0
|
|
||||||
uWSGI==2.0.21
|
uWSGI==2.0.21
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<script src="{{ url_for('static', filename='js/aqi.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/aqi.js') }}"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}">
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}">
|
||||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/lightbox.css') }}">
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/lightbox.css') }}">
|
||||||
<script async defer data-website-id="903006c2-afce-40ff-8ba3-20041de11e92" src="https://stats.lpb-air.com/umami.js"></script>
|
<script async defer data-website-id="903006c2-afce-40ff-8ba3-20041de11e92" src="https://stats.lpb-air.com/script.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="preload">
|
<div class="preload">
|
||||||
|
|
Loading…
Reference in New Issue