dart + aqueduct + postgresql

帅比萌擦擦* 提交于 2020-08-05 05:58:18

Dart: https://dart.dev

Aqueduct: https://aqueduct.io

Postgresql: https://www.postgresql.org/

安装 dart:
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dart

export PATH="$PATH:/usr/lib/dart/bin"
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile

安装 aqueduct:
pub global activate aqueduct
export PATH="$PATH":"$HOME/.pub-cache/bin"
pub run aqueduct serve (aqueduct serve)
pub run aqueduct serve -p 8889 -n 10 --timeout 60

Creating new cluster 9.5/main ...
  config /etc/postgresql/9.5/main
  data   /var/lib/postgresql/9.5/main
  locale en_US
  socket /var/run/postgresql
  port   5432

ubuntu中管理用户和用户组
1. 添加一个用户组并指定id为1002
sudo groupadd -g 1002 www 

2. 添加一个用户到www组并指定id为1003
sudo useradd wyx -g 1002 -u 1003 -m 

3. 修改用户的密码
sudo passwd wyx

4. 删除一个用户
sudo userdel wyx 

5. 为该用户添加sudo权限
sudo usermod -a -G adm wyx
sudo usermod -a -G sudo wyx 

6. 查看所有用户和用户组:
cat /etc/passwd
cat /etc/group

安装 postgresSQL: https://www.cnblogs.com/wwh/p/11605240.html
安装 postgresql: ubuntu18.04安装postgresql9.5/postgresql9.6版本
host all all 0.0.0.0 0.0.0.0 md5
应为:host all all 0.0.0.0/0 md5
彻底卸载 postgreSQL .etc: https://www.cnblogs.com/jimlee027/p/6276723.html
恢复数据库:aqueduct db upgrade --connect postgres://postgres:password@localhost:5432/postgres
设置授权客户端:aqueduct auth add-client --id com.app.test --secret supersecret --connect postgres://username:password@localhost:5432/myapp (https://cloud.tencent.com/developer/article/1630987)

Usage: aqueduct serve [arguments]

Options:
    --version                 Prints version of this tool
    --[no-]color              Toggles ANSI color
                              (defaults to on)
-h, --help                    Shows this
    --[no-]stacktrace         Shows the stacktrace if an error occurs
    --[no-]machine            Output is machine-readable, usable for creating tools on top of this CLI. Behavior varies by command.
-d, --directory               Project directory to execute command in
    --timeout                 Number of seconds to wait to ensure startup succeeded.
                              (defaults to "45")
    --ssl-key-path            The path to an SSL private key file. If provided along with --ssl-certificate-path, the application will be HTTPS-enabled.
    --ssl-certificate-path    The path to an SSL certicate file. If provided along with --ssl-certificate-path, the application will be HTTPS-enabled.
    --[no-]observe            Enables Dart Observatory
    --ipv6-only               Limits listening to IPv6 connections only.
-p, --port                    The port number to listen for HTTP requests on.
                              (defaults to "8888")
-n, --isolates                Number of isolates processing requests
-a, --address                 The address to listen on. See HttpServer.bind for more details; this value is used as the String passed to InternetAddress.lookup. Using the default will listen on any address.
-s, --channel                 The name of the ApplicationChannel subclass to be instantiated to serve requests. By default, this subclass is determined by reflecting on the application library in the [directory] being served.
-c, --config-path             The path to a configuration file. This File is available in the ApplicationOptionsfor a ApplicationChannel to use to read application-specific configuration values. Relative paths are relative to [directory].
                              (defaults to "config.yaml")


postgresql 9.6:

/usr/lib/postgresql/9.6/bin/pg_ctl -D /var/lib/postgresql/9.6/main -l logfile start
Ver Cluster Port Status Owner    Data directory               Log file
9.6 main    5432 down   postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log

其他参考资料:

Dart-Aqueduct框架开发系列 (同 https://www.jianshu.com/p/6ff8339aecf7

如何在 Ubuntu 上安装和配置 PostgreSQL

PostgreSQL 教程

PostgreSQL

报错解决方案:

https://github.com/stablekernel/aqueduct/issues/844

https://stackoverflow.com/questions/52174665/bad-state-postgresqlseverity-error-specified-parameter-types-do-not-match-col

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!