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

Moves the locales to the config container #5099

Merged
merged 1 commit into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions docker/config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ ENV VERSION=$VERSION

RUN \
apt-get update && \
apt-get install --assume-yes --no-install-recommends gettext-base python3-pip python3-setuptools && \
apt-get install --assume-yes --no-install-recommends gettext-base python3 && \
apt-get clean && \
rm --recursive --force /var/lib/apt/lists/*

COPY requirements.txt /tmp
RUN python3 -m pip install --requirement=/tmp/requirements.txt
2 changes: 0 additions & 2 deletions docker/config/requirements.txt

This file was deleted.

48 changes: 35 additions & 13 deletions geoportal/c2cgeoportal_geoportal/scaffolds/create/Dockerfile_tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
FROM camptocamp/geomapfish-config-build:{{geomapfish_version}}

ARG PGSCHEMA
ENV PGSCHEMA=$PGSCHEMA

COPY . /tmp/config/
FROM camptocamp/geomapfish-build:{{geomapfish_version}} as builder

ENV LANGUAGES="en fr de"
ENV VARS_FILE=vars.yaml
ENV CONFIG_VARS sqlalchemy.url sqlalchemy.pool_recycle sqlalchemy.pool_size sqlalchemy.max_overflow \
sqlalchemy.use_batch_mode sqlalchemy_slave.url sqlalchemy_slave.pool_recycle sqlalchemy_slave.pool_size \
sqlalchemy_slave.max_overflow sqlalchemy_slave.use_batch_mode schema schema_static enable_admin_interface \
Expand All @@ -14,7 +11,37 @@ ENV CONFIG_VARS sqlalchemy.url sqlalchemy.pool_recycle sqlalchemy.pool_size sqla
reset_password fulltextsearch global_headers headers authorized_referers hooks stats db_chooser \
dbsessions urllogin host_forward_host smtp c2c.base_path welcome_email \
lingua_extractor interfaces_config interfaces devserver_url api
ENV VARS_FILE=vars.yaml

COPY . /tmp/config/

RUN \
for lang in ${LANGUAGES}; \
do \
node /usr/bin/compile-catalog \
/opt/c2cgeoportal_geoportal/c2cgeoportal_geoportal/locale/${lang}/LC_MESSAGES/ngeo.po \
/opt/c2cgeoportal_geoportal/c2cgeoportal_geoportal/locale/${lang}/LC_MESSAGES/gmf.po \
/tmp/config/geoportal/{{package}}_geoportal/locale/${lang}/LC_MESSAGES/{{package}}_geoportal-client.po \
> /tmp/config/geoportal/{{package}}_geoportal/static/${lang}.json; \
done && \
rm -rf /tmp/config/geoportal/{{package}}_geoportal/locale

RUN \
cd /tmp/config/geoportal/ && \
c2c-template --vars ${VARS_FILE} \
--get-config {{package}}_geoportal/config.yaml \
${CONFIG_VARS} && \
pykwalify --data-file {{package}}_geoportal/config.yaml \
--schema-file CONST_config-schema.yaml && \
rm CONST_* vars.yaml

###############################################################################

FROM camptocamp/geomapfish-config-build:{{geomapfish_version}}

ARG PGSCHEMA
ENV PGSCHEMA=$PGSCHEMA

COPY --from=builder /tmp/config/ /tmp/config/

RUN mv /tmp/config/bin/* /usr/bin/ && \
if [ -e /tmp/config/mapserver ]; then mv /tmp/config/mapserver /etc/; fi && \
Expand All @@ -25,12 +52,7 @@ RUN mv /tmp/config/bin/* /usr/bin/ && \
if [ -e /tmp/config/front_dev ]; then mv /tmp/config/front_dev /etc/haproxy_dev; fi && \
mkdir --parent /usr/local/tomcat/webapps/ROOT/ && \
if [ -e /tmp/config/print ]; then mv /tmp/config/print/print-apps /usr/local/tomcat/webapps/ROOT/; fi && \
cd /tmp/config/geoportal && \
mkdir --parent /etc/geomapfish/ && \
c2c-template --vars ${VARS_FILE} --get-config /tmp/_config.yaml ${CONFIG_VARS} && \
pykwalify --data-file /tmp/_config.yaml --schema-file CONST_config-schema.yaml && \
mv /tmp/_config.yaml /etc/geomapfish/config.yaml && \
mv /tmp/config/geoportal/{{package}}_geoportal/static /etc/geomapfish/ && \
mv /tmp/config/geoportal/{{package}}_geoportal/ /etc/geomapfish/ && \
chmod g+w -R /etc /usr/local/tomcat/webapps && \
adduser www-data root

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ APP_JS_FILES = $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*
HTML_FILES += $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*.html' 2> /dev/null)
SASS_FILES += $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*.scss' 2> /dev/null)
CSS_FILES += $(shell find $(PACKAGE)_geoportal/static-ngeo/js -type f -name '*.css' 2> /dev/null)
JSON_CLIENT_LOCALISATION_FILES = $(addprefix $(APP_OUTPUT_DIR)/, $(addsuffix .json, $(LANGUAGES)))
ANGULAR_LOCALES_FILES = $(addprefix $(APP_OUTPUT_DIR)/angular-locale_, $(addsuffix .js, $(LANGUAGES)))
NGEO_OUTPUT_FILES = $(JSON_CLIENT_LOCALISATION_FILES) \
$(ANGULAR_LOCALES_FILES)
NGEO_OUTPUT_FILES += apps
NGEO_OUTPUT_FILES = $(ANGULAR_LOCALES_FILES) apps

NGEO_API_OUTPUT_JS_FILE ?= $(APP_OUTPUT_DIR)/api.js.tmpl
NGEO_API_OUTPUT_FILES += $(NGEO_API_OUTPUT_JS_FILE) $(APP_OUTPUT_DIR)/api.css
Expand Down Expand Up @@ -93,14 +90,6 @@ eslint: $(APP_JS_FILES)
.PHONY: build-ngeo
build-ngeo: $(NGEO_OUTPUT_FILES)

.PRECIOUS: $(APP_OUTPUT_DIR)/%.json
$(APP_OUTPUT_DIR)/%.json:
mkdir --parent $(dir $@)
node /usr/bin/compile-catalog \
/opt/c2cgeoportal_geoportal/c2cgeoportal_geoportal/locale/$*/LC_MESSAGES/ngeo.po \
/opt/c2cgeoportal_geoportal/c2cgeoportal_geoportal/locale/$*/LC_MESSAGES/gmf.po \
$(PACKAGE)_geoportal/locale/$*/LC_MESSAGES/$(PACKAGE)_geoportal-client.po > $@

