taiga-front icon indicating copy to clipboard operation
taiga-front copied to clipboard

Example conf.json isn't the same as the default

Open iantra opened this issue 3 years ago • 3 comments

Describe the bug This might just be an issue with me misunderstanding the instructions and having misplaced expectations, but when trying to configure a self-hosted taiga setup I ran into this annoying problem that took me way too long to figure out. When running Taiga in a docker container, the default config that is used in case no conf.json file exists in dist seems to be created by the docker-compose file based on some of the environment variables there. However, the default settings in this file (mainly "api" address and "eventsURL") seem to be different from the defaults provided in conf.example.json.

The result of this is that simply duplicating conf.example.json into a new conf.json file completely breaks the frontend, while common sense (at least the way I see it) dictates that if no conf.json file exists, this exact default would be used instead.

To Reproduce Steps to reproduce the behavior:

  1. Build taiga-front, go to dist directory
  2. Duplicate conf.example.json, name it conf.json
  3. Try to run Taiga
  4. See error

Expected behavior I would expect the example file to be identical to the file used by default, or at least to be able to work with the rest of the system with the provided defaults.

Taiga environment Self-hosted, docker with a local taiga-front image

Desktop (please complete the following information):

  • OS: ubuntu
  • Browser chrome
  • Version 6.0.10

iantra avatar Apr 26 '21 07:04 iantra

Hi @iantra,

If I don't understand you bad, what you have intended is to run all the taiga's components from docker but taiga-front, which is started directly from source code exposing the dist directory.

You have copied your conf.json from conf.example.json without changing the api address, which is pointing to http://localhost:8000/api/v1/.

In that scenario, it should be enough to fix your api key from taiga-front/dist/conf.json to use the correct taiga-back address: http://localhost:9000/api/v1/.

{
  "api": "http://localhost:9000/api/v1/",
  "eventsUrl": null,

The reason is that when using docker, everything is exposed to your local machine http://localhost:9000 address, and then it's redirected by taiga-gateway to the proper internal docker addresses (including taiga-back service in the 8000 port):

taiga-docker $ docker-compose ps

                Name                              Command               State                                           Ports                                       
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
taiga-docker_taiga-async-rabbitmq_1    docker-entrypoint.sh rabbi ...   Up       15671/tcp, 15672/tcp, 15691/tcp, 15692/tcp, 25672/tcp, 4369/tcp, 5671/tcp, 5672/tcp
taiga-docker_taiga-async_1             /taiga-back/docker/async_e ...   Up       8000/tcp                                                                           
taiga-docker_taiga-back_1              ./docker/entrypoint.sh           Up       8000/tcp                                                                           
taiga-docker_taiga-db_1                docker-entrypoint.sh postgres    Up       5432/tcp                                                                           
taiga-docker_taiga-events-rabbitmq_1   docker-entrypoint.sh rabbi ...   Up       15671/tcp, 15672/tcp, 15691/tcp, 15692/tcp, 25672/tcp, 4369/tcp, 5671/tcp, 5672/tcp
taiga-docker_taiga-events_1            ./docker/entrypoint.sh           Up       8888/tcp                                                                           
taiga-docker_taiga-front_1             /docker-entrypoint.sh ngin ...   Exit 0                                                                                      
taiga-docker_taiga-gateway_1           /docker-entrypoint.sh ngin ...   Up       0.0.0.0:9000->80/tcp                                                               
taiga-docker_taiga-protected_1         ./docker/entrypoint.sh           Up       8003/tcp 

Just for reference, this is the taiga-gateway configuration from taiga-docker:

taiga-docker $ cat taiga-gateway/taiga.conf

    ...

    # Api
    location /api {
        proxy_pass http://taiga-back:8000/api;
        ...
    }

Please, tell us if you achieve to start taiga correctly with the suggested changes in your taiga-front/dist/conf.json file.

daniel-herrero avatar Apr 27 '21 09:04 daniel-herrero

Hi @daniel-herrero, thanks for the reply! I did get taiga running in the end, sorry if I failed to mention this in my post. The issue is just that it was more difficult that it should have been, and I thought maybe this was unwanted behavior.

I was running all of taiga's components through docker, including taiga-front. The only difference is that I built a local image for taiga-front with my changes instead of using the one from docker-hub. However, now that you mention it, I assume the defaults are just set up to work when starting the api directly from source and not from inside docker. This is just a bit confusing since docker seems to be the recommended way of doing things.

iantra avatar Apr 27 '21 09:04 iantra

Hi @iantra

You're right, there are many ways to run the different components Taiga needs, and sometimes it's difficult to write documentation and code that suits all user profiles and usages.

The fact is that, by default, each Taiga's component runs in its particular port, being proxy passed (just in docker) by the taiga-gateway using an nginx.

Regarding front, it's because of two environment variables defined in taiga-docker/docker-compose.yml (TAIGA_URL and TAIGA_WEBSOCKETS_URL), and the taiga-front/docker/conf.json.template file, that the default ports are changed.

{
    "api": "${TAIGA_URL}/api/v1/",
    "eventsUrl": "${TAIGA_WEBSOCKETS_URL}/events",
    ...

If you built a new taiga-docker image for taiga-front, you also have to define those variables, either in the docker-compose.yml if you're starting using docker-compose up, or as system variables if you're starting taiga-front directly from your docker built image.

If you don't, taiga-front tries to connect to the api (taiga-back) using the default port it uses when it runs as an independent serivce and not being after a gateway (http://localhost:8000/api/v1/).

daniel-herrero avatar Apr 29 '21 12:04 daniel-herrero