1
0
mirror of https://github.com/peeringdb/peeringdb.git synced 2024-05-11 05:55:09 +00:00

operations changes (#1508)

* remove listening env vars from docker file
* allow env override of STATIC and MEDIA root
* add uwsgi file to tester target
* add output_dir to kmz gen, kmz-gen-only
This commit is contained in:
Matt Griswold
2024-01-16 14:37:44 -06:00
committed by GitHub
parent e1f3c72588
commit 04a6d8f071
6 changed files with 28 additions and 13 deletions

View File

@ -1 +1 @@
2.53.0
2.54.0-beta

View File

@ -105,16 +105,20 @@ COPY poetry.lock pyproject.toml ./
RUN true
COPY tests/ tests
RUN chown -R pdb:pdb tests/
COPY Ctl/docker/entrypoint.sh .
# install dev deps
RUN apk --update --no-cache add $build_deps
RUN pip install -U poetry
RUN poetry install --no-root
# Same as final entrypoint for running in dev mode
COPY Ctl/docker/entrypoint.sh .
RUN true
COPY Ctl/docker/django-uwsgi.ini etc/
USER pdb
ENTRYPOINT ["./entrypoint.sh"]
CMD ["runserver", "$RUNSERVER_BIND"]
CMD ["runserver"]
#### entry point from final image, not tester
FROM final
@ -123,10 +127,6 @@ COPY Ctl/docker/entrypoint.sh .
RUN true
COPY Ctl/docker/django-uwsgi.ini etc/
ENV UWSGI_SOCKET="127.0.0.1:7002"
ENV RUNSERVER_BIND="127.0.0.1:8080"
USER pdb
ENTRYPOINT ["./entrypoint.sh"]
CMD ["runserver", "$RUNSERVER_BIND"]
CMD ["runserver"]

View File

@ -553,10 +553,10 @@ ADMINS = [
]
MANAGERS = ADMINS
MEDIA_ROOT = os.path.abspath(os.path.join(BASE_DIR, "media"))
set_option("MEDIA_ROOT", os.path.abspath(os.path.join(BASE_DIR, "media")))
MEDIA_URL = f"/m/{PEERINGDB_VERSION}/"
STATIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, "static"))
set_option("STATIC_ROOT", os.path.abspath(os.path.join(BASE_DIR, "static")))
STATIC_URL = f"/s/{PEERINGDB_VERSION}/"
# limit error emails (2/minute)

View File

@ -72,16 +72,20 @@ def collect_carriers(path=None):
return mapping
def fac_export_kmz(limit=None, path=None):
def fac_export_kmz(limit=None, path=None, output_dir=None):
"""
This function exports facility data to a KMZ file.
It reads the facility data from a JSON file, creates a KML object, and adds points to a folder in the KML.
Each point represents a facility with its name, notes, and coordinates.
The KML is then saved as a KMZ file.
If `output_dir` is not passed, it uses `path`
"""
if not path:
path = settings.API_CACHE_ROOT
if not output_dir:
output_dir = path
cached_fac_path = f"{path}/fac-0.json"
@ -138,4 +142,4 @@ def fac_export_kmz(limit=None, path=None):
displayname="Carriers",
)
kml.savekmz(f"{path}/peeringdb.kmz")
kml.savekmz(f"{output_dir}/peeringdb.kmz")

View File

@ -71,6 +71,11 @@ class Command(BaseCommand):
action="store_true",
help="will generate kmz file in from the api-cache data",
)
parser.add_argument(
"--gen-kmz-only",
action="store_true",
help="generate kmz file from api-cache data, output to output dir, and exit",
)
parser.add_argument(
"--date",
action="store",
@ -121,6 +126,11 @@ class Command(BaseCommand):
# checks
settings.GENERATING_API_CACHE = True
if options.get("gen_kmz_only"):
print("Generating kmz file")
fac_export_kmz(output_dir=output_dir)
return
if only:
only = only.split(",")
@ -215,6 +225,7 @@ class Command(BaseCommand):
if options.get("gen_kmz"):
print("Generating kmz file")
# uses path here so it's using the newly generated cache files
fac_export_kmz(path=output_dir)
end_time = time.time()

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "peeringdb_server"
version = "2.53.0"
version = "2.54.0-beta"
description = "source code for PeeringDB.com"
readme = "README.md"
repository = "https://github.com/peeringdb/peeringdb"