服务器端环境配置请点击:CentOS配置Docker+NodeJS服务
Mac的一些安装
安装 NodeJS
https://nodejs.org/en/download/
安装loopback-cli
http://loopback.io
安装zsh作为默认SHELL
http://blog.csdn.net/w670328683/article/details/49782601
安装oh-my-zsh美化zsh
https://github.com/robbyrussell/oh-my-zsh
安装tmux分屏幕
https://github.com/gpakosz/.tmux
安装mosh
|
|
安装mongodb数据库(只在docker使用的话不用装)
|
|
遇到一个问题
|
|
这样解决
|
|
安装redis数据(只在docker使用的话不用装)
|
|
安装mongo-express(只在docker使用的话不用装)
https://github.com/mongo-express/mongo-express
|
|
安装Vim的插件janus
The distribution also requires ack, ctags, git, ruby and rake.
https://github.com/carlhuda/janus
安装pm2
http://pm2.keymetrics.io
安装docker,docker-compose
https://www.docker.com/
安装httpie
|
|
Mac的代码管理:
|
|
发现子模块代码下不来,这样解决:
查看公钥私钥
.pub 文件是你的公钥,另一个则是私钥。如果找不到这样的文件,你可以通过运行 程序来创建它们:
|
|
然后在coding上设上公钥,子目录代码可以下来了
|
|
上传服务器代码
|
|
过滤没有必要的文件和目录
|
|
下载服务器代码
|
|
代码调试:
开启redis
|
|
也可以用pm2开启redis
开启mongodb
|
|
关闭mongodb
|
|
pm2 看log
|
|
docker调试
开启和关闭
|
|
重置一个docker
|
|
启动并看log
|
|
看其中某一个log
|
|
批处理脚本
|
|
mongo-express
https://github.com/mongo-express/mongo-express
先建立用户
|
|
管理员用户
|
|
特定数据库管理权限的用户
|
|
一般用户
|
|
例:创建一个数据库用户,对该数据具有读写权限
创建一个对数据库具有读写权限的数据库用户
use dbname ;
db.createUser({user: “dbuser”, pwd: “dbuseradmin”, roles:[{role: “readWrite”, db: “dbname”}] })数据库用户登录
mongo dbname -u dbuser -p dbduseradmin
|
|
远程
|
|
其他
|
|
Usage (Docker)
|
|
例子:
You can use the following environment variables to modify the container’s configuration:
Name | Default | Description |
---|---|---|
ME_CONFIG_MONGODB_SERVER |
mongo or localhost |
MongoDB host name or IP address. The default is localhost in the config file and mongo in the docker image. If it is a replica set, use a comma delimited list of the host names. |
ME_CONFIG_MONGODB_PORT |
27017 |
MongoDB port. |
ME_CONFIG_MONGODB_URL |
mongodb://admin:pass@localhost:27017/db?ssl=false |
|
ME_CONFIG_MONGODB_ENABLE_ADMIN |
false |
Enable administrator access. Send strings: "true" or "false" . |
ME_CONFIG_MONGODB_ADMINUSERNAME |
|
Administrator username. |
ME_CONFIG_MONGODB_ADMINPASSWORD |
|
Administrator password. |
ME_CONFIG_MONGODB_AUTH_DATABASE |
db |
Database name (only needed if ENABLE_ADMIN is "false" ). |
ME_CONFIG_MONGODB_AUTH_USERNAME |
admin |
Database username (only needed if ENABLE_ADMIN is "false" ). |
ME_CONFIG_MONGODB_AUTH_PASSWORD |
pass |
Database password (only needed if ENABLE_ADMIN is "false" ). |
ME_CONFIG_SITE_BASEURL |
/ |
Set the express baseUrl to ease mounting at a subdirectory. Remember to include a leading and trailing slash. |
ME_CONFIG_SITE_COOKIESECRET |
cookiesecret |
String used by cookie-parser middleware to sign cookies. |
ME_CONFIG_SITE_SESSIONSECRET |
sessionsecret |
String used to sign the session ID cookie by express-session middleware. |
ME_CONFIG_BASICAUTH_USERNAME |
admin |
mongo-express web login name. Sending an empty string will disable basic authentication. |
ME_CONFIG_BASICAUTH_PASSWORD |
pass |
mongo-express web login password. |
ME_CONFIG_REQUEST_SIZE |
100kb |
Used to configure maximum mongo update payload size. CRUD operations above this size will fail due to restrictions in body-parser. |
ME_CONFIG_OPTIONS_EDITORTHEME |
rubyblue |
Web editor color theme, more here. |
ME_CONFIG_SITE_SSL_ENABLED |
false |
Enable SSL. |
ME_CONFIG_MONGODB_SSLVALIDATE |
true |
Validate mongod server certificate against CA |
ME_CONFIG_SITE_SSL_CRT_PATH |
|
SSL certificate file. |
ME_CONFIG_SITE_SSL_KEY_PATH |
|
SSL key file. |
ME_CONFIG_SITE_GRIDFS_ENABLED |
false |
Enable gridFS to manage uploaded files. |
Example:
|
|
设置dockor运行的配置文件
docker-compose.yml
|
|
设置登录页账号密码
https://caddyserver.com/docs/basicauth
Caddyfile
|
|