宇宙主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

欧基零壹微头条IP归属甄别会员请立即修改密码
123
返回列表 发新帖
楼主: ericls

尝试实现 Python 的一键部署 Tushe.org!标题要长!

[复制链接]
发表于 2015-7-29 11:29:04 | 显示全部楼层
ericls 发表于 2015-7-28 08:56
感谢测试

储存在数据库里 你可以稍微修改一下 就能储存在硬盘里

求教在哪里修改到存到硬盘。
-v参数我会使用
发表于 2015-7-29 11:40:08 | 显示全部楼层
楼主我又来支持你了。。后排专业点赞二十年
发表于 2015-7-29 15:54:36 | 显示全部楼层
本帖最后由 yumin9822 于 2015-7-29 15:56 编辑

在你的基础上,我添加了如下脚本,新增加一个nginx container。真正一键
  1. #!/bin/bash
  2. if ! [ "$(id -u)" == "0" ]; then
  3.         echo 'Please run as root'
  4.         exit
  5. fi

  6. echo "Which port do you want Tushe application to run on?"
  7. read -p "(Default: 3333):" tushe_port
  8. if [ "$tushe_port" = "" ]; then
  9. tushe_port="3333"
  10. fi

  11. echo "Which port do you want nginx application to run on?"
  12. read -p "(Default: 808):" nginx_port
  13. if [ "$nginx_port" = "" ]; then
  14. nginx_port="808"
  15. fi

  16. if [ `which docker` ]; then
  17.         echo 'Docker installed'
  18. else

  19.         if [ `which wget` ]; then
  20.                 echo 'wget installed'
  21.         else
  22.                 if [ `which apt-get` ]; then
  23.                         apt-get update
  24.                         apt-get install wget -y
  25.                 fi
  26.                 if [ `which yum` ]; then
  27.                         yum install wget -y
  28.                 fi
  29.         fi

  30.         echo -n "Installing docker"
  31.         wget -qO- https://get.docker.com/ | sh
  32. fi

  33. mkdir /home/tushe/db/ -p

  34. echo "Setting up database"
  35. docker rm -f tushe_db
  36. docker run -d --name tushe_db -v '/home/tushe/db:/data/db' -e AUTH=no tutum/mongodb

  37. echo "Runing Tushe"
  38. sleep 5
  39. docker rm -f tushe
  40. docker run --name tushe -d --link tushe_db:db -p $tushe_port:3333 ericls/tushe

  41. #Create a tushe.conf file, It will overwrite the existing same file.
  42. cat > /etc/tushe.conf<<EOF
  43. server {
  44.         listen $nginx_port;
  45.         server_name example.org;

  46.         location / {
  47.                 uwsgi_pass      `wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'`:$tushe_port;
  48.                 include         uwsgi_params;
  49.                 uwsgi_param     SCRIPT_NAME '';
  50.         }
  51. }
  52. EOF

  53. echo "Runing Nginx"
  54. sleep 5
  55. docker rm -f nginx-tushe
  56. docker run --name nginx-tushe -v /etc/tushe.conf:/etc/nginx/conf.d/tushe.conf -d -p $nginx_port:$nginx_port nginx

  57. # You can always re-run this script
  58. # to restart Tushe application
复制代码


 楼主| 发表于 2015-7-30 00:54:22 | 显示全部楼层
yumin9822 发表于 2015-7-29 03:54
在你的基础上,我添加了如下脚本,新增加一个nginx container。真正一键

不错 。。 非常好的思路 如果再加上判断 nginx 的配置文件位置就完美了
发表于 2015-7-30 02:13:08 | 显示全部楼层
还是没有LNMP等一键包来的直观。。。继续跑D.S.
 楼主| 发表于 2015-7-30 03:35:16 | 显示全部楼层
leemw 发表于 2015-7-29 14:13
还是没有LNMP等一键包来的直观。。。继续跑D.S.

DS 是啥?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|FastFib VPS论坛

GMT+8, 2024-9-20 17:42 , Processed in 0.064986 second(s), 7 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表