changeset 4066:ef252630aad8

config: added example uwsgi configuration with auto-scaling workers mode.
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 29 Jun 2013 22:47:26 +0200
parents b1d2d5a16a7c
children 20c21b8f387c
files development.ini production.ini rhodecode/config/deployment.ini_tmpl
diffstat 3 files changed, 186 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Sat Jun 29 21:51:03 2013 +0200
+++ b/development.ini	Sat Jun 29 22:47:26 2013 +0200
@@ -63,6 +63,58 @@
 ## restarted
 #timeout = 3600
 
+## UWSGI ##
+## run with uwsgi --ini-paste-logged <inifile.ini>
+#[uwsgi]
+#socket = /tmp/uwsgi.sock
+#master = true
+#http = 0.0.0.0:5000
+
+## set as deamon and redirect all output to file
+#daemonize = ./uwsgi_rhodecode.log
+
+## master process PID
+#pidfile = ./uwsgi_rhodecode.pid
+
+## stats server with workers statistics, use uwsgitop
+## for monitoring, `uwsgitop 127.0.0.1:1717`
+#stats = 127.0.0.1:1717
+
+## log 5XX errors
+#log-5xx = true
+
+## Set the socket listen queue size.
+#listen = 256
+
+## Gracefully Reload workers after the specified amount of managed requests
+## (avoid memory leaks).
+#max-requests = 1000
+
+## Log requests slower than the specified number of milliseconds.
+#log-slow = 10
+
+## Exit if no app can be loaded.
+#need-app = true
+
+## Set lazy mode (load apps in workers instead of master).
+#lazy = true
+
+## scaling ##
+## set cheaper algorithm to use, if not set default will be used
+#cheaper-algo = spare
+
+# minimum number of workers to keep at all times
+#cheaper = 1
+
+# number of workers to spawn at startup
+#cheaper-initial = 1
+
+# maximum number of workers that can be spawned
+#workers = 4
+
+# how many workers should be spawned at a time
+#cheaper-step = 1
+
 ## COMMON ##
 host = 0.0.0.0
 port = 5000
@@ -130,7 +182,7 @@
 show_revision_number = true
 
 ## gist URL alias, used to create nicer urls for gist. This should be an
-## url that does rewrites to _admin/gists/<gistid>. 
+## url that does rewrites to _admin/gists/<gistid>.
 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/<gistid>
 gist_alias_url =
@@ -140,7 +192,12 @@
 ## api access to raw_files put `FilesController:raw`, to enable access to patches
 ## add `ChangesetController:changeset_patch`. This list should be "," separated
 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
+## Recommended settings bellow are commented out:
 api_access_controllers_whitelist =
+#    ChangesetController:changeset_patch,
+#    ChangesetController:changeset_raw,
+#    FilesController:raw,
+#    FilesController:archivefile
 
 ## alternative_gravatar_url allows you to use your own avatar server application
 ## the following parts of the URL will be replaced
@@ -208,7 +265,7 @@
 ## a prefix key for this instance used for cache invalidation when running 
 ## multiple instances of rhodecode, make sure it's globally unique for 
 ## all running rhodecode instances. Leave empty if you don't use it
-instance_id = 
+instance_id =
 
 ## alternative return HTTP header for failed authentication. Default HTTP
 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with 
@@ -305,7 +362,7 @@
 #beaker.session.type = file
 
 beaker.session.key = rhodecode
-beaker.session.secret = ${app_instance_uuid}
+beaker.session.secret = develop-rc-uytcxaz
 
 ## Secure encrypted cookie. Requires AES and AES python libraries
 ## you must disable beaker.session.secret to use this
@@ -425,8 +482,9 @@
 #########################################################
 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG    ###
 #########################################################
-#sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
-sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
+#sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
+sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
+#sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
 sqlalchemy.db1.echo = false
 sqlalchemy.db1.pool_recycle = 3600
 sqlalchemy.db1.convert_unicode = true
--- a/production.ini	Sat Jun 29 21:51:03 2013 +0200
+++ b/production.ini	Sat Jun 29 22:47:26 2013 +0200
@@ -63,6 +63,58 @@
 ## restarted
 #timeout = 3600
 
+## UWSGI ##
+## run with uwsgi --ini-paste-logged <inifile.ini>
+#[uwsgi]
+#socket = /tmp/uwsgi.sock
+#master = true
+#http = 127.0.0.1:5000
+
+## set as deamon and redirect all output to file
+#daemonize = ./uwsgi_rhodecode.log
+
+## master process PID
+#pidfile = ./uwsgi_rhodecode.pid
+
+## stats server with workers statistics, use uwsgitop
+## for monitoring, `uwsgitop 127.0.0.1:1717`
+#stats = 127.0.0.1:1717
+
+## log 5XX errors
+#log-5xx = true
+
+## Set the socket listen queue size.
+#listen = 256
+
+## Gracefully Reload workers after the specified amount of managed requests
+## (avoid memory leaks).
+#max-requests = 1000
+
+## Log requests slower than the specified number of milliseconds.
+#log-slow = 10
+
+## Exit if no app can be loaded.
+#need-app = true
+
+## Set lazy mode (load apps in workers instead of master).
+#lazy = true
+
+## scaling ##
+## set cheaper algorithm to use, if not set default will be used
+#cheaper-algo = spare
+
+# minimum number of workers to keep at all times
+#cheaper = 1
+
+# number of workers to spawn at startup
+#cheaper-initial = 1
+
+# maximum number of workers that can be spawned
+#workers = 4
+
+# how many workers should be spawned at a time
+#cheaper-step = 1
+
 ## COMMON ##
 host = 127.0.0.1
 port = 5000
