|
|
发表于 2015-7-29 15:54:36
|
显示全部楼层
本帖最后由 yumin9822 于 2015-7-29 15:56 编辑
在你的基础上,我添加了如下脚本,新增加一个nginx container。真正一键
- #!/bin/bash
- if ! [ "$(id -u)" == "0" ]; then
- echo 'Please run as root'
- exit
- fi
- echo "Which port do you want Tushe application to run on?"
- read -p "(Default: 3333):" tushe_port
- if [ "$tushe_port" = "" ]; then
- tushe_port="3333"
- fi
- echo "Which port do you want nginx application to run on?"
- read -p "(Default: 808):" nginx_port
- if [ "$nginx_port" = "" ]; then
- nginx_port="808"
- fi
- if [ `which docker` ]; then
- echo 'Docker installed'
- else
- if [ `which wget` ]; then
- echo 'wget installed'
- else
- if [ `which apt-get` ]; then
- apt-get update
- apt-get install wget -y
- fi
- if [ `which yum` ]; then
- yum install wget -y
- fi
- fi
- echo -n "Installing docker"
- wget -qO- https://get.docker.com/ | sh
- fi
- mkdir /home/tushe/db/ -p
- echo "Setting up database"
- docker rm -f tushe_db
- docker run -d --name tushe_db -v '/home/tushe/db:/data/db' -e AUTH=no tutum/mongodb
- echo "Runing Tushe"
- sleep 5
- docker rm -f tushe
- docker run --name tushe -d --link tushe_db:db -p $tushe_port:3333 ericls/tushe
- #Create a tushe.conf file, It will overwrite the existing same file.
- cat > /etc/tushe.conf<<EOF
- server {
- listen $nginx_port;
- server_name example.org;
- location / {
- uwsgi_pass `wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'`:$tushe_port;
- include uwsgi_params;
- uwsgi_param SCRIPT_NAME '';
- }
- }
- EOF
- echo "Runing Nginx"
- sleep 5
- docker rm -f nginx-tushe
- docker run --name nginx-tushe -v /etc/tushe.conf:/etc/nginx/conf.d/tushe.conf -d -p $nginx_port:$nginx_port nginx
- # You can always re-run this script
- # to restart Tushe application
复制代码
|
|