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

serverURL still uses port 3000 instead of the remapped port of docker #1177

Closed
frankyan opened this issue Mar 20, 2019 · 3 comments
Closed

Comments

@frankyan
Copy link

Hi, I am using CodiMD with docker container on a Linux server. The server has a domain name www.myserver.com. So I set CMD_DOMAIN=myserver.com. The edited part of the compose file is shown below.

  app:
    image: hackmdio/hackmd:1.3.0
    environment:
      - CMD_DB_URL=postgres://hackmd:hackmdpass@database:5432/hackmd
      - CMD_ALLOW_EMAIL_REGISTER=false
      - CMD_ALLOW_ANONYMOUS=false
      - CMD_ALLOW_ANONYMOUS_EDITS=false
      - CMD_DEFAULT_PERMISSION=locked
      - CMD_ALLOW_FREEURL=false
      - CMD_ALLOW_PDF_EXPORT=true
      - CMD_IMAGE_UPLOAD_TYPE=filesystem
      - CMD_URL_ADDPORT=true
      - CMD_PROTOCOL_USESSL=false
      - CMD_DOMAIN=www.myserver.com
    ports:
        - "10001:3000"

I can access the index page of CodiMD by URL http://www.myserver.com:10001. But I cannot login or do other things. I inspected the index page and found that it's trying to fetch things on server using generated URL with prot 3000. For example, the index page cannot display the CodiMD screenshot figure, because it's trying to get from http://www.myserver.com:3000/screenshot.png . The correct address is http://www.myserver.com:10001/screenshot.png.

I think it might be a bug in setting serverURL. How can I fix it? Thank you.

@jackycute
Copy link
Member

jackycute commented Mar 20, 2019

Please disable CMD_URL_ADDPORT or just set CMD_PORT

@SISheogorath
Copy link
Contributor

I just realized that we have no concept for that. You can't map it to another port than CodiMD is running on. The good news is, you can just run CodiMD inside the container on port 10001 by using CMD_PORT and then map this port to the same outside.

@frankyan
Copy link
Author

@jackycute "disable CMD_URL_ADDPORT or just set CMD_PORT" doesn't work. @SISheogorath is right. I need to change these two settings. Everything works now! Thank you.

    environment:
      - CMD_PORT=10001
    ports:
        - "10001:10001"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants