LQPP/Installation
< LQPP
Inhaltsverzeichnis
LiquidFeedback Komponenten Installieren
#########################################################
##
## Festlegen der zu installierenden Versionen:
##
export VERSION_WEBMCP="v1.1.1"
export VERSION_ROCKETWIKI="v0.2"
export VERSION_CORE="v1.1.0"
export VERSION_FRONTEND="beta19"
##
#########################################################
# Install dependencies and utilities:
apt-get install lighttpd postgresql libpq-dev lua5.1 liblua5.1-0-dev build-essential ghc libghc6-parsec-dev imagemagick sudo
# Make sure we do not overwrite a running instance
if test -e /opt/liquid_feedback
then
echo "ERROR: /opt/liquid_feedback already exists. EXIT."
exit 1
fi
# Download von WebMCP, RocketWiki, Core und Frontend:
mkdir -p /usr/src/liquid_feedback
cd /usr/src/liquid_feedback || exit 1
wget http://www.public-software-group.org/pub/projects/webmcp/${VERSION_WEBMCP}/webmcp-${VERSION_WEBMCP}.tar.gz || exit 1
wget http://www.public-software-group.org/pub/projects/rocketwiki/liquid_feedback_edition/${VERSION_ROCKETWIKI}/rocketwiki-lqfb-${VERSION_ROCKETWIKI}.tar.gz || exit 1
wget http://www.public-software-group.org/pub/projects/liquid_feedback/backend/${VERSION_CORE}/liquid_feedback_core-${VERSION_CORE}.tar.gz || exit 1
wget http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/${VERSION_FRONTEND}/liquid_feedback_frontend-${VERSION_FRONTEND}.tar.gz || exit 1
# Erstellen des Betriebsverzeichnisses:
mkdir -p /opt/liquid_feedback
# ACHTUNG: Alle weiteren Befehle erwarten, dass sie aus
# ======== diesem Verzeichnis heraus ausgefuehrt werden.
# Installieren von WebMCP:
cd /opt/liquid_feedback || exit 1
tar xvzf /usr/src/liquid_feedback/webmcp-${VERSION_WEBMCP}.tar.gz
mv webmcp-${VERSION_WEBMCP} webmcp || exit 1
# OPTIONALER Schritt (nur für 64bit Systeme):
#sed -i webmcp/Makefile.options -e 's/^CFLAGS = -O2/CFLAGS = -fPIC -O2/g'
# OPTIONALER Schritt ENDE
make -C webmcp || exit 1
# Installieren von RocketWiki:
cd /opt/liquid_feedback || exit 1
tar xvzf /usr/src/liquid_feedback/rocketwiki-lqfb-${VERSION_ROCKETWIKI}.tar.gz
mv rocketwiki-lqfb-${VERSION_ROCKETWIKI} rocketwiki || exit 1
make -C rocketwiki || exit 1
# Installieren von LiquidFeedback-Core:
cd /opt/liquid_feedback || exit 1
tar xvzf /usr/src/liquid_feedback/liquid_feedback_core-${VERSION_CORE}.tar.gz
mv liquid_feedback_core-${VERSION_CORE} core || exit 1
make -C core
# Installieren des LiquidFeedback-Frontends:
cd /opt/liquid_feedback || exit 1
tar xvzf /usr/src/liquid_feedback/liquid_feedback_frontend-${VERSION_FRONTEND}.tar.gz
mv liquid_feedback_frontend-${VERSION_FRONTEND}/ webapp || exit 1
sed -i webapp/fastpath/getpic.c -e 's|/liquid_feedback_testing/app/|/liquid_feedback/webapp/|g' || exit 1
#mkdir webapp/pp
#cp webapp/fastpath/getpic.c webapp/pp/
#sed -i webapp/pp/getpic.c -e 's|dbname=liquid_feedback"|dbname=liquid_feedback_pp"|g'
#make -C webapp/pp -f ../fastpath/Makefile
# TMP-Verzeichnis beschreibbar machen:
chown /opt/liquid_feedback/www-data webapp/tmp/
# Logo herunterladen:
wget http://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Piratpartiet.svg/48px-Piratpartiet.svg.png -O /opt/liquid_feedback/webapp/static/logo.png
Webconfig fuer LiquidFeedback erstellen:
Datei '/etc/lighttpd/conf-available/42-liquid_feedback.conf' mit folgendem Inhalt erstellen:
server.modules += (
"mod_cgi",
"mod_alias",
"mod_setenv",
"mod_rewrite",
"mod_redirect",
)
# Redirect fuer /lf/ auf /pp/
url.redirect += (
"^/lf$" => "/pp/",
"^/lf/(.*)" => "/pp/$1",
)
# Enable CGI-Execution of *.lua files through lua binary
cgi.assign += ( ".lua" => "/usr/bin/lua" )
# Connect external URLs to server static files and the webmcp cgi interface
alias.url += (
"/pp/fastpath/" => "/opt/liquid_feedback/webapp/fastpath/pp/",
"/pp/static/" => "/opt/liquid_feedback/webapp/static/",
"/pp/" => "/opt/liquid_feedback/webmcp/framework/cgi-bin/"
)
$HTTP["url"] =~ "^/pp/" {
setenv.add-environment += (
"WEBMCP_CONFIG_NAME" => "piraten-pp",
"WEBMCP_APP_BASEPATH" => "/opt/liquid_feedback/webapp",
)
}
# URL beautification
url.rewrite-once += (
# do not rewrite redirects from /lf/
"^(/lf.*)" => "$1",
# do not rewrite static URLs
"^/([a-z][a-z])/fastpath/(.*)$" => "/$1/fastpath/$2",
"^/([a-z][a-z])/static/(.*)$" => "/$1/static/$2",
# base URL
"^/([a-z][a-z])/(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=0&_webmcp_module=index&_webmcp_view=index&$3",
# module base URLs
"^/([a-z][a-z])/([^/\?]+)/(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$2&_webmcp_view=index&$4",
# actions
"^/([a-z][a-z])/([^/\?]+)/([^/\.\?]+)(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$2&_webmcp_action=$3&$5",
# views without numeric id or string ident
"^/([a-z][a-z])/([^/\?]+)/([^/\.\?]+)\.([^/\?]+)(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$2&_webmcp_view=$3&_webmcp_suffix=$4&$6",
# views with numeric id or string ident
"^/([a-z][a-z])/([^/\?]+)/([^/\?]+)/([^/\.\?]+)\.([^/\?]+)(\?(.*))?$" => "/$1/webmcp-wrapper.lua?_webmcp_urldepth=2&_webmcp_module=$2&_webmcp_view=$3&_webmcp_id=$4&_webmcp_suffix=$5&$7",
)
# Redirects for URLs without trailing slashes
url.redirect += (
# base URL without trailing slash
"^/([a-z][a-z])$" => "/$1/",
# module base URL without trailing slash
"^/([a-z][a-z])/([^/\?]+)$" => "/$1/$2/",
)
$SERVER["socket"] == ":80" {
url.redirect += (
"^/(.*)$" => "https://lqfb.piratenpartei.de$0"
)
}
$HTTP["url"] =~ "^/pp/fastpath/" {
cgi.assign = ( "" => "" )
setenv.add-response-header = ( "Cache-Control" => "private; max-age=86400" )
}
Und als Modul aktivieren:
lighttpd-enable-mod liquid_feedback
LiquidFeedback konfigurieren
Die Datei '/opt/liquid_feedback/webapp/config/pp.lua' mit dem folgendem Inhalt erzeugen:
----------------------------------------------------- -- GENERAL ----------------------------------------------------- config.app_name = "Liquid Feedback" config.app_version = "beta19" config.instance_name = "Piratenpartei" config.instance_prefix = "pp" config.absolute_base_url = "https://lqfb.piratenpartei.de/".. config.instance_prefix .. "/" config.app_title = config.app_name .. " der Piratenpartei Deutschland" config.app_logo = "logo.png" config.mail_subject_prefix = "[lqfb.piratenpartei.de] " config.mail_from = { name = "lqfb.piratenpartei.de", address = "support@lqfb.piratenpartei.de" } request.set_404_route{ module = 'index', view = '404' } config.member_image_default_file = { avatar = "avatar.jpg", photo = nil } config.member_image_content_type = "image/jpeg" config.member_image_convert_func = { avatar = function(data) return os.pfilter(data, "convert", "-define", "jpeg:size=48x48" , "-", "-flatten", "-thumbnail", "48x48", "-interlace", "Line", "jpeg:-") end, photo = function(data) return os.pfilter(data, "convert", "-define", "jpeg:size=240x240", "-", "-flatten", "-thumbnail", "240x240", "-interlace", "Line", "jpeg:-") end } ----------------------------------------------------- -- DATABASE ----------------------------------------------------- db = assert(mondelefant.connect{ engine='postgresql', dbname='liquid_feedback_' .. config.instance_prefix }) at_exit(function() db:close() end) function mondelefant.class_prototype:get_db_conn() return db end -- enable output of SQL commands in trace system function db:sql_tracer(command) return function(error_info) local error_info = error_info or {} trace.sql{ command = command, error_position = error_info.position } end end -- TODO abstraction -- get record by id function mondelefant.class_prototype:by_id(id) local selector = self:new_selector() selector:add_where{ 'id = ?', id } selector:optional_object_mode() return selector:exec() end ----------------------------------------------------- -- FEATURES ----------------------------------------------------- config.issue_discussion_url_func = function(issue) return "http://piratenpad.de/" .. string.upper(config.instance_prefix) .. ":LiquidFeedback_Themendiskussion_" .. issue.id end config.formatting_engine_executeables = { rocketwiki= "/opt/liquid_feedback/rocketwiki/rocketwiki-lqfb", compat = "/opt/liquid_feedback/rocketwiki/rocketwiki-lqfb-compat" } config.public_access = "pseudonym" -- Available options: "anonymous", "pseudonym" config.api_enabled = true config.feature_rss_enabled = false -- currently broken config.download_dir = "/opt/liquid_feedback/download/pp/" ----------------------------------------------------- -- LEGAL STUFF ----------------------------------------------------- config.app_service_provider = "Piratenpartei Deutschland (PIRATEN)<br />Pflugstr. 9a<br />10115 Berlin<br /><br />E-Mail Support: <a href='mailto:support@lqfb.piratenpartei.de'>support@lqfb.piratenpartei.de</a><br /><br \>E-Mail Administratoren: <a href='mailto:admins@lqfb.piratenpartei.de'>admins@lqfb.piratenpartei.de</a><br /><br />Weitere Informationen & FAQ: <a href='http://wiki.piratenpartei.de/LQPP'>http://wiki.piratenpartei.de/LQPP</a>" config.use_terms = "=== Nutzungsbedingungen ===\n1. Wenn man keine Ahnung hat, einfach mal Kresse halten." config.download_use_terms = "Es gelten die [https://lqfb.piratenpartei.de/pp/index/usage_terms.html Nutzungsbedingungen], insbesondere Punkt 1 ist zu beachten:\n\n" ----------------------------------------------------- -- PERFORMANCE ----------------------------------------------------- --FIXME: Fastpath ist momentan defekt (Rücksprache Dark) ! --config.fastpath_url_func = function(member_id, image_type) -- return "https://lqfb.piratenpartei.de/" .. config.instance_prefix .. "/fastpath/getpic?" .. tostring(member_id) .. "+" .. tostring(image_type) --end --TODO: Können wir das folgende aktivieren ? -- uncomment the following two lines to use C implementations of chosen -- functions and to disable garbage collection during the request, to -- increase speed: -- -- require 'webmcp_accelerator' -- collectgarbage("stop") ----------------------------------------------------- -- What's that ----------------------------------------------------- --TODO: Können wir den OpenID Kram rausschmeißen ? -- OpenID authentication is not fully implemented yet, DO NOT USE BEFORE THIS NOTICE HAS BEEN REMOVED! config.auth_openid_enabled = false config.auth_openid_https_as_default = true config.auth_openid_identifier_check_func = function(uri) return false end --TODO: Braucen wir das ? request.set_allowed_json_request_slots{ "title", "actions", "support", "default", "trace", "system_error" } if request.get_json_request_slots() then request.force_absolute_baseurl() end request.set_absolute_baseurl(config.absolute_base_url)
Adminaccount erstellen
su - www-data
cd /opt/liquid_feedback/webapp
../webmcp/framework/bin/webmcp_shell pp
member = Member:by_id(1)
member:set_password("sesam")
member:save()
CTRL-d
exit