uniphant

所属分类:PostgreSQL
开发工具:PLpgSQL
文件大小:73KB
下载次数:0
上传日期:2021-07-11 16:36:38
上 传 者sh-1993
说明:  以PostgreSQL为中心的全栈演示项目
(PostgreSQL-centric Full Stack demo project)

文件列表:
1.4--1.5-footer.sql (0, 2021-06-25)
1.4--1.5-header.sql (39, 2021-06-25)
FUNCTIONS (0, 2021-06-25)
FUNCTIONS\api (0, 2021-06-25)
FUNCTIONS\api\create_role.sql (221, 2021-06-25)
FUNCTIONS\api\create_user.sql (453, 2021-06-25)
FUNCTIONS\api\get_credential_creation_options.sql (254, 2021-06-25)
FUNCTIONS\api\grant_resource_to_role.sql (285, 2021-06-25)
FUNCTIONS\api\grant_role_to_user.sql (273, 2021-06-25)
FUNCTIONS\api\init_credential.sql (922, 2021-06-25)
FUNCTIONS\api\openapi_swagger.sql (481, 2021-06-25)
FUNCTIONS\api\sign_in.sql (331, 2021-06-25)
FUNCTIONS\api\sign_out.sql (485, 2021-06-25)
FUNCTIONS\api\sign_up.sql (922, 2021-06-25)
FUNCTIONS\api\store_credential.sql (1716, 2021-06-25)
FUNCTIONS\api\update_credential_validity.sql (616, 2021-06-25)
FUNCTIONS\api\verify_assertion.sql (837, 2021-06-25)
FUNCTIONS\auth.sql (871, 2021-06-25)
FUNCTIONS\auto_add_new_resources.sql (1092, 2021-06-25)
FUNCTIONS\check_resource_access.sql (385, 2021-06-25)
FUNCTIONS\effective_domain.sql (811, 2021-06-25)
FUNCTIONS\has_role.sql (352, 2021-06-25)
FUNCTIONS\issue_access_token.sql (686, 2021-06-25)
FUNCTIONS\notify_ddl_postgrest.sql (237, 2021-06-25)
FUNCTIONS\register_resource.sql (1074, 2021-06-25)
FUNCTIONS\remote_ip.sql (477, 2021-06-25)
FUNCTIONS\set_openapi_swagger.sql (330, 2021-06-25)
FUNCTIONS\set_user_id.sql (331, 2021-06-25)
FUNCTIONS\user_id.sql (191, 2021-06-25)
LICENSE (1064, 2021-06-25)
Makefile (2111, 2021-06-25)
TABLES (0, 2021-06-25)
... ...

uniphant

build-test status super-linter status

