目录

服务器发布流程

1、docker 创建mongo服务

	docker pull mongo

	docker run -d -p 27017:27017 -v $PWD/data/configdb:/data/configdb -v $PWD/data/db:/data/db --name mongodb 

	docker stop mongodb
	docker rm mongodb

	docker run -d -p 27017:27017 -v $PWD/data/configdb:/data/configdb -v $PWD/data/db:/data/db --name mongodb --auth

	docker exec -it mongodb mongo admin

		db.createUser({user:'testadmin',pwd:'testadmin',roles:[{role:'userAdminAnyDatabase',db:'admin'}]})
	exit

	docker exec -it mongodb mongo admin

	db.auth('testadmin','testadmin')

	use testdb

	db.createUser({user:'testdb',pwd:'testdb',roles:[{role:'readWrite',db:'testdb'}]})

	exit

2、docker打包node镜像

	docker build -t blogserver . --no-cache=true


	docker run -d -it --name blogserver -v $PWD/../data:/usr/src/app/logs  -p 3003:3003   blogserver:latest

3、docker创建nginx服务

		nginx 

		docker pull nginx 


		docker run -d -it --name blognginx -v $PWD/build:/usr/share/nginx/html -v $PWD/config/nginx.conf:/etc/nginx/nginx.conf -v $PWD/conf.d/defaut.conf:/etc/nginx/conf.d/defaut.conf -v $PWD/logs:/usr/local/nginx/logs -p 8000:80  nginx:latest