diff --git a/docker-compose.development.yml b/docker-compose.development.yml index 86685d1346..0f25e694ca 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -126,7 +126,7 @@ services: restart: "on-failure:2" central: - image: "ghcr.io/hotosm/fmtm/odkcentral:${ODK_CENTRAL_TAG:-v2024.1.0}" + image: "ghcr.io/hotosm/fmtm/odkcentral:${ODK_CENTRAL_TAG:-v2024.2.1}" depends_on: central-db: condition: service_healthy @@ -168,7 +168,7 @@ services: central-ui: # This service simply builds the frontend to a volume # accessible to the proxy, then shuts down - image: "ghcr.io/hotosm/fmtm/odkcentral-ui:${ODK_CENTRAL_TAG:-v2024.1.0}" + image: "ghcr.io/hotosm/fmtm/odkcentral-ui:${ODK_CENTRAL_TAG:-v2024.2.1}" volumes: - central_frontend:/frontend network_mode: none diff --git a/docker-compose.yml b/docker-compose.yml index 9b1d45e656..1ab0c5fbbe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -159,11 +159,11 @@ services: central: profiles: ["", "central"] - image: "ghcr.io/hotosm/fmtm/odkcentral:${ODK_CENTRAL_TAG:-v2024.1.0}" + image: "ghcr.io/hotosm/fmtm/odkcentral:${ODK_CENTRAL_TAG:-v2024.2.1}" build: context: odkcentral/api args: - ODK_CENTRAL_TAG: ${ODK_CENTRAL_TAG:-v2024.1.0} + ODK_CENTRAL_TAG: ${ODK_CENTRAL_TAG:-v2024.2.1} depends_on: central-db: condition: service_healthy @@ -211,11 +211,11 @@ services: # This service simply builds the frontend to a volume # accessible to the proxy, then shuts down profiles: ["", "central"] - image: "ghcr.io/hotosm/fmtm/odkcentral-ui:${ODK_CENTRAL_TAG:-v2024.1.0}" + image: "ghcr.io/hotosm/fmtm/odkcentral-ui:${ODK_CENTRAL_TAG:-v2024.2.1}" build: context: odkcentral/ui args: - ODK_CENTRAL_TAG: ${ODK_CENTRAL_TAG:-v2024.1.0} + ODK_CENTRAL_TAG: ${ODK_CENTRAL_TAG:-v2024.2.1} volumes: - central_frontend:/frontend network_mode: none diff --git a/docs/about/faq.md b/docs/about/faq.md index 03f8223163..bdf2f224fa 100644 --- a/docs/about/faq.md +++ b/docs/about/faq.md @@ -31,10 +31,10 @@ already. FMTM is not aiming to compete with these tools, but instead has two goa - Manages both **coordination** and **data collection\*** in one framework. - Roadmapping input from the rich HOTOSM community. -!!! note + !!! note - *The data collection portion is outsourced to the excellent - ecosystem of ODK tools underneath. + The data collection* portion is outsourced to the excellent + ecosystem of ODK tools underneath. --- diff --git a/odkcentral/api/Dockerfile b/odkcentral/api/Dockerfile index e5ea1fd541..813a1316ac 100644 --- a/odkcentral/api/Dockerfile +++ b/odkcentral/api/Dockerfile @@ -15,61 +15,15 @@ # along with FMTM. If not, see . # -ARG node_version=20.10 +# NOTE this dockerfile simply extends the official image +# to init an admin user at startup - - -FROM docker.io/bitnami/git:2 as repo ARG ODK_CENTRAL_TAG -RUN git clone --depth 1 --branch ${ODK_CENTRAL_TAG} \ - "https://github.com/getodk/central.git" \ - && cd central && git submodule update --init - - - -FROM docker.io/node:${node_version}-slim -WORKDIR /usr/odk -COPY --from=repo central/files/service/crontab /etc/cron.d/odk -COPY --from=repo central/files/service/scripts/ ./ -COPY --from=repo central/files/service/config.json.template /usr/share/odk/ -COPY --from=repo central/files/service/odk-cmd /usr/bin/ -# Add entrypoint script to init user +FROM ghcr.io/getodk/central-service:${ODK_CENTRAL_TAG} COPY init-user-and-start.sh / -# package.json must be added and installed prior to final COPY -COPY --from=repo central/server/package*.json ./ - -# Install system deps -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - curl \ - gpg \ - cron \ - wait-for-it \ - gettext \ - procps \ - postgresql-client \ - netcat-traditional \ - && rm -rf /var/lib/apt/lists/* \ - # Install node_modules - && npm clean-install --omit=dev --legacy-peer-deps --no-audit \ - --fund=false --update-notifier=false \ - # Required to start via entrypoint - && mkdir /etc/secrets sentry-versions \ - && echo 'jhs9udhy987gyds98gfyds98f' > /etc/secrets/enketo-api-key \ - && echo '1' > sentry-versions/server \ - && echo '1' > sentry-versions/central \ - && echo '1' > sentry-versions/client \ - # Set entrypoint executable - && chmod +x /init-user-and-start.sh - -# Add remaining files after deps installed -COPY --from=repo central/server/ ./ - +RUN chmod +x /init-user-and-start.sh ENTRYPOINT ["/init-user-and-start.sh"] -EXPOSE 8383 - -# Add Healthcheck HEALTHCHECK --start-period=10s --interval=5s --retries=10 \ CMD nc -z localhost 8383 || exit 1 diff --git a/odkcentral/enketo/Dockerfile b/odkcentral/enketo/Dockerfile deleted file mode 100644 index dfd359077f..0000000000 --- a/odkcentral/enketo/Dockerfile +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team -# This file is part of FMTM. -# -# FMTM is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# FMTM is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with FMTM. If not, see . -# - -# TODO this dockerfile is not complete, but is largely optimise -# over the official image (>800MB reduction) -ARG node_version=16 - - -FROM docker.io/bitnami/git:2 as enketo -ARG ENKETO_TAG=6.2.2 -RUN git clone --depth 1 --branch ${ENKETO_TAG} \ - "https://github.com/enketo/enketo-express.git" - - - -FROM docker.io/bitnami/git:2 as central -ARG ODK_CENTRAL_TAG -RUN git clone --depth 1 --branch ${ODK_CENTRAL_TAG} \ - "https://github.com/getodk/central.git" - - - -FROM docker.io/node:${node_version}-slim as build -WORKDIR /repo -COPY --from=enketo enketo-express/ . -RUN npm install -g npm@^6 -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - git \ - build-essential \ - python3 \ - openssh-client \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* \ - && update-ca-certificates -# Skip chrome install for puppeteer -ENV PUPPETEER_SKIP_DOWNLOAD='true' -RUN npm ci -RUN npx grunt -RUN npm prune --production - - - -FROM docker.io/node:${node_version}-slim as runtime -ENV ENKETO_SRC_DIR=/srv/src/enketo_express -WORKDIR ${ENKETO_SRC_DIR} -RUN npm install -g pm2@$(npm info pm2 version) -# Persist the `secrets` directory so the encryption key remains consistent. -RUN mkdir -p ${ENKETO_SRC_DIR}/setup/docker/secrets -VOLUME ${ENKETO_SRC_DIR}/setup/docker/secrets - -# From ODK Central Config -COPY --from=central central/files/enketo/config.json.template \ - ${ENKETO_SRC_DIR}/config/config.json.template -COPY --from=central central/files/enketo/config.json.template \ - ${ENKETO_SRC_DIR}/config/config.json -COPY --from=central central/files/enketo/start-enketo.sh \ - ${ENKETO_SRC_DIR}/start-enketo.sh - -RUN apt-get update && \ - apt-get install gettext-base \ - && rm -rf /var/lib/apt/lists/* \ - && mkdir /etc/secrets \ - && echo 'jhs9udhy987gyds98gfyds98f' > /etc/secrets/enketo-api-key \ - && echo 'jhs9udhy987gyds98gfyds98f' > /etc/secrets/enketo-secret \ - && echo 'jhs9udhy987gyds98gfyds98f' > /etc/secrets/enketo-less-secret - -COPY --from=build /repo/ ./ - -EXPOSE 8005 - -CMD ["./start-enketo.sh"] diff --git a/odkcentral/ui/Dockerfile b/odkcentral/ui/Dockerfile index c164735b35..8b32da873e 100644 --- a/odkcentral/ui/Dockerfile +++ b/odkcentral/ui/Dockerfile @@ -15,30 +15,25 @@ # along with FMTM. If not, see . # -ARG node_version=20.10 +# An image to copy the built ODK Central dist into an rclone +# container for copying to nginx at runtime - - -FROM docker.io/bitnami/git:2 as repo ARG ODK_CENTRAL_TAG -RUN git clone --depth 1 --branch ${ODK_CENTRAL_TAG} \ - "https://github.com/getodk/central.git" \ - && cd central && git submodule update --init - - - -FROM docker.io/node:${node_version}-slim as build -WORKDIR /frontend -COPY --from=repo central/client/ /frontend/ -RUN npm ci --no-audit --fund=false --update-notifier=false -RUN VUE_APP_OIDC_ENABLED="false" npm run build - +FROM ghcr.io/getodk/central-nginx:${ODK_CENTRAL_TAG} as frontend FROM docker.io/rclone/rclone:1 as prod +ARG ODK_CENTRAL_TAG +# Disable OIDC when we generate client config json below +ENV OIDC_ENABLED="false" VOLUME /frontend +WORKDIR /app COPY container-entrypoint.sh / -RUN chmod +x /container-entrypoint.sh +RUN apk add --no-cache envsubst \ + && chmod +x /container-entrypoint.sh +ADD https://raw.githubusercontent.com/getodk/central/${ODK_CENTRAL_TAG}/files/nginx/client-config.json.template . +# See https://github.com/getodk/central/blob/2d95a612218e7c73ee8b3e715749401f08fc00ac/files/nginx/setup-odk.sh#L10 +RUN envsubst < ./client-config.json.template > ./client-config.json \ + && rm ./client-config.json.template +COPY --from=frontend /usr/share/nginx/html . ENTRYPOINT ["/container-entrypoint.sh"] -WORKDIR /app -COPY --from=build /frontend/dist .