Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SETEC - Custom theme #348

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
34 changes: 27 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,52 @@
# Dockerfile for udata
##########################################

FROM udata/system
FROM udata/system:py3.11

# Optionnal build arguments
ARG REVISION="N/A"
ARG CREATED="Undefined"

# Write .pyc files only once. See: https://stackoverflow.com/a/60797635/2556577
ENV PYTHONDONTWRITEBYTECODE 1
# Make sure that stdout and stderr are not buffered. See: https://stackoverflow.com/a/59812588/2556577
ENV PYTHONUNBUFFERED 1
# Remove assert statements and any code conditional on __debug__. See: https://docs.python.org/3/using/cmdline.html#cmdoption-O
ENV PYTHONOPTIMIZE 2
# PIP - DISABLE VERSION CHECK
ENV PIP_DISABLE_PIP_VERSION_CHECK 1
# PIP - HIDE PROGRESS BAR
ENV PIP_PROGRESS_BAR off
# PIP - RETRIES
ENV PIP_RETRIES 1
# PIP - DISABLE WARNING ABOUT ROOT USER
ENV PIP_ROOT_USER_ACTION ignore


# OCI annotations
# See: https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL "org.opencontainers.image.title"="udata all-in-one"
LABEL "org.opencontainers.image.description"="udata with all known plugins and themes"
LABEL "org.opencontainers.image.authors"="Open Data Team"
LABEL "org.opencontainers.image.description"="udata with all known plugins and themes for SETEC Geodatahub"
LABEL "org.opencontainers.image.authors"="Open Data Team, Oslandia"
LABEL "org.opencontainers.image.sources"="https://github.com/opendatateam/docker-udata"
LABEL "org.opencontainers.image.revision"=$REVISION
LABEL "org.opencontainers.image.created"=$CREATED

RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apt update && apt upgrade -y && apt install -y --no-install-recommends \
# uWSGI rooting features
libpcre3-dev \
# Clean up
&& apt-get autoremove\
&& apt-get clean\
&& apt autoremove --purge \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install udata and all known plugins
COPY requirements.pip /tmp/requirements.pip
RUN pip install -r /tmp/requirements.pip && pip check || pip install -r /tmp/requirements.pip
RUN python -m pip install --no-cache-dir -U pip && \
python -m pip install --no-cache-dir -U setuptools wheel && \
python -m pip install --no-cache-dir -U --no-cache-dir -r tmp/requirements.pip && \
python -m pip check || pip install --no-cache-dir -U --no-cache-dir -r /tmp/requirements.pip

RUN rm -r /root/.cache

RUN mkdir -p /udata/fs /src
Expand Down
44 changes: 38 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,62 @@ version: '3'

services:
mongodb:
container_name: gdh-db-mongo
image: mongo:6.0.4
volumes:
- mongo-data:/data/db
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db

redis:
container_name: gdh-bus-redis
image: redis
ports:
- "6379:6379"
volumes:
- redis-data:/data

elasticsearch:
image: udata/elasticsearch
container_name: gdh-search-elasticsearch
ports:
- "6379:6379"
- "9200:9200"
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data

udata:
container_name: gdh-group-app-udata
build: .
links:
- elasticsearch:elasticsearch
- mongodb:mongodb
- redis:redis
volumes:
- udata-fs:/udata/fs
command: serve --host 0.0.0.0 --debugger --reload
environment:
- FLASK_DEBUG=true
ports:
- "7000:7000"
volumes:
- ./udata-config:/udata/fs
# - ../udata-front-sbe:/src/udata-front

volumes:
udata-fs:
elasticsearch-data:
mongo-data:
redis-data:
udata-fs:
driver: local # Define the driver and options under the volume name
driver_opts:
type: none
device: ./data/
o: bind

networks:
default:
name: gdh-udata-network
external: true
ipam:
driver: bridge
config:
- subnet: 172.17.0.0/29

8 changes: 7 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
set -e

if [ "$(ls -A /src)" ]; then
ngstate="$(shopt -p nullglob || true)"
shopt -s nullglob

