We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.

changeset 136:4f080a258623

dev-vcs/kallithea: more config changes
author Daniel Neugebauer <dneuge@energiequant.de>
date Mon, 28 Mar 2016 15:56:07 +0200
parents f77525122775
children e08c1ff80cad
files dev-vcs/kallithea/Manifest dev-vcs/kallithea/kallithea-0.3.1.ebuild
diffstat 2 files changed, 57 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dev-vcs/kallithea/Manifest	Mon Mar 28 14:22:35 2016 +0200
+++ b/dev-vcs/kallithea/Manifest	Mon Mar 28 15:56:07 2016 +0200
@@ -1,5 +1,5 @@
 AUX production.wsgi 448 SHA256 34aa607585b8526356d0a4e7103689a4c353e333bfd7dbd9316dea1601403af6 SHA512 f1d6310626ce5687317d856e4be2ea37d4d39dea5402846c64195d77cef1454ef96d3c6d23832a9a0c8ecdc6645582bc86b138cc7fbb7dc78226f45279d44f7a WHIRLPOOL cfee76d169facea538b00fdd9683a9ecefe58cd49f3c2f3f46e49025af459e5a8bdd236ea55252d5488ee52212f2f57423f3d8e21ddb2251e25851bffc93d243
 AUX start-virtualenv.sh 463 SHA256 2f5def6c4840b94b78055fcc3f3e37aa42dd709e4e71dfa16d1fc63966274456 SHA512 0912644b3806b9c04d301f5f2f59c9b212549e73dec848a324fb0dd8bc9410e60750a571a3438ccc4b9dd940020986b67a9f3bb29a7fd27945daa2ae4c24139d WHIRLPOOL f4cbb8e583ec907baaa0801c6c2f73a9832689422654661079d420002a6c55ff872f8af1b4a2b78e50085f90e2c8d5876e93a436c443ac75f9d589510d8f615c
 DIST Kallithea-0.3.1.tar.bz2 5320317 SHA256 9c6cac42d99da475af63012265f986c4d743a07e81c18f4744b3bf8be84aad7d SHA512 09bf8552d00176258dc2f00fc8a186bb95e0f12b535db836bf6a404bc41821805c144056af76f69eec66926ce3226ba0a6b3776abb8d717f5bbe5b33faa81beb WHIRLPOOL d05b0cbf7f9613571116efc10a0d99b1944c2c2ae4ede37dfde074120839bd40c2c0708f5028e2018f9d1fb4a24a7ef42b84f211c1fdef13200b2b7ee765f85f
-EBUILD kallithea-0.3.1.ebuild 10277 SHA256 df075c3ddb77b7e00f0240e989e15766545d2e34585472074df7ab563050d7f7 SHA512 a5d1d3116ca0fa165c92485d882fdf9a78449ab5d8aa472868e7c38e64f4bf23a503ce2a300e8b0ce4e47f4048a5008f6699583457a2585b84eb06d82174eaf3 WHIRLPOOL 6f6b0fb51e9604df2aab5c1397ccd5a3c5bd1b894fd58abd64d1b510134bcaeb6cd6fd3dda00decfbea26d16ef49776bd1638feabec251f5cbdabb8f5a7e032a
+EBUILD kallithea-0.3.1.ebuild 13420 SHA256 a99204fe079e45babd42b51fedb806829828c830c3716635e9e9ccff1c322fef SHA512 4ec19057d3aa7fefe189f7e05bf0fddc0bbc64c889471f13120e3d8708642020b114b12f02d441492bf1f8fd47cf5e8df8eac080b034c2b8685583588b76ce8e WHIRLPOOL c83dbb591a710d995253ca5e0d17cda66923bae9ce611a9fdabdde86b5e30e083c86dde566c19dc24d3233e13617d0875b31a6a11e77aa8a4b2969fb6066695a
 EBUILD kallithea-9999.ebuild 8413 SHA256 0455764589e04a214f885831587ab57a823994f9e57bda1b969f2ff746b59d03 SHA512 3e6b0a1ef1f2c1316f8690336a7d1516ac80cce301d8ac85f8b4adcb7b86780fd56328338c7c271dee0de505f54c324c1339b2b619ecc1a7169e67aac3cd4eae WHIRLPOOL 97827448c10e7ec8bd94ff129a5a9b3b2f94dde815d8a357c28b0e8e6f3c1a0768381133e730f0b0472750920cc55f9276aa0822bddc0581be0f3b2ec76eccfa
--- a/dev-vcs/kallithea/kallithea-0.3.1.ebuild	Mon Mar 28 14:22:35 2016 +0200
+++ b/dev-vcs/kallithea/kallithea-0.3.1.ebuild	Mon Mar 28 15:56:07 2016 +0200
@@ -22,7 +22,9 @@
 
 RDEPEND="dev-python/virtualenv"
 
-DEPEND="${RDEPEND}"
+DEPEND="${RDEPEND} \
+	app-arch/unzip \
+	sys-apps/sed"
 
 LICENSE="GPL-3"
 SLOT="0"
@@ -38,6 +40,7 @@
 
 urlDocumentationSetup="http://kallithea.readthedocs.org/en/${PV}/setup.html"
 urlDocumentationRhodeCode="http://kallithea.readthedocs.org/en/${PV}/readme.html#converting-from-rhodecode"
