coollabsio / coolify

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

[Bug]: Appwrite Template missing Runtimes network #2089

Open VincenzoKoestler opened 5 months ago

VincenzoKoestler commented 5 months ago

Description

The docker compose for appwrite seems to be missing the runtimes network for the Openruntimes Executor

Minimal Reproduction (if possible, example repository)

deploy appwrite in v4.0.0-beta.269

Exception or Error

no runtimes network deployed

Version

v4.0.0-beta.269

ray-bun commented 3 months ago

I've also noticed that the domains format is in an incorrect format: Domains: 666bd7740fe61bb6c6b1.https://xx.xxx.com/

Build log:

Docker Error: 59689d0f5d1c48fe2181496b3bcce3259b32ad1f22b0fcaa5ff39c571fb17084 docker: Error response from daemon: network runtimes not found.

/usr/src/code/src/Executor/Executor.php:97

0 /usr/src/code/src/Appwrite/Platform/Workers/Builds.php(407): Executor\Executor->createRuntime('666bd773a47ab03...', '666bd5d1001ecab...', '/storage/functi...', 'openruntimes/no...', 'v3', true, 'src/main.js', '/storage/builds...', Array, 'tar -zxf /tmp/c...')

https://github.com/appwrite/appwrite/pull/1 [internal function]: Appwrite\Platform\Workers\Builds->Appwrite\Platform\Workers{closure}() https://github.com/appwrite/appwrite/pull/2 {main}

ray-bun commented 3 months ago

Same for python Docker Error: 17c805b82649f5289b67a27f391a7d84c38279ffc99102cce0a4a6b16b16c054 docker: Error response from daemon: network runtimes not found.

/usr/src/code/src/Executor/Executor.php:97

0 /usr/src/code/src/Appwrite/Platform/Workers/Builds.php(407): Executor\Executor->createRuntime('666c3dabe8be94d...', '666bd5d1001ecab...', '/storage/functi...', 'openruntimes/py...', 'v3', true, 'src/main.py', '/storage/builds...', Array, 'tar -zxf /tmp/c...')

1 [internal function]: Appwrite\Platform\Workers\Builds->Appwrite\Platform\Workers{closure}()

2 {main}

LcsH0s commented 3 months ago

Just noticed this as well on python

Docker Error: bb1e166b7612d622029e4d8f762bd941b5d41f87cb191e17c495ef88195d611e

WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
docker: Error response from daemon: network runtimes not found.

/usr/src/code/src/Executor/Executor.php:97
#0 /usr/src/code/src/Appwrite/Platform/Workers/Builds.php(407): Executor\Executor->createRuntime('666c7181154a0fc...', 'codecanary', '/storage/functi...', 'openruntimes/py...', 'v3', true, 'src/main.py', '/storage/builds...', Array, 'tar -zxf /tmp/c...')
#1 [internal function]: Appwrite\Platform\Workers\Builds->Appwrite\Platform\Workers\{closure}()
#2 {main}

And with an incorrectly formatted domain shown in functions :

Domains: https://666c7181030886c99dd1.https//example.com

ray-bun commented 3 months ago

Just noticed this as well on python

Docker Error: bb1e166b7612d622029e4d8f762bd941b5d41f87cb191e17c495ef88195d611e

WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
docker: Error response from daemon: network runtimes not found.

/usr/src/code/src/Executor/Executor.php:97
#0 /usr/src/code/src/Appwrite/Platform/Workers/Builds.php(407): Executor\Executor->createRuntime('666c7181154a0fc...', 'codecanary', '/storage/functi...', 'openruntimes/py...', 'v3', true, 'src/main.py', '/storage/builds...', Array, 'tar -zxf /tmp/c...')
#1 [internal function]: Appwrite\Platform\Workers\Builds->Appwrite\Platform\Workers\{closure}()
#2 {main}

And with an incorrectly formatted domain shown in functions :

Domains: https://666c7181030886c99dd1.https//example.com

I was able to fixed the domain issue by editing the docker file. Please see: https://github.com/coollabsio/coolify/issues/1959

also the service ID is in the URL

kuzerno1 commented 3 months ago

I have got my appwrite instance running with the following changes.

For the functions the network runtimes is not created. I changed the env variable _APP_FUNCTIONS_RUNTIMES_NETWORK to the service network. That means that I have a appwrite service with the name "appwrite-okggkwo" then you need to use "okggkwo" as you network. You can also check in the compose file when "Show Deployable Compose" is check what the name of the network is.

