Skip to content

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

Adds CLI Actions

Copple8fdc53ef86c9
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
index b6d0ec39ca3..e6896c46133 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts
@@ -60,6 +60,12 @@ export const HOMEPAGE_MENU_ITEMS: HomepageMenuItems = [
},
],
[
+ {
+ label: 'Local Dev / CLI',
+ icon: 'reference-cli',
+ href: '/guides/cli',
+ level: 'reference_javascript',
+ },
{
label: 'Platform',
icon: 'platform',
@@ -78,13 +84,6 @@ export const HOMEPAGE_MENU_ITEMS: HomepageMenuItems = [
href: '/guides/self-hosting',
level: 'self_hosting',
},
- {
- label: 'Integrations',
- icon: 'integrations',
- hasLightIcon: true,
- href: '/guides/integrations',
- level: 'integrations',
- },
],
[
{
@@ -131,7 +130,14 @@ export const HOMEPAGE_MENU_ITEMS: HomepageMenuItems = [
community: true,
},
{
- label: 'Tools reference',
+ label: 'Tools',
+ },
+ {
+ label: 'Integrations',
+ icon: 'integrations',
+ hasLightIcon: true,
+ href: '/guides/integrations',
+ level: 'integrations',
},
{
label: 'Management API',
@@ -139,12 +145,6 @@ export const HOMEPAGE_MENU_ITEMS: HomepageMenuItems = [
href: '/reference/api/introduction',
level: 'reference_javascript',
},
- {
- label: 'Supabase CLI',
- icon: 'reference-cli',
- href: '/guides/cli',
- level: 'reference_javascript',
- },
],
[
{
@@ -970,7 +970,7 @@ export const ai: NavMenuConstant = {
export const supabase_cli: NavMenuConstant = {
icon: 'reference-cli',
- title: 'Supabase CLI',
+ title: 'Local Dev / CLI',
url: '/guides/cli',
items: [
{ name: 'Overview', url: '/guides/cli' },
@@ -979,6 +979,14 @@ export const supabase_cli: NavMenuConstant = {
name: 'Using environment variables in config.toml',
url: '/guides/cli/using-environment-variables-in-config',
},
+ {
+ name: 'GitHub Action',
+ url: undefined,
+ items: [
+ { name: 'Getting started', url: '/guides/cli/github-action/intro' },
+ { name: 'Managing database migrations', url: '/guides/cli/github-action/migrations' },
+ ],
+ },
{
name: 'Reference',
url: undefined,
diff --git a/apps/docs/pages/guides/cli/github-action/[slug].tsx b/apps/docs/pages/guides/cli/github-action/[slug].tsx
new file mode 100644
index 00000000000..428072763aa
--- /dev/null
+++ b/apps/docs/pages/guides/cli/github-action/[slug].tsx
@@ -0,0 +1,142 @@
+import { CodeHikeConfig, remarkCodeHike } from '@code-hike/mdx'
+import { GetStaticPaths, GetStaticProps } from 'next'
+import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote'
+import { serialize } from 'next-mdx-remote/serialize'
+import { relative } from 'path'
+import rehypeSlug from 'rehype-slug'
+import remarkGfm from 'remark-gfm'
+import codeHikeTheme from 'config/code-hike.theme.json' assert { type: 'json' }
+import components from '~/components'
+import Layout from '~/layouts/DefaultGuideLayout'
+import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform'
+import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition'
+import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle'
+
+// We fetch these docs at build time from an external repo
+const org = 'supabase'
+const repo = 'setup-cli'
+const branch = 'gh-pages'
+const docsDir = 'docs'
+const externalSite = 'https://supabase.github.io/setup-cli'
+
+// Each external docs page is mapped to a local page
+const pageMap = [
+ {
+ slug: 'intro',
+ meta: {
+ title: 'Getting Started',
+ },
+ remoteFile: 'index.md',
+ },
+ {
+ slug: 'migrations',
+ meta: {
+ title: 'Managing database migrations',
+ },
+ remoteFile: 'migrations.md',
+ },
+]
+
+interface ActionDocsProps {
+ source: MDXRemoteSerializeResult
+ meta: {
+ title: string
+ description?: string
+ }
+}
+
+export default function ActionDocs({ source, meta }: ActionDocsProps) {
+ return (
+ <Layout meta={meta}>
+ <MDXRemote {...source} components={components} />
+ </Layout>
+ )
+}
+
+/**
+ * Fetch markdown from external repo and transform links
+ */
+export const getStaticProps: GetStaticProps<ActionDocsProps> = async ({ params }) => {
+ const page = pageMap.find(({ slug }) => slug === params.slug)
+
+ if (!page) {
+ throw new Error(`No page mapping found for slug '${params.slug}'`)
+ }
+
+ const { remoteFile, meta } = page
+
+ const response = await fetch(
+ `https://raw.githubusercontent.com/${org}/${repo}/${branch}/${docsDir}/${remoteFile}`
+ )
+
+ const source = await response.text()
+
+ const urlTransform: UrlTransformFunction = (url) => {
+ try {
+ const externalSiteUrl = new URL(externalSite)
+
+ const placeholderHostname = 'placeholder'
+ const { hostname, pathname, hash } = new URL(url, `http://${placeholderHostname}`)
+
+ // Don't modify a url with a FQDN or a url that's only a hash
+ if (hostname !== placeholderHostname || pathname === '/') {
+ return url
+ }
+
+ const relativePage = (
+ pathname.endsWith('.md')
+ ? pathname.replace(/\.md$/, '')
+ : relative(externalSiteUrl.pathname, pathname)
+ ).replace(/^\//, '')
+
+ const page = pageMap.find(({ remoteFile }) => `${relativePage}.md` === remoteFile)
+
+ // If we have a mapping for this page, use the mapped path
+ if (page) {
+ return page.slug + hash
+ }
+
+ // If we don't have this page in our docs, link to original docs
+ return `${externalSite}/${relativePage}${hash}`
+ } catch (err) {
+ console.error('Error transforming markdown URL', err)
+ return url
+ }
+ }
+
+ const codeHikeOptions: CodeHikeConfig = {
+ theme: codeHikeTheme,
+ lineNumbers: true,
+ showCopyButton: true,
+ skipLanguages: [],
+ autoImport: false,
+ }
+
+ const mdxSource = await serialize(source, {
+ scope: {
+ chCodeConfig: codeHikeOptions,
+ },
+ mdxOptions: {
+ remarkPlugins: [
+ remarkGfm,
+ remarkMkDocsAdmonition,
+ [removeTitle, meta.title],
+ [remarkCodeHike, codeHikeOptions],
+ ],
+ rehypePlugins: [[linkTransform, urlTransform], rehypeSlug],
+ },
+ })
+
+ return { props: { source: mdxSource, meta } }
+}
+
+export const getStaticPaths: GetStaticPaths = async () => {
+ return {
+ paths: pageMap.map(({ slug }) => ({
+ params: {
+ slug,
+ },
+ })),
+ fallback: false,
+ }
+}
diff --git a/apps/docs/pages/guides/self-hosting/docker.mdx b/apps/docs/pages/guides/self-hosting/docker.mdx
index f496cd10efe..667aaf0e99a 100644
--- a/apps/docs/pages/guides/self-hosting/docker.mdx
+++ b/apps/docs/pages/guides/self-hosting/docker.mdx
@@ -66,6 +66,18 @@ Update the `.env` file with your own secrets. In particular, these are required:
- `SITE_URL`: the base URL of your site.
- `SMTP_*`: mail server credentials. You can use any SMTP server.
+### Adding a firewall
+
+We recommend using a firewall to restrict access to your Supabase setup (something like `ufw`). One thing to highlight is that Docker usually [makes changes to your iptables](https://askubuntu.com/questions/652556/uncomplicated-firewall-ufw-is-not-blocking-anything-when-using-docker).
+
+To disable this behavior, you can add the following to your `/etc/docker/daemon.json` file and then run `sudo service docker restart`:
+
+```json
+{
+ "iptables": false
+}
+```
+
## Exposing services
The services running on the machine are not exposed to the internet by default. We recommend using a reverse proxy such as [NGINX](https://www.nginx.com/) or [Caddy](https://caddyserver.com/) if you want to expose the services publicly: