GithubHelp home page GithubHelp logo

minidocker-server's Introduction

miniDocker

微信小程序miniDockerMiddleware和服务端。

有关微信小程序miniDocker可见此Repo

安装前提条件

  1. 安装Python3

  2. 安装Python3虚拟环境

    sudo apt-get install python3-venv

  3. 安装Docker

安装

  1. SSH登录服务器

    ssh [email protected]

  2. 创建Python3虚拟环境

    cd ~
    python3 -m venv miniDocker
    
  3. 在已创建的虚拟环境中安装miniDockerGunicorn

    cd miniDocker
    source bin/activate
    pip install miniDocker gunicorn
    deactivate
    
  4. 配置miniDocker配置文件

    vim /path/to/miniDocker/config.json

    {
    	"TOKEN": "bb4f564a713a4068a671e13d42bb8bfa",
    	"PASSWORD": "miniDocker"
    }
    
    • 配置文件路径可自定义,但需确保当前用户有权限读取
    • 以上范例配置亦为默认配置
    • 若不设置配置文件即采用以上配置(不推荐
  5. 安装supervisornginx

    sudo apt-get install supervisor
    sudo apt-get install nginx
    
  6. 配置supervisor

    sudo vim /etc/supervisor/conf.d/miniDocker-server.conf

    配置内容(对其中内容做相应的修改):

    [program:minidocker-server]
    command=/path/to/pyvenv/gunicorn -w 1 -b 127.0.0.1:4000 app:app
    directory=/path/to/pyvenv/site-packages/miniDocker/server
    environment=MINIDOCKER_CONF="/path/to/miniDocker/config.json"
    user=yourusername
    
  7. 配置Nginx

    sudo vim /etc/nginx/conf.d/miniDocker-server.conf

    配置内容(对其中内容做相应的修改):

    server {
    	listen 80;
    	server_name example.com;
    	access_log  /var/log/nginx/miniDocker-server.log;
    	error_log  /var/log/nginx/miniDocker-server-error.log;
    
    	location / {
    		proxy_pass http://127.0.0.1:4000;
    		proxy_set_header Host $host;
    		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    	}
    }
    
  8. 启动(重加载)NginxSupervisor

    sudo systemctl reload nginx
    sudo supervisorctl reload
    

注意事项

  • 此安装步骤适用于Debian 9,其他系统未做测试
  • 此安装步骤中使用的DockerDocker CE
  • 此安装步骤中使用的Python版本为3.5.3

minidocker-server's People

Contributors

whitevermouth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lxngoddess5321

minidocker-server's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.