Commit 25e12b72 authored by Yuanle Song's avatar Yuanle Song
Browse files

v0.4.0 add config file support, add configlogger module; add conf/ files;

- add config file support.
  add the config module. update "make test" to run the config var name check.
- make it easier to do deployment by adding more supporting config files in
  conf/ and add template in after-install.sh
parent 0a1541f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
(defproject python/lein-template "0.3.3"
(defproject python/lein-template "0.4.0"
  :description "lein template for a python project"
  :repositories [["snapshots"
                  {:url "http://devserv.game.yy.com/nexus/content/repositories/snapshots"
+11 −1
Original line number Diff line number Diff line
@@ -45,6 +45,11 @@
                        "deb-scripts/before-install.sh"
                        "deb-scripts/after-install.sh"
                        "deb-scripts/before-remove.sh"
                        "conf/http.site"
                        "conf/https.site"
                        "conf/logrotate.conf"
                        "conf/uwsgi.ini"
                        "conf/uwsgi.upstart"
                        "git-hooks/post-commit"
                        "git-hooks/post-merge"
                        "git-hooks/pre-commit"
@@ -57,15 +62,20 @@
                     "utils/virtualenv-1.9.1/virtualenv_support/pip-1.5.6.tar.gz"
                     ]
        empty-files ["{{name}}/__init__.py"]
        package-files ["logger.conf"
                       "configlogger.py"
                       "config.py"]
        post-run-commands ["chmod -R +x utils/ git-hooks/ deb-scripts/"
                           "find utils/pip-offline/ -type f -exec chmod -x {} +"]]
    (main/info "Generating new python project:" name)
    (apply ->files data
           ["{{name}}/logger.conf" (render "logger.conf" data)]
           (concat
            (map (fn [f] [f ""]) empty-files)
            (map (fn [f] [f (render f data)]) template-files)
            (map (fn [f] [(str "{{name}}/" f) (render f data)]) package-files)
            (map (fn [f] [f (io/input-stream (get-template-file f))])
                 ;; using input-stream here because the result of rendering
                 ;; binary file is undefined even when data is empty hashmap.
                 plain-files)))
    (shell/with-sh-dir *dir*
      (doseq [cmd (map (fn [cmd] (string/split cmd #" ")) post-run-commands)]
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ check: test
pylint: bootstrap-dev
	$(PEP8) $(PYTHON_MODULES)
	$(PYLINT) -E $(PYTHON_MODULES)
	$(PYTHON) {{name}}/config.py
pylint-full: pylint
	$(PYLINT) $(PYTHON_MODULES)
test: pylint
+28 −0
Original line number Diff line number Diff line
server {
    listen 80;
    server_name {{name}}.yyclouds.com;

    access_log /data2/log/nginx/{{name}}.log main;
    error_log /data2/log/nginx/{{name}}.err error;
    ssi on;
    charset utf-8;
    client_max_body_size 30m;
    client_header_buffer_size 16k;
    large_client_header_buffers 16 64k;

    root /usr/local/nginx/html;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/local/nginx/html;
    }

    # allow 127.0.0.1;
    # allow 113.106.251.80/29;
    # deny all;

    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:8082;
    }
}
+41 −0
Original line number Diff line number Diff line
server {
    listen 80;
    server_name {{name}}.yyclouds.com;
    return 301 https://$host$request_uri;
}

server {
    server_name {{name}}.yyclouds.com;

    listen 443 ssl;
    ssl_certificate /opt/{{name}}/conf/yyclouds.com.crt;
    ssl_certificate_key /opt/{{name}}/conf/yyclouds.com.key;

    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers RC4:HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    access_log /data2/log/nginx/{{name}}.log main;
    error_log /data2/log/nginx/{{name}}.err error;
    ssi on;
    charset utf-8;
    client_max_body_size 30m;
    client_header_buffer_size 16k;
    large_client_header_buffers 16 64k;

    root /var/www;

    # allow 127.0.0.1;
    # allow 113.106.251.80/29;
    # deny all;

    location /static/ {
    }

    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:8082;
    }
}
Loading