1. [About](https://github.com/truthly/uniphant/blob/master/#about) 1. [Dependencies](https://github.com/truthly/uniphant/blob/master/#dependencies) 1. [Installation](https://github.com/truthly/uniphant/blob/master/#installation) 1. [Running Ubuntu in VirtualBox](https://github.com/truthly/uniphant/blob/master/#virtualbox) 1. [Ubuntu 20.04.1](https://github.com/truthly/uniphant/blob/master/#ubuntu) 1. [Setting up SSL/TLS using Let's Encrypt/Certbot](https://github.com/truthly/uniphant/blob/master/#certbot) [Running Ubuntu in VirtualBox]: #virtualbox

1. About

`uniphant` is a full-stack demo project on how to integrate various PostgreSQL-centric components to work nicely together. For a live demo of the latest released version, check out [https://uniphant.dev](https://github.com/truthly/uniphant/blob/master/https://uniphant.dev).

2. Dependencies

[”webauthn] for the WebAuthn Server. [PostgREST](https://github.com/truthly/uniphant/blob/master/https://postgrest.org/en/v7.0.0/) for the API. [”webauthn]: https://github.com/truthly/pg-webauthn

3. Installation

3.1. Running Ubuntu in VirtualBox

1. Download and install [VirtualBox](https://github.com/truthly/uniphant/blob/master/https://www.virtualbox.org/wiki/Downloads) 1. Download [ubuntu-20.04.1-live-server-amd***.iso](https://github.com/truthly/uniphant/blob/master/https://releases.ubuntu.com/20.04/ubuntu-20.04.1-live-server-amd***.iso) 1. Open VirtualBox 1. Click **New** and follow instructions 1. Click **Settings** and goto **Network**, Attached to: **NAT**, Click **Port Forwarding** 1. Add Host Port **2200** Guest Port **22**, leave Host IP and Guest IP blank 1. Add Host Port **8080** Guest Port **80**, leave Host IP and Guest IP blank 1. Click **OK**, Click **OK** 1. Click **Start** 1. Select **ubuntu-20.04.1-live-server-amd***.iso** 1. Follow instructions 1. To simplify logging in via SSH, you can install your GitHub user's SSH key. (optional) 1. Install OpenSSH server: **YES** 1. Import SSH identity: **from GitHub** 1. GitHub username: **[Enter your GitHub username]**

3.2. Ubuntu 20.04.1

Connect to your VirtualBox machine, assuming the forwarded Host Port is **2200** and the username is **uniphant**: ```sh ssh -p 2200 uniphant@localhost ``` The following exact step-by-step instructions assume a clean installation of Ubuntu. ```sh # postgresql: sudo apt-get -y dist-upgrade sudo locale-gen "en_US.UTF-8" sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 sudo apt-get -y install gnupg 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 postgresql-server-dev-13 build-essential sudo service postgresql start sudo -u postgres createuser -s "$USER" createdb -E UTF8 uniphant createuser api -L -s createuser web_anon -L createuser postgrest -I # pg-cbor: git clone https://github.com/truthly/pg-cbor.git (cd pg-cbor && make && sudo make install && make installcheck) # pg-ecdsa: git clone https://github.com/truthly/pg-ecdsa.git (cd pg-ecdsa && make && sudo make install && make installcheck) # pg-webauthn: git clone https://github.com/truthly/pg-webauthn.git (cd pg-webauthn && make && sudo make install && make installcheck) # uniphant: git clone https://github.com/truthly/uniphant.git cd uniphant || exit (make && sudo make install && make installcheck) psql -c "CREATE EXTENSION uniphant WITH SCHEMA public CASCADE" uniphant # postgrest: wget --quiet https://github.com/PostgREST/postgrest/releases/download/v7.0.1/postgrest-v7.0.1-linux-x***-static.tar.xz tar xvf postgrest-v7.0.1-linux-x***-static.tar.xz sudo cp postgrest /bin/postgrest sudo mkdir -p /etc/postgrest sudo cp postgrest.conf /etc/postgrest/config sudo cp postgrest.service /etc/systemd/system/postgrest.service sudo adduser --system --no-create-home postgrest sudo systemctl enable postgrest sudo systemctl start postgrest # nginx: sudo apt-get -y install nginx-light sudo rm /etc/nginx/sites-enabled/default sudo cp nginx.conf /etc/nginx/sites-available/uniphant sudo ln -s /etc/nginx/sites-available/uniphant /etc/nginx/sites-enabled/uniphant sudo ln -s "$HOME/uniphant/demo" /var/www/html/uniphant sudo systemctl restart nginx ``` Installation complete. You can now try a sign-up using `curl` from the command line: ```sh curl 'http://localhost/api/rpc/sign_up' \ -H 'Content-Type: application/json;charset=utf-8' \ --data '{"username":"test"}' \ -w "\n" ``` Use `psql` to check the content of the `users` table which should now contain one row: ```sh psql -x uniphant ``` ```sql SELECT * FROM users; -[ RECORD 1 ]------+----------------------------------------------------------------------------------------------------------------------------------- user_id | 1 user_random_id | \x4e271a6190358***27357f17d4e8e3c1c6a1512a6d6ce3d4de5748c9e15d0bb278e507f0df9911ea5c0d3b7bb159065eb867b5ac68acf92a***9c293437fbe3410 username | test ``` This is how far we get testing in the command line. To complete a real sign-up and sign-in, we need to use a real browser, since the private/public key pairs can't be easily generated from the command line, since they depend on an *Authenticator device*, either built-in TouchID/FaceID, or an external device like a Yubikey. To do so, browse to `http://localhost:8080` to test a real sign-up and sign-in. **Note:** Only works with Chrome and Safari. **Firefox** is currently **not supported** due to a [bug](https://github.com/truthly/uniphant/blob/master/https://bugzilla.mozilla.org/show_bug.cgi?id=1530370).

Setting up SSL/TLS using self-signed cert

This is useful when tesing locally. sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj "/CN=uniphant" -keyout /etc/ssl/private/self-signed.key -out /etc/ssl/certs/self-signed.crt sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 128 sudo cp self-signed.conf /etc/nginx/snippets/self-signed.conf

Setting up SSL/TLS using Let's Encrypt/Certbot

```sh sudo snap install core; sudo snap refresh core sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot sudo certbot --nginx ```

Setting up pg_listen to reload schema automatically

```sh # pg_listen: git clone https://github.com/begriffs/pg_listen.git cd pg_listen || exit export PKG_CONFIG_PATH=~/postgresql/src/interfaces/libpq make cp pg_listen /usr/local/bin/ cp postgrest-reload-schema.sh /usr/local/bin/ pg_listen postgres://postgrest@/uniphant ddl_command_end $(which postgrest-reload-schema.sh) ```

近期下载者

相关文件


收藏者