Closed1
MemosをGlitchで動かす
binにmemos置いてdataにmemos_prod.dbが生成されるだけのシンプルさに感動したので作った。
$ curl -fsSL https://tkithrta.gitlab.io/u/glitch-memos.sh | bash
cd
mkdir -p bin data
curl -LO https://github.com/usememos/memos/releases/download/v0.22.5/memos_v0.22.5_linux_amd64.tar.gz
tar -xzf memos_v0.22.5_linux_amd64.tar.gz -C bin memos
rm memos_v0.22.5_linux_amd64.tar.gz
echo -e '/bin\n/data' > .gitignore
echo '{"scripts":{"start":"memos --data=data --mode=prod --port=${PORT:-3000}"}}' > package.json
tr -dc a-zA-Z0-9 </dev/urandom 2>/dev/null | head -c48
cd && rm -rf .cache .git && refresh
最後に出力される48文字はパスワードです。
個人的にMemosにアクセスしたらやること一覧
- ユーザー名とパスワードでアカウントを作成
- Settings(設定)のPreferences(設定)の「Language(言語)」を「日本語」、「Theme(テーマ)」を「ダークモード」にする
- Settings(設定)のシステムの「Disallow user registration」をオンにする
- Settings(設定)のmemoの「公開メモを無効化する」をオンにする
- ユーザー名をクリックして「ログアウト」
- パスワードを保存するにチェック入れてユーザー名とパスワードでサインイン
おまけ
v0.22.5のSQLiteスキーマ
CREATE TABLE migration_history (
version TEXT NOT NULL PRIMARY KEY,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now'))
)
CREATE TABLE system_setting (
name TEXT NOT NULL,
value TEXT NOT NULL,
description TEXT NOT NULL DEFAULT '',
UNIQUE(name)
)
CREATE TABLE user (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',
username TEXT NOT NULL UNIQUE,
role TEXT NOT NULL CHECK (role IN ('HOST', 'ADMIN', 'USER')) DEFAULT 'USER',
email TEXT NOT NULL DEFAULT '',
nickname TEXT NOT NULL DEFAULT '',
password_hash TEXT NOT NULL,
avatar_url TEXT NOT NULL DEFAULT '',
description TEXT NOT NULL DEFAULT ''
)
CREATE TABLE sqlite_sequence(name,seq)
CREATE INDEX idx_user_username ON user (username)
CREATE TABLE user_setting (
user_id INTEGER NOT NULL,
key TEXT NOT NULL,
value TEXT NOT NULL,
UNIQUE(user_id, key)
)
CREATE TABLE memo (
id INTEGER PRIMARY KEY AUTOINCREMENT,
uid TEXT NOT NULL UNIQUE,
creator_id INTEGER NOT NULL,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',
content TEXT NOT NULL DEFAULT '',
visibility TEXT NOT NULL CHECK (visibility IN ('PUBLIC', 'PROTECTED', 'PRIVATE')) DEFAULT 'PRIVATE',
tags TEXT NOT NULL DEFAULT '[]',
payload TEXT NOT NULL DEFAULT '{}'
)
CREATE INDEX idx_memo_creator_id ON memo (creator_id)
CREATE INDEX idx_memo_content ON memo (content)
CREATE INDEX idx_memo_visibility ON memo (visibility)
CREATE INDEX idx_memo_tags ON memo (tags)
CREATE TABLE memo_organizer (
memo_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
pinned INTEGER NOT NULL CHECK (pinned IN (0, 1)) DEFAULT 0,
UNIQUE(memo_id, user_id)
)
CREATE TABLE memo_relation (
memo_id INTEGER NOT NULL,
related_memo_id INTEGER NOT NULL,
type TEXT NOT NULL,
UNIQUE(memo_id, related_memo_id, type)
)
CREATE TABLE resource (
id INTEGER PRIMARY KEY AUTOINCREMENT,
uid TEXT NOT NULL UNIQUE,
creator_id INTEGER NOT NULL,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
filename TEXT NOT NULL DEFAULT '',
blob BLOB DEFAULT NULL,
type TEXT NOT NULL DEFAULT '',
size INTEGER NOT NULL DEFAULT 0,
memo_id INTEGER,
storage_type TEXT NOT NULL DEFAULT '',
reference TEXT NOT NULL DEFAULT '',
payload TEXT NOT NULL DEFAULT '{}'
)
CREATE INDEX idx_resource_creator_id ON resource (creator_id)
CREATE INDEX idx_resource_memo_id ON resource (memo_id)
CREATE TABLE activity (
id INTEGER PRIMARY KEY AUTOINCREMENT,
creator_id INTEGER NOT NULL,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
type TEXT NOT NULL DEFAULT '',
level TEXT NOT NULL CHECK (level IN ('INFO', 'WARN', 'ERROR')) DEFAULT 'INFO',
payload TEXT NOT NULL DEFAULT '{}'
)
CREATE TABLE idp (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
type TEXT NOT NULL,
identifier_filter TEXT NOT NULL DEFAULT '',
config TEXT NOT NULL DEFAULT '{}'
)
CREATE TABLE inbox (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
sender_id INTEGER NOT NULL,
receiver_id INTEGER NOT NULL,
status TEXT NOT NULL,
message TEXT NOT NULL DEFAULT '{}'
)
CREATE TABLE webhook (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',
creator_id INTEGER NOT NULL,
name TEXT NOT NULL,
url TEXT NOT NULL
)
CREATE INDEX idx_webhook_creator_id ON webhook (creator_id)
CREATE TABLE reaction (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
creator_id INTEGER NOT NULL,
content_id TEXT NOT NULL,
reaction_type TEXT NOT NULL,
UNIQUE(creator_id, content_id, reaction_type)
)
このスクラップは2ヶ月前にクローズされました