Skip to content

Commit

Permalink
Merge pull request #26 from radio4000/main
Browse files Browse the repository at this point in the history
Release to production
  • Loading branch information
oskarrough authored May 12, 2024
2 parents 65358e4 + 0fedcef commit e801f0a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
19 changes: 3 additions & 16 deletions docs/self-hosting.md → docs/local-self-hosting.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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`.
17 changes: 17 additions & 0 deletions docs/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion supabase/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions supabase/migrations/20240418145338_initial_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e801f0a

Please sign in to comment.