+urlDocumentationMegacoffee="http://gentoo-overlay.megacoffee.net/s/docs-kallithea-apache-mod_wsgi"
 
 pkg_setup() {
 	# create user and group
@@ -98,8 +101,6 @@
 		fi
 	done
 	
-	# TODO: remove dummy config & directory
-	
 	# create config
 	mkdir "${realWorkDir}/etc"
 	cd "${realWorkDir}/etc"
@@ -109,7 +110,46 @@
 	sed -i -e "s/%(here)s\(\/\(tarballcache\|data\)\)/${installDataPath//\//\\/}\1/" production.ini
 	sed -i -e "s/%(here)s\(\/kallithea.db\)/${installDataPath//\//\\/}\1/" production.ini
 	
-	# TODO: only log WARN by default?
+	# rewrite config to only log from WARN level to "console"
+	# By Kallithea defaults, handler_console logs everything from INFO level to "console".
+	# As mod_wsgi logs everything from "console" to error_log this results in a huge amount
+	# of unnecessary log entries which we would like to prevent.
+	# NOTE: As sed syntax is hard to read... this replacement rule is prefixed with an "address" which
+	#       is being defined by two regexps, effectively restricting replacements just to the
+	#       handler_console section of our ini file.
+	sed -i -e '/^\[handler_console\]/,/^\[/ s/level\s*=\s*INFO/level = WARN/' production.ini
+	
+	# rewrite config to disable debug mode
+	# By default, Kallithea uses debug = true which should *NOT* be used except during development.
+	# See: http://kallithea.readthedocs.org/en/0.3.1/usage/debugging.html
+	sed -i -e '/^\[DEFAULT\]/,/^\[/ s/\(debug\s*=\s*\)true/\1false/' production.ini
+	
+	## (disabled, does not work from sandbox)
+	## maintain system-unique variables from previous production.ini if available
+	#previousProductionConfig="${installConfigPath}/production.ini"
+	#if [ -e "${previousProductionConfig}" ]; then
+	#	previousAppInstanceUUID="$(grep -oE '^\s*app_instance_uuid\s*=\s*[0-9a-f\-]+' /etc/kallithea/production.ini | cut -d'=' -f2 | tr -d ' ')"
+	#	previousBeakerSessionSecret="$(grep -oE '^\s*beaker\.session\.secret\s*=\s*[0-9a-f\-]+' "${previousProductionConfig}" | cut -d'=' -f2 | tr -d ' ')"
+	#	
+	#	if [ ! -z "${previousAppInstanceUUID}" ]; then
+	#		echo 'Transferring previous app instance UUID to new production.ini'
+	#		sed -i -e "s/^\(\s*app_instance_uuid\s*=\s*\).*/\1${previousAppInstanceUUID}/" production.ini
+	#	fi
+	#	
+	#	if [ ! -z "${previousBeakerSessionSecret}" ]; then
+	#		echo 'Transferring previous Beaker session secret to new production.ini'
+	#		sed -i -e "s/^\(\s*beaker\.session\.secret\s*=\s*\).*/\1${previousBeakerSessionSecret}/" production.ini
+	#	fi
+	#fi
+	
+	# remove newly generated UUID and Beaker session secret from config
+	# as user should configure that instead and config diffs don't show
+	# unnecessary stuff
+	sed -i -e "s/^\(\s*app_instance_uuid\s*=\).*/#\1 (run uuidgen and insert the returned UUID here)/" production.ini
+	sed -i -e "s/^\(\s*beaker\.session\.secret\s*=\).*/#\1 (run uuidgen and insert the returned UUID here)/" production.ini
+	
+	# rename production.ini as it requires more configuration and is hard to read
+	mv production.ini production.ini.example
 	
 	# rewrite virtualenv directory to later installation directory
 	oldIFS="${IFS}"
@@ -143,7 +183,7 @@
 	diropts -m750 -oroot -gkallithea
 	insopts -m640 -oroot -gkallithea
 	insinto "${installConfigPath}"
-	doins "${S}/etc/production.ini"
+	doins "${S}/etc/production.ini.example"
 	insopts -m644 -oroot -gkallithea
 	doins "${S}/etc/production.wsgi"
 	
@@ -156,8 +196,12 @@
 	#               1         2         3         4         5         6         7         8
 	#      12345678901234567890123456789012345678901234567890123456789012345678901234567890
 	einfo "An example configuration file has already been created so you don't need to run"
-	einfo "make-config again, see:"
-	einfo "    ${installConfigPath}/production.ini"
+	einfo "make-config again; please copy and edit carefully on first setup:"
+	einfo "    cp -a ${installConfigPath}/production.ini.example ${installConfigPath}/production.ini"
+	einfo "    \$EDITOR ${installConfigPath}/production.ini"
+	einfo ""
+	einfo "After updates, please compare what has changed and copy any necessary changes:"
+	einfo "    diff -u ${installConfigPath}/production.ini ${installConfigPath}/production.ini.example"
 	einfo ""
 	einfo "You still need to follow Kallithea's other setup steps according to the"
 	einfo "instructions at:"
@@ -169,6 +213,11 @@
 	einfo ""
 	einfo "    source ${installBasePath}/${virtualenvActivationPath}"
 	einfo ""
+	einfo "We altered the default config slightly. It may be best to have a look at our"
+	einfo "short example on how to setup hosting with Apache and mod_wsgi, even if you"
+	einfo "prefer another method of hosting Kallithea:"
+	einfo "    ${urlDocumentationMegacoffee}"
+	einfo ""
 	#einfo "We can wrap those commands for you if you run (no prior activation needed):"
 	#einfo "    emerge --config =${CATEGORY}/${PF}"
 	#einfo ""