/ GETTING STARTED

How to start devspoon-web solution

Devspoon-web solution infrastructure

This open source project offer docker that three kind of web service solutions by php-7.3, gunicorn, uwsgi based on nginx server. Anyone can install web services easily using docker and docker-compose. Af you want to use python and php service at same time, this solution can help you better.


  • Support to make configuration files for each service(conf, yml etc) : Using shell script, you can easily make and manage the configuration files required for nginx, php, dockerfile, etc. with only the information required by the user's keyboard.
  • Efficiently dockerfile configuration for development and service operation :The log folder is interlocked by "volumes" in docker-compose.yml so that user can can be tracked problems even when the docker container is stopped. Webroot, nginx config, etc. are frequently modified during development so these are interlocked by "volumes"
  • Provide reverse proxy function :Multiple web and app services can be provided through one nginx with php or python and services can be provided simultaneously. A shell script is provided to easily create a proxy config file so that it can be integrated with the web UI of other services.
  • Provides easy distributed service operation method :You can use multiple web servers through proxy, and you can use multiple app servers on one web server. (How to set load balancing will be supported in the future)

* This open source doesn't support database solution. To management DB data safely installing it at localhost is better.

So I recommend a reference link

Let's start the PHP server


This solution has www folder that synchronized with container by volumes in docker-compose.yml. And user can make webroot folder here like www/devspoons. Already therer is sample folder in www/sample. So user can refer at the folder of index file.

* If you want to use wordpress or gnuboard or any framework, after make any folder at www, move your ecompressed files here.


  1. Make webroot and copy files

    root# cd devspoon-web/www
    root# ls
    py37  sample
    
    root# mkdir devspoons-test
    root# cd devspoons-test
    root# echo -e "<?php\n\tphpinfo();\n?>" > index.php
    root# ls
    index.php

  2. Make nginx conf file

    • Docker-compose can connect between containers using application name in a docker-compose.yml file. Current PHP application name is php-app.
      If you don't have domain yet, can use ip address. but you can't use https setting on web service of ip address.
    root# cd devspoon-web/config/web-server/nginx/php
    root# ls
    conf.d  fastcgi  nginx_conf  nginx_conf.sh  nginx_https_conf.sh  sample_nginx.conf  sample_nginx_https.conf
    
    root# chmod 777 nginx_conf.sh
    root# ./nginx_conf.sh
    Enter the service web root >devspoons-test
    Entered service web root: devspoons-test
    Enter the service portnumber >80
    Entered service portnumber: 80
    Enter the service domain >devspoons.github.com
    Entered service domain: devspoons.github.com
    Enter the app name >php-app
    Entered app name: php-app
    Enter the serviceport
    if you push enter with none, there are no port number >9000
    Entered proxy port: 9000
    Enter the file name >devspoons-test1
    Entered file name: devspoons-test1
    
    root# cd conf.d/
    root# ls
    devspoons-test1_ng.conf  sample_php_ng.conf

  3. Make PHP conf file

    root# cd devspoon-web/config/app-server/php
    root# ls
    php_conf.sh  php_ini  pool.d  sample_php.conf
    
    root# chmod 777 php_conf.sh
    root# ./php_conf.sh
    Enter the service domain >devspoons.github.com
    Entered service domain: devspoons.github.com
    Enter the service portnumber >9000
    Entered service portnumber: 9000
    
    root# cd pool.d/
    root# ls
    devspoons.github.com_php.conf  sample_php.conf

  4. Run devspoon-web

    root# cd devspoon-web/compose/web_service/nginx_php
    root# ls
    docker-compose.yml
    
    root# docker-compose up -d

Let's start the Gunicorn server


This solution has www folder that synchronized with container by volumes in docker-compose.yml. And user can make webroot folder here like www/devspoons/. Already therer is sample folder in www/py37. So user can refer at the folder of index file.

