coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
33.94k stars 1.83k forks source link

[Bug]: Plausible compose deployment errors & SSL certificates generating incorrectly #3817

Open bcheidemann opened 3 weeks ago

bcheidemann commented 3 weeks ago

Error Message and Logs

Logs for plausible container:

2024-10-09T19:48:25.754766703Z ERROR! Config provider Config.Reader failed with:
2024-10-09T19:48:25.764687193Z ** (RuntimeError) BASE_URL must start with `http` or `https`. Currently configured as ``
2024-10-09T19:48:25.764716417Z     /app/releases/0.0.1/runtime.exs:81: (file)
2024-10-09T19:48:25.764726596Z     (elixir 1.17.1) src/elixir.erl:386: :elixir.eval_external_handler/3
2024-10-09T19:48:25.764733770Z     (stdlib 6.0) erl_eval.erl:904: :erl_eval.do_apply/7
2024-10-09T19:48:25.764740001Z     (stdlib 6.0) erl_eval.erl:271: :erl_eval.exprs/6
2024-10-09T19:48:25.764763065Z     (elixir 1.17.1) src/elixir.erl:364: :elixir.eval_forms/4
2024-10-09T19:48:25.764771310Z     (elixir 1.17.1) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1
2024-10-09T19:48:25.764780497Z     (elixir 1.17.1) lib/code.ex:572: Code.validated_eval_string/3
2024-10-09T19:48:25.764788412Z     (elixir 1.17.1) lib/config.ex:290: Config.__eval__!/3
2024-10-09T19:48:25.764794022Z 
2024-10-09T19:48:25.765605325Z Runtime terminating during boot ({#{message=><<"BASE_URL must start with `http` or `https`. Currently configured as ``">>,'__struct__'=>'Elixir.RuntimeError','__exception__'=>true},[{elixir_eval,'__FILE__',1,[{file,"/app/releases/0.0.1/runtime.exs"},{line,81}]},{elixir,eval_external_handler,3,[{file,"src/elixir.erl"},{line,386},{error_info,#{module=>'Elixir.Exception'}}]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,904}]},{erl_eval,exprs,6,[{file,"erl_eval.erl"},{line,271}]},{elixir,eval_forms,4,[{file,"src/elixir.erl"},{line,364}]},{'Elixir.Module.ParallelChecker',verify,1,[{file,"lib/module/parallel_checker.ex"},{line,112}]},{'Elixir.Code',validated_eval_string,3,[{file,"lib/code.ex"},{line,572}]},{'Elixir.Config','__eval__!',3,[{file,"lib/config.ex"},{line,290}]}]})
2024-10-09T19:48:25.767854313Z 
2024-10-09T19:48:25.852920454Z Crash dump is being written to: erl_crash.dump...

Visiting https://plausible.mydomain.com results in a certificate with CN "TRAEFIK DEFAULT CERT" instead of plausible.mydomain.com.

Steps to Reproduce

  1. Create Application
  2. Select Private Repository
  3. Build Pack: Docker Compose
  4. Use from https://raw.githubusercontent.com/coollabsio/coolify/main/templates/compose/plausible.yaml

Example Repository URL

No response

Coolify Version

v4.0.0-beta357

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.04.1

Additional Information

No response

peaklabs-dev commented 3 weeks ago

Are you on a cloud server or on your local machine?

djsisson commented 3 weeks ago

BASE_URL must start with http or https. Currently configured as ``

can u check your envs are set ok?

bcheidemann commented 3 weeks ago

@peaklabs-dev I'm on a cloud server.

@djsisson Trouble is I'm not sure exactly what to look for. The docs imply this should "just work" but don't mention about SSL certs at all.

My BASE_URL env is set to "$SERVICE_FQDN_PLAUSIBLE" with "Is Literal" unchecked.

From the error, I'm guessing this is resolving to an empty string. But I'm not sure why.

My understanding from the docs is that this is a kind of "magic" environment variable which can be configured via the input field in the settings. I've set the domain for the plausible container to https://... which should be setting the BASE_URL via SERVICE_FQDN_PLAUSIBLE if my understanding is correct 🤔

djsisson commented 3 weeks ago

it should be, but if it isnt just manually set the BASE_URL

bcheidemann commented 3 weeks ago

it should be, but if it isnt just manually set the BASE_URL

Even after manually setting BASE_URL, I still get SSL errors and the following error still persists:

2024-10-14T08:59:37.223772231Z ERROR! Config provider Config.Reader failed with:
2024-10-14T08:59:37.228851269Z ** (RuntimeError) BASE_URL must start with `http` or `https`. Currently configured as ``
2024-10-14T08:59:37.228873501Z     /app/releases/0.0.1/runtime.exs:81: (file)
2024-10-14T08:59:37.228878060Z     (elixir 1.17.1) src/elixir.erl:386: :elixir.eval_external_handler/3
2024-10-14T08:59:37.228883820Z     (stdlib 6.0) erl_eval.erl:904: :erl_eval.do_apply/7
2024-10-14T08:59:37.228893117Z     (stdlib 6.0) erl_eval.erl:271: :erl_eval.exprs/6
2024-10-14T08:59:37.228896945Z     (elixir 1.17.1) src/elixir.erl:364: :elixir.eval_forms/4
2024-10-14T08:59:37.228899920Z     (elixir 1.17.1) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1
2024-10-14T08:59:37.228905641Z     (elixir 1.17.1) lib/code.ex:572: Code.validated_eval_string/3
2024-10-14T08:59:37.228909017Z     (elixir 1.17.1) lib/config.ex:290: Config.__eval__!/3
2024-10-14T08:59:37.228912725Z 
2024-10-14T08:59:37.229453549Z Runtime terminating during boot ({#{message=><<"BASE_URL must start with `http` or `https`. Currently configured as ``">>,'__struct__'=>'Elixir.RuntimeError','__exception__'=>true},[{elixir_eval,'__FILE__',1,[{file,"/app/releases/0.0.1/runtime.exs"},{line,81}]},{elixir,eval_external_handler,3,[{file,"src/elixir.erl"},{line,386},{error_info,#{module=>'Elixir.Exception'}}]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,904}]},{erl_eval,exprs,6,[{file,"erl_eval.erl"},{line,271}]},{elixir,eval_forms,4,[{file,"src/elixir.erl"},{line,364}]},{'Elixir.Module.ParallelChecker',verify,1,[{file,"lib/module/parallel_checker.ex"},{line,112}]},{'Elixir.Code',validated_eval_string,3,[{file,"lib/code.ex"},{line,572}]},{'Elixir.Config','__eval__!',3,[{file,"lib/config.ex"},{line,290}]}]})
2024-10-14T08:59:37.232332339Z 
2024-10-14T08:59:37.286699604Z Crash dump is being written to: erl_crash.dump...
peaklabs-dev commented 3 weeks ago

I have refactored the plausible template a lot for the next release. Please use the new template and re-test if this problem still occurs.

bcheidemann commented 2 weeks ago

I have refactored the plausible template a lot for the next release. Please use the new template and re-test if this problem still occurs.

Hey, I have tried the new template but I get the following error when I try to deploy it:


2024-Oct-17 20:47:42.919327 Starting deployment of obsidian-stack/obsidian-monorepo:main-m8oo4k0c4co4oocwow00kgw0 to localhost.
2024-Oct-17 20:47:43.139233 Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:1.0.2.
2024-Oct-17 20:47:45.053591 ----------------------------------------
2024-Oct-17 20:47:45.056657 Importing obsidian-stack/obsidian-monorepo:main (commit sha HEAD) to /artifacts/kgg8gkw8gsoo40gwc0k44c48.
2024-Oct-17 20:47:49.067394 Pulling & building required images.
2024-Oct-17 20:47:49.377110 Removing old containers.
2024-Oct-17 20:47:51.735434 Starting new application.
2024-Oct-17 20:47:58.462917 Oops something is not okay, are you okay? 😢
2024-Oct-17 20:47:58.465047 Container plausible-events-db-m8oo4k0c4co4oocwow00kgw0-204748547147  Creating
2024-Oct-17 20:47:58.465047  Container mail-m8oo4k0c4co4oocwow00kgw0-204748536332  Creating
2024-Oct-17 20:47:58.465047  Container plausible-db-m8oo4k0c4co4oocwow00kgw0-204748536964  Creating
2024-Oct-17 20:47:58.465047  Container plausible-events-db-m8oo4k0c4co4oocwow00kgw0-204748547147  Created
2024-Oct-17 20:47:58.465047  Container mail-m8oo4k0c4co4oocwow00kgw0-204748536332  Created
2024-Oct-17 20:47:58.465047  Container plausible-db-m8oo4k0c4co4oocwow00kgw0-204748536964  Created
2024-Oct-17 20:47:58.465047  Container plausible-m8oo4k0c4co4oocwow00kgw0-204748526662  Creating
2024-Oct-17 20:47:58.465047  Container plausible-m8oo4k0c4co4oocwow00kgw0-204748526662  Created
2024-Oct-17 20:47:58.465047  Container plausible-db-m8oo4k0c4co4oocwow00kgw0-204748536964  Starting
2024-Oct-17 20:47:58.465047  Container plausible-events-db-m8oo4k0c4co4oocwow00kgw0-204748547147  Starting
2024-Oct-17 20:47:58.465047  Container mail-m8oo4k0c4co4oocwow00kgw0-204748536332  Starting
2024-Oct-17 20:47:58.465047  Container plausible-db-m8oo4k0c4co4oocwow00kgw0-204748536964  Started
2024-Oct-17 20:47:58.465047  Container mail-m8oo4k0c4co4oocwow00kgw0-204748536332  Started
2024-Oct-17 20:47:58.465047  Container plausible-events-db-m8oo4k0c4co4oocwow00kgw0-204748547147  Started
2024-Oct-17 20:47:58.465047  Container plausible-db-m8oo4k0c4co4oocwow00kgw0-204748536964  Waiting
2024-Oct-17 20:47:58.465047  Container plausible-events-db-m8oo4k0c4co4oocwow00kgw0-204748547147  Waiting
2024-Oct-17 20:47:58.465047  Container mail-m8oo4k0c4co4oocwow00kgw0-204748536332  Waiting
2024-Oct-17 20:47:58.465047  Container plausible-db-m8oo4k0c4co4oocwow00kgw0-204748536964  Error
2024-Oct-17 20:47:58.465047  Container mail-m8oo4k0c4co4oocwow00kgw0-204748536332  Healthy
2024-Oct-17 20:47:58.465047  Container plausible-events-db-m8oo4k0c4co4oocwow00kgw0-204748547147  Healthy
2024-Oct-17 20:47:58.465047 dependency failed to start: container plausible-db-m8oo4k0c4co4oocwow00kgw0-204748536964 is unhealthy

Unrelated to the above, I also noticed that when I update the "Domains for Plausible" and/or "Domains for Mail", it takes a very long time to save, and is giving me timeouts from cloudflare (I'm proxying to the dashboard through cloudflare). Not sure why it takes so long to save but I'm wondering if this could be causing the issues I'm seeing somehow.

peaklabs-dev commented 2 weeks ago

@bcheidemann How do you deploy plausible, I just copied the compose file from the link above into the docker compose empty deploy type, deployed it and everything worked?

bcheidemann commented 2 weeks ago

@bcheidemann How do you deploy plausible, I just copied the compose file from the link above into the docker compose empty deploy type, deployed it and everything worked?

  1. Go to "Projects" tab
  2. Select the project I want to deploy Plausible for
  3. Select "+ New" Screenshot 2024-10-18 at 16 46 05
  4. Select "Private Repository" Screenshot 2024-10-18 at 16 46 47
  5. Set branch to "main", choose "Docker Compose" for "Build Pack", set "Base Directory" to the directory containing "docker-compose.yaml" Screenshot 2024-10-18 at 16 50 53
  6. Press "Continue"
  7. Set the domains Screenshot 2024-10-18 at 16 51 46
  8. Click "save" - this takes a really long time and usually is timed out by the cloudflare proxy. However, the domains are persisted after a few attempts.
  9. Click "Deploy"

FWIW, I also tried with docker compose empty and just copying the file but the result is the same (though the UI is slightly different).

RxDBA commented 2 weeks ago

I have refactored the plausible template a lot for the next release. Please use the new template and re-test if this problem still occurs.

Not OP but this fixed my issue. Thanks

horosin commented 4 days ago

@peaklabs-dev thank you so much for the new compose, I was working on a similar update actually - what I get now is this error, I'll try generating the key manually

2024-10-31T17:11:18.763001706Z Request: GET /register
2024-10-31T17:11:18.763008058Z ** (exit) an exception was raised:
2024-10-31T17:11:18.763015442Z     ** (ArgumentError) cookie store expects conn.secret_key_base to be at least 64 bytes
2024-10-31T17:11:18.763025943Z         (plug 1.16.1) lib/plug/session/cookie.ex:184: Plug.Session.COOKIE.validate_secret_key_base/1
2024-10-31T17:11:18.763032575Z         (plug 1.16.1) lib/plug/session/cookie.ex:176: Plug.Session.COOKIE.derive/3
2024-10-31T17:11:18.763039138Z         (plug 1.16.1) lib/plug/session/cookie.ex:95: Plug.Session.COOKIE.put/4
2024-10-31T17:11:18.763048577Z         (plug 1.16.1) lib/plug/session.ex:96: anonymous fn/3 in Plug.Session.before_send/2
2024-10-31T17:11:18.763057684Z         (elixir 1.17.1) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
2024-10-31T17:11:18.763063966Z         (plug 1.16.1) lib/plug/conn.ex:1850: Plug.Conn.run_before_send/2
2024-10-31T17:11:18.763070479Z         (plug 1.16.1) lib/plug/conn.ex:441: Plug.Conn.send_resp/1
2024-10-31T17:11:18.763076721Z         (phoenix 1.7.14) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
horosin commented 4 days ago

For anyone looking to fix this one, go to you environment variables for the service and manually change SERVICE_BASE64_64_PLAUSIBLE

to the output of this command: openssl rand -base64 64