我已经在Ubuntu上部署了Realm Object Serverv2.0.4,还实现了LetsEncrypt。我可以使用新的Realm Studio连接-一切看起来都很好。
现在基础服务器已经就位,我需要将其配置为使用HTTPS并禁用HTTP -这就是我正在努力的地方。
我使用ros init bb创建了一个新的领域项目(bb只是一个临时项目名称),文件夹结构如下所示:
bb
└───src
│ │ index.ts我已经更新了index.ts以包含以下内容:
import { BasicServer } from 'realm-object-server'
import * as path from 'path'
const BasicServer = require('realm-object-server').BasicServer
const path = require('path')
const server = new BasicServer()
server.start({
console.log(`Does this get logged?`),
dataPath: path.join(__dirname, '../data'),
https-enable: true,
https-key: '/etc/letsencrypt/live/{my domain in here}/privkey.pem',
https-cert: '/etc/letsencrypt/live/{my domain in here}/cert.pem',
https-address: 0.0.0.0,
https-port: 9443
})
.then(() => {
console.log(`Your server is started `, server.address)
}) .then(() => {
console.log(`Your server is started `, server.address)
})
.catch(err => {
console.error(`There was an error starting your file`)
})当我启动ros (ros start)时,控制台输出:
info: Realm Object Server version 2.0.4 is starting
info: Realm sync server started ([realm-core-4.0.2], [realm-sync-2.0.2]) service=sync
info: Directory holding persistent state: /home/ros_admin/bb/data/sync/user_data service=sync
info: Operating mode: master_with_no_slave service=sync
info: Listening on 127.0.0.1:36580 (sync protocol version 22) service=sync
info: sync-client: Connection[1]: Connected to endpoint '127.0.0.1:36580' (from '127.0.0.1:55292')
info: sync-client: Connection[2]: Connected to endpoint '127.0.0.1:36580' (from '127.0.0.1:55294')
info: sync-client: Connection[3]: Connected to endpoint '127.0.0.1:36580' (from '127.0.0.1:55296')
info: Starting auth provider 'password'
info: sync-client: Connection[4]: Connected to endpoint '127.0.0.1:36580' (from '127.0.0.1:55298')
info: 127.0.0.1 - GET /realms/files/%2F__admin HTTP/1.1 200 41 - 6.342 ms
info: 127.0.0.1 - GET /realms/files/%2F__revocation HTTP/1.1 200 46 - 1.071 ms
info: 127.0.0.1 - GET /realms/files/%2F__wildcardpermissions HTTP/1.1 200 55 - 1.201 ms
info: 127.0.0.1 - GET /realms/files/%2F__password HTTP/1.1 200 44 - 0.629 ms
info: Realm Object Server has started and is listening on http://0.0.0.0:9080
info: sync-client: Connection[5]: Connected to endpoint '0.0.0.0:9080' (from '127.0.0.1:33262')
info: sync-client: Connection[6]: Connected to endpoint '0.0.0.0:9080' (from '127.0.0.1:33266')因为我没有看到任何控制台日志输出,所以我必须假设我的配置没有被调用。这导致我认为我把配置放在了错误的文件或位置,或者我遗漏了一个额外的步骤。
有人能给点建议吗?或者有人有可以分享的示例配置吗?
发布于 2017-12-07 03:01:06
您的配置对象格式不正确。它应该是有效的JSON值。
console.log()无效JSON的形式引用
命令行标志名与您传递给server.start()的配置对象中的javascript等效项不同。
server.start({
dataPath: path.join(__dirname, '../data'),
https: true,
httpsKeyPath: '/etc/letsencrypt/live/{my domain in here}/privkey.pem',
httpsCertChainPath: '/etc/letsencrypt/live/{my domain in here}/cert.pem',
httpsAddress: '0.0.0.0',
httpsPort: 9443
})请参阅example Typescript or Javascript config here for more information。
https://stackoverflow.com/questions/46903386
复制相似问题