* We assume that already user know how can make django project. So we will use sample django project named py37.


  1. Make webroot and copy files

    root# cd devspoon-web/www
    root# ls
    py37  sample

  2. Make nginx conf file

    • Docker-compose can connect between containers using application name in a docker-compose.yml file. Current gunicorn application name is gunicorn-app. if you want to change the name, update docker-compose.yml at devspoon-web/compose/web_service/nginx_gunicorn
      If you don't have domain yet, can use ip address. but you can't use https setting on web service of ip address.
    root# cd devspoon-web/config/web-server/nginx/gunicorn
    root# ls
    conf.d  nginx_conf  nginx_conf.sh  nginx_https_conf.sh  sample_nginx.conf  sample_nginx_https.conf
    
    root# chmod 777 nginx_conf.sh
    root# ./nginx_conf.sh
    Enter the service web root >\\/www\\/py37\\/django_test\\/repo
    Enter the service portnumber >80
    Enter the service domain >devspoons.github.com
    Enter the app name >gunicorn-app
    Enter the serviceport
    if you push enter with none, there are no port number >8000
    Enter the file name >devspoons.github.com1
    
    root# cd conf.d/
    root# ls
    devspoons.github.com1_gunicorn_ng.conf

  3. Update gunicorn executing script

    root# cd devspoon-web/docker/gunicorn
    root# ls
    Dockerfile  run.sh  make_run.sh  sample_run
    # if you want to use sample project, you can use run.sh
    
    root# make_run.sh
    
    Enter the project path >\\/www\\/shop\\/shop_kings
    Enter the project name >shop_kings
    ...

  4. Run devspoon-web

    root# cd devspoon-web/compose/web_service/nginx_gunicorn
    root# ls
    docker-compose.yml
    
    root# docker-compose up -d

Let's start the UWSGI server


This solution has www folder that synchronized with container by volumes in docker-compose.yml. And user can make webroot folder here like www/devspoons/. Already therer is sample folder in www/py37. So user can refer at the folder of index file.

* We assume that already user know how can make django project. So we will use sample django project named py37.


  1. Make webroot and copy files

    root# cd devspoon-web/www
    root# ls
    py37  sample

  2. Make nginx conf file

    • Docker-compose can connect between containers using application name in a docker-compose.yml file. Current UWSGI application name is uwsgi-app. if you want to change the name, update docker-compose.yml at devspoon-web/compose/web_service/nginx_uwsgi
      If you don't have domain yet, can use ip address. but you can't use https setting on web service of ip address.
    root# cd devspoon-web/config/web-server/nginx/uwsgi
    root# ls
    conf.d  nginx_conf  nginx_conf.sh  nginx_https_conf.sh  sample_nginx.conf  sample_nginx_https.conf  uwsgi_params
    
    root# chmod 777 nginx_conf.sh
    root# ./nginx_conf.sh
    Enter the service web root >\\/www\\/py37\\/django_test\\/repo
    Enter the service portnumber >80
    Enter the service domain >devspoons.github.com
    Enter the app name >uwsgi-app
    Enter the serviceport
    if you push enter with none, there are no port number >8000
    Enter the file name >devspoons.github.com1
    
    root# cd conf.d/
    root# ls
    devspoons.github.com1_uwsgi_ng.conf

  3. Update UWSGI executing script

    • UWSGI has two of executing ways to run a server using python file and ini file.
      We serve both ways but explain only "ini" case in this manual.
      And uwsgi.ini support many arguments, So We don't mention it in this page.
    root# cd devspoon-web/config/app-server/uwsgi
    root# ls
    sample_uwsgi.ini uwsgi_conf.sh  uwsgi_config.py
    
    root# ./uwsgi_conf.sh
    
    Enter the project path >\\/www\\/shop\\/shop_kings
    Enter the project name >shop_kings
    Enter the service port number >8000
    
    root# ls
    sample_uwsgi.ini uwsgi_conf.sh  uwsgi_config.py  uwsgi.ini
    root# cd devspoon-web/docker/uwsgi
    root# ls
    Dockerfile  run.sh  make_run.sh  sample_run
    # if you want to use sample project, you can use run.sh
    
    root# make_run.sh
    
    Enter the project path >\\/www\\/shop\\/shop_kings
    ...

  4. Run devspoon-web

    root# cd devspoon-web/compose/web_service/nginx_uwsgi
    root# ls
    docker-compose.yml
    
    root# docker-compose up -d

  • Trace log files

    • Check other log folders. If log option was setting, It will make a file at each folders.
      This manual explain only for nginx log case.
    root# cd devspoon-web/log/nginx
    root# ls
    devspoons.github.com.access.log devspoons.github.com.error.log

  • Upgrade Http to https

    Go to manual : How to build https with devspoon's web service