Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos
Commits
e15d88f4
Commit
e15d88f4
authored
Apr 03, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tt-rss'
parents
51529c39
5b5df7cd
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
960 additions
and
5 deletions
+960
-5
setup.py
setup.py
+1
-0
slapos/recipe/apachephp/__init__.py
slapos/recipe/apachephp/__init__.py
+3
-0
slapos/recipe/apachephpconfigure/__init__.py
slapos/recipe/apachephpconfigure/__init__.py
+132
-0
slapos/recipe/apachephpconfigure/runner.py
slapos/recipe/apachephpconfigure/runner.py
+28
-0
slapos/recipe/request.py
slapos/recipe/request.py
+1
-1
software/tt-rss/instance-custom.cfg.in
software/tt-rss/instance-custom.cfg.in
+16
-0
software/tt-rss/script/tt-rss.sql
software/tt-rss/script/tt-rss.sql
+513
-0
software/tt-rss/software.cfg
software/tt-rss/software.cfg
+49
-0
software/tt-rss/template/config.php.in
software/tt-rss/template/config.php.in
+197
-0
stack/lamp/apache/instance-apache-php.cfg.in
stack/lamp/apache/instance-apache-php.cfg.in
+4
-0
stack/lamp/buildout.cfg
stack/lamp/buildout.cfg
+16
-4
No files found.
setup.py
View file @
e15d88f4
...
...
@@ -73,6 +73,7 @@ setup(name=name,
'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe'
,
'apacheperl = slapos.recipe.apacheperl:Recipe'
,
'apachephp = slapos.recipe.apachephp:Recipe'
,
'apachephpconfigure = slapos.recipe.apachephpconfigure:Recipe'
,
'apacheproxy = slapos.recipe.apacheproxy:Recipe'
,
'certificate_authority = slapos.recipe.certificate_authority:Recipe'
,
'certificate_authority.request = slapos.recipe.certificate_authority:Request'
,
...
...
slapos/recipe/apachephp/__init__.py
View file @
e15d88f4
...
...
@@ -101,6 +101,9 @@ class Recipe(GenericBaseRecipe):
mysql_ip
=
self
.
options
[
'mysql-host'
],
mysql_port
=
self
.
options
[
'mysql-port'
],
secret_key
=
secret_key
,
ip
=
'[%s]'
%
self
.
options
[
'ip'
],
port
=
self
.
options
[
'port'
],
# XXX-Cedric: add frontend url.
)
directory
,
file_
=
os
.
path
.
split
(
self
.
options
[
'configuration'
])
...
...
slapos/recipe/apachephpconfigure/__init__.py
0 → 100644
View file @
e15d88f4
##############################################################################
#
# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
zc.buildout
import
sys
import
zc.recipe.egg
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
"""
Taken out from the old "lamp" recipe. Allows do configure a LAMP instance.
"""
self
.
path_list
=
[]
document_root
=
self
.
options
[
'htdocs'
]
url
=
self
.
options
.
get
(
'url'
,
''
)
mysql_conf
=
{
'mysql_host'
:
self
.
options
[
'mysql-host'
],
'mysql_port'
:
self
.
options
[
'mysql-port'
],
'mysql_user'
:
self
.
options
[
'mysql-username'
],
'mysql_password'
:
self
.
options
[
'mysql-password'
],
'mysql_database'
:
self
.
options
[
'mysql-database'
],
}
self
.
configureInstallation
(
document_root
,
url
,
mysql_conf
)
return
self
.
path_list
def
configureInstallation
(
self
,
document_root
,
url
,
mysql_conf
):
"""Start process which can launch python scripts, move or remove files or
directories when installing software.
"""
if
not
self
.
options
.
has_key
(
'delete'
)
and
not
self
.
options
.
has_key
(
'rename'
)
and
not
\
self
.
options
.
has_key
(
'chmod'
)
and
not
self
.
options
.
has_key
(
'script'
)
and
not
self
.
options
.
has_key
(
'sql-script'
):
return
""
delete
=
[]
chmod
=
[]
data
=
[]
rename
=
[]
rename_list
=
""
argument
=
[
self
.
options
[
'lampconfigure'
],
"-H"
,
mysql_conf
[
'mysql_host'
],
"-P"
,
mysql_conf
[
'mysql_port'
],
"-p"
,
mysql_conf
[
'mysql_password'
],
"-u"
,
mysql_conf
[
'mysql_user'
]]
if
not
self
.
options
.
has_key
(
'file_token'
):
argument
=
argument
+
[
"-d"
,
mysql_conf
[
'mysql_database'
],
"--table"
,
self
.
options
[
'table_name'
].
strip
(),
"--cond"
,
self
.
options
.
get
(
'constraint'
,
'1'
).
strip
()]
else
:
argument
=
argument
+
[
"-f"
,
self
.
options
[
'file_token'
].
strip
()]
argument
+=
[
"-t"
,
document_root
]
if
self
.
options
.
has_key
(
'delete'
):
delete
=
[
"delete"
]
for
fname
in
self
.
options
[
'delete'
].
split
(
','
):
delete
.
append
(
fname
.
strip
())
if
self
.
options
.
has_key
(
'rename'
):
for
fname
in
self
.
options
[
'rename'
].
split
(
','
):
if
fname
.
find
(
"=>"
)
<
0
:
old_name
=
fname
fname
=
[]
fname
.
append
(
old_name
)
fname
.
append
(
old_name
+
'-'
+
mysql_conf
[
'mysql_user'
])
else
:
fname
=
fname
.
split
(
"=>"
)
cmd
=
[
"rename"
]
if
self
.
options
.
has_key
(
'rename_chmod'
):
cmd
+=
[
"--chmod"
,
self
.
options
[
'rename_chmod'
].
strip
()]
rename
.
append
(
cmd
+
[
fname
[
0
].
strip
(),
fname
[
1
].
strip
()])
rename_list
+=
fname
[
0
]
+
" to "
+
fname
[
1
]
+
" "
if
self
.
options
.
has_key
(
'chmod'
):
chmod
=
[
"chmod"
,
self
.
options
[
'mode'
].
strip
()]
for
fname
in
self
.
options
[
'chmod'
].
split
(
','
):
chmod
.
append
(
fname
.
strip
())
if
self
.
options
.
has_key
(
'script'
)
and
\
self
.
options
[
'script'
].
strip
().
endswith
(
".py"
):
data
=
[
"run"
,
self
.
options
[
'script'
].
strip
(),
"-v"
,
mysql_conf
[
'mysql_database'
],
url
,
document_root
]
if
self
.
options
.
has_key
(
'sql-script'
):
data
=
[
"sql"
,
self
.
options
[
'sql-script'
].
strip
(),
"-v"
,
mysql_conf
[
'mysql_database'
],
url
,
document_root
]
# TODO factor
if
delete
!=
[]:
print
"Creating lampconfigure with 'delete' arguments"
command
=
argument
+
delete
if
rename
!=
[]:
for
parameters
in
rename
:
print
"Creating lampconfigure with 'rename' arguments"
command
=
argument
+
rename
if
chmod
!=
[]:
print
"Creating lampconfigure with 'chmod' arguments"
command
=
argument
+
chmod
if
data
!=
[]:
print
"Creating lampconfigure with 'run' arguments"
command
=
argument
+
data
configureinstall_wrapper_path
=
self
.
createPythonScript
(
self
.
options
[
'configureinstall-location'
],
__name__
+
'.runner.executeRunner'
,
[
argument
,
delete
,
rename
,
chmod
,
data
]
)
#TODO finish to port this and remove upper one
#configureinstall_wrapper_path = self.createPythonScript(
# self.options['configureinstall-location'],
# 'slapos.lamp.run',
# [command]
#)
self
.
path_list
.
append
(
configureinstall_wrapper_path
)
return
rename_list
slapos/recipe/apachephpconfigure/runner.py
0 → 100644
View file @
e15d88f4
import
subprocess
def
executeRunner
(
args
):
"""Start the instance configure. this may run a python script, move or/and rename
file or directory when dondition is filled. the condition may be when file exist or when an entry
exist into database.
"""
arguments
,
delete
,
rename
,
chmod
,
data
=
args
if
delete
!=
[]:
print
"Calling lampconfigure with 'delete' arguments"
result
=
subprocess
.
Popen
(
arguments
+
delete
)
result
.
wait
()
if
rename
!=
[]:
for
parameters
in
rename
:
print
"Calling lampconfigure with 'rename' arguments"
result
=
subprocess
.
Popen
(
arguments
+
parameters
)
result
.
wait
()
if
chmod
!=
[]:
print
"Calling lampconfigure with 'chmod' arguments"
result
=
subprocess
.
Popen
(
arguments
+
chmod
)
result
.
wait
()
if
data
!=
[]:
print
"Calling lampconfigure with 'run' arguments"
print
arguments
+
data
result
=
subprocess
.
Popen
(
arguments
+
data
)
result
.
wait
()
return
slapos/recipe/request.py
View file @
e15d88f4
...
...
@@ -195,7 +195,7 @@ class RequestOptional(Recipe):
self
.
logger
.
warning
(
'Optional request failed.'
)
if
not
isinstance
(
self
.
_raise_request_exception
,
slapmodule
.
NotFoundError
):
# full traceback for optional 'not found' is too verbose and confusing
self
.
logger
.
warnin
g
(
self
.
_raise_request_exception_formatted
)
self
.
logger
.
debu
g
(
self
.
_raise_request_exception_formatted
)
elif
self
.
failed
is
not
None
:
# Check instance status to know if instance has been deployed
try
:
...
...
software/tt-rss/instance-custom.cfg.in
0 → 100644
View file @
e15d88f4
[buildout]
# Run a SQL script to populate DB at first run
[tt-rss-init]
recipe = slapos.cookbook:apachephpconfigure
table_name = db.ttrss_users
#constraint = `pn_id`>0
lampconfigure = ${buildout:bin-directory}/lampconfigure
htdocs = $${apache-php:htdocs}
mysql-username = $${apache-php:mysql-username}
mysql-password = $${apache-php:mysql-password}
mysql-database = $${apache-php:mysql-database}
mysql-host = $${apache-php:mysql-host}
mysql-port = $${apache-php:mysql-port}
configureinstall-location = $${basedirectory:scripts}/configureInstall
sql-script = ${sql-script:location}/${sql-script:filename}
\ No newline at end of file
software/tt-rss/script/tt-rss.sql
0 → 100644
View file @
e15d88f4
This diff is collapsed.
Click to expand it.
software/tt-rss/software.cfg
0 → 100644
View file @
e15d88f4
[buildout]
extends =
../../stack/lamp/buildout.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = https://github.com/gothfox/Tiny-Tiny-RSS/archive/1.7.5.tar.gz
#md5sum = a81cea71701404cebf64c07b7ac6c948
strip-top-level-dir = true
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template/config.php.in
#md5sum = Student may put here md5sum of this file, this is good idea
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = config.php
[sql-script]
recipe = slapos.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/script/tt-rss.sql
#md5sum = c4d5f87d8f02cad3f20e679160195f48
filename = tt-rss.sql
mode = 0744
# XXX Should disappear and be integrated into apachephpconfigure
[configure-script]
recipe = slapos.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/configure-tt-rss.py
#md5sum = c4d5f87d8f02cad3f20e679160195f48
filename = configure-tt-rss.py
mode = 0744
[custom-application-deployment-template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-custom.cfg.in
output = ${buildout:directory}/instance-custom.cfg
#md5sum = 283cb53ff8cd34635703e771062db919
mode = 0644
[custom-application-deployment]
path = ${custom-application-deployment-template:output}
part-list = tt-rss-init
software/tt-rss/template/config.php.in
0 → 100644
View file @
e15d88f4
<?php
// *******************************************
// *** Database configuration (important!) ***
// *******************************************
define
(
'DB_TYPE'
,
"mysql"
);
// or mysql
define
(
'DB_HOST'
,
"%(mysql_host)s"
);
define
(
'DB_USER'
,
"%(mysql_user)s"
);
define
(
'DB_NAME'
,
"%(mysql_database)s"
);
define
(
'DB_PASS'
,
"%(mysql_password)s"
);
define
(
'MYSQL_CHARSET'
,
'UTF8'
);
// Connection charset for MySQL. If you have a legacy database and/or experience
// garbage unicode characters with this option, try setting it to a blank string.
// ***********************************
// *** Basic settings (important!) ***
// ***********************************
//FIXME set frontend URL
define
(
'SELF_URL_PATH'
,
'http://%(ip)s:%(port)s'
);
// Full URL of your tt-rss installation. This should be set to the
// location of tt-rss directory, e.g. http://yourserver/tt-rss/
// You need to set this option correctly otherwise several features
// including PUSH, bookmarklets and browser integration will not work properly.
define
(
'SINGLE_USER_MODE'
,
true
);
// Operate in single user mode, disables all functionality related to
// multiple users.
define
(
'SIMPLE_UPDATE_MODE'
,
false
);
// Enables fallback update mode where tt-rss tries to update feeds in
// background while tt-rss is open in your browser.
// If you don't have a lot of feeds and don't want to or can't run
// background processes while not running tt-rss, this method is generally
// viable to keep your feeds up to date.
// Still, there are more robust (and recommended) updating methods
// available, you can read about them here: http://tt-rss.org/wiki/UpdatingFeeds
// *****************************
// *** Files and directories ***
// *****************************
//FIXME
define
(
'PHP_EXECUTABLE'
,
'/usr/bin/php'
);
// Path to PHP executable, used for various command-line tt-rss programs
define
(
'LOCK_DIRECTORY'
,
'lock'
);
// Directory for lockfiles, must be writable to the user you run
// daemon process or cronjobs under.
define
(
'CACHE_DIR'
,
'cache'
);
// Local cache directory for RSS feed content.
define
(
'ICONS_DIR'
,
"feed-icons"
);
define
(
'ICONS_URL'
,
"feed-icons"
);
// Local and URL path to the directory, where feed favicons are stored.
// Unless you really know what you're doing, please keep those relative
// to tt-rss main directory.
// **********************
// *** Authentication ***
// **********************
// Please see PLUGINS below to configure various authentication modules.
define
(
'AUTH_AUTO_CREATE'
,
true
);
// Allow authentication modules to auto-create users in tt-rss internal
// database when authenticated successfully.
define
(
'AUTH_AUTO_LOGIN'
,
true
);
// Automatically login user on remote or other kind of externally supplied
// authentication, otherwise redirect to login form as normal.
// If set to true, users won't be able to set application language
// and settings profile.
// *********************
// *** Feed settings ***
// *********************
define
(
'FORCE_ARTICLE_PURGE'
,
0
);
// When this option is not 0, users ability to control feed purging
// intervals is disabled and all articles (which are not starred)
// older than this amount of days are purged.
// *** PubSubHubbub settings ***
define
(
'PUBSUBHUBBUB_HUB'
,
''
);
// URL to a PubSubHubbub-compatible hub server. If defined, "Published
// articles" generated feed would automatically become PUSH-enabled.
define
(
'PUBSUBHUBBUB_ENABLED'
,
false
);
// Enable client PubSubHubbub support in tt-rss. When disabled, tt-rss
// won't try to subscribe to PUSH feed updates.
// *********************
// *** Sphinx search ***
// *********************
define
(
'SPHINX_ENABLED'
,
false
);
// Enable fulltext search using Sphinx (http://www.sphinxsearch.com)
// Please see http://tt-rss.org/wiki/SphinxSearch for more information.
define
(
'SPHINX_INDEX'
,
'ttrss'
);
// Index name in Sphinx configuration. You can specify multiple indexes
// as a comma-separated string.
// ***********************************
// *** Self-registrations by users ***
// ***********************************
define
(
'ENABLE_REGISTRATION'
,
false
);
// Allow users to register themselves. Please be vary that allowing
// random people to access your tt-rss installation is a security risk
// and potentially might lead to data loss or server exploit. Disabled
// by default.
define
(
'REG_NOTIFY_ADDRESS'
,
'user@your.domain.dom'
);
// Email address to send new user notifications to.
define
(
'REG_MAX_USERS'
,
10
);
// Maximum amount of users which will be allowed to register on this
// system. 0 - no limit.
// **********************************
// *** Cookies and login sessions ***
// **********************************
define
(
'SESSION_COOKIE_LIFETIME'
,
86400
*
30
);
// Default lifetime of a session (e.g. login) cookie. In seconds,
// 0 means cookie will be deleted when browser closes.
// Setting this to zero will affect several user preferences
// like widescreen mode not saving.
define
(
'SESSION_EXPIRE_TIME'
,
86400
*
30
);
// Hard expiration limit for sessions. Should be
// greater or equal to SESSION_COOKIE_LIFETIME
define
(
'SESSION_CHECK_ADDRESS'
,
1
);
// Check client IP address when validating session:
// 0 - disable checking
// 1 - check first 3 octets of an address (recommended)
// 2 - check first 2 octets of an address
// 3 - check entire address
// *********************************
// *** Email and digest settings ***
// *********************************
define
(
'SMTP_FROM_NAME'
,
'Tiny Tiny RSS'
);
define
(
'SMTP_FROM_ADDRESS'
,
'noreply@your.domain.dom'
);
// Name, address and subject for sending outgoing mail. This applies
// to password reset notifications, digest emails and any other mail.
define
(
'DIGEST_SUBJECT'
,
'[tt-rss] New headlines for last 24 hours'
);
// Subject line for email digests
define
(
'SMTP_HOST'
,
''
);
// SMTP Host to send outgoing mail. Blank - use system MTA.
define
(
'SMTP_PORT'
,
''
);
// SMTP port to sent outgoing mail. Default is 25.
define
(
'SMTP_LOGIN'
,
''
);
define
(
'SMTP_PASSWORD'
,
''
);
// These two options enable SMTP authentication when sending
// outgoing mail. Only used with SMTP_HOST
// ***************************************
// *** Other settings (less important) ***
// ***************************************
define
(
'CHECK_FOR_NEW_VERSION'
,
false
);
// Check for new versions of tt-rss automatically.
define
(
'ENABLE_GZIP_OUTPUT'
,
false
);
// Selectively gzip output to improve wire performance. This requires
// PHP Zlib extension on the server.
// Enabling this can break tt-rss in several httpd/php configurations,
// if you experience weird errors and tt-rss failing to start, blank pages
// after login, or content encoding errors, disable it.
define
(
'PLUGINS'
,
'auth_remote, auth_internal, note'
);
// Comma-separated list of plugins to load automatically for all users.
// System plugins have to be specified here. Please enable at least one
// authentication plugin here (auth_*).
// Users may enable other user plugins from Preferences/Plugins but may not
// disable plugins specified in this list.
define
(
'CONFIG_VERSION'
,
26
);
// Expected config version. Please update this option in config.php
// if necessary (after migrating all new options from this file).
// vim:ft=php
?>
stack/lamp/apache/instance-apache-php.cfg.in
View file @
e15d88f4
[buildout]
extends = ${custom-application-deployment:path}
parts =
certificate-authority
...
...
@@ -13,6 +14,8 @@ parts =
frontend-promise
content-promise
publish-connection-informations
${custom-application-deployment:part-list}
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
...
...
@@ -35,6 +38,7 @@ tmp = $${buildout:directory}/tmp
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/service
scripts = $${rootdirectory:etc}/run
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
...
...
stack/lamp/buildout.cfg
View file @
e15d88f4
...
...
@@ -74,7 +74,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/apache/instance-apache-php.cfg.in
output = ${buildout:directory}/instance-apache-php.cfg
md5sum =
af0d52de4c10d5a3a64f7c92283ad959
md5sum =
296ba845c8ffe75fbc6352dd0e8ce836
mode = 0644
[instance-apache-import]
...
...
@@ -95,7 +95,7 @@ context = key templateapache instance-apache-php:output
import-list = file parts template-parts:destination
file replicated template-replicated:destination
md5sum =
4704f2788f096c7494694db72a9f6193
md5sum =
24c5d0db063e5343a3cb0db9d5fbc738
mode = 0644
[instance-resilient]
...
...
@@ -158,13 +158,25 @@ location =
[application-configuration]
location =
#----------------
[custom-application-deployment]
# Optional part allowing applications using this stack to run a custom
# instance.cfg at the end of Apache/PHP instance deployment.
# To use it in your application, just override those two parameters, like:
# path = /path/to/instance-custom.cfg
# part-list =
# part1
# part2
# See software/tt-rss/software.cfg for an example.
path =
part-list =
[eggs]
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
slapos.toolbox
slapos.toolbox
[lampconfigure]
[networkcache]
# Romain Courteaud + Sebastien Robin + Alain Takoudjou
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment