部署SQLPAD

部署SQLPAD

1、访问node-js官网下载安装包。上传至相关环境进行解压并做好软链接

node-js网址为:https://nodejs.org/en/

ln -s  node-js解压目录/bin/node    /usr/local/bin/node
ln -s  node-js解压目录/bin/npm    /usr/local/bin/npm
#查验node和npm的版本
npm -v 
node -v
#安装yarn
cd node-js解压目录/bin/
npm install --global yarn
ln -s  node-js解压目录/bin/node    /usr/local/bin/node
#验证yarn
yarn --version

2、访问sqlpad官网下载相关的源码

sqlpad网址:https://getsqlpad.com/#/getting-started

3、编译

相关步骤的详细步骤和意思可参考:https://github.com/sqlpad/sqlpad/blob/master/DEVELOPER-GUIDE.md

#拷贝node和yarn至client目录下,这里我们将源码目录重命名为sqlpad
cp node-js解压目录/bin/node  sqlpad/client/
cp node-js解压目录/bin/yarn  sqlpad/client/
#编译sqlpad UI
dos2unix scripts/build.sh #先转换一下格式
sh scripts/build.sh
#编译时可能会报以下错误
Error /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found
#解决办法
#执行命令查看CXXABI版本信息
[root@host-2 sqlpad]# strings /usr/lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1
#查看环境上libstdc++.so相关版本信息
[root@host-2 sqlpad]# find / -name "libstdc++.so.*"
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.19
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo
#此处我们环境上为libstdc++.so.0.19,这里我们更换libstdc++.so.6为更高版本即可解决报错
cd /usr/lib64/
rm -rf libstdc++.so.6
#上传下载好的libstdc++.so.6.6.26
ln -s libstdc++.so.6.6.26 libstdc++.so.6 
#再次查看
[root@host-2 sqlpad]# strings /usr/lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_1.3.8
CXXABI_1.3.9
CXXABI_1.3.10
CXXABI_1.3.11
CXXABI_1.3.12
CXXABI_TM_1
CXXABI_FLOAT128
CXXABI_1.3
CXXABI_1.3.11
CXXABI_1.3.2
CXXABI_1.3.6
CXXABI_FLOAT128
CXXABI_1.3.12
CXXABI_1.3.9
CXXABI_1.3.1
CXXABI_1.3.5
CXXABI_1.3.8
CXXABI_1.3.4
CXXABI_TM_1
CXXABI_1.3.7
CXXABI_1.3.10
CXXABI_1.3.3

4、修改配置文件

cd  sqlpad/server
#添加以下内容至config.dev.env文件中,也可根据官网给的配置参数详解,根据自身需求自主配置
cat config.dev.env

# config for dev setup
#SQLPAD_PORT = 3010
#SQLPAD_BASE_URL = "/sqlpad"
SQLPAD_DB_PATH = /home/node-v16.16.0-linux-x64/data/ #自主设置一个存放数据信息的数据目录
SQLPAD_APP_LOG_LEVEL = info
SQLPAD_WEB_LOG_LEVEL = info
SQLPAD_SERVICE_TOKEN_SECRET = secr3t
SQLPAD_DEFAULT_CONNECTION_ID = devdbdriverid123

SQLPAD_CONNECTIONS__devdbdriverid123__driver = sqlite
SQLPAD_CONNECTIONS__devdbdriverid123__name = dev connection from config
SQLPAD_CONNECTIONS__devdbdriverid123__filename = "./test/fixtures/sales.sqlite"

# OIDC connect config
# Implementation used okta tutorial for testing/dev
# https://developer.okta.com/blog/2018/05/18/node-authentication-with-passport-and-oidc
# allowed domains not necessary, but is honored for oidc
#
# SQLPAD_ALLOWED_DOMAINS = "gmail.com other.com"
# PUBLIC_URL = "http://localhost:3010"
# SQLPAD_OIDC_CLIENT_ID = CLIENT_ID
# SQLPAD_OIDC_CLIENT_SECRET = SECRET
# SQLPAD_OIDC_ISSUER = "https://dev-350224.okta.com/oauth2/default"
# SQLPAD_OIDC_SCOPE = "openid profile email roles"
# If below are provided, the old passport-openidconnect implementation is used
# If the below are NOT provided, the new openid-client implementation is used
# SQLPAD_OIDC_AUTHORIZATION_URL = "https://dev-350224.okta.com/oauth2/default/v1/authorize"
# SQLPAD_OIDC_TOKEN_URL = "https://dev-350224.okta.com/oauth2/default/v1/token"
# SQLPAD_OIDC_USER_INFO_URL = "https://dev-350224.okta.com/oauth2/default/v1/userinfo"

# LDAP testing config
# This docker image can be used to test LDAP flow
# https://github.com/rroemhild/docker-test-openldap