This is probably not the best solution, but its working for now. I will look further into it and try to add the appwrite_runtime network in the docker-compose like the normal one to test if it will work. So that we don't have to change this.

Then you have the problem that the domain provided by Coolify is http(s)://domain.ltd/. This is not how Appwrite wants the domain name, it needs to be domain.ltd. I don't know if this is possible to get from Coolify but I change the following env variables: _APP_DOMAIN, _APP_DOMAIN_FUNCTIONS and _APP_DOMAIN_TARGET to domain.ltd. And remove $SERVICE_FQDN_APPWRITE from the docker compose for these env variables.

If we can get the domain name from Coolify without the http(s) include then we can replace $SERVICE_FQDN_APPWRITE with that in docker compose. But for now me setup is finally working.

And if this is possible there will be a problem with multiple domains. Because the env variables _APP_DOMAIN, _APP_DOMAIN_FUNCTIONS and _APP_DOMAIN_TARGET needs to be one domain if I'm correct. I think there needs to be a main domain variable and additional domains for services like this in Coolify.

ray-bun commented 3 months ago

Are you able to get the function url working ?

kuzerno1 commented 3 months ago

I have look into the function url. You need to add the function url into the list of domains in the Coolify service.

So when you have https://example.com/ you need to add https://66715baa53b2c498008f.example.com/ to it. So you will get https://example.com/,https://66715baa53b2c498008f.example.com/ in Coolify.

There is a issue for wildcard domains #2391, when that is implemented you can add hopefully https://*.example.com/. to the list of domains and it will work without any manual edits to domains.

ray-bun commented 3 months ago

I have look into the function url. You need to add the function url into the list of domains in the Coolify service.

So when you have https://example.com/ you need to add https://66715baa53b2c498008f.example.com/ to it. So you will get https://example.com/,https://66715baa53b2c498008f.example.com/ in Coolify.

There is a issue for wildcard domains #2391, when that is implemented you can add hopefully https://*.example.com/. to the list of domains and it will work without any manual edits to domains.

Awesome. Thank you. It's working after waiting about 30mins

anasaijaz commented 2 months ago

Can this be fixed temporarily by redirecting the *.subdomain.domain.tld to subdomain.domain.tld? From the caddy file?

vvinhas commented 2 weeks ago

I have got my appwrite instance running with the following changes.

For the functions the network runtimes is not created. I changed the env variable _APP_FUNCTIONS_RUNTIMES_NETWORK to the service network. That means that I have a appwrite service with the name "appwrite-okggkwo" then you need to use "okggkwo" as you network. You can also check in the compose file when "Show Deployable Compose" is check what the name of the network is.

This is probably not the best solution, but its working for now. I will look further into it and try to add the appwrite_runtime network in the docker-compose like the normal one to test if it will work. So that we don't have to change this.

Then you have the problem that the domain provided by Coolify is http(s)://domain.ltd/. This is not how Appwrite wants the domain name, it needs to be domain.ltd. I don't know if this is possible to get from Coolify but I change the following env variables: _APP_DOMAIN, _APP_DOMAIN_FUNCTIONS and _APP_DOMAIN_TARGET to domain.ltd. And remove $SERVICE_FQDN_APPWRITE from the docker compose for these env variables.

If we can get the domain name from Coolify without the http(s) include then we can replace $SERVICE_FQDN_APPWRITE with that in docker compose. But for now me setup is finally working.

And if this is possible there will be a problem with multiple domains. Because the env variables _APP_DOMAIN, _APP_DOMAIN_FUNCTIONS and _APP_DOMAIN_TARGET needs to be one domain if I'm correct. I think there needs to be a main domain variable and additional domains for services like this in Coolify.

Thanks a lot, man! I've spent 3 days trying to fix this, and your solution was the only one that make it work! 🎉 Adding the full function domain is boring though, I wish Coolify added the option to handle these subdomains automagically

Divinely5782 commented 2 weeks ago

@kuzerno1 Hi! Many thanks for your discovery for awesome self-hosters! I have some misunderstanding, i completed all steps as in your guide and when i go to appwrite primary domain: https://appwrite-p80wkossggw.example.com i got an error:

Error 401
This domain is not connected to any Appwrite resource yet. Please configure custom domain or function domain to allow this request.

Type

general_access_forbidden

Thank your for help!