2023年08月21日

PostgREST 11.1.2 Ubuntu20.04LTS PostgreSQL15 画像付き

Ubuntu20.04LTS
Chromeをインストールできます
Screenshot from 2023-08-21 17-47-39.png


PostgreSQL15のインストール

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update

sudo apt-get -y install postgresql
Screenshot from 2023-08-21 18-20-06.png


PostgreSQL15のパスワードの変更
sudo su - postgres 
psql
alter role postgres with password 'Passwd123';
PostgreSQL15の接続設定
sudo gedit /etc/postgresql/15/main/postgresql.conf
sudo gedit /etc/postgresql/15/main/pg_hba.conf
Screenshot from 2023-08-21 18-20-06.png

Screenshot from 2023-08-21 18-06-22.png

Screenshot from 2023-08-21 18-07-16.png


PostgRESTのダウンロードと解凍
Screenshot from 2023-08-21 17-54-32.png

Screenshot from 2023-08-21 17-55-03.png

Screenshot from 2023-08-21 17-55-10.png

Screenshot from 2023-08-21 17-55-26.png



Tutorial 0 - Get it Running
を参考に、少し変更する
sudo su - postgres 
psql

create database test_1;

\c test_1;

create schema api;

create table api.todos (
  id serial primary key,
  done boolean not null default false,
  task text not null,
  due timestamptz
);

insert into api.todos (task) values
  ('finish tutorial 0'), ('pat self on back');

create role web_anon nologin;

grant usage on schema api to web_anon;
grant select on api.todos to web_anon;

Screenshot from 2023-08-21 18-34-41.png


PostgRESTの起動用.confを作成
t_1.conf で保存する
db-uri = "postgres://postgres:Passwd123@localhost:5432/test_1"
db-schemas = "api"
db-anon-role = "web_anon"
Screenshot from 2023-08-21 18-39-08.png

db-uri       = "postgres://user:pass@host:5432/dbname" の各意味のドキュメントは


解凍したフォルダで起動
cd ダウロード
cd postgrest-v11.2.0-linux-static-x64

./postgrest tutorial.conf
Screenshot from 2023-08-21 18-39-08.png


ブラウザが確認
Screenshot from 2023-08-21 18-59-08.png

curlの場合は

posted by a23 at 19:21| Comment(0) | REST API

PostgREST 11.1.2 Ubuntu20.04LTS PostgreSQL15

PostgreSQL15のインストール
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update

sudo apt-get -y install postgresql

PostgreSQL15のパスワードの変更
sudo su - postgres 
psql
alter role postgres with password 'Passwd123';

PostgreSQL15の接続設定
sudo gedit /etc/postgresql/15/main/postgresql.conf
sudo gedit /etc/postgresql/15/main/pg_hba.conf

その他 Ubuntiのツールのインストール(これは、PostgRESTには関係ありません)



sudo apt install net-tools
sudo apt-get -y install baobab

PostgRESTのダウンロードと解凍



Tutorial 0 - Get it Running
を参考に、少し変更する
sudo su - postgres 
psql

create database test_1;

\c test_1;

create schema api;

create table api.todos (
  id serial primary key,
  done boolean not null default false,
  task text not null,
  due timestamptz
);

insert into api.todos (task) values
  ('finish tutorial 0'), ('pat self on back');

create role web_anon nologin;

grant usage on schema api to web_anon;
grant select on api.todos to web_anon;

PostgRESTの起動用.confを作成
db-uri = "postgres://postgres:Passwd123@localhost:5432/test_1"
db-schemas = "api"
db-anon-role = "web_anon"

db-uri       = "postgres://user:pass@host:5432/dbname" の各意味のドキュメントは

起動
./postgrest tutorial.conf






posted by a23 at 19:14| Comment(0) | PostgreSQL