From 32b86e72852ca97d9a572c4889a9313455f3c4d8 Mon Sep 17 00:00:00 2001 From: HidemaruOwO Date: Mon, 26 Aug 2024 07:58:10 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20added=20method=20for=20running=20fi?= =?UTF-8?q?refish=20on=20macOS=20(dev/macos/README.md,=20dev/macos/build-p?= =?UTF-8?q?groonga.sh,=20dev/macos/install.sh,=20dev/macos/start-postgres.?= =?UTF-8?q?sh,=20dev/macos/start-redis.sh)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/macos/README.md | 52 +++++++++++++++++++++++++++++++++++++ dev/macos/build-pgroonga.sh | 8 ++++++ dev/macos/install.sh | 3 +++ dev/macos/start-postgres.sh | 9 +++++++ dev/macos/start-redis.sh | 2 ++ 5 files changed, 74 insertions(+) create mode 100644 dev/macos/README.md create mode 100755 dev/macos/build-pgroonga.sh create mode 100755 dev/macos/install.sh create mode 100755 dev/macos/start-postgres.sh create mode 100755 dev/macos/start-redis.sh diff --git a/dev/macos/README.md b/dev/macos/README.md new file mode 100644 index 0000000..7cf4289 --- /dev/null +++ b/dev/macos/README.md @@ -0,0 +1,52 @@ +## macOS installation methods + +- install redis and postgresql + +```bash +./install.sh +``` + +- build pgroonga + +```bash +./build-pgroonga.sh +``` + +- start redis and postgresql + +```bash +./start-postgres.sh + +# and +./start-redis.sh +``` + +- setup detabase + +* create db and user + +```bash +psql -d postgres -U $USER +``` + +```sql +-- Create a new PostgreSQL user named 'firefish' with encrypted password. +-- This user will not have superuser, createdb, or createrole privileges. +CREATE USER firefish WITH ENCRYPTED PASSWORD 'password' SUPERUSER NOCREATEDB NOCREATEROLE; + +-- Create a new database named 'firefish_db' with UTF8 encoding and owned by the 'firefish' user. +CREATE DATABASE firefish_db WITH ENCODING 'UTF8' OWNER firefish; + +``` + +- enable pgroonga extension + +```bash +# enter this command then type password +psql -U firefish -d firefish_db -W +``` + +```sql +-- This ensures the PGroonga extension is enabled for the database. +CREATE EXTENSION pgroonga; +``` diff --git a/dev/macos/build-pgroonga.sh b/dev/macos/build-pgroonga.sh new file mode 100755 index 0000000..4d4a07e --- /dev/null +++ b/dev/macos/build-pgroonga.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +sudo -v +brew install groonga + +git clone --recursive https://github.com/pgroonga/pgroonga.git --depth 1 +cd pgroonga +make +sudo make install diff --git a/dev/macos/install.sh b/dev/macos/install.sh new file mode 100755 index 0000000..6d01b35 --- /dev/null +++ b/dev/macos/install.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +brew install redis +brew install postgresql@16 diff --git a/dev/macos/start-postgres.sh b/dev/macos/start-postgres.sh new file mode 100755 index 0000000..2c1ed4c --- /dev/null +++ b/dev/macos/start-postgres.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH" + +export LDFLAGS="-L/opt/homebrew/opt/postgresql@16/lib" +export CPPFLAGS="-I/opt/homebrew/opt/postgresql@16/include" +export PKG_CONFIG_PATH="/opt/homebrew/opt/postgresql@16/lib/pkgconfig" + +LC_ALL="C" /opt/homebrew/opt/postgresql@16/bin/postgres -D /opt/homebrew/var/postgresql@16 diff --git a/dev/macos/start-redis.sh b/dev/macos/start-redis.sh new file mode 100755 index 0000000..4191188 --- /dev/null +++ b/dev/macos/start-redis.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +redis-server