coolify icon indicating copy to clipboard operation
coolify copied to clipboard

feat(templates): add openpanel template & svg logo

Open gurvancampion opened this issue 9 months ago • 5 comments

Changes

  • Added openpanel.yaml template service
  • Added openpanel.svg logo

~This is my first time setting a coolify template, not sure but I have an issue when adding a custom domain, to make it work I had to remove the following in my docker compose:~

# Set coolify FQDN domain
- NEXT_PUBLIC_API_URL=$SERVICE_FQDN_OPENPANELAPI
- NEXT_PUBLIC_DASHBOARD_URL=$SERVICE_FQDN_OPENPANEL

~And set it like this to make it work:~

# Set custom domain
- NEXT_PUBLIC_DASHBOARD_URL=${NEXT_PUBLIC_DASHBOARD_URL:-https://your-domain.com}
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-https://your-domain.com/api}

~Not sure why it doesn't work modifying the NEXT_PUBLIC_API_URL and NEXT_PUBLIC_DASHBOARD_URL directly via the coolify UI.~

Edit: I got it working now with Coolify FQDN thanks to @dickwolff reply: https://github.com/coollabsio/coolify/pull/5310#issuecomment-2762641740

gurvancampion avatar Mar 09 '25 20:03 gurvancampion

@gurvancampion I dont know if it helps, but while trying your docker-compose I got the FQDN to work by matching it with the service name. So I renamed it from op-api to api and then by doing SERVICE_FQDN_API changing the domain via the UI and saving it also updates the environment variable. And the same for the dashboard.

Edit: and I also found out about the missing variables on the dashboard, which I see you also already added.

dickwolff avatar Mar 28 '25 21:03 dickwolff

@dickwolff Oh you are right, I just tried again by matching my docker service name with SERVICE_FQDN_<SERVICENAME> and now it works!

gurvancampion avatar Mar 29 '25 10:03 gurvancampion

@gurvancampion I tried your file again to verify and the FQDN works as expected. However when I open the dashboard, I see some weird behavior and a lot of failing API calls like https://openpanelapi-o4ococggw08gwc0gsckgsos8.mycoolifyinstance.tld/api/misc/favicon?url=https%3A%2F%2Fupload.w.... Do you also see this? My API URL is set to something else then specified above.

Apart from that, both the API and Dashboard seem to be running just fine, but they are being reported as unhealthy in Coolify. Not sure if this is down to that there isn't a health check specified.

dickwolff avatar Mar 29 '25 14:03 dickwolff

@dickwolff Did you restart the services after you changed the domains?

If you change the domain on the API, the dashboard (Next.js) needs to be rebuilt (by doing a restart) to properly set the new API URL. Before I had similar failing API calls, it was because the FQDN didn't work, so it was using the wrong URL. But I do remember also having an issue with cache (my domain is using Cloudflare), it was using cached files from my previous build (tests) calling the wrong API URL.

Regarding the "unhealthy", yes it's because there are no health checks specified

gurvancampion avatar Mar 29 '25 14:03 gurvancampion

@gurvancampion I put everything under a new FQDN and then it was working. When I change the API URL and redeploy, then it keeps the old API URL. I also use Cloudflare on my domain, could be that they are doing some caching stuff.

Edit: after fully purging the cache on Cloudflare, new stuff is being picked up.

Edit 2: unfortunately not I can't seem to log in. Purged all relevant caches, even tried to redeploy the whole stack again. Now the web app says "successfully signed in", but then does nothing, no session created etc..

dickwolff avatar Mar 29 '25 14:03 dickwolff

@gurvancampion I put everything under a new FQDN and then it was working. When I change the API URL and redeploy, then it keeps the old API URL. I also use Cloudflare on my domain, could be that they are doing some caching stuff.

Edit: after fully purging the cache on Cloudflare, new stuff is being picked up.

Edit 2: unfortunately not I can't seem to log in. Purged all relevant caches, even tried to redeploy the whole stack again. Now the web app says "successfully signed in", but then does nothing, no session created etc..

When I was doing mass testing at the beginning, I had to put my Cloudflare domain in development mode temporarily to avoid issues with the dashboard domain picking up old files from previous deployments.

@dickwolff Regarding your issues after signing in, do you have any errors in your services logs?

gurvancampion avatar Apr 05 '25 07:04 gurvancampion

Thanks for this! I'm however unfortunately not getting it to work fully. A couple of issues:

  1. When using the default URLs for the API and Dashboard, both load - however they default to http (not https) which breaks calling the API from my website. The Dashboard seems to work though.
  2. When changing both the API and Dashboard URLs to e.g., https://mycoolifysite.com/op-api and https://mycoolifysite.com/op-dashboard, the API seems to work, but the dashboard doesn't. Instead, I get redirected back to https://mycoolifysite.com just like I do with any /path that doesn't exist. This applies for any /path I use.
  3. If I change only the API URL, I can create an account in the Dashboard however I cannot log in or proceed with the onboarding.

Any idea what could be the cause of these issues and how to fix them? Would love to see this merged.

gustavfridell avatar Apr 14 '25 20:04 gustavfridell

Thanks for this! I'm however unfortunately not getting it to work fully. A couple of issues:

  1. When using the default URLs for the API and Dashboard, both load - however they default to http (not https) which breaks calling the API from my website. The Dashboard seems to work though.
  2. When changing both the API and Dashboard URLs to e.g., https://mycoolifysite.com/op-api and https://mycoolifysite.com/op-dashboard, the API seems to work, but the dashboard doesn't. Instead, I get redirected back to https://mycoolifysite.com just like I do with any /path that doesn't exist. This applies for any /path I use.
  3. If I change only the API URL, I can create an account in the Dashboard however I cannot log in or proceed with the onboarding.

Any idea what could be the cause of these issues and how to fix them? Would love to see this merged.

  1. Hmm, I never had this issue. If you have a wildcard domain set on your server, it should generate https FQDN, no?
  2. Seems to be a proxy configuration issue, did you restart the services after you changed the domains?
  3. May be related to point 2, the best would be to check the logs on the dashboard and API service to have any glue about what could be wrong

gurvancampion avatar Apr 14 '25 20:04 gurvancampion

I have similar issues as you @gustavfridell with #3. I run Coolify behind Cloudflare and I seem to have some cache issues. I tried to test some things today with Cloudflare but didn't have time to finish my testing.

dickwolff avatar Apr 14 '25 20:04 dickwolff

Thanks! That solved it, specifically adding a wildcard subdomain on Cloudflare and running the API and Dashboard as https://op-api.mycoolifysite.com and https://op-dashboard.mycoolifysite.com respectively.

Another issue I encountered is that it seems like the environment variable OPENPANEL_ALLOW_REGISTRATION doesn't work correctly. I have it set to false (which is the default value) but I can still register new users on the dashboard. Could be an issue where false is interpreted as a truthy string, but haven't looked into it.

gustavfridell avatar Apr 15 '25 06:04 gustavfridell

One thing that's different from my end is that i'm trying to run the API and dashboard on separate domains (so API on api.domaina.com, and the dashboard on dashboard.domainb.com). But I would think that doesn't make the difference as both are wildcard domains.

dickwolff avatar Apr 15 '25 07:04 dickwolff

Is there a way to update to the latest version of OpenPanel using this template? The standard self-hosting guide has an ./update script as described here.

gustavfridell avatar Apr 22 '25 14:04 gustavfridell

I haven't tried yet to update a service in Coolify but currently there are no more recent Docker images for OpenPanel https://hub.docker.com/u/lindesvard

I guess modifying each service version in the docker compose file and click on "Pull latest images & restart" would probably do it CleanShot 2025-04-23 at 23 54 19@2x

gurvancampion avatar Apr 23 '25 21:04 gurvancampion

It was a mistake, sorry. I recreated the next branch and it auto-closed this PR.

andrasbacsai avatar May 09 '25 11:05 andrasbacsai

@lindesvard are you satisfied with this PR? OpenPanel is great so would love to see it merged.

gustavfridell avatar May 14 '25 10:05 gustavfridell

@lindesvard are you satisfied with this PR? OpenPanel is great so would love to see it merged.

Mostly yes but 2 things:

  • @reynaldichernando had suggestion to bake in geo db into the api https://github.com/Openpanel-dev/openpanel/issues/153, then this docker compose would be a bit simpler
  • I'll hopefully release new versions of self-hosting this week

So could we hold this PR open for a couple of days?

lindesvard avatar May 14 '25 12:05 lindesvard

If I'm blocking you guys, maybe we could just proceed with this PR, and I can make another PR to coolify for updating the compose.yml when my change is finished?

reynaldichernando avatar May 14 '25 12:05 reynaldichernando

If I'm blocking you guys, maybe we could just proceed with this PR, and I can make another PR to coolify for updating the compose.yml when my change is finished?

@reynaldichernando I'm fine waiting like @lindesvard suggested - sounds like great improvements. Thanks both.

gustavfridell avatar May 14 '25 13:05 gustavfridell

Let's wait a bit then 👌

lindesvard avatar May 14 '25 13:05 lindesvard

Thank you for your contribution. Due to inactivity, we're closing this PR. If you'd like to revisit this change, feel free to reopen this PR or open a new pull request.

peaklabs-dev avatar Jun 18 '25 10:06 peaklabs-dev

@lindesvard and @gurvancampion - are there any plans on reopening this with @peaklabs-dev's suggested changes?

gustavfridell avatar Jun 19 '25 11:06 gustavfridell

Just tried this yesterday on coolify so I'm keen of opening it. But have notified some things that can be better.

Will also make sure the docker compose gets all necessary changes.

Will be my weekend mission.

Apart from that, all things we waited for before is done ✅

lindesvard avatar Jun 19 '25 11:06 lindesvard

Okey, I have done my tests (not really used to Coolify so I'm not sure what edge cases exists) and it works good.

Here is the templated I used (I've done some changes to @gurvancampion original file)

~~https://github.com/Openpanel-dev/openpanel/blob/92d62c3e5c679d6382b6d50de71c8c38dac0dd8e/self-hosting/coolify.yml~~

I have fixed all comments @peaklabs-dev has made except run command for the API. I think I would like to have the check before running migrations to be sure the services are live.

edit new link: https://github.com/Openpanel-dev/openpanel/blob/main/self-hosting/coolify.yml

lindesvard avatar Jun 23 '25 20:06 lindesvard

Great, I've pushed a new commit with @lindesvard changes and made few adjustments:

https://github.com/gurvancampion/coolify/commit/1632e5e9b1347d0d841b12c6a4a71bb8d5a388e8

  • Modified the API run command to only run migrations. I didn't encounter any issue in my tests; it seems like it relies correctly on the "depends_on" healthy services configuration.
  • Modified the environment SERVICE_FQDN_OPAPI=/api to SERVICE_FQDN_OPAPI, which was causing an issue when requesting from the Dashboard to the API with a generated domain name from Coolify FQDN or when setting a custom domain name.

I've tested with Coolify FQDN generated domain names and by setting custom ones (e.g: https://op-api.mydomain.com, https://op-dashboard.mydomain.com & https://op-bullboard.mydomain.com), it's all working correctly.

@peaklabs-dev I cannot reopen this PR with our changes, Could you reopen it?

gurvancampion avatar Jun 30 '25 08:06 gurvancampion

@gurvancampion have you really pushed? 🤔

lindesvard avatar Jun 30 '25 09:06 lindesvard

@gurvancampion have you really pushed? 🤔

Yes I did push here: https://github.com/gurvancampion/coolify/commit/1632e5e9b1347d0d841b12c6a4a71bb8d5a388e8

gurvancampion avatar Jun 30 '25 09:06 gurvancampion

@gurvancampion that commit (or your changes) does not exists in this PR at least 🤷‍♂️

lindesvard avatar Jul 02 '25 10:07 lindesvard

@gurvancampion that commit (or your changes) does not exists in this PR at least 🤷‍♂️

Yes seems like I don't have the right to reopen the PR, so my changes are not taken. @peaklabs-dev could you reopen it? or shoud we create a new PR?

gurvancampion avatar Jul 04 '25 06:07 gurvancampion

@gurvancampion PR is now opened, in case you missed it. Thanks @peaklabs-dev!

gustavfridell avatar Jul 13 '25 07:07 gustavfridell

Thanks for the PR. I will fix it a bit.

peaklabs-dev avatar Aug 05 '25 16:08 peaklabs-dev