$(APP_OUTPUT_DIR)/angular-locale_%.js: /usr/lib/node_modules/ngeo/package.json language_mapping
mkdir --parent $(dir $@)
rm --force $@
Expand Down
2 changes: 1 addition & 1 deletion geoportal/c2cgeoportal_geoportal/views/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def dynamic(self):
'interface': interface_name,
'cache_version': get_cache_version(),
'lang_urls': {
lang: self.request.static_url('/etc/static-ngeo/{lang}.json'.format(
lang: self.request.static_url('/etc/geomapfish/static/{lang}.json'.format(
package=self.request.registry.settings["package"],
lang=lang,
_query={
Expand Down
8 changes: 4 additions & 4 deletions geoportal/tests/functional/test_dynamicview.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_constant_dynamic_lang_urls(self):

assert 'XTest' in dynamic['constants'], dynamic
assert dynamic['constants']['XTest'] == {
'fr': '/dummy/route/url//etc/static-ngeo/fr.json'
'fr': '/dummy/route/url//etc/geomapfish/static/fr.json'
}

def test_constant_dynamic_fulltextsearch_groups(self):
Expand Down Expand Up @@ -269,7 +269,7 @@ def test_route_with_keywords(self):
}
}
})) as config:
config.add_static_view(name='static-ngeo', path='/etc/static-ngeo')
config.add_static_view(name='static', path='/etc/geomapfish/static')
config.add_route('test', '/test')
config.add_route('route_with_keywords', '/test/{key1}/{key2}')
request = DummyRequest({'interface': 'test'})
Expand All @@ -290,7 +290,7 @@ def test_route_with_segments(self):
}
}
})) as config:
config.add_static_view(name='static-ngeo', path='/etc/static-ngeo')
config.add_static_view(name='static', path='/etc/geomapfish/static')
config.add_route('test', '/test')
config.add_route('route_with_segments', '/test')
request = DummyRequest({'interface': 'test'})
Expand Down Expand Up @@ -318,7 +318,7 @@ def test_route_with_all(self):
}
}
})) as config:
config.add_static_view(name='static-ngeo', path='/etc/static-ngeo')
config.add_static_view(name='static', path='/etc/geomapfish/static')
config.add_route('test', '/test')
config.add_route('route_with_all', '/test/{key1}/{key2}')
request = DummyRequest({'interface': 'test'})
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pep8~=1.7.1 # lint
pep8-naming~=0.8.2 # Lint
polib~=1.1.0 # i18n
pyflakes~=2.1.1 # lint, flake8
pykwalify==1.7.0 # Validate config
pylint~=2.3.1 # lint
Pillow~=6.0.0 # Tile generation, rq.filter: < 6.0.0
pytest-cov~=2.7.1 # tests
Expand Down