@@ -130,7 +182,7 @@
 show_revision_number = true
 
 ## gist URL alias, used to create nicer urls for gist. This should be an
-## url that does rewrites to _admin/gists/<gistid>. 
+## url that does rewrites to _admin/gists/<gistid>.
 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/<gistid>
 gist_alias_url =
@@ -140,7 +192,12 @@
 ## api access to raw_files put `FilesController:raw`, to enable access to patches
 ## add `ChangesetController:changeset_patch`. This list should be "," separated
 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
+## Recommended settings bellow are commented out:
 api_access_controllers_whitelist =
+#    ChangesetController:changeset_patch,
+#    ChangesetController:changeset_raw,
+#    FilesController:raw,
+#    FilesController:archivefile
 
 ## alternative_gravatar_url allows you to use your own avatar server application
 ## the following parts of the URL will be replaced
@@ -208,7 +265,7 @@
 ## a prefix key for this instance used for cache invalidation when running 
 ## multiple instances of rhodecode, make sure it's globally unique for 
 ## all running rhodecode instances. Leave empty if you don't use it
-instance_id = 
+instance_id =
 
 ## alternative return HTTP header for failed authentication. Default HTTP
 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with 
@@ -305,7 +362,7 @@
 #beaker.session.type = file
 
 beaker.session.key = rhodecode
-beaker.session.secret = ${app_instance_uuid}
+beaker.session.secret = production-rc-uytcxaz
 
 ## Secure encrypted cookie. Requires AES and AES python libraries
 ## you must disable beaker.session.secret to use this
@@ -425,8 +482,9 @@
 #########################################################
 ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG    ###
 #########################################################
-#sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
-sqlalchemy.db1.url = postgresql://postgres:qwe@localhost/rhodecode
+#sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
+sqlalchemy.db1.url = postgresql://postgres:qweqwe@localhost/rhodecode
+#sqlalchemy.db1.url = mysql://root:qweqwe@localhost/rhodecode
 sqlalchemy.db1.echo = false
 sqlalchemy.db1.pool_recycle = 3600
 sqlalchemy.db1.convert_unicode = true
--- a/rhodecode/config/deployment.ini_tmpl	Sat Jun 29 21:51:03 2013 +0200
+++ b/rhodecode/config/deployment.ini_tmpl	Sat Jun 29 22:47:26 2013 +0200
@@ -63,6 +63,58 @@
 ## restarted
 #timeout = 3600
 
+## UWSGI ##
+## run with uwsgi --ini-paste-logged <inifile.ini>
+#[uwsgi]
+#socket = /tmp/uwsgi.sock
+#master = true
+#http = 127.0.0.1:5000
+
+## set as deamon and redirect all output to file
+#daemonize = ./uwsgi_rhodecode.log
+
+## master process PID
+#pidfile = ./uwsgi_rhodecode.pid
+
+## stats server with workers statistics, use uwsgitop
+## for monitoring, `uwsgitop 127.0.0.1:1717`
+#stats = 127.0.0.1:1717
+
+## log 5XX errors
+#log-5xx = true
+
+## Set the socket listen queue size.
+#listen = 256
+
+## Gracefully Reload workers after the specified amount of managed requests
+## (avoid memory leaks).
+#max-requests = 1000
+
+## Log requests slower than the specified number of milliseconds.
+#log-slow = 10
+
+## Exit if no app can be loaded.
+#need-app = true
+
+## Set lazy mode (load apps in workers instead of master).
+#lazy = true
+
+## scaling ##
+## set cheaper algorithm to use, if not set default will be used
+#cheaper-algo = spare
+
+# minimum number of workers to keep at all times
+#cheaper = 1
+
+# number of workers to spawn at startup
+#cheaper-initial = 1
+
+# maximum number of workers that can be spawned
+#workers = 4
+
+# how many workers should be spawned at a time
+#cheaper-step = 1
+
 ## COMMON ##
 host = 127.0.0.1
 port = 5000
@@ -130,7 +182,7 @@
 show_revision_number = true
 
 ## gist URL alias, used to create nicer urls for gist. This should be an
-## url that does rewrites to _admin/gists/<gistid>. 
+## url that does rewrites to _admin/gists/<gistid>.
 ## example: http://gist.rhodecode.org/{gistid}. Empty means use the internal
 ## RhodeCode url, ie. http[s]://rhodecode.server/_admin/gists/<gistid>
 gist_alias_url =
@@ -140,7 +192,12 @@
 ## api access to raw_files put `FilesController:raw`, to enable access to patches
 ## add `ChangesetController:changeset_patch`. This list should be "," separated
 ## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
+## Recommended settings bellow are commented out:
 api_access_controllers_whitelist =
+#    ChangesetController:changeset_patch,
+#    ChangesetController:changeset_raw,
+#    FilesController:raw,
+#    FilesController:archivefile
 
 ## alternative_gravatar_url allows you to use your own avatar server application
 ## the following parts of the URL will be replaced
@@ -208,7 +265,7 @@
 ## a prefix key for this instance used for cache invalidation when running 
 ## multiple instances of rhodecode, make sure it's globally unique for 
 ## all running rhodecode instances. Leave empty if you don't use it
-instance_id = 
+instance_id =
 
 ## alternative return HTTP header for failed authentication. Default HTTP
 ## response is 401 HTTPUnauthorized. Currently HG clients have troubles with 
@@ -427,7 +484,7 @@
 #########################################################
 
 # SQLITE [default]
-sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db
+sqlalchemy.db1.url = sqlite:///%(here)s/rhodecode.db?timeout=30
  
 # POSTGRESQL
 # sqlalchemy.db1.url = postgresql://user:pass@localhost/rhodecode