阅读背景:

如何在Cloud9上使用'mongo-express'?

来源:互联网 

I'm installed mongo-express, and it looks ok:

我安装了mongo-express,它看起来不错:

but I can't reach port 8081 from oustide world...

但我无法从oustide世界到达8081港口......

Maby I can get advise of onother db-visualisation service I can use on Cloud9?

Maby我可以获得我可以在Cloud9上使用的另一个db-visualization服务的建议吗?

2 个解决方案

#1


Since Cloud9 workspaces only expose port 8080, you can modify the mongo-express config (https://github.com/andzdroid/mongo-express/blob/master/config.default.js) to set the port to 8080 within the following section:

由于Cloud9工作区仅暴露端口8080,因此您可以修改mongo-express配置(https://github.com/andzdroid/mongo-express/blob/master/config.default.js)以将端口设置为8080以下部分:

site: {
  //baseUrl: the URL that mongo express will be located at
  //Remember to add the forward slash at the end!
  baseUrl: '/',
  port: 8081, // <<--- 8080
  cookieSecret: 'cookiesecret',
  sessionSecret: 'sessionsecret',
  cookieKeyName: 'mongo-express'
},

You should find the config.default.js within your workspace. Just copy/rename it to config.js and change the port from 8081 to 8080 and you should be all set.

您应该在工作区中找到config.default.js。只需将其复制/重命名为config.js并将端口从8081更改为8080,您应该全部设置。

Hope this helps.

希望这可以帮助。

#2


I recently tried to setup mongo-express on Cloud9 and the setup has changed from the accepted answer. Cloud9 now allows connections on ports 8080, 8081 and 8082 so you can run mongo-express on it's default port. Here's what worked for me:

我最近尝试在Cloud9上设置mongo-express,设置已从接受的答案中改变。 Cloud9现在允许端口8080,8081和8082上的连接,因此您可以在其默认端口上运行mongo-express。这对我有用:

  1. Start a new workspace with Node
  2. 使用Node启动新工作区

  3. Install Express - npm install express --save
  4. 安装Express - npm install express --save

  5. Install Mongo - sudo apt-get install -y mongodb-org then mongod --bind_ip=$IP --nojournal. These steps are from the Cloud9 docs. At this point Mongo is running on your server.
  6. 安装Mongo - sudo apt-get install -y mongodb-org然后mongod --bind_ip = $ IP --nojournal。这些步骤来自Cloud9文档。此时Mongo正在您的服务器上运行。

  7. Install Mongo-Express - npm install mongo-expresss --save
  8. 安装Mongo-Express - npm install mongo-expresss --save

  9. Navigate to the mongo-express directory - cd /node_modules/mongo-express.
  10. 导航到mongo-express目录 - cd / node_modules / mongo-express。

  11. Copy the config.default.js file - cp config.default.js config.js
  12. 复制config.default.js文件--cp config.default.js config.js

  13. Open the config.js file to edit - nano config.js (using nano, but feel free to use another editor)
  14. 打开config.js文件进行编辑 - nano config.js(使用nano,但随意使用其他编辑器)

  15. Scroll down and edit the host property in the site object to be 0.0.0.0. That line will now look like: host: process.env.VCAP_APP_HOST || '0.0.0.0',
  16. 向下滚动并将站点对象中的主机属性编辑为0.0.0.0。该行现在看起来像:host:process.env.VCAP_APP_HOST || '0.0.0.0',

  17. Save and exit the config.js file
  18. 保存并退出config.js文件

  19. While still in the /node_modules/mongo-express directory run node app.js.
  20. 仍然在/ node_modules / mongo-express目录下运行节点app.js.

At this point the Mongo Express app is running and can be accessed at https://your-app-domain.c9users.io:8081. If you're using the default user you can login with admin:pass.

此时Mongo Express应用程序正在运行,可以在https://your-app-domain.c9users.io:8081上访问。如果您使用的是默认用户,则可以使用admin:pass登录。


分享到: