From be8bfd2bf57cb85faecefe40be0afa3eeeca14ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Wed, 14 Oct 2020 17:12:39 +0200 Subject: [PATCH 1/4] Replace old Mapbox tiles with Static Tiles API Old Mapbox classic styles and API have been deprecated then removed since June 2020. This PR changes the default Mapbox tiles to request the new API. See --- src/frontend/app/ui/gallery/map/map.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/app/ui/gallery/map/map.service.ts b/src/frontend/app/ui/gallery/map/map.service.ts index 4e764135..856701e2 100644 --- a/src/frontend/app/ui/gallery/map/map.service.ts +++ b/src/frontend/app/ui/gallery/map/map.service.ts @@ -13,13 +13,13 @@ export class MapService { constructor(private networkService: NetworkService) { MapService.MAPBOXLAYERS = [{ - name: 'street', url: 'https://api.tiles.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=' + name: 'street', url: 'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/256/{z}/{x}/{y}?access_token=' + Config.Client.Map.mapboxAccessToken }, { - name: 'satellite', url: 'https://api.tiles.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=' + name: 'satellite', url: 'https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/256/{z}/{x}/{y}?access_token=' + Config.Client.Map.mapboxAccessToken }, { - name: 'hybrid', url: 'https://api.tiles.mapbox.com/v4/mapbox.streets-satellite/{z}/{x}/{y}.png?access_token=' + name: 'hybrid', url: 'https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token=' + Config.Client.Map.mapboxAccessToken } ]; From 54d88f280164d771d18418bf396f370a569827a9 Mon Sep 17 00:00:00 2001 From: zertrin Date: Thu, 22 Oct 2020 23:46:48 +0800 Subject: [PATCH 2/4] Fix docker instructions for running without docker-compose Correct definition of config volume. Previously, it would create a `config.json` folder on the host upon first creation of the container, which prevents the app to create the `config.json` file. --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 2ea35c5a..0a80554d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -83,7 +83,7 @@ If you want to run the container by yourself, here you go: docker run \ -p 80:80 \ -e NODE_ENV=production \ - -v /config.json:/app/data/config/config.json \ + -v :/app/data/config \ -v :/app/data/db \ -v :/app/data/images \ -v :/app/data/tmp \ From d149457b3c013f09d9bbb12f7ed4837fe340831c Mon Sep 17 00:00:00 2001 From: zertrin Date: Sun, 25 Oct 2020 20:19:23 +0800 Subject: [PATCH 3/4] Update Dockerfiles - added wget to debian images (it was removed from the node base image, see https://github.com/nodejs/docker-node/issues/1185) - resynchronized the standalone Dockerfile with the one used for builds - apt install without recommended packages - clean apt cache after install to reduce image size a bit --- docker/alpine/Dockerfile.build | 4 +- docker/debian-stretch/Dockerfile.build | 13 ++-- .../debian-stretch/selfcontained/Dockerfile | 59 +++++++++++-------- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/docker/alpine/Dockerfile.build b/docker/alpine/Dockerfile.build index 454561ab..58f0fc3e 100644 --- a/docker/alpine/Dockerfile.build +++ b/docker/alpine/Dockerfile.build @@ -14,7 +14,7 @@ RUN mkdir -p /app/data/config && \ #-----------------MAIN-------------------- #----------------------------------------- -FROM node:12-alpine3.11 as main +FROM node:12-alpine3.11 AS main WORKDIR /app ENV NODE_ENV=production \ # overrides only the default value of the settings (the actualy value can be overwritten through config.json) @@ -24,7 +24,6 @@ ENV NODE_ENV=production \ # flagging dockerized environemnt PI_DOCKER=true - EXPOSE 80 RUN apk add --update-cache --repository https://alpine.global.ssl.fastly.net/alpine/v3.11/community/ \ vips ffmpeg @@ -34,7 +33,6 @@ HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ CMD wget --quiet --tries=1 --no-check-certificate --spider \ http://localhost:80/heartbeat || exit 1 - # after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible # Exec form entrypoint is need otherwise (using shell form) ENV variables are not properly passed down to the app ENTRYPOINT ["node", "./src/backend/index", "--expose-gc", "--config-path=/app/data/config/config.json"] diff --git a/docker/debian-stretch/Dockerfile.build b/docker/debian-stretch/Dockerfile.build index e06da8ac..a765a585 100644 --- a/docker/debian-stretch/Dockerfile.build +++ b/docker/debian-stretch/Dockerfile.build @@ -12,7 +12,7 @@ RUN mkdir -p /app/data/config && \ #-----------------MAIN-------------------- #----------------------------------------- -FROM node:12-stretch-slim as main +FROM node:12-stretch-slim AS main WORKDIR /app ENV NODE_ENV=production \ # overrides only the default value of the settings (the actualy value can be overwritten through config.json) @@ -22,14 +22,11 @@ ENV NODE_ENV=production \ # flagging dockerized environemnt PI_DOCKER=true -# after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible -# This trick is needed as entrypoint in exec form does not support ENV variables -# and in shell form ENV variables were not properly passed to pigallry2 -#RUN echo -e '#!/bin/bash \n node ./src/backend/index --expose-gc --config-path=${CONFIG_FILE}' > ./entrypoint.sh && \ -# chmod +x ./entrypoint.sh - EXPOSE 80 -RUN apt-get update && apt-get install -y ffmpeg +RUN apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates wget ffmpeg \ + && apt-get clean -q -y \ + && rm -rf /var/lib/apt/lists/* COPY --from=builder /app /app VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ diff --git a/docker/debian-stretch/selfcontained/Dockerfile b/docker/debian-stretch/selfcontained/Dockerfile index cb37e22c..46da3b28 100644 --- a/docker/debian-stretch/selfcontained/Dockerfile +++ b/docker/debian-stretch/selfcontained/Dockerfile @@ -1,32 +1,43 @@ -FROM node:12-stretch AS BUILDER +#-----------------BUILDER----------------- +#----------------------------------------- +FROM node:12-stretch AS builder # LABEL maintainer="Patrik J. Braun" # copying only package{-lock}.json to make node_modules cachable RUN git clone https://github.com/bpatrik/pigallery2.git /build WORKDIR /build -RUN set -x && npm install --unsafe-perm && \ - mkdir -p /build/release/data/config && \ - mkdir -p /build/release/data/db && \ - mkdir -p /build/release/data/images && \ - mkdir -p /build/release/data/tmp && \ - npm run create-release && \ - cd /build/release && npm install --unsafe-perm +RUN npm install --unsafe-perm \ + && mkdir -p /build/release/data/config \ + && mkdir -p /build/release/data/db \ + && mkdir -p /build/release/data/images \ + && mkdir -p /build/release/data/tmp \ + && npm run create-release \ + && cd /build/release \ + && npm install --unsafe-perm - -FROM node:12-stretch-slim +#-----------------MAIN-------------------- +#----------------------------------------- +FROM node:12-stretch-slim AS main WORKDIR /app ENV NODE_ENV=production \ - CONFIG_FILE=/app/data/config/config.json \ - Server-Database-dbFolder=/app/data/db \ - Server-Media-folder=/app/data/images \ - Server-Media-tempFolder=/app/data/tmp -ENTRYPOINT ["npm", "start", "--", \ - # after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible - "--expose-gc", \ - "--config-path=$CONFIG_FILE"] -EXPOSE 80 -COPY --from=BUILDER /build/release /app -VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] -HEALTHCHECK --interval=30s --timeout=10s --retries=4 --start-period=60s \ - CMD wget --quiet --tries=1 --no-check-certificate --spider \ - http://localhost:80 || exit 1 + # overrides only the default value of the settings (the actualy value can be overwritten through config.json) + default-Server-Database-dbFolder=/app/data/db \ + default-Server-Media-folder=/app/data/images \ + default-Server-Media-tempFolder=/app/data/tmp \ + # flagging dockerized environemnt + PI_DOCKER=true + +EXPOSE 80 +RUN apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates wget ffmpeg \ + && apt-get clean -q -y \ + && rm -rf /var/lib/apt/lists/* +COPY --from=builder /build/release /app +VOLUME ["/app/data/config", "/app/data/db", "/app/data/images", "/app/data/tmp"] +HEALTHCHECK --interval=40s --timeout=30s --retries=3 --start-period=60s \ + CMD wget --quiet --tries=1 --no-check-certificate --spider \ + http://localhost:80/heartbeat || exit 1 + +# after a extensive job (like video converting), pigallery calls gc, to clean up everthing as fast as possible +# Exec form entrypoint is need otherwise (using shell form) ENV variables are not properly passed down to the app +ENTRYPOINT ["node", "./src/backend/index", "--expose-gc", "--config-path=/app/data/config/config.json"] From 0877b7b2b135ef05327793aceb1728e803b5bb1d Mon Sep 17 00:00:00 2001 From: fxjkhr <780260+fxjkhr@users.noreply.github.com> Date: Wed, 28 Oct 2020 13:02:15 -0700 Subject: [PATCH 4/4] added missing space I believe a space was needed --- docker/docker-compose/with-mysql/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose/with-mysql/docker-compose.yml b/docker/docker-compose/with-mysql/docker-compose.yml index c6f1014d..d11bab38 100644 --- a/docker/docker-compose/with-mysql/docker-compose.yml +++ b/docker/docker-compose/with-mysql/docker-compose.yml @@ -26,7 +26,7 @@ services: pigallery2: image: bpatrik/pigallery2:latest - command: sh -c 'bin/wait-for pigallery-db:3306 -- --Server-Database-mysql-host=pigallery-db --Server-Database-mysql-username=pigallery2 --Server-Database-mysql-password=pigallery2_pass--Server-Database-mysql-database=pigallery2' + command: sh -c 'bin/wait-for pigallery-db:3306 -- --Server-Database-mysql-host=pigallery-db --Server-Database-mysql-username=pigallery2 --Server-Database-mysql-password=pigallery2_pass --Server-Database-mysql-database=pigallery2' container_name: pigallery2 environment: - NODE_ENV=production