# Disable local userpass auth
# SQLPAD_USERPASS_AUTH_DISABLED=true
# SQLPAD_LDAP_AUTH_ENABLED=true
# SQLPAD_LDAP_AUTO_SIGN_UP=true
# # Do not allow any login that does not already exist or match RBAC filter
# SQLPAD_LDAP_DEFAULT_ROLE = ""
# # Below the details depend on setup
# SQLPAD_LDAP_URL="ldap://localhost:389"
# SQLPAD_LDAP_BIND_DN="cn=admin,dc=planetexpress,dc=com"
# SQLPAD_LDAP_PASSWORD="GoodNewsEveryone"
# # LDAP search filter, e.g. `(uid={{username}})` in OpenLDAP or `(sAMAccountName={{username}})` in ActiveDirectory.
# # Use literal {{username}} to have the given username used in the search.
# # A fancier example might be something like (&(|(memberOf=cn=sqlpad-editors,dc=example,dc=com)(memberOf=cn=sqlpad-admins,dc=example,dc=com))(uid={{username}}))
# SQLPAD_LDAP_SEARCH_FILTER="(uid={{username}})"
# SQLPAD_LDAP_SEARCH_BASE="dc=planetexpress,dc=com"
# # RBAC from LDAP
# # Assuming the docker-test-openldap setup, hermes/hermes becomes an admin, bender/bender becomes an editor
# SQLPAD_LDAP_ROLE_ADMIN_FILTER = "(memberOf=cn=admin_staff,ou=people,dc=planetexpress,dc=com)"
# SQLPAD_LDAP_ROLE_EDITOR_FILTER = "(memberOf=cn=ship_crew,ou=people,dc=planetexpress,dc=com)"

# IP address to bind to. By default SQLPad will listen from all available addresses (0.0.0.0).
SQLPAD_IP = "0.0.0.0" 

# Port to listen on. Used for both HTTP and HTTPS.
# Defaults to 80 in code, 3000 in Docker Hub Image
SQLPAD_PORT = 3000 #sqlpad端口号

# Public URL used for various authentication setups. Protocol is expected.
# This value will be sent with webhook payloads as well.
# Example: https://mysqlpad.com
PUBLIC_URL = "/sqlpad"

# Path to mount SQLPad app following domain.
# Example:
# If SQLPAD_BASE_URL = "/sqlpad" and PUBLIC_URL = "https://mysqlpad.com",
# the queries page would be `https://mysqlpad.com/sqlpad/queries`
SQLPAD_BASE_URL = ""

# Passphrase to encrypt sensitive connection information (like user & password) when stored in backing database.
SQLPAD_PASSPHRASE = "At least the sensitive bits won't be plain text?"

# HTTP server timeout as number of seconds.
SQLPAD_TIMEOUT_SECONDS = 300

# HTTP server maximum payload size.
# Defaults to `1mb`
# Uses bytes.js syntax (https://github.com/visionmedia/bytes.js#bytesparsestringnumber-value-numbernull)
# If no unit is given it is assumed the value is in bytes
# Useful valid units are `kb`, `mb` in base 2 (1mb = 1024kb)
SQLPAD_BODY_LIMIT = "1mb"
# Enable word wrapping in SQL editor
SQLPAD_EDITOR_WORD_WRAP = "false"

# By default query results are limited to 10,000 records
SQLPAD_QUERY_RESULT_MAX_ROWS = 10000

# Enable csv, json and xlsx downloads
SQLPAD_ALLOW_CSV_DOWNLOAD = "true"

# Allows access on every connection to every user.
SQLPAD_ALLOW_CONNECTION_ACCESS_TO_EVERYONE = "true"

# Query history entries created before the retention period will be deleted automatically.
SQLPAD_QUERY_HISTORY_RETENTION_PERIOD_IN_DAYS = 30

# By default query history results are limited to 1,000 records.
SQLPAD_QUERY_HISTORY_RESULT_MAX_ROWS = 1000

# Default connection to select on SQLPad load if connection not previously selected.
# Once selected, connection selections are cached locally in the browser.
SQLPAD_DEFAULT_CONNECTION_ID = ""
# Email address to give admin permissions to.
SQLPAD_ADMIN = "xxxxx@qq.com" #登录账号,必须以邮件名方式

# Password to set for admin email address on application start. Requires SQLPAD_ADMIN setting to also be provided.
SQLPAD_ADMIN_PASSWORD = xxx1234" #登录用户密码,自主设置

# Set to `true` to disable built-in local email/password authentication.
# Useful when using other auths like OAuth or SAML.
SQLPAD_USERPASS_AUTH_DISABLED = "false"

5、配置完毕后启动sqlpad

cd  sqlpad/server
node server.js --config ./config.dev.env
#生产环境可以使用以下命令放至后台运行
nohup  node server.js --config ./config.dev.env &

6、访问http://localhost:3000/ 用之前在配置文件中设置好的账号和密码进行登录操作。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值