S
Supabase5d ago
Siva

Help: Self-hosting Supabase on an offline server — edge functions container keeps restarting

I’m self-hosting Supabase on a fully secured/offline server (no internet access). Everything deploys correctly except supabase-edge-functions, which keeps restarting because it tries to fetch external dependencies during boot. Since the server has no outbound internet, the container repeatedly fails with errors like:
Error: failed to load 'https://deno.land/std@0.131.0/http/server.ts': Import 'https://deno.land/std@0.131.0/http/server.ts' failed: error sending request for url: error trying to connect: tcp connect error: Connection timed out (os error 110) Error: main worker boot error: worker boot error failed to load 'https://deno.land/std@0.131.0/http/server.ts': tcp connect error: Connection timed out (os error 110)
Is there a way to run edge functions with all dependencies bundled/inlined (so it doesn’t try to reach Deno’s CDN)? Is there a recommended way to host the Deno dependencies locally? Any advice or examples from anyone who has achieved fully offline/air-gapped deployment would be greatly appreciated! Thanks!
No description
1 Reply
inder
inder5d ago
One way I can think of is that you allow outbound connections once and cache the dependencies so that you don't have to download them again. You can either use a named volume or a bind mount For example in your functions service
functions:
volumes:
# either use a named volume or a bind mount here.
- ./deno_modules:/root/.cache/deno
functions:
volumes:
# either use a named volume or a bind mount here.
- ./deno_modules:/root/.cache/deno
or using named volume
functions:
volumes:
- deno_cache:/root/.cache/deno

volumes:
deno_cache:
functions:
volumes:
- deno_cache:/root/.cache/deno

volumes:
deno_cache:
Also I see in the logs, server module is being downloaded. You can simply use Deno.serve. That should remove one dependency. You can remove that import here https://github.com/supabase/supabase/blob/master/docker/volumes/functions/main/index.ts#L1 and on this line https://github.com/supabase/supabase/blob/master/docker/volumes/functions/main/index.ts#L33, change it to Deno.serve

Did you find this page helpful?