前提環境
% git --version
git version 2.39.5 (Apple Git-154)
% python3 -V
Python 3.9.6
% clang --version
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
% brew -v
Homebrew 4.4.29
% docker version
Client:
Version: 28.0.1
API version: 1.48
Go version: go1.23.6
Git commit: 068a01e
Built: Wed Feb 26 10:38:16 2025
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.39.0 (184744)
Engine:
Version: 28.0.1
API version: 1.48 (minimum version 1.24)
Go version: go1.23.6
Git commit: bbd0a17
Built: Wed Feb 26 10:40:57 2025
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.25
GitCommit: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
runc:
Version: 1.2.4
GitCommit: v1.2.4-0-g6c52b3f
docker-init:
Version: 0.19.0
GitCommit: de40ad0
%
github
% pwd
/Users/m/Dev
% git clone https://github.com/unrcom/link.bkiban.git
Cloning into 'link.bkiban'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (3/3), done.
bkiban01 bkiban02 bkiban03 db.bkiban link.bkiban sirokuro-dev6 sirokuro-dev7 supabase termlog unrwebpagemui
% cd link.bkiban
% ls
README.md
%
docker-compose.yml
% pwd
/Users/m/Dev/link.bkiban
% vi docker-compose.yml
% cat docker-compose.yml
version: '3'
services:
link:
image: node:latest
container_name: 'linkuser'
hostname: 'linkuser'
ports:
- '3000:3000'
stdin_open: true
tty: true
working_dir: '/var/www/html'
volumes:
- ./:/var/www/html
networks:
- bknet
networks:
bknet:
external: true
%
% docker compose up
WARN[0000] /Users/m/Dev/link.bkiban/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 1/1
✔ Container linkuser Created 0.1s
Attaching to linkuser
linkuser | Welcome to Node.js v23.11.0.
linkuser | Type ".help" for more information.
v View in Docker Desktop o View Config w Enable Watch
コンテナ接続
% docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a849debeff4e node:latest "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:3000->3000/tcp linkuser
% docker container exec -it linkuser /bin/bash
root@linkuser:/var/www/html#
React (Next.js) インストール
root@linkuser:/var/www/html# npx create-next-app@latest
Need to install the following packages:
create-next-app@15.3.1
Ok to proceed? (y) y
✔ What is your project named? … my-app
✔ Would you like to use TypeScript? … No / Yes
✔ Would you like to use ESLint? … No / Yes
✔ Would you like to use Tailwind CSS? … No / Yes
✔ Would you like your code inside a `src/` directory? … No / Yes
✔ Would you like to use App Router? (recommended) … No / Yes
✔ Would you like to use Turbopack for `next dev`? … No / Yes
✔ Would you like to customize the import alias (`@/*` by default)? … No / Yes
Creating a new Next.js app in /var/www/html/my-app.
(snip)
Success! Created my-app at /var/www/html/my-app
npm notice
npm notice New major version of npm available! 10.9.2 -> 11.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0
npm notice To update run: npm install -g npm@11.3.0
npm notice
root@linkuser:/var/www/html#
React Router
使いませんでした (すべてコンポーネントでまかなった)
開発サーバ起動
root@linkuser:/var/www/html/my-app# npm run dev
> my-app@0.1.0 dev
> next dev --turbopack
▲ Next.js 15.3.1 (Turbopack)
- Local: http://localhost:3000
- Network: http://172.19.0.2:3000
✓ Starting...
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
✓ Ready in 1207ms
○ Compiling / ...
✓ Compiled / in 2.2s
Vercel deploy
% git status
On branch main
Your branch is up to date with 'origin/main'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
docker-compose.yml
my-app/
nothing added to commit but untracked files present (use "git add" to track)
% git add docker-compose.yml
% git add my-app/
% git status
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: docker-compose.yml
new file: my-app/.gitignore
new file: my-app/README.md
new file: my-app/app/favicon.ico
new file: my-app/app/globals.css
new file: my-app/app/layout.tsx
new file: my-app/app/page.tsx
new file: my-app/next.config.ts
new file: my-app/package-lock.json
new file: my-app/package.json
new file: my-app/postcss.config.mjs
new file: my-app/public/file.svg
new file: my-app/public/globe.svg
new file: my-app/public/next.svg
new file: my-app/public/vercel.svg
new file: my-app/public/window.svg
new file: my-app/tsconfig.json
% git commit -m "1st commit"
[main 6586022] 1st commit
17 files changed, 2224 insertions(+)
create mode 100644 docker-compose.yml
create mode 100644 my-app/.gitignore
create mode 100644 my-app/README.md
create mode 100644 my-app/app/favicon.ico
create mode 100644 my-app/app/globals.css
create mode 100644 my-app/app/layout.tsx
create mode 100644 my-app/app/page.tsx
create mode 100644 my-app/next.config.ts
create mode 100644 my-app/package-lock.json
create mode 100644 my-app/package.json
create mode 100644 my-app/postcss.config.mjs
create mode 100644 my-app/public/file.svg
create mode 100644 my-app/public/globe.svg
create mode 100644 my-app/public/next.svg
create mode 100644 my-app/public/vercel.svg
create mode 100644 my-app/public/window.svg
create mode 100644 my-app/tsconfig.json
% git status
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
% git push
Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 8 threads
Compressing objects: 100% (22/22), done.
Writing objects: 100% (22/22), 29.36 KiB | 9.79 MiB/s, done.
Total 22 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/unrcom/link.bkiban.git
ae2b8d6..6586022 main -> main
%
supabase ローカル環境
インストール
% brew install supabase/tap/supabase
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:7645e2d653a335798030f6502e7834dfdbeeec5629429a1a34da5dbb2c57d63e
################################################################################################################################################################################################################################# 100.0%
==> Pouring portable-ruby-3.3.8.arm64_big_sur.bottle.tar.gz
==> Auto-updated Homebrew!
Updated 3 taps (supabase/tap, homebrew/core and homebrew/cask).
==> New Formulae
api-linter buffrs dockerfmt hub-tool nip4 protoc-gen-doc sacad tsui uhubctl
brename dblab erlfmt intermodal otterdog pyp tfcmt twitch-cli xtl
==> New Casks
comfyui font-ancizar-sans font-exile font-kumar-one-outline font-libertinus-mono liviable opencloud profit vimy
deepchat font-ancizar-serif font-huninn font-libertinus-math font-m-plus-rounded-1c notion-mail ovice viables
You have 10 outdated formulae installed.
Warning: supabase/tap/supabase 2.20.12 is already installed and up-to-date.
To reinstall 2.20.12, run:
brew reinstall supabase
% brew reinstall supabase
==> Fetching supabase/tap/supabase
==> Downloading https://github.com/supabase/cli/releases/download/v2.20.12/supabase_darwin_arm64.tar.gz
Already downloaded: /Users/m/Library/Caches/Homebrew/downloads/37781e74ef26f90d10e37d320392671fb88836a7f881ab6b515bccaeed2424dd--supabase_darwin_arm64.tar.gz
==> Reinstalling supabase/tap/supabase
==> Caveats
zsh completions have been installed to:
/opt/homebrew/share/zsh/site-functions
==> Summary
🍺 /opt/homebrew/Cellar/supabase/2.20.12: 9 files, 36.3MB, built in 2 seconds
==> Running `brew cleanup supabase`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
%
Initialize a project
% supabase init
Generate VS Code settings for Deno? [y/N] y
Generated VS Code settings in .vscode/settings.json. Please install the recommended extension!
Finished supabase init.
%
Create an Edge Function
% pwd
/Users/m/Dev/link.bkiban
% supabase functions new hello-world
Created new Function at supabase/functions/hello-world
%
How to write the code
Running Edge Functions locally
start the supabase stack
% supabase start
Seeding globals from roles.sql...
WARN: no files matched pattern: supabase/seed.sql
WARNING: analytics requires mounting default docker socket: /var/run/docker.sock
Started supabase local development setup.
API URL: http://127.0.0.1:54321
GraphQL URL: http://127.0.0.1:54321/graphql/v1
S3 Storage URL: http://127.0.0.1:54321/storage/v1/s3
DB URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres
Studio URL: http://127.0.0.1:54323
Inbucket URL: http://127.0.0.1:54324
JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
anon key: eyJhbG....
service_role key: eyJhbG....
S3 Access Key: 625729....
S3 Secret Key: 850181....
S3 Region: local
%
start the Functions watcher
% supabase functions serve
Setting up Edge Functions runtime...
Serving functions on http://127.0.0.1:54321/functions/v1/<function-name>
Using supabase-edge-runtime-1.67.4 (compatible with Deno v1.45.2)
Invoking Edge Functions locally
% curl --request POST 'http://localhost:54321/functions/v1/hello-world' \
--header 'Authorization: Bearer eyJhbG....' \
--header 'Content-Type: application/json' \
--data '{ "name":"Functions" }'
{"message":"Hello Functions!"}%
%
Deploy to Production
Login to the CLI
% supabase login
Hello from Supabase! Press Enter to open browser and login automatically.
Here is your login link in case browser did not open https://supabase.com/dashboard/cli/login?session_id=0e176242-3b6f-4fc7-b54a-2d3a69d91de9&token_name=cli_m@mopnoMac-mini.local_1745233496&public_key=0445d377a78d6daffeb95fe5d98028e667a458a8bfc833b5b357fcc729112999d35d6ba5fc51c1b89422a7b674077baa36dea48430a05bfe25843d17863e30b64f
Enter your verification code:
Enter your verification code: bce8ecc7
Token cli_m@mopnoMac-mini.local_1745233496 created successfully.
You are now logged in. Happy coding!
%
Get your project ID
% supabase projects list
Cannot find project ref. Have you run supabase link?
LINKED | ORG ID | REFERENCE ID | NAME | REGION | CREATED AT (UTC)
--------|----------------------|----------------------|------------|------------------------|---------------------
| sflwwkgnxfcjqphbllcx | wpxnwgskbjuohebokzdw | bkiban_dev | Northeast Asia (Tokyo) | 2024-05-06 05:38:35
| sflwwkgnxfcjqphbllcx | jkonuomspjpwmixvidwz | db.bkibam | Northeast Asia (Tokyo) | 2025-04-07 22:08:11
%
Link your local project
% supabase link --project-ref jkonuo....
Enter your database password (or leave blank to skip):
Connecting to remote database...
NOTICE (42P06): schema "supabase_migrations" already exists, skipping
NOTICE (42P07): relation "schema_migrations" already exists, skipping
NOTICE (42701): column "statements" of relation "schema_migrations" already exists, skipping
NOTICE (42701): column "name" of relation "schema_migrations" already exists, skipping
NOTICE (42P06): schema "supabase_migrations" already exists, skipping
NOTICE (42P07): relation "seed_files" already exists, skipping
Finished supabase link.
WARNING: Local config differs from linked project. Try updating supabase/config.toml
diff supabase/config.toml jkonuomspjpwmixvidwz
--- supabase/config.toml
+++ jkonuomspjpwmixvidwz
@@ -53,14 +53,14 @@
[auth]
enabled = true
-site_url = "http://127.0.0.1:3000"
-additional_redirect_urls = ["https://127.0.0.1:3000"]
+site_url = "http://localhost:3000"
+additional_redirect_urls = []
jwt_expiry = 3600
enable_refresh_token_rotation = true
refresh_token_reuse_interval = 10
enable_manual_linking = false
enable_signup = true
-enable_anonymous_sign_ins = false
+enable_anonymous_sign_ins = true
minimum_password_length = 6
password_requirements = ""
jwt_secret = ""
@@ -77,8 +77,8 @@
[auth.mfa]
max_enrolled_factors = 10
[auth.mfa.totp]
-enroll_enabled = false
-verify_enabled = false
+enroll_enabled = true
+verify_enabled = true
[auth.mfa.phone]
enroll_enabled = false
verify_enabled = false
@@ -93,12 +93,12 @@
inactivity_timeout = "0s"
[auth.email]
enable_signup = true
-double_confirm_changes = true
-enable_confirmations = false
+double_confirm_changes = false
+enable_confirmations = true
secure_password_change = false
-max_frequency = "1s"
-otp_length = 6
-otp_expiry = 3600
+max_frequency = "1m0s"
+otp_length = 6
+otp_expiry = 86400
[auth.email.template]
[auth.sms]
enable_signup = false
%
Deploy your Edge Functions
% pwd
/Users/m/Dev/link.bkiban/supabase/functions/hello-world
% supabase functions deploy hello-world
Using workdir /Users/m/Dev/link.bkiban
Selected project: jkonuomspjpwmixvidwz
Bundling Function: hello-world
Download https://jsr.io/@supabase/functions-js/meta.json
Download https://jsr.io/@supabase/functions-js/2.4.4_meta.json
Deploying Function: hello-world (script size: 2.8kB)
Deployed Functions on project jkonuomspjpwmixvidwz: hello-world
You can inspect your deployment in the Dashboard: https://supabase.com/dashboard/project/jkonuomspjpwmixvidwz/functions
%
Invoking remote functions
% curl --request POST 'https://jkonuo.....supabase.co/functions/v1/hello-world' \
--header 'Authorization: Bearer eyJhbG....' \
--header 'Content-Type: application/json' \
--data '{ "name":"Functions" }'
{"message":"Hello Functions!"}%
%
supabase ローカル環境の停止
現状
% docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
95e6e1bdedde public.ecr.aws/supabase/edge-runtime:v1.67.4 "sh -c 'cat <<'EOF' …" 3 days ago Up 3 days 8081/tcp supabase_edge_runtime_link.bkiban
556ce861019c public.ecr.aws/supabase/studio:20250317-6955350 "docker-entrypoint.s…" 3 days ago Up 3 days (healthy) 0.0.0.0:54323->3000/tcp supabase_studio_link.bkiban
3e0092005b59 public.ecr.aws/supabase/postgres-meta:v0.88.2 "docker-entrypoint.s…" 3 days ago Up 3 days (healthy) 8080/tcp supabase_pg_meta_link.bkiban
cda40cb02efa public.ecr.aws/supabase/storage-api:v1.19.3 "docker-entrypoint.s…" 3 days ago Up 3 days (healthy) 5000/tcp supabase_storage_link.bkiban
5d326638e5f0 public.ecr.aws/supabase/postgrest:v12.2.8 "postgrest" 3 days ago Up 3 days 3000/tcp supabase_rest_link.bkiban
b87b08a4840e public.ecr.aws/supabase/realtime:v2.34.45 "/usr/bin/tini -s -g…" 3 days ago Up 3 days (healthy) 4000/tcp supabase_realtime_link.bkiban
a8e4fc148a15 public.ecr.aws/supabase/mailpit:v1.22.3 "/mailpit" 3 days ago Up 3 days (healthy) 1025/tcp, 1110/tcp, 0.0.0.0:54324->8025/tcp supabase_inbucket_link.bkiban
7f3e5fd41c5c public.ecr.aws/supabase/gotrue:v2.170.0 "auth" 3 days ago Up 3 days (healthy) 9999/tcp supabase_auth_link.bkiban
092e6e60f864 public.ecr.aws/supabase/kong:2.8.1 "sh -c 'cat <<'EOF' …" 3 days ago Up 3 days (healthy) 8001/tcp, 8088/tcp, 8443-8444/tcp, 0.0.0.0:54321->8000/tcp supabase_kong_link.bkiban
c5a6674df5e0 public.ecr.aws/supabase/vector:0.28.1-alpine "sh -c 'cat <<'EOF' …" 3 days ago Up 3 days (healthy) supabase_vector_link.bkiban
21fb8e9f149e public.ecr.aws/supabase/logflare:1.12.0 "sh -c 'cat <<'EOF' …" 3 days ago Up 3 days (healthy) 0.0.0.0:54327->4000/tcp supabase_analytics_link.bkiban
8113e704ce47 public.ecr.aws/supabase/postgres:15.8.1.060 "sh -c '\ncat <<'EOF'…" 3 days ago Up 3 days (healthy) 0.0.0.0:54322->5432/tcp supabase_db_link.bkiban
%
停止
% supabase stop
Using workdir /Users/m/Dev/link.bkiban
Stopped supabase local development setup.
A new version of Supabase CLI is available: v2.22.6 (currently installed v2.20.12)
We recommend updating regularly for new features and bug fixes: https://supabase.com/docs/guides/cli/getting-started#updating-the-supabase-cli
Local data are backed up to docker volume. Use docker to show them: docker volume ls --filter label=com.supabase.cli.project=link.bkiban
%
docker container 状態確認
% docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
%
素晴らしい!