Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Supabase #833

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft

Adding Supabase #833

wants to merge 28 commits into from

Conversation

ak4zh
Copy link
Contributor

@ak4zh ak4zh commented Jan 10, 2023

Supabase includes a lot of services so it can sometimes timeout pulling the images.
It would be a good idea to pull all required images beforehand using the command below:

docker pull supabase/studio:20221214-4eecc99
docker pull kong:2.8.1
docker pull supabase/gotrue:v2.40.1
docker pull postgrest/postgrest:v9.0.1.20220717
docker pull supabase/realtime:v2.0.2
docker pull supabase/storage-api:v0.26.1
docker pull supabase/postgres-meta:v0.52.1
docker pull supabase/postgres:14.1.0.89

To test the deployment copy the template from here and paste in Caprover -> One Click Apps -> template

☑️ Self Check before Merge

  • I have tested the template using the method described in README.md thoroughly
  • I have ensured that I put as much default values as possible (except passwords) to ensure minimum effort required for end users to get started.
  • I have ensured that I am not using the "latest" tag as this tag is dynamically changing and might break the one-click app. Use a fixed version.
  • I have made sure that instructions.start and instructions.end are clear and self-explanatory.
  • Icon is added as a png file to the logos directory.

@pedropaf
Copy link

@ak4zh thanks for this PR, for the section that has your // TODO comment, this is what you need to do:

$$cap_appname-realtime: depends_on: - $$cap_appname-db restart: unless-stopped environment: PORT: 4000 DB_HOST: srv-captain--$$cap_appname-db DB_PORT: 5432 DB_USER: $$cap_pg_user DB_PASSWORD: $$cap_pg_pass DB_NAME: $$cap_pg_db DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime' DB_ENC_KEY: supabaserealtime API_JWT_SECRET: $$cap_jwt_secret FLY_ALLOC_ID: fly123 FLY_APP_NAME: realtime SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq ERL_AFLAGS: -proto_dist inet_tcp ENABLE_TAILSCALE: "false" DNS_NODES: "''" caproverExtra: containerHttpPort: 4000 dockerfileLines: - FROM supabase/realtime:$$cap_realtime_version - CMD sh -c "/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server"

It'd be great if you update this PR. Thanks!

@ak4zh
Copy link
Contributor Author

ak4zh commented Feb 27, 2023

Thanks, @pedropaf
I have updated the PR.
Have you tested the deployment?
The above app deploys for me but I am having some issues connecting the dashboard with the API.
Hoping someone can figure that out.

@HarunKilic
Copy link

HarunKilic commented Feb 28, 2023

Just tested this out, but there is an issue with line: 413

The image /var/lib/docker/volumes/captain--supabase-db-init/_data/ does not exist.
Should it be db instead of init ?

@ak4zh
Copy link
Contributor Author

ak4zh commented Feb 28, 2023

@HarunKilic Just checked with supabase official docker file.
Seems line 413 is not required anymore as the example data.sql on supabase repo is empty anyway.

You may need to copy the SQL files from their repo and to appropriate volumes.
I will update the instructions later.

@HarunKilic
Copy link

@ak4zh do you have a running instance running right now?
The configurations does almost work.
But I get an infinite Connecting to Default Project message on the frontend.
The log says error - Failed to load env from /app/studio/.env RangeError: Maximum call stack size exceeded

@ak4zh
Copy link
Contributor Author

ak4zh commented Mar 14, 2023

@HarunKilic I do not have a running instance with me right now because supabase is quite big and crashes on playwithdocker.
I was testing on my production server but don't want to mess it up.

While I was testing I got the same issue studio is not able to connect to the pgrest API.
I will try to do some more tests on a new DO instance.

@HarunKilic
Copy link

@ak4zh I just tried to deploy it again, and I have issues with the DB.

initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
2023-03-16T11:54:07.364660625Z initdb: hint: If you want to create a new database system, either remove or empty the directory "/var/lib/postgresql/data" or run initdb with an argument other than "/var/lib/postgresql/data".

This happens when following step 4.

@marekbrze
Copy link

Hi!

Did you find the reason for the problem with db? Do you need any help with investigation?

@AriaFantom
Copy link

@ak4zh I just tried to deploy it again, and I have issues with the DB.

initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
2023-03-16T11:54:07.364660625Z initdb: hint: If you want to create a new database system, either remove or empty the directory "/var/lib/postgresql/data" or run initdb with an argument other than "/var/lib/postgresql/data".

This happens when following step 4.

Same thing happened with me

@ak4zh
Copy link
Contributor Author

ak4zh commented Jul 2, 2023

@AriaFantom There are multiple commands in step 4.
Which exact command causes the issue?
The first command is to delete the existing data folder so after that it should not say db exists.

I have stopped using supabase and moved all my projects to use drizzle ORM instead. As supabase self hosting is overly complicated for me and the hosted solution get’s super expensive over time. I would still be interested in getting it added on caprover so if anyone can get it working that would be amazing. At the moment everything deploys smooth for me but I have some issues connecting them together.

@AriaFantom
Copy link

@AriaFantom There are multiple commands in step 4. Which exact command causes the issue? The first command is to delete the existing data folder so after that it should not say db exists.

I have stopped using supabase and moved all my projects to use drizzle ORM instead. As supabase self hosting is overly complicated for me and the hosted solution get’s super expensive over time. I would still be interested in getting it added on caprover so if anyone can get it working that would be amazing. At the moment everything deploys smooth for me but I have some issues connecting them together.

After stopping the instance of pg then it doesn't starts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants