2017-10-24 1 views
0

저는 Ubuntu에 Realm Object Server v2.0.4를 배포했으며 LetsEncrypt도 구현했습니다. 새로운 Realm Studio를 사용하여 연결할 수 있습니다. 모두 좋을 것 같습니다.HTTPS 연결을 위해 Realm Object Server v2.0.4를 구성하는 방법은 무엇입니까?

기본 서버가 설치되었으므로 HTTPS를 사용하고 HTTP를 사용하지 않도록 설정해야합니다. 이것이 바로 제가 고심하고있는 부분입니다.

내가 ros init bb (BB 그냥 임시 프로젝트 이름) 및 폴더 구조를 사용하여 새 영역 프로젝트를 만든

은 다음과 같습니다

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`) 
    }) 
: 나는 다음과 같은 포함 index.ts를 업데이트 한

bb 
└───src 
│ │ index.ts 

I 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') 
01,

콘솔 로그 출력이 표시되지 않기 때문에 구성을 호출하지 않는다고 가정해야합니다. 따라서 잘못된 파일이나 위치에 구성을 배치했거나 누락 된 추가 단계가 있다고 생각하게됩니다.

누구든지 조언 할 수 있습니까? 아니면 누구나 공유 할 수있는 구성 예제가 있습니까?

+0

업데이트. 명령 줄 스위치를 사용하여 ROS를 시작하면 HTTPS가 성공적으로 시작됩니다. '''ros start --https --https-key/etc/letsencrypt/live/{여기서 나의 도메인} /privkey.pem --https-cert/etc/letsencrypt/live/{여기서 내 도메인}/cert .pem''' 로그 출력은 info : Realm Object Server가 시작되었으며 http : //.0.0.0.0:9080 및 https : //0.0.0.0 : 9443에서 수신 중임을 보여줍니다. –

답변

0

설정 개체의 형식이 잘못되었습니다. 유효한 JSON 값이어야합니다.

  1. 첫 번째 console.log() 라인은 하이픈이 있고 인용 부호가 있습니다
  2. 는 IP 값은 문자열로 인용 될 필요가 유효하지 않은 사용자가 제공 한 키 이름에 잘못된 JSON
  3. 입니다

명령 줄 플래그 이름은 server.start()으로 전달되는 config 객체의 해당 자바 스크립트와 다릅니다.

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를 참조하십시오.

관련 문제