# Install source repositories as editable
for d in /src/*/ ; do
echo "Installing $d"
Expand All @@ -10,8 +13,11 @@ if [ "$(ls -A /src)" ]; then
# Install packages from requirements files
for r in /src/*.pip ; do
echo "Installing dependencies from $r"
pip install -r "$d"
pip install -r "$r"
done

$(eval $ngstate)

fi

case $1 in
Expand Down
18 changes: 8 additions & 10 deletions requirements.pip
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
uwsgi==2.0.20
gevent==21.12.0
udata==6.1.7
udata-ckan==3.0.1
udata-geoplatform==2.0.0
udata-front==3.2.6
udata-ods==3.0.1
udata-piwik==3.1.0
udata-recommendations==3.1.4
sentry-sdk[flask]==1.3.1
uwsgi==2.0.21
gevent==24.2.1
udata==8.0.1
udata-ckan==3.0.3
udata-front==4.0.0
udata-piwik==4.1.0
udata-recommendations==3.1.5
sentry-sdk[flask]==1.9.0
46 changes: 46 additions & 0 deletions udata-config/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
set -e

if [ "$(ls -A /src)" ]; then
ngstate="$(shopt -p nullglob || true)"
shopt -s nullglob

# Install source repositories as editable
for d in /src/*/ ; do
echo "Installing $d"
pip install -e "$d"
done
# Install packages from requirements files
for r in /src/*.pip ; do
echo "Installing dependencies from $r"
pip install -r "$r"
done

$(eval $ngstate)

fi

case $1 in
uwsgi)
udata collect -ni /udata/public
uwsgi --emperor /udata/uwsgi/
;;
front)
uwsgi /udata/uwsgi/front.ini
;;
worker)
uwsgi /udata/uwsgi/worker.ini
;;
beat)
uwsgi /udata/uwsgi/beat.ini
;;
celery)
celery -A udata.worker "${@:2}"
;;
bash)
/bin/bash
;;
*)
udata "$@"
;;
esac
41 changes: 41 additions & 0 deletions udata-config/udata.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from udata.settings import Defaults

AUTO_INDEX = True

DEBUG = True
DEFAULT_LANGUAGE = 'fr'

MONGODB_HOST = 'mongodb://mongodb:27017/udata'

PLUGINS = ['front']
THEME = 'gouvfr'

CACHE_TYPE = 'redis'
CACHE_REDIS_URL = 'redis://redis:6379/1'
CELERY_BROKER_URL = 'redis://redis:6379'
CELERY_RESULT_BACKEND = 'redis://redis:6379'

ELASTICSEARCH_URL = 'elasticsearch:9200'

FS_PREFIX = '/s'
FS_ROOT = '/udata/fs'



SITE_ID = 'gdh-setec-group'
SITE_TITLE = 'Geodatahub SETEC'
SITE_KEYWORDS = ['opendata', 'udata', 'geodatahub', 'setec', 'oslandia']
SITE_AUTHOR_URL = 'https://oslandia.com'
SITE_AUTHOR = 'OpenDataTeam (Etalab), Oslandia '
SITE_GITHUB_URL = 'https://github.com/etalab/udata'
# SITE_TERMS_LOCATION = pkg_resources.resource_filename(__name__, 'terms.md')

UDATA_INSTANCE_NAME = 'udata-gdh-setec-group'


# :warning: debug values for local usage
RESOURCES_FILE_ALLOWED_DOMAINS = ['*']
SEND_MAIL = False
URLS_ALLOW_PRIVATE = True
URLS_ALLOW_LOCAL = True
URLS_ALLOWED_TLDS = Defaults.URLS_ALLOWED_TLDS | set(['local'])
24 changes: 22 additions & 2 deletions udata.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from udata.settings import Defaults

DEBUG = False
AUTO_INDEX = True

DEBUG = True
DEFAULT_LANGUAGE = 'fr'

MONGODB_HOST = 'mongodb://mongodb:27017/udata'


PLUGINS = ['front']
THEME = 'gouvfr'

Expand All @@ -12,11 +16,27 @@ CACHE_REDIS_URL = 'redis://redis:6379/1'
CELERY_BROKER_URL = 'redis://redis:6379'
CELERY_RESULT_BACKEND = 'redis://redis:6379'

ELASTICSEARCH_URL = 'elasticsearch:9200'

FS_PREFIX = '/s'
FS_ROOT = '/udata/fs'



SITE_ID = 'gdh-setec-group'
SITE_TITLE = 'Geodatahub SETEC'
SITE_KEYWORDS = ['opendata', 'udata', 'geodatahub', 'setec', 'oslandia']
SITE_AUTHOR_URL = 'https://oslandia.com'
SITE_AUTHOR = 'OpenDataTeam (Etalab), Oslandia '
SITE_GITHUB_URL = 'https://github.com/etalab/udata'
# SITE_TERMS_LOCATION = pkg_resources.resource_filename(__name__, 'terms.md')

UDATA_INSTANCE_NAME = 'udata-gdh-setec-group'


# :warning: debug values for local usage
RESOURCES_FILE_ALLOWED_DOMAINS = ['*']
SEND_MAIL = False
URLS_ALLOW_PRIVATE = True
URLS_ALLOW_LOCAL = True
URLS_ALLOWED_TLDS = Defaults.URLS_ALLOWED_TLDS | set(['local'])
RESOURCES_FILE_ALLOWED_DOMAINS = ['*']