diff --git a/docs/self-hosting.md b/docs/local-self-hosting.md similarity index 60% rename from docs/self-hosting.md rename to docs/local-self-hosting.md index 7434e6e..f14e61e 100644 --- a/docs/self-hosting.md +++ b/docs/local-self-hosting.md @@ -1,4 +1,4 @@ -# Self-hosted Supabase with Docker +# Local, self-hosted Supabase with Docker If you want to host your own Supabase instance, you can do it. This is how. You have to do this setup only once. @@ -24,20 +24,7 @@ To use the [@radio4000/sdk](https://github.com/radio4000/sdk), you will need at ### User authentication (emails) -The local development server (supabase backend), allows to `signUp` -(register) and `signIn` (login) new users (also `signOut`). +When you develop locally, all the emails related to user authentication ARE NOT SENT. Instead, what would potentially have been sent are displayed in a local software called @inbucket on http://127.0.0.1:54324/monitor. -Since these actions **send emails**,no mail will be sent to the "real -email" used to register locally, but mails are displayed in a local -web server/interface. - -The local "webmail" (provided by the supabase setup) is available at -[http://localhost:9000/](http://localhost:9000/). - -It allows to click the user validating link, for all email -adresses that have been used to register. - -> Note, if no server is available at this local address, is is most -> probably because you are not running the local supabase server (see -> above) +> Note, if no server is available at this address, the local `supabase` server is most probably not running. Check with `supabase status`. diff --git a/docs/postgresql.md b/docs/postgresql.md index 64eec1c..a203a17 100644 --- a/docs/postgresql.md +++ b/docs/postgresql.md @@ -12,3 +12,20 @@ psql $DATABASE_URL -f supabase/migrations/*.sql Now there is an empty PostgreSQL database with the correct schemas, setup to work for Radio4000. + +## Backup + +Do not forget that this is PostgreSQL. The usual methods like `pg_dump` and [`pg_dumpall`](https://www.postgresql.org/docs/current/app-pg-dumpall.html) will work. That being said, the Supabase CLI makes it easier to run. + +By default it'll attempt to connect to your _linked_, remote Supabase project. It will ask for the db password. If no project is linked, run `supabase link`. + +``` +supabase db dump -f supabase/schema.sql +supabase db dump -f supabase/roles.sql --role-only +supabase db dump -f supabase/seed.sql --data-only +``` + +To connect to your local set up, use the `--local` flag. + +- https://supabase.com/docs/reference/cli/supabase-db-dump +- https://supabase.com/docs/guides/platform/backups diff --git a/supabase/config.toml b/supabase/config.toml index 968fd7b..36ed62e 100644 --- a/supabase/config.toml +++ b/supabase/config.toml @@ -4,7 +4,6 @@ project_id = "radio4000" [api] enabled = true -# Port to use for the API URL. port = 54321 # Schemas to expose in your API. Tables, views and stored procedures in this schema will get API # endpoints. `public` is always included. diff --git a/supabase/migrations/20240418145338_initial_schema.sql b/supabase/migrations/20240418145338_initial_schema.sql index ddc4686..5f6b2ec 100644 --- a/supabase/migrations/20240418145338_initial_schema.sql +++ b/supabase/migrations/20240418145338_initial_schema.sql @@ -3,17 +3,6 @@ set pgaudit.log = 'none'; create extension if not exists postgis schema extensions; set pgaudit.log = 'ddl'; --- Drop exisiting tables -DROP TABLE if exists public.accounts; -DROP TABLE if exists channels CASCADE; -DROP TABLE if exists channel_track CASCADE; -DROP TABLE if exists tracks CASCADE; -DROP TABLE if exists user_channel; -DROP TABLE if exists followers; - --- Make sure all users are deleted -DELETE FROM auth.users; - -- Create a table for public user accounts create table accounts ( id uuid not null references auth.users (id) on delete cascade,