Skip to content

Commit

Permalink
fix: fix off.html deploy on staging
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgarel committed Jun 5, 2024
1 parent 4bbada5 commit 38bccee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions confs/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ server {
# web server dev has specific urls, we want to redirect them to static
rewrite ^/(__wds-|__web-dev-server)(.*)$ /static/$1$2 last;

# Temporary hack: redirect bundled to base js for dev
location /static${DEV_UI_SUFFIX}/search-a-licious.bundled.js {
return 302 $scheme://$http_host/static/dist/search-a-licious.js;
}

# Static files - in DEV = node server
location /static${DEV_UI_SUFFIX} {
Expand All @@ -46,6 +50,7 @@ server {
# Static files - in PROD = files on disk
location /static${PROD_UI_SUFFIX} {
root /opt/search-a-licious/public/;
rewrite ^/static(.*)$ $1 break;
try_files $uri $uri/ /index.html;
}
# all other requests goes to API
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,11 @@ services:
- api
environment:
# enabling prod config and disabling dev one
PROD_UI_SUFFIX: "${PROD_UI_SUFFIX--static}"
DEV_UI_SUFFIX: "${DEV_UI_SUFFIX-}"
PROD_UI_SUFFIX: "${PROD_UI_SUFFIX-}"
DEV_UI_SUFFIX: "${DEV_UI_SUFFIX--static}"
volumes:
# Nginx, we use templates dir to be able to use environment vars
- ./confs/nginx.conf:/etc/nginx/templates/default.conf.template
# dynamic mount
- ./frontend/public:/opt/search-a-licious/public
ports:
- ${SEARCH_EXPOSE:-127.0.0.1:8000}:80
build:
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/off.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
href="https://static.openfoodfacts.org/css/dist/app-ltr.css?v=1695281325"
data-base-layout="true"
/>
<script type="module" src="./dist/search-a-licious.js"></script>
<script type="module" src="./search-a-licious.bundled.js"></script>
<style>
/* temporary inline styles to test CSS customization */
/* search bar styling */
Expand Down

0 comments on commit 38bccee

Please sign in to comment.