Installing Codi via docker and already running other services

Hi, I’m attempting to use this docker-compose with latest Codi build behind nginx. Already have other services (Discourse with Postgres + rocket.chat on port 3000) running so I’m seeing this output.

Any suggestions appreciated for getting Codi running via Docker on port 3003 or similar. Looked at this issue on github, but unsure of how to resolve setting up an additional database if that makes the most sense.

That’s easy :slight_smile:

All you have to do is changing the ports setting in the docker-compose.yml from:

 ports:
      # Ports that are published to the outside.
      # The latter port is the port inside the container. It should always stay on 3000
      # If you only specify a port it'll published on all interfaces. If you want to use a
      # local reverse proxy, you may want to listen on 127.0.0.1.
      # Example:
       - "127.0.0.1:3003:3003"
         #- "3000:3000"

to:

 ports:
      # Ports that are published to the outside.
      # The latter port is the port inside the container. It should always stay on 3000
      # If you only specify a port it'll published on all interfaces. If you want to use a
      # local reverse proxy, you may want to listen on 127.0.0.1.
      # Example:
       - "127.0.0.1:3003:3000"
         #- "3000:3000"

And make sure you set CMD_DOMAIN, CMD_PROTOCOL_USESSL, and CMD_URL_ADDPORT in order to make CodiMD providing the right domain for your reverse proxy setup :slight_smile:

Thank you. I do not see these values in the compose file. Are they located elsewhere?

We don’t provide all config values in the default compose file, because maintain all these would be too much work.

You can find all of them in the docs: https://github.com/codimd/server/blob/master/docs/configuration-env-vars.md

Awesome, thank you.

I’ve set all of those values and am now running into issues with already having a running database.
PostgreSQL Database directory appears to contain a database; Skipping initialization

We have a Discourse forum already using Postgresql. I’m looking through documentation for a way to define a secondary database I think.

When you used the compose file you linked above, CodiMD runs an own instance postgres and will have its own database. You don’t need to change anything on your discourse postgres deployment.

If you think something is wrong wit the database and you want to start from scratch (for CodiMD) use docker-compose down -v, which will delete the containers as well as the volume. (please make sure you use this in the CodiMD project directory and not anywhere else, because it will delete volumes → data)

1 Like

I’ve got CodiMD running. Somehow the updated nginx config is not working. I did set it to 3003:3000 in docker-compose.

What does your proxy location look like? Do you send traffic to https://127.0.0.1:3003?

Gist updated. We’re already sending 127.0.0.1:3000 traffic to rocket.chat

I’m just trying to get traffic to Codi. Using 3003 has no other purpose. Just seems we already have services on port 3000 and 3001.
Screenshot_20200423_111304
These settings have gotten the instance running properly. Just have to sort out an nginx complaint.