adminMongo icon indicating copy to clipboard operation
adminMongo copied to clipboard

Environment Variable CONTEXT does not work.

Open offbeatful opened this issue 6 years ago • 5 comments

I use the following docker-compose file:

  mongo-ui:
    container_name: mongo-ui
    image: mrvautin/adminmongo:latest   
    restart: always    
    user: root
    ports:      
      - 80:80
    environment:      
      - PORT=80
      - CONTEXT=mongo
      - CONN_NAME=default
      - DB_HOST=db

When composed I try to access admin-mongo at http://localhost/mongo and get 404.

Logs: Error: Not Found at /app/user/app.js:226:15 at Layer.handle [as handle_request] (/app/user/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/app/user/node_modules/express/lib/router/index.js:317:13) at /app/user/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/app/user/node_modules/express/lib/router/index.js:335:12) at next (/app/user/node_modules/express/lib/router/index.js:275:10) at /app/user/node_modules/express/lib/router/index.js:635:15 at next (/app/user/node_modules/express/lib/router/index.js:260:14) at next (/app/user/node_modules/express/lib/router/route.js:127:14) at /app/user/routes/index.js:8:5 GET /mongo 404 88.565 ms - 8911

I tried setting context to /mongo as well - same result.

Please advice.

offbeatful avatar Apr 26 '18 14:04 offbeatful

I was able to find a workaround. app.json should be deleted prior before launching the container. This file is auto-generated when container is started with values from environment variables. If the file exist - nothing happens.

offbeatful avatar May 07 '18 12:05 offbeatful

@offbeatful How did you manage to remove that file and launch the container ?

I mean, I've tried in my docker-compose to add

command : bash -c "node app.js && rm ./config/app.json" 

But it's not working

MikyStar avatar Aug 01 '18 08:08 MikyStar

@MikyStar i tried this method and it works, but not the same way as u. i run into the container shell and delete the app.json then restart the container and it works. you may ran into your container and check if your command work as expect 😃

gIt-SpLasHeR avatar Oct 08 '18 19:10 gIt-SpLasHeR

Is there a fix or workaround is ok for everybody? If yes - please close close this issue.

offbeatful avatar Dec 30 '18 00:12 offbeatful

Found a fix by slightly modifying the code from @MikyStar bash is not installed in the Docker image, but sh works. Also the file has to be deleted before starting node:

command: sh -c "rm ./config/app.json && node app.js"

gschelter avatar Jul 17 '19 11:07 gschelter