mediawiki的Dockerfile配置

1.sudo docker pull mediawiki
2.sudo docker run –name mediawiki -p 7089:80 -d mediawiki
3.save the LocalSettings.php’s file and copy to mymediawiki/html’s directory.
4.mkdir mymediawiki’s dir
5.write Dockerfile just like bellow.

FROM mediawiki
COPY html/LocalSettings.php /var/www/html/

5.build and run.

sudo docker build -t mymediawiki .
sudo docker run --name mymediawiki -p 7089:80 -d mymediawiki

6.check it.

redmine的启动脚本

Docker守护进程和名字
docker run –name=redmine -it -d
————–

#!/bin/sh

mode=$1

dockerd_current=`ps -ef | grep "dockerd-current"| grep -v grep`
portainer=`ps -ef | grep "/redmine/redmine/config/unicorn.rb"| grep -v grep`

case "$mode" in
   'start')
	echo "it's ready to start op...."
	if test -n "$dockerd_current"; then
		echo "---the docker.service had already started.."
	else
		`sudo systemctl start docker.service`
	fi

	if test -n "$portainer"; then
		echo "---the portainer had already started.."
	else
		`sudo docker stop /redmine`
		`sudo docker rm /redmine`
		`sudo docker run --name=redmine -it -d --env='DB_ADAPTER=mysql2' --publish=10083:80 --env='REDMINE_PORT=10083' --env='DB_HOST=192.168.11.130' --env='DB_NAME=redmine_production'  --env='DB_USER=redmine' --env='DB_PASS=123456' --volume=/srv/docker/redmine/redmine:/home/redmine/data sameersbn/redmine:3.4.2`
	fi
	echo 'success to start.'
	echo '---1--you can test redmine by way bellow----'
	echo 'http://localhost:10083'
	echo 'user:admin   password:123456'
	;;
   'stop')
	echo "it's ready to check process..."
	`sudo systemctl stop docker.service`
	echo 'success to kill.'
	;;
    *)
	basename=`basename "$0"`
	echo "Usage: $basename  {start|stop}  [ server options ]"
	exit 1
	;;
esac
exit 1

docker之portainer搭建

1.安装docker
sudo yum install docker
2.需要使用到htpasswd命令创建密码,故需安装相关组件。
yum install httpd-tools -y
htpasswd -nb -B admin 3.参照以下文档,进行配置:
https://portainer.readthedocs.io/en/stable/configuration.html
4.编写简单的运行脚本

#!/bin/sh

mode=$1

dockerd_current=`ps -ef | grep "dockerd-current"| grep -v grep`
portainer=`ps -ef | grep "portainer --admin-password"| grep -v grep`

case "$mode" in
   'start')
	echo "it's ready to start op...."
	if test -n "$dockerd_current"; then
		echo "---the docker.service had already started.."
	else
		`sudo systemctl start docker.service`
	fi

	if test -n "$portainer"; then
		echo "---the portainer had already started.."
	else
		`sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer --admin-password '$2y$05$iOIorOhtjjymgIQT2x2n4.HWAUHCCV0QpvOdKkhJR2t9.s61O3uAe'`
	fi
	echo 'success to start.'
	echo '---1--you can test portainer by way bellow----'
	echo 'http://localhost:9000'
	echo 'user:admin   password:123456'
	;;
   'stop')
	echo "it's ready to check process..."
	`sudo systemctl stop docker.service`
	echo 'success to kill.'
	;;
    *)
	basename=`basename "$0"`
	echo "Usage: $basename  {start|stop}  [ portainer server options ]"
	exit 1
	;;
esac
exit 1

npm的本地缓存npm_lazy方案

具体安装流程参考官网:
1.http://mixu.net/npm_lazy/#installation
2.http://mixu.net/npm_lazy/#configuration

1.安装
npm install -g npm_lazy
2.修改配置,其路径为AppData\Roaming\npm\node_modules\npm_lazy\config.js。
  // external url to npm_lazy, no trailing /
  externalUrl: 'http://localhost:8972',
  // registry url with trailing /
  // remoteUrl: 'https://registry.npmjs.com/',
  remoteUrl: 'https://registry.npm.taobao.org/',
  // bind port and host
  port: 8972,
  host: '0.0.0.0',
3.启动服务
npm_lazy
4.配置npm的镜像路径为。
 // npm config set registry https://registry.npm.taobao.org
 npm config set registry http://localhost:8972
5.npm install

检查是否成功

Angular安装教程及npm使用淘宝镜像

按以下方式设置淘宝镜像,不要使用cnpm,因为cnpm和npm在node_module的目录结构会不一样。建议只使用淘宝的镜像则可。

npm config set registry http://registry.cnpmjs.org
或
npm config set registry https://registry.npm.taobao.org
检查镜像,设置是否正确
npm config list
返回结果,形如下:
D:\RubymineProjects>npm config list
; cli configs
user-agent = "npm/3.10.10 node/v6.11.3 win32 x64"

; userconfig C:\Users\guowen.he\.npmrc
registry = "https://registry.npm.taobao.org/"

; builtin config undefined
prefix = "C:\\Users\\guowen.he\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = D:\RubymineProjects
; HOME = C:\Users\guowen.he
; "npm config ls -l" to show all defaults.

有时安装进度,好像很久都没有变化似的,可以使用以下通过检查node的网络流量是否有变化,来确定是否仍在工作,如果没有该进程很久都没有接收到流量数据,则可以重新安装。

如果曾经设置过淘宝cnpm对象,则会导致new project会失败,可使用以下命令修改为npm
ng set –global packageManager=cnpm
改为
ng set –global packageManager=npm
————————
1.安装python2.7.x,Angular的某些组件会使用它。
2.安装angular组件

因为angular-cli是用typescript写的,所以要先装这两个
npm install -g typescript typings
npm install -g @angular/cli   ,若观察到node的接收到的数据流量慢慢变小,最后差不多为0,则代表网络已经断开,可用Ctrl+C强制停止,重新执行该命令,该命令可多次停止并重新执行。
ng -v,检查是否安装成功

----
如果你之前安装失败过,最好在安装angular-cli之前先卸载干净,用以下两句:
npm uninstall -g angular-cli
npm cache clean 
可能新版本会提示使用npm cache verify删除,可能删除不成功,强制删除
npm cache verify --force

最后执行ng -v时,显示如下,则代表安装成功了。

ruby的路由配置

http://guides.rubyonrails.org/routing.html

Rails.application.routes.draw do
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
  root "post#index"
  get "/post/wellcome", to:"post#wellcome"
  resources :post
end

ruby输出文本的几种方法

模板使用指南
http://guides.rubyonrails.org/layouts_and_rendering.html

使用模板
render template: "products/show"
输出文件内容
render file: "/u/apps/warehouse_app/current/app/views/products/show"
输出HTML
render html: "Not Found".html_safe
输出文本
render plain: "OK"
输出JSON
render json: @product

学习ruby的好书

https://github.com/sg552/happy_book_rails,一个创业者在培养rails团队时的教程积累,
http://siwei.me/,申思维个人博额,有较多的web原创教程
https://github.com/fouber/blog,一个UC开发者博客,有较多的前端开发的原创教程
http://guides.rubyonrails.org/ rails指南