vocascan / vocascan-frontend

A highly configurable vocabulary trainer
https://vocascan.com
Apache License 2.0
29 stars 8 forks source link

Configuration environment variables don`t work with docker-compose #146

Closed seyar closed 1 year ago

seyar commented 1 year ago

I installed vocascan-server and vocascan-frontend behind traefik proxy. Frontend installed via docker-compose and I have only one yml file in folder

content of file:

version: "2"
services:
  frontend:
    image: vocascan/frontend:latest
    restart: always
    tty: true
    environment:
      REACT_APP_VOCASCAN_BASE_URL: "https://vocascan.<my server domain>"
      REACT_APP_VOCASCAN_SHOW_PLANS: "false"
      VOCASCAN_BASE_URL: "https://vocascan.<my server domain>"
      VOCASCAN_SHOW_PLANS: "false"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      - "traefik.http.routers.frontend.middlewares=my-ipwhitelist@file"
      - "traefik.http.routers.frontend.entrypoints=websecure"
      - "traefik.http.routers.frontend.rule=Host(`<my domain>`)"
      - "traefik.http.routers.frontend.tls=true"
      - "traefik.http.routers.frontend.tls.certresolver=myresolver"
      - "traefik.http.services.frontend.loadbalancer.server.port=<my port>"
    networks:
      - traefik

networks:
  traefik:
    external: true

To Reproduce Steps to reproduce the behavior:

  1. create docker-compose.yml and run server docker-compose up -d --build
  2. open and open browser console
  3. invoke window.VOCASCAN_CONFIG
  4. Variables are different

Expected behavior window.VOCASCAN_CONFIG imports docker-compose.yml variables and works properly

Screenshots

Please complete the following information: vocascan-frontend v1.3.0 #f8f3047 #2487582578-373 2022-06-13T10:06:01.779Z (232 days ago)

vocascan-frontend v1.3.0 #f8f3047 #2487582578-373

2022-06-13T10:06:01.779Z (232 days ago)

Version: v1.3.0
Commit:
Date:
Electron:
Firefox: 108.0.1 
Node.js: from docker-compose, vocascan/frontend:latest
V8:
OS: MacOs

Additional context I think problem that I pulled up already built version from registry. Also I think pull the github repo and run through Dockerfile will solve problem. But I dont know how to do this with traefik. There are two Dockerfiles and no documents about run Dockerfile and traefik

luwol03 commented 1 year ago

Hello @seyar ,

sorry for the late reply, I'am not really sure what you try to do. If you want to run vocascan behind traefik, we provide official documentation for that.

We provide pre-build images with the tags vocascan/server:latest and vocascan/frontend:latest, so there is no need for building them yourself with a custom docker file.

Please provide further information what you try to do and what parts work/don't work.

luwol03

seyar commented 1 year ago

Hi, @luwol03 . Sorry for mess. My problem consist of non working environment variables. I added them to the docker-compose.yml as shown above

...
environment:
      REACT_APP_VOCASCAN_BASE_URL: "https://vocascan.<my server domain>"
      REACT_APP_VOCASCAN_SHOW_PLANS: "false"
      VOCASCAN_BASE_URL: "https://vocascan.<my server domain>"
      VOCASCAN_SHOW_PLANS: "false"
...

but on frontend I still see plans window. And in my global window I see that my settings not reassigned

luwol03 commented 1 year ago

Hi,

Ok. Got it. This is due to a bug which is already fixed by #121 in the experimental stage. We plan to release a new version soon so this will also get into the latest stage, but we are currently all busy so that's why everything is a bit postponed. You can already try to use the vocascan/frontend:experimental image if you want. That should work fine.

Btw. you don't need these REACT_APP_ prefixed variables, they only work on (react) build time, not on runtime.

seyar commented 1 year ago

@luwol03 Thank you for quick answer I`ll try the experimental image