diff --git a/.env b/.env index f633ccb60c301..244c6a1f09cb7 100644 --- a/.env +++ b/.env @@ -19,7 +19,7 @@ TAG=latest # static lang dependent files for the website # we have a minimal set of files in server repo, in prod we use main repo -WEB_LANG_PATH=./lang-default +WEB_RESOURCES_PATH=./web-default # env vars PRODUCERS_PLATFORM=0 diff --git a/.github/workflows/container-deploy.yml b/.github/workflows/container-deploy.yml index 337e773886685..2953419a10a39 100644 --- a/.github/workflows/container-deploy.yml +++ b/.github/workflows/container-deploy.yml @@ -133,7 +133,7 @@ jobs: # Set App variables echo "TAG=sha-${{ github.sha }}" >> .env - echo "WEB_LANG_PATH=../off-web-net/lang" >> .env + echo "WEB_RESOURCES_PATH=../off-web-net/" >> .env echo "PRODUCERS_PLATFORM=0" >> .env echo "PRODUCT_OPENER_PORT=80" >> .env echo "PRODUCT_OPENER_DOMAIN=${{ env.PRODUCT_OPENER_DOMAIN }}" >> .env diff --git a/Makefile b/Makefile index c0216449f9b0f..e3188337e040e 100644 --- a/Makefile +++ b/Makefile @@ -49,9 +49,10 @@ HOSTS=127.0.0.1 world.productopener.localhost fr.productopener.localhost static. # commands aliases DOCKER_COMPOSE=docker compose --env-file=${ENV_FILE} ${LOAD_EXTRA_ENV_FILE} # we run tests in a specific project name to be separated from dev instances +# keep web-default for web contents # we also publish mongodb on a separate port to avoid conflicts # we also enable the possibility to fake services in po_test_runner -DOCKER_COMPOSE_TEST=ROBOTOFF_URL="http://backend:8881/" GOOGLE_CLOUD_VISION_API_URL="http://backend:8881/" COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}_test PO_COMMON_PREFIX=test_ MONGO_EXPOSE_PORT=27027 docker compose --env-file=${ENV_FILE} +DOCKER_COMPOSE_TEST=WEB_RESOURCES_PATH=./web-default ROBOTOFF_URL="http://backend:8881/" GOOGLE_CLOUD_VISION_API_URL="http://backend:8881/" COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME}_test PO_COMMON_PREFIX=test_ MONGO_EXPOSE_PORT=27027 docker compose --env-file=${ENV_FILE} # Enable Redis only for integration tests DOCKER_COMPOSE_INT_TEST=REDIS_URL="redis:6379" ${DOCKER_COMPOSE_TEST} diff --git a/conf/nginx.conf b/conf/nginx.conf index 6a705bb664327..f8d6834b3b8d8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -11,7 +11,7 @@ # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## -# Default server configuration +# Default server configuration for DOCKER # # we need to have main domain for CORS (see nginx-cors includes) @@ -20,13 +20,16 @@ map $host $main_domain { ~*.*\.(?[^.]+\.[^.]+) $host_main_domain; } +include /etc/nginx/snippets/expires-no-json-xml.conf; server { listen 80; listen [::]:80; # Product Opener needs a root domain + a wildcard for all subdomains - server_name server_name ${PRODUCT_OPENER_DOMAIN} *.${PRODUCT_OPENER_DOMAIN}; + server_name ${PRODUCT_OPENER_DOMAIN} *.${PRODUCT_OPENER_DOMAIN}; + + access_log /var/log/${productopener_access_file_prefix}access.log; # static file we serve are in html/ root /opt/product-opener/html/; @@ -48,11 +51,9 @@ server { # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; - # handling expirations - include /etc/nginx/snippets/expires-no-json-xml.conf; - location ~ ^/images/products/ { include /etc/nginx/snippets/off.cors-headers.include; + include /etc/nginx/snippets/expiry-headers.include; add_header Link "; rel='license'; title='CC-BY-SA 3.0'"; # optimize gzip compressed content (like OCR .json stored next to .jpg files) gzip_static always; @@ -63,6 +64,7 @@ server { location ~ ^/files/(.*) { include snippets/off.cors-headers.include; + include /etc/nginx/snippets/expiry-headers.include; # fist try in files_resources try_files files_resources/$1 $uri $uri/ =404; gzip_static always; @@ -71,9 +73,10 @@ server { location ~ ^/(.well-known|images|fonts|css|js|rss|resources|foundation|bower_components)/ { include /etc/nginx/snippets/off.cors-headers.include; - # First attempt to serve request as file, then - # as directory, then fall back to displaying a 404. - try_files $uri $uri/ =404; + include /etc/nginx/snippets/expiry-headers.include; + # First attempt to serve request as file, off_web_html acting as an override, + # then as directory, then fall back to displaying a 404. + try_files /off_web_html$uri $uri $uri/ =404; gzip_static always; gunzip on; } @@ -82,13 +85,13 @@ server { # and much less when caching headers are sent location = /.well-known/assetlinks.json { include /etc/nginx/snippets/off.cors-headers.include; - expires 1d; + include /etc/nginx/snippets/expiry-headers.include; try_files $uri $uri/ =404; } location ~ /(favicon\.ico)$ { include /etc/nginx/snippets/off.cors-headers.include; - expires 1d; + include /etc/nginx/snippets/expiry-headers.include; try_files $uri $uri/ =404; } @@ -100,8 +103,9 @@ server { # this is the internal Docker DNS, cache only for 30s resolver 127.0.0.11 valid=30s; - location ~ /donate\/.*$ { + location ~ ^/donate\/.*$ { include /etc/nginx/snippets/off.cors-headers.include; + include /etc/nginx/snippets/expiry-headers.include; try_files $uri =404; } location / { diff --git a/conf/nginx/sites-available/foodbattle b/conf/nginx/sites-available/foodbattle index a2e89c327b07b..da9131d43843d 100644 --- a/conf/nginx/sites-available/foodbattle +++ b/conf/nginx/sites-available/foodbattle @@ -21,6 +21,7 @@ server { return 301 http://foodbattle.net$request_uri; } +include /etc/nginx/expires-no-json-xml.conf; server { #listen 80 default_server; @@ -104,5 +105,4 @@ server { # deny all; #} - include /etc/nginx/expires-no-json-xml.conf; } diff --git a/conf/nginx/sites-available/howmuchsugar b/conf/nginx/sites-available/howmuchsugar index d6815f494e6ef..399925cb08643 100644 --- a/conf/nginx/sites-available/howmuchsugar +++ b/conf/nginx/sites-available/howmuchsugar @@ -11,6 +11,8 @@ map $howmuchsugar_name $howmuchsugar_lang { combiendesucres fr; } +include /etc/nginx/snippets/expires-no-json-xml.conf; + log_format proxied_requests2 '$http_x_forwarded_for - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' @@ -22,8 +24,6 @@ server { server_name howmuchsugar.in combiendesucres.fr; - include /etc/nginx/snippets/expires-no-json-xml.conf; - access_log /var/log/nginx/nginx.howmuchsugar.access.log proxied_requests2; error_log /var/log/nginx/nginx.howmuchsugar.error.log; @@ -36,16 +36,19 @@ server { index index.html index.htm index.nginx-debian.html; location ~* \.(eot|ttf|woff|woff2)$ { + include /etc/nginx/snippets/expiry-headers.conf; add_header Access-Control-Allow-Origin *; } location ~ ^/(favicon.ico) { + include /etc/nginx/snippets/expiry-headers.conf; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $howmuchsugar_name-favicon.ico =404; } location ~ ^/(.well-known|images|js|rss|data|files|resources|foundation)/ { + include /etc/nginx/snippets/expiry-headers.conf; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; @@ -56,11 +59,13 @@ server { } location ~ ^/$ { + include /etc/nginx/snippets/expires-no-json-xml.conf; try_files $uri /$howmuchsugar_name.html; } # redirect to .html files location / { + include /etc/nginx/snippets/expires-no-json-xml.conf; try_files $uri $uri.html =404; } diff --git a/conf/nginx/sites-available/madenearme b/conf/nginx/sites-available/madenearme index 03fe6cdaa6f26..46e91ba11e4f7 100644 --- a/conf/nginx/sites-available/madenearme +++ b/conf/nginx/sites-available/madenearme @@ -6,6 +6,9 @@ map $host $madenearme_name { madenear.me.uk madenearme-uk; } + +include /etc/nginx/snippets/expires-no-json-xml.conf; + server { listen 80; listen [::]:80; @@ -18,8 +21,6 @@ server { gzip on; gzip_min_length 1000; - include /etc/nginx/snippets/expires-no-json-xml.conf; - root /srv/off/html; # Add index.php to the list if you are using PHP @@ -27,16 +28,19 @@ server { location ~* \.(eot|ttf|woff|woff2)$ { add_header Access-Control-Allow-Origin *; + include /etc/nginx/snippets/expires-no-json-xml.conf; } location ~ ^/images/products/ { add_header Link "; rel='license'; title='CC-BY-SA 3.0'"; + include /etc/nginx/snippets/expires-no-json-xml.conf; } location ~ ^/(favicon.ico) { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri /images/misc/$madenearme_name.16x16.png; + include /etc/nginx/snippets/expires-no-json-xml.conf; } @@ -44,6 +48,7 @@ server { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; + include /etc/nginx/snippets/expires-no-json-xml.conf; } location = /robots.txt { @@ -52,6 +57,7 @@ server { location / { try_files $uri /data/$madenearme_name.html; + include /etc/nginx/snippets/expires-no-json-xml.conf; } } diff --git a/conf/nginx/sites-available/obf b/conf/nginx/sites-available/obf index 28b8dad95528c..ccc516014a42d 100644 --- a/conf/nginx/sites-available/obf +++ b/conf/nginx/sites-available/obf @@ -11,6 +11,9 @@ # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## + +include /etc/nginx/snippets/expires-no-json-xml.conf; + # Default server configuration # server { @@ -66,17 +69,19 @@ server { location /data/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; include snippets/ssl-headers.conf; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; -} + } # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; location ~* \.(eot|ttf|woff|woff2)$ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; } location ~ ^/images/products/ { @@ -96,6 +101,7 @@ server { location ~ ^/(.well-known|images|fonts|css|js|rss|files|resources|foundation|bower_components)/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; @@ -105,6 +111,7 @@ server { # and much less when caching headers are sent location = /.well-known/assetlinks.json { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; expires 1d; try_files $uri $uri/ =404; } @@ -130,5 +137,4 @@ server { # deny all; #} - include /etc/nginx/expires-no-json-xml.conf; } diff --git a/conf/nginx/sites-available/off b/conf/nginx/sites-available/off index 679c07507849a..24f2926a2f276 100644 --- a/conf/nginx/sites-available/off +++ b/conf/nginx/sites-available/off @@ -13,6 +13,10 @@ server { } } +# variables definitions for expiry headers +include /etc/nginx/snippets/expires-no-json-xml.conf; + + server { listen 80; @@ -29,7 +33,7 @@ server { client_header_timeout 120s; # logs location - access_log /var/log/nginx/off-access.log proxied_requests buffer=256K flush=1s; + access_log /var/log/nginx/${productopener_access_file_prefix}off-access.log proxied_requests buffer=256K flush=1s; error_log /var/log/nginx/off-error.log; # some redirection for specific subdomains @@ -43,15 +47,15 @@ server { location /data/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } - include /etc/nginx/snippets/expires-no-json-xml.conf; # 2018-06-18 Moved to the end because of CORS issue with top_translators.csv - location ~ ^/images/products/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; add_header Link "; rel='license'; title='CC-BY-SA 3.0'"; # optimize gzip compressed content (like OCR .json stored next to .jpg files) gzip_static always; @@ -85,6 +89,7 @@ server { # Static files are served directly by NGINX location ~ ^/(.well-known|files)/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # First attempt to serve request from resource, then as file, # then as directory, then fall back to displaying a 404. try_files resources/$uri $uri $uri/ =404; @@ -93,9 +98,10 @@ server { } location ~ ^/(images|fonts|css|js|rss|foundation|bower_components)/ { include snippets/off.cors-headers.include; - # First attempt to serve as file, + include snippets/expiry-headers.include; + # First attempt to serve request as file, off_web_html acting as an override, # then as directory, then fall back to displaying a 404. - try_files $uri $uri/ =404; + try_files /off_web_html$uri $uri $uri/ =404; gzip_static always; gunzip on; } @@ -108,9 +114,10 @@ server { # GoogleAssociationService made 2500 requests/min to assetlinks.json # and much less when caching headers are sent location = /.well-known/assetlinks.json { - include snippets/off.cors-headers.include; - expires 1d; - try_files $uri $uri/ =404; + include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; + expires 1d; + try_files $uri =404; } include snippets/off.locations-redirects.include; diff --git a/conf/nginx/sites-available/off-pro b/conf/nginx/sites-available/off-pro index f1bc42a261a63..b37846b4023bb 100644 --- a/conf/nginx/sites-available/off-pro +++ b/conf/nginx/sites-available/off-pro @@ -13,6 +13,8 @@ server { } } +include /etc/nginx/snippets/expires-no-json-xml.conf; + server { listen 80; @@ -34,7 +36,7 @@ server { send_timeout 1200; # logs location - access_log /var/log/nginx/off-access.log proxied_requests; + access_log /var/log/nginx/${productopener_access_file_prefix}off-access.log proxied_requests; error_log /var/log/nginx/off-error.log; gzip on; @@ -45,15 +47,15 @@ server { location /data/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } - include /etc/nginx/snippets/expires-no-json-xml.conf; # 2018-06-18 Moved to the end because of CORS issue with top_translators.csv - location ~ ^/images/products/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; add_header Link "; rel='license'; title='CC-BY-SA 3.0'"; # optimize gzip compressed content (like OCR .json stored next to .jpg files) gzip_static always; @@ -69,6 +71,7 @@ server { # Static files are served directly by NGINX location ~ ^/(.well-known|files)/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # First attempt to serve request from resource, then as file, # then as directory, then fall back to displaying a 404. try_files resources/$uri $uri $uri/ =404; @@ -77,9 +80,10 @@ server { } location ~ ^/(images|fonts|css|js|rss|foundation|bower_components)/ { include snippets/off.cors-headers.include; - # First attempt to serve as file, + include snippets/expiry-headers.include; + # First attempt to serve request as file, off_web_html acting as an override, # then as directory, then fall back to displaying a 404. - try_files $uri $uri/ =404; + try_files /off_web_html$uri $uri $uri/ =404; gzip_static always; gunzip on; } diff --git a/conf/nginx/sites-available/opf b/conf/nginx/sites-available/opf index 2e66895024318..0b2ffde8f65c7 100644 --- a/conf/nginx/sites-available/opf +++ b/conf/nginx/sites-available/opf @@ -32,6 +32,8 @@ server { return 301 https://world.openproductsfacts.org$request_uri; } +include /etc/nginx/snippets/expires-no-json-xml.conf; + server { #listen 80 default_server; #listen [::]:80 default_server; @@ -52,10 +54,10 @@ server { # Don't use them in a production server! # # include snippets/snakeoil.conf; - #listen [::]:443 ssl default_server; - #listen [::]:443 ssl; - include snippets/ssl.openproductsfacts.org; - include snippets/ssl-params.conf; + #listen [::]:443 ssl default_server; + #listen [::]:443 ssl; + include snippets/ssl.openproductsfacts.org; + include snippets/ssl-params.conf; root /srv/opf/html; @@ -103,6 +105,7 @@ server { location ~ ^/images/products/ { add_header Link "; rel='license'; title='CC-BY-SA 3.0'"; include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # optimize gzip compressed content (like OCR .json stored next to .jpg files) gzip_static always; gunzip on; @@ -116,6 +119,7 @@ server { location ~ ^/(.well-known|images|fonts|css|js|rss|files|resources|foundation|bower_components)/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; @@ -125,6 +129,7 @@ server { # and much less when caching headers are sent location = /.well-known/assetlinks.json { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; expires 1d; try_files $uri $uri/ =404; } @@ -150,6 +155,4 @@ server { #location ~ /\.ht { # deny all; #} - - include /etc/nginx/expires-no-json-xml.conf; } diff --git a/conf/nginx/sites-available/opff b/conf/nginx/sites-available/opff index 82a9956c9075d..15ce8ce0385ac 100644 --- a/conf/nginx/sites-available/opff +++ b/conf/nginx/sites-available/opff @@ -32,6 +32,8 @@ server { return 301 https://world.openpetfoodfacts.org$request_uri; } +include /etc/nginx/snippets/expires-no-json-xml.conf; + server { #listen 80 default_server; #listen [::]:80 default_server; @@ -57,7 +59,6 @@ server { include snippets/ssl.openpetfoodfacts.org; include snippets/ssl-params-opff.conf; - root /srv/opff/html; access_log /srv/opff/logs/nginx.access2.log; @@ -82,6 +83,7 @@ server { location /data/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; include snippets/ssl-headers.conf; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. @@ -103,6 +105,7 @@ server { location ~ ^/images/products/ { add_header Link "; rel='license'; title='CC-BY-SA 3.0'"; include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # optimize gzip compressed content (like OCR .json stored next to .jpg files) gzip_static always; gunzip on; @@ -117,6 +120,7 @@ server { location ~ ^/(.well-known|images|fonts|css|js|rss|files|resources|foundation|bower_components)/ { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; @@ -126,6 +130,7 @@ server { # and much less when caching headers are sent location = /.well-known/assetlinks.json { include snippets/off.cors-headers.include; + include snippets/expiry-headers.include; expires 1d; try_files $uri $uri/ =404; } @@ -152,5 +157,4 @@ server { # deny all; #} - include /etc/nginx/expires-no-json-xml.conf; } diff --git a/conf/nginx/snippets/expires-no-json-xml.conf b/conf/nginx/snippets/expires-no-json-xml.conf index 53ea62994b3ec..6c3ca932123c7 100644 --- a/conf/nginx/snippets/expires-no-json-xml.conf +++ b/conf/nginx/snippets/expires-no-json-xml.conf @@ -8,32 +8,65 @@ # future (if the default expire rule is 1 month). Therefore, do not use a # default expire rule with nginx unless your site is completely static -# cache.appcache, your document html and data -location ~* \.(?:manifest|appcache|html?)$ { - expires -1; -} +map $uri $productopener_expires_time { + default off; -# Feed -location ~* \.(?:rss|atom)$ { - expires 1h; + # cache.appcache, your document html and data + "~*\.(?:manifest|appcache|html?)$" -1; + # Feed + "~*\.(?:rss|atom)$" 1h; + # Media: images, icons, video, audio, HTC + "~*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ico)$" 10d; + # CSS and Javascript + "~*\.(?:css|js)$" 1d; + # Web Fonts + "~*\.(?:ttf|ttc|otf|eot|woff|woff2)$" 10d; } -# Media: images, icons, video, audio, HTC -location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { - expires 10d; -# expires 1M; - access_log off; - # FIXME: add_header here may hide CORS headers (and other headers, we should better use map) - add_header Cache-Control "public"; + +map $uri $productopener_is_public_cache { + default ""; + # Media: images, icons, video, audio, HTC + "~*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ico)$" public; } -# CSS and Javascript -location ~* \.(?:css|js)$ { - expires 1d; -# expires 1y; - access_log off; +map $uri $productopener_access_file_prefix { + default ""; + # Media: images, icons, video, audio, HTC + "~*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$" "static-"; + # CSS and Javascript + "~*\.(?:css|js)$" "static-"; + # Web Fonts + "~*\.(?:ttf|ttc|otf|eot|woff|woff2)$" "static-"; } + +# # cache.appcache, your document html and data +# location ~* \.(?:manifest|appcache|html?)$ { +# expires -1; +# } + +# # Feed +# location ~* \.(?:rss|atom)$ { +# expires 1h; +# } + +# # Media: images, icons, video, audio, HTC +# location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { +# expires 10d; +# # expires 1M; +# access_log off; +# # FIXME: add_header here may hide CORS headers (and other headers, we should better use map) +# add_header Cache-Control "public"; +# } + +# # CSS and Javascript +# location ~* \.(?:css|js)$ { +# expires 1d; +# # expires 1y; +# access_log off; +# } + # WebFonts #location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ { # expires 1d; diff --git a/conf/nginx/snippets/expiry-headers.include b/conf/nginx/snippets/expiry-headers.include new file mode 100644 index 0000000000000..c20010957a234 --- /dev/null +++ b/conf/nginx/snippets/expiry-headers.include @@ -0,0 +1,6 @@ +# defines expiry headers for static resources + +# variables defined in /etc/nginx/snippets/expires-no-json-xml.conf; +expires $productopener_expires_time; +# it's allowed to repeat Cache-Control to add informations +add_header Cache-Control $productopener_is_public_cache; \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8f06d067510f6..8e7f3aaca6378 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,9 @@ x-backend-conf: &backend-conf - memcached volumes: # pointer to openfoodfacts-web/lang - - ${WEB_LANG_PATH}:/mnt/podata/lang + - ${WEB_RESOURCES_PATH}/lang:/mnt/podata/lang + # pointer to openfoodfacts-web/html + - ${WEB_RESOURCES_PATH}/html:/opt/product-opener/html/off_web_html # Static data (e.g dumps) - html_data:/opt/product-opener/html/data # other servers dirs (this is temporary to be able to develop for now) @@ -121,6 +123,10 @@ services: - css_dist:/opt/product-opener/html/css/dist - node_modules:/opt/product-opener/node_modules + # openfoodfacts-web static files + - ${WEB_RESOURCES_PATH}/html:/opt/product-opener/html/off_web_html + + # Logs - ./logs/nginx/:/var/log/nginx/ @@ -128,6 +134,7 @@ services: - ./conf/nginx.conf:/etc/nginx/templates/default.conf.template # cors headers definition as an include - ./conf/nginx/snippets/off.cors-headers.include:/etc/nginx/snippets/off.cors-headers.include + - ./conf/nginx/snippets/expiry-headers.include:/etc/nginx/snippets/expiry-headers.include # some expires rules - ./conf/nginx/snippets/expires-no-json-xml.conf:/etc/nginx/snippets/expires-no-json-xml.conf # some redirects diff --git a/docs/dev/how-to-use-pages-from-openfoodfacts-web.md b/docs/dev/how-to-use-pages-from-openfoodfacts-web.md index aab5f3763ef23..aea860328a7df 100644 --- a/docs/dev/how-to-use-pages-from-openfoodfacts-web.md +++ b/docs/dev/how-to-use-pages-from-openfoodfacts-web.md @@ -12,6 +12,6 @@ you should first clone openfoodfacts-web repo locally, and then: - if you are using docker, - you can set the `WEB_LANG_PATH` env variable to a relative or absolute path - leading to openfoodfacts-web lang directory. -- else, make symlink `lang` point to openfoodfacts-web lang directory. + you can set the `WEB_RESOURCES_PATH` env variable to a relative or absolute path + leading to openfoodfacts-web directory. +- else, make symlink `lang` point to openfoodfacts-web `lang` directory, and `html/off_web_html` points to openfoodfacts-web `html` directory. diff --git a/scripts/deploy/verify-deployment.sh b/scripts/deploy/verify-deployment.sh index 4d92c52297d97..1b673849a0091 100644 --- a/scripts/deploy/verify-deployment.sh +++ b/scripts/deploy/verify-deployment.sh @@ -106,6 +106,7 @@ function compute_expected_links { EXPECTED_LINKS["$REPO_PATH/po/site-specific"]="$REPO_PATH/po/$SERVICE_LONG_NAME" # off-web EXPECTED_LINKS["$REPO_PATH/lang"]="/srv/openfoodfacts-web/lang" + EXPECTED_LINKS["$REPO_PATH/html/off_web_html"]="/srv/openfoodfacts-web/html" # data linked to zfs storages EXPECTED_LINKS["$REPO_PATH/data"]="$ZFS_PATH/data" EXPECTED_LINKS["$REPO_PATH/orgs"]="$ZFS_PATH/orgs" diff --git a/lang-default/README.md b/web-default/README.md similarity index 100% rename from lang-default/README.md rename to web-default/README.md diff --git a/lang-default/en/emails/user_welcome.html b/web-default/lang/en/emails/user_welcome.html similarity index 100% rename from lang-default/en/emails/user_welcome.html rename to web-default/lang/en/emails/user_welcome.html diff --git a/lang-default/en/texts/index-pro.html b/web-default/lang/en/texts/index-pro.html similarity index 100% rename from lang-default/en/texts/index-pro.html rename to web-default/lang/en/texts/index-pro.html diff --git a/lang-default/en/texts/index.html b/web-default/lang/en/texts/index.html similarity index 100% rename from lang-default/en/texts/index.html rename to web-default/lang/en/texts/index.html diff --git a/lang-default/fr/additives/e100.html b/web-default/lang/fr/additives/e100.html similarity index 100% rename from lang-default/fr/additives/e100.html rename to web-default/lang/fr/additives/e100.html diff --git a/lang-default/fr/knowledge_panels/additives/en_e100_world.html b/web-default/lang/fr/knowledge_panels/additives/en_e100_world.html similarity index 100% rename from lang-default/fr/knowledge_panels/additives/en_e100_world.html rename to web-default/lang/fr/knowledge_panels/additives/en_e100_world.html