Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Support storage and buckets for self hosted

Aditya Dhawan25d374be355d
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index d879f3ba834..2eed64571ff 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -18,7 +18,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
SUPABASE_URL: http://kong:8000
- SUPABASE_REST_URL: ${PUBLIC_REST_URL}
+ SUPABASE_REST_URL: ${SUPABASE_PUBLIC_URL}
SUPABASE_ANON_KEY: ${ANON_KEY}
SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}
@@ -112,8 +112,7 @@ services:
SLOT_NAME: supabase_realtime_rls
TEMPORARY_SLOT: "true"
command: >
- bash -c "./prod/rel/realtime/bin/realtime eval Realtime.Release.migrate
- && ./prod/rel/realtime/bin/realtime start"
+ bash -c "./prod/rel/realtime/bin/realtime eval Realtime.Release.migrate && ./prod/rel/realtime/bin/realtime start"
storage:
container_name: supabase-storage
diff --git a/studio/.env b/studio/.env
index db284f3411e..633099bfb61 100644
--- a/studio/.env
+++ b/studio/.env
@@ -2,7 +2,7 @@ STUDIO_PG_META_URL=http://localhost:8000/pg
POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password
SUPABASE_URL=http://localhost:8000
-SUPABASE_REST_URL=http://localhost:8000/rest/v1/
+SUPABASE_REST_URL=http://localhost:8000
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJzZXJ2aWNlX3JvbGUiLAogICAgImlzcyI6ICJzdXBhYmFzZS1kZW1vIiwKICAgICJpYXQiOiAxNjQxNzY5MjAwLAogICAgImV4cCI6IDE3OTk1MzU2MDAKfQ.DaYlNEoUrrEn2Ig7tqibS-PHK5vgusbcbo7X36XVt4Q
diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index b08d1dbc460..98fa7181c6b 100644
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -39,16 +39,14 @@ export const generateProductRoutes = (ref: string, project?: ProjectBase): Route
icon: <IconUsers size={18} strokeWidth={2} />,
link: isProjectBuilding ? buildingUrl : `/project/${ref}/auth/users`,
},
- ...(IS_PLATFORM
- ? [
- {
- key: 'storage',
- label: 'Storage',
- icon: <IconArchive size={18} strokeWidth={2} />,
- link: isProjectBuilding ? buildingUrl : `/project/${ref}/storage/buckets`,
- },
- ]
- : []),
+
+ {
+ key: 'storage',
+ label: 'Storage',
+ icon: <IconArchive size={18} strokeWidth={2} />,
+ link: isProjectBuilding ? buildingUrl : `/project/${ref}/storage/buckets`,
+ },
+
{
key: 'sql',
label: 'SQL Editor',
diff --git a/studio/components/layouts/StorageLayout/StorageMenu.tsx b/studio/components/layouts/StorageLayout/StorageMenu.tsx
index d2bc0302cfd..496b41ec4a7 100644
--- a/studio/components/layouts/StorageLayout/StorageMenu.tsx
+++ b/studio/components/layouts/StorageLayout/StorageMenu.tsx
@@ -19,6 +19,7 @@ import {
import ProductMenuItem from 'components/ui/ProductMenu/ProductMenuItem'
import { STORAGE_ROW_STATUS } from 'components/to-be-cleaned/Storage/Storage.constants'
import { useStorageStore } from 'localStores/storageExplorer/StorageExplorerStore'
+import { IS_PLATFORM } from 'lib/constants'
interface Props {}
@@ -94,21 +95,27 @@ const StorageMenu: FC<Props> = () => {
<div className="">
<Menu.Group title="Configuration" />
- <Link href={`/project/${projectRef}/storage/settings`}>
- <Menu.Item rounded active={page === 'settings'}>
- <Typography.Text className="truncate">Settings</Typography.Text>
- </Menu.Item>
- </Link>
+ {IS_PLATFORM && (
+ <Link href={`/project/${projectRef}/storage/settings`}>
+ <Menu.Item rounded active={page === 'settings'}>
+ <Typography.Text className="truncate">Settings</Typography.Text>
+ </Menu.Item>
+ </Link>
+ )}
+
<Link href={`/project/${projectRef}/storage/policies`}>
<Menu.Item rounded active={page === 'policies'}>
<Typography.Text className="truncate">Policies</Typography.Text>
</Menu.Item>
</Link>
- <Link href={`/project/${projectRef}/storage/usage`}>
- <Menu.Item rounded active={page === 'usage'}>
- <Typography.Text className="truncate">Usage</Typography.Text>
- </Menu.Item>
- </Link>
+
+ {IS_PLATFORM && (
+ <Link href={`/project/${projectRef}/storage/usage`}>
+ <Menu.Item rounded active={page === 'usage'}>
+ <Typography.Text className="truncate">Usage</Typography.Text>
+ </Menu.Item>
+ </Link>
+ )}
</div>
</div>
</Menu>
diff --git a/studio/hooks/misc/withAuth.tsx b/studio/hooks/misc/withAuth.tsx
index 3ced511a8f2..ce5c5263d5d 100644
--- a/studio/hooks/misc/withAuth.tsx
+++ b/studio/hooks/misc/withAuth.tsx
@@ -4,7 +4,7 @@ import { NextRouter, useRouter } from 'next/router'
import { IS_PLATFORM } from 'lib/constants'
import { useProfile, useStore, usePermissions } from 'hooks'
-const PLATFORM_ONLY_PAGES = ['storage', 'reports', 'settings']
+const PLATFORM_ONLY_PAGES = ['reports', 'settings']
export function withAuth<T>(
WrappedComponent: ComponentType<T>,
diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.js
index 93a00a3b945..92b4488620c 100644
--- a/studio/localStores/storageExplorer/StorageExplorerStore.js
+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js
@@ -112,7 +112,7 @@ class StorageExplorerStore {
/* Methods which are commonly used + For better readability */
initializeSupabaseClient = (serviceKey, serviceEndpoint) => {
- this.supabaseClient = createClient(`https://${serviceEndpoint}`, serviceKey, {
+ this.supabaseClient = createClient(`${serviceEndpoint}`, serviceKey, {
auth: {
persistSession: false,
autoRefreshToken: false,
@@ -469,6 +469,7 @@ class StorageExplorerStore {
fetchBuckets = async () => {
const { data: buckets, error } = await this.supabaseClient.storage.listBuckets()
+
if (error) return this.ui.setNotification({ message: error.message, category: 'error' })
const formattedBuckets = buckets.map((bucket) => {
diff --git a/studio/package.json b/studio/package.json
index 8715e7c0f45..6d7caac6c58 100644
--- a/studio/package.json
+++ b/studio/package.json
@@ -3,7 +3,7 @@
"version": "0.0.9",
"private": true,
"scripts": {
- "dev": "next dev -p 8082",
+ "dev": "next dev -p 3000",
"build": "next build",
"start": "next start",
"test": "jest",
diff --git a/studio/pages/api/projects/[ref]/index.ts b/studio/pages/api/projects/[ref]/index.ts
index 5d0e34ff354..f009a9e94f1 100644
--- a/studio/pages/api/projects/[ref]/index.ts
+++ b/studio/pages/api/projects/[ref]/index.ts
@@ -34,7 +34,7 @@ const handleGet = async (req: NextApiRequest, res: NextApiResponse) => {
db_ssl: false,
}),
kpsVersion: 'kps-v1.0.0',
- restUrl: process.env.SUPABASE_REST_URL || 'http://localhost:8000/rest/v1/',
+ restUrl: `${process.env.SUPABASE_REST_URL}/rest/v1/` || 'http://localhost:8000/rest/v1/',
}
return res.status(200).json(response)
diff --git a/studio/pages/api/props/project/[ref]/api.ts b/studio/pages/api/props/project/[ref]/api.ts
index 556f4deb40b..f5752d27374 100644
--- a/studio/pages/api/props/project/[ref]/api.ts
+++ b/studio/pages/api/props/project/[ref]/api.ts
@@ -42,7 +42,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
realtime_enabled: true,
},
endpoint: process.env.SUPABASE_URL || 'http://localhost:8000',
- restUrl: process.env.SUPABASE_REST_URL || 'http://localhost:8000/rest/v1/',
+ restUrl: `${process.env.SUPABASE_REST_URL}/rest/v1/` || 'http://localhost:8000/rest/v1/',
defaultApiKey: process.env.SUPABASE_ANON_KEY,
serviceApiKey: process.env.SUPABASE_SERVICE_KEY,
service_api_keys: [
@@ -71,7 +71,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
realtime_enabled: true,
},
endpoint: process.env.SUPABASE_URL,
- restUrl: process.env.SUPABASE_REST_URL,
+ restUrl: `${process.env.SUPABASE_REST_URL}/rest/v1/`,
defaultApiKey: process.env.SUPABASE_ANON_KEY,
serviceApiKey: process.env.SUPABASE_SERVICE_KEY,
service_api_keys: [