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

Regarding changing from storing data in local machine to storing data in supabase's servers #6

Open
rezteknoloji opened this issue Oct 4, 2023 · 4 comments

Comments

@rezteknoloji
Copy link

Hi, I need to store the data in Supabase's servers rather than storing it in my local machine. How can i do that? which file in source code should i change?

Thank you!

@pierre-lgb
Copy link
Owner

Hi, I need to store the data in Supabase's servers rather than storing it in my local machine. How can i do that? which file in source code should i change?

Thank you!

Hi,

You can follow these steps:

  • Download repository

  • In the repository's root directory, run yarn install

  • Setup environment variables: duplicate .env.development, rename it .env.local and set the NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY environment variables to the URL and the anon key that you can get from supabase dashboard.

  • Run the following command (set --dbname to the postgres database URL ):

cd server/scripts && psql --single-transaction --variable ON_ERROR_STOP=1 --file tables.sql --file auth.sql --file rpc.sql --file folders.sql --file documents.sql --file shares.sql --file cron.sql --file realtime.sql --file storage.sql --dbname "postgres:..." && cd ../..

  • Rename @tiptap-pro-placeholder (shared/editor/extensions/@tiptap-pro-placeholder) to @tiptap-pro

  • To start the app in development mod, run npm run dev. To start the app in production mode, run npm run build then npm run start

Hope it helps you! (Let me know if you need more details)

@rezteknoloji
Copy link
Author

Hi, I need to store the data in Supabase's servers rather than storing it in my local machine. How can i do that? which file in source code should i change?
Thank you!

Hi,

You can follow these steps:

  • Download repository
  • In the repository's root directory, run yarn install
  • Setup environment variables: duplicate .env.development, rename it .env.local and set the NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY environment variables to the URL and the anon key that you can get from supabase dashboard.
  • Run the following command (set --dbname to the postgres database URL ):

cd server/scripts && psql --single-transaction --variable ON_ERROR_STOP=1 --file tables.sql --file auth.sql --file rpc.sql --file folders.sql --file documents.sql --file shares.sql --file cron.sql --file realtime.sql --file storage.sql --dbname "postgres:..." && cd ../..

  • Rename @tiptap-pro-placeholder (shared/editor/extensions/@tiptap-pro-placeholder) to @tiptap-pro
  • To start the app in development mod, run npm run dev. To start the app in production mode, run npm run build then npm run start

Hope it helps you! (Let me know if you need more details)

The project does use Docker. How can I remove docker, and from storing everything on local machine to use supabase's Databases to store all the data including auth? and some projects use SUPABASE_DB_URL in .env but this project doesn't. How can I change all this WITHOUT need to run this command:

**cd server/scripts && psql --single-transaction --variable ON_ERROR_STOP=1 --file tables.sql --file auth.sql --file rpc.sql --file folders.sql --file documents.sql --file shares.sql --file cron.sql --file realtime.sql --file storage.sql --dbname "postgres:..." && cd ../..

**
?

Thank you:)

@pierre-lgb
Copy link
Owner

The project does use Docker. How can I remove docker, and from storing everything on local machine to use supabase's Databases to store all the data including auth? and some projects use SUPABASE_DB_URL in .env but this project doesn't. How can I change all this WITHOUT need to run this command:

**cd server/scripts && psql --single-transaction --variable ON_ERROR_STOP=1 --file tables.sql --file auth.sql --file rpc.sql --file folders.sql --file documents.sql --file shares.sql --file cron.sql --file realtime.sql --file storage.sql --dbname "postgres:..." && cd ../..

** ?

Thank you:)

Sorry for my late reply,

The SUPABASE_DB_URL variable you're refering to is called NEXT_PUBLIC_SUPABASE_URL in .env file (same for SUPABASE_ANON_KEY, called NEXT_PUBLIC_SUPABASE_ANON_KEY).

To run the different scripts it's easier to run the command you mentioned, as running each script manually on supabase SQL editor probably won't work because of relations... You should try to connect to supabase with psql and run the command.

Hope it helps!

@rezteknoloji
Copy link
Author

The project does use Docker. How can I remove docker, and from storing everything on local machine to use supabase's Databases to store all the data including auth? and some projects use SUPABASE_DB_URL in .env but this project doesn't. How can I change all this WITHOUT need to run this command:
**cd server/scripts && psql --single-transaction --variable ON_ERROR_STOP=1 --file tables.sql --file auth.sql --file rpc.sql --file folders.sql --file documents.sql --file shares.sql --file cron.sql --file realtime.sql --file storage.sql --dbname "postgres:..." && cd ../..
** ?
Thank you:)

Sorry for my late reply,

The SUPABASE_DB_URL variable you're refering to is called NEXT_PUBLIC_SUPABASE_URL in .env file (same for SUPABASE_ANON_KEY, called NEXT_PUBLIC_SUPABASE_ANON_KEY).

To run the different scripts it's easier to run the command you mentioned, as running each script manually on supabase SQL editor probably won't work because of relations... You should try to connect to supabase with psql and run the command.

Hope it helps!

Thank you brother! I will check and drop the results.

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

No branches or pull requests

2 participants