$ docker run -d --name memos -p 5230:5230 -v ~/.memos/:/var/opt/memos ghcr.io/usememos/memos:latest $ docker stats --no-stream CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS b1e07dd30ffa memos 0.00% 27.67MiB / 7.649GiB 0.35% 1.89MB / 5.36MB 291MB / 52.1MB 11
source code 入手
$ git clone https://github.com/usememos/memos && cd memos
air 導入
$ go install github.com/cosmtrek/air@latest $ which air /home/matoken/go/bin/air $ air -v __ _ ___ / /\ | | | |_) /_/--\ |_| |_| \_ , built with Go
build & start
$ air -c scripts/.air.toml
nodejs install
$ sudo apt install nodejs $ dpkg-query -W nodejs nodejs 18.13.0+dfsg1-1 $ nodejs --version v18.13.0
pnpm install
$ curl -fsSL https://get.pnpm.io/install.sh | sh - $ which pnpm /home/matoken/.local/share/pnpm/pnpm $ pnpm --version 8.6.7
frontend 起動
$ cd web && pnpm i && pnpm dev VITE v4.2.1 ready in 394 ms ➜ Local: http://localhost:3001/ ➜ Network: http://192.168.100.26:3001/ ➜ Network: http://100.104.249.122:3001/ ➜ Network: http://172.17.0.1:3001/ ➜ press h to show help Shortcuts press r to restart the server press u to show server url press o to open in browser press c to clear console press q to quit
既定値ではSqlite3
docker
$ file ~/.memos/memos_prod.db /home/matoken/.memos/memos_prod.db: SQLite 3.x database, last written using SQLite version 3041002, file counter 219, database pages 300, cookie 0xe, schema 4, UTF-8, version-valid-for 219
source
$ file .air/memos_dev.db .air/memos_dev.db: SQLite 3.x database, last written using SQLite version 3041002, file counter 6, database pages 32, cookie 0x13, schema 4, UTF-8, version-valid-for 6
アカウントがない状態で http://localhost:5230/ にアクセスすると 管理者アカウントを作成できる画面 なので注意.
$ memos setup --host-username=$USERNAME --host-password=$PASSWORD --mode=prod
$ curl -X POST -H "Content-Type: application/json" \ -d '{ "content": "http://localhost:5230より、こんにちは!#memos" }' \ http://localhost:5230/api/memo?openId=9785f2d8-6702-4593-a7e6-c822f6c2f4ac { "data": { "id": 11, "rowStatus": "NORMAL", "creatorId": 2, "createdTs": 1689376766, "updatedTs": 1689376766, "displayTs": 1689376766, "content": "http://localhost:5230より、こんにちは!#memos", "visibility": "PRIVATE", "pinned": false, "creatorName": "matoken", "resourceList": [], "relationList": [] } }
/newbot
で新規bot作成_bot
である必要がある4839574812:AAFD39kkdpWt3ywyRZergyOLMaJhac60qc
$ ngrok http 5230 : Forwarding https://66e0-150-66-119-185.ngrok-free.app -> http://localhost:5230 :
NOTE: Telegram でPOST するだけなら公開する必要はない
コメント