Split out lodgeit module
Move the lodgeit module to its own project. Depends-On: I0fcba109f74ae6ff31eca50137a412f4da34c261 Change-Id: I44995767b2ddb9980caf353c0e46abcbaf889652
This commit is contained in:
parent
c37b392b95
commit
fd2699e6ac
@ -59,6 +59,7 @@ SOURCE_MODULES["https://github.com/puppet-community/puppet-module-puppetboard"]=
|
|||||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-elasticsearch"]="origin/master"
|
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-elasticsearch"]="origin/master"
|
||||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-storyboard"]="origin/master"
|
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-storyboard"]="origin/master"
|
||||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-kibana"]="origin/master"
|
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-kibana"]="origin/master"
|
||||||
|
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-lodgeit"]="origin/master"
|
||||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-jenkins"]="origin/master"
|
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-jenkins"]="origin/master"
|
||||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-pip"]="origin/master"
|
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-pip"]="origin/master"
|
||||||
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-github"]="origin/master"
|
INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-github"]="origin/master"
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB |
@ -1,47 +0,0 @@
|
|||||||
# == Class: lodgeit
|
|
||||||
#
|
|
||||||
class lodgeit {
|
|
||||||
$packages = [ 'python-imaging',
|
|
||||||
'python-jinja2',
|
|
||||||
'python-pybabel',
|
|
||||||
'python-werkzeug',
|
|
||||||
'python-simplejson',
|
|
||||||
'python-pygments']
|
|
||||||
|
|
||||||
include apache
|
|
||||||
|
|
||||||
include pip
|
|
||||||
a2mod { 'proxy':
|
|
||||||
ensure => present,
|
|
||||||
}
|
|
||||||
a2mod { 'proxy_http':
|
|
||||||
ensure => present,
|
|
||||||
}
|
|
||||||
|
|
||||||
package { $packages:
|
|
||||||
ensure => present,
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! defined(Package['python-mysqldb']) {
|
|
||||||
package { 'python-mysqldb':
|
|
||||||
ensure => present,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
package { 'SQLAlchemy':
|
|
||||||
ensure => present,
|
|
||||||
provider => pip,
|
|
||||||
require => Class[pip],
|
|
||||||
}
|
|
||||||
|
|
||||||
file { '/srv/lodgeit':
|
|
||||||
ensure => directory,
|
|
||||||
}
|
|
||||||
|
|
||||||
vcsrepo { '/tmp/lodgeit-main':
|
|
||||||
ensure => latest,
|
|
||||||
provider => git,
|
|
||||||
source => 'https://git.openstack.org/openstack-infra/lodgeit',
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
# == Define: site
|
|
||||||
#
|
|
||||||
|
|
||||||
define lodgeit::site(
|
|
||||||
$port,
|
|
||||||
$db_password,
|
|
||||||
$db_host='locahost',
|
|
||||||
$db_user=$name,
|
|
||||||
$vhost_name="paste.${name}.org",
|
|
||||||
$image='') {
|
|
||||||
|
|
||||||
include apache
|
|
||||||
|
|
||||||
apache::vhost::proxy { $vhost_name:
|
|
||||||
port => 80,
|
|
||||||
dest => "http://localhost:${port}",
|
|
||||||
require => File["/srv/lodgeit/${name}"],
|
|
||||||
}
|
|
||||||
|
|
||||||
file { "/etc/init/${name}-paste.conf":
|
|
||||||
ensure => present,
|
|
||||||
content => template('lodgeit/upstart.erb'),
|
|
||||||
replace => true,
|
|
||||||
require => Package[$::apache::params::apache_name],
|
|
||||||
notify => Service["${name}-paste"],
|
|
||||||
}
|
|
||||||
|
|
||||||
file { "/srv/lodgeit/${name}":
|
|
||||||
ensure => directory,
|
|
||||||
recurse => true,
|
|
||||||
source => '/tmp/lodgeit-main',
|
|
||||||
}
|
|
||||||
|
|
||||||
if $image != '' {
|
|
||||||
file { "/srv/lodgeit/${name}/lodgeit/static/${image}":
|
|
||||||
ensure => present,
|
|
||||||
source => "puppet:///modules/lodgeit/${image}",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file { "/srv/lodgeit/${name}/manage.py":
|
|
||||||
ensure => present,
|
|
||||||
mode => '0755',
|
|
||||||
replace => true,
|
|
||||||
content => template('lodgeit/manage.py.erb'),
|
|
||||||
notify => Service["${name}-paste"],
|
|
||||||
}
|
|
||||||
|
|
||||||
file { "/srv/lodgeit/${name}/lodgeit/views/layout.html":
|
|
||||||
ensure => present,
|
|
||||||
replace => true,
|
|
||||||
content => template('lodgeit/layout.html.erb'),
|
|
||||||
}
|
|
||||||
|
|
||||||
cron { "update_backup_${name}":
|
|
||||||
ensure => absent,
|
|
||||||
user => root,
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_backup::backup_remote { $name:
|
|
||||||
database_host => $db_host,
|
|
||||||
database_user => $db_user,
|
|
||||||
database_password => $db_password,
|
|
||||||
}
|
|
||||||
|
|
||||||
service { "${name}-paste":
|
|
||||||
ensure => running,
|
|
||||||
provider => upstart,
|
|
||||||
require => Service[$::apache::params::apache_name],
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,87 +0,0 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
||||||
"http://www.w3.org/TR/html4/loose.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>{{ page_title|e }} | LodgeIt!</title>
|
|
||||||
<link rel="stylesheet" href="/static/style.css" type="text/css" />
|
|
||||||
<link rel="stylesheet" href="/static/print.css" type="text/css" media="print" />
|
|
||||||
<script type="text/javascript" src="/static/jquery.js"></script>
|
|
||||||
<script type="text/javascript" src="/static/jquery.autocomplete.js"></script>
|
|
||||||
<script type="text/javascript" src="/static/cookie.js"></script>
|
|
||||||
<script type="text/javascript" src="/static/lodgeit.js"></script>
|
|
||||||
{%- if css %}
|
|
||||||
<style type="text/css">
|
|
||||||
{{ css|e }}
|
|
||||||
</style>
|
|
||||||
{%- endif %}
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="page">
|
|
||||||
<div id="header">
|
|
||||||
<h1>
|
|
||||||
<% if has_variable?("image") then %>
|
|
||||||
<img src="/static/<%= @image %>" style="padding-bottom: 10px; margin-left: 10px;" alt="<%= @name.capitalize %> Pastebin" />
|
|
||||||
<% else %>
|
|
||||||
<%= @name.capitalize %> Pastebin
|
|
||||||
<% end %>
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<ul id="navigation">
|
|
||||||
{%- for href, id, caption in [
|
|
||||||
('pastes/new_paste', 'new', _('New')),
|
|
||||||
('static/about', 'about', _('About')),
|
|
||||||
('static/help', 'help', '?')
|
|
||||||
] %}
|
|
||||||
<li {% if active_page == id %} class="active"{% endif %} >
|
|
||||||
<a href="{{ url_for(href) | e }}">{{ caption|e }}</a>
|
|
||||||
</li>
|
|
||||||
{%- endfor %}
|
|
||||||
</ul>
|
|
||||||
{# <ul id="languages">
|
|
||||||
{% for lang, name in i18n_languages %}
|
|
||||||
<li {% if request.locale.language == lang %}class="active"{% endif %}>
|
|
||||||
<a href="{{ url_for('pastes/new_paste', language='%s' % lang) }}">
|
|
||||||
<img alt="{{ lang }}" src="{{ '/static/flags/%s.png' % lang }}" />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul> #}
|
|
||||||
<div class="content">
|
|
||||||
<h2>{{ page_title|e }}</h2>
|
|
||||||
{%- if new_replies %}
|
|
||||||
<div class="notification">
|
|
||||||
<h3>{% trans %}Someone Replied To Your Paste{% endtrans %}</h3>
|
|
||||||
{% for paste in new_replies %}
|
|
||||||
<p>{% trans date=paste.pub_date|datetimeformat, parent=paste.parent.paste_id,
|
|
||||||
paste=paste.paste_id, paste_url=paste.url|e, parent_url=paste.parent.url|e %}
|
|
||||||
on {{ date }} someone replied to your paste
|
|
||||||
<a href="{{ parent_url }}">#{{ parent }}</a>,
|
|
||||||
in paste <a href="{{ paste_url }}">#{{ paste }}</a>. Click here to {% endtrans %}
|
|
||||||
<a href="{{ url_for('pastes/compare_paste', new_id=paste.paste_id, old_id=paste.parent.paste_id) }}">
|
|
||||||
{%- trans %}compare those two pastes{% endtrans %}</a>.
|
|
||||||
</p>
|
|
||||||
{% endfor %}
|
|
||||||
<p><a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this notification{% endtrans %}</a></p>
|
|
||||||
</div>
|
|
||||||
{% elif request.first_visit %}
|
|
||||||
<div class="notification">
|
|
||||||
<h3>{% trans %}Welcome On LodgeIt{% endtrans %}</h3>
|
|
||||||
<p>{%- trans -%}
|
|
||||||
Welcome to the LodgeIt pastebin. In order to use the notification feature
|
|
||||||
a 31 day cookie with an unique ID was created for you. The lodgeit database
|
|
||||||
does not store any information about you, it's just used for an advanced
|
|
||||||
pastebin experience :-). Read more on the {% endtrans -%}
|
|
||||||
<a href="{{ url_for('static/about') }}#privacy">{% trans %}about lodgeit{% endtrans %}</a>
|
|
||||||
{%- trans %} page. Have fun :-){%- endtrans -%}
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this notification{% endtrans %}</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{% endif -%}
|
|
||||||
{% block body %}{% endblock -%}
|
|
||||||
<div class="footer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,36 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
from werkzeug import script, create_environ, run_wsgi_app
|
|
||||||
from werkzeug.serving import run_simple
|
|
||||||
|
|
||||||
from lodgeit import local
|
|
||||||
from lodgeit.application import make_app
|
|
||||||
from lodgeit.database import session
|
|
||||||
|
|
||||||
dburi = 'mysql://<%= @db_user %>:<%= @db_password %>@<%= @db_host %>:3306/<%= @name %>'
|
|
||||||
|
|
||||||
SECRET_KEY = 'no secret key'
|
|
||||||
|
|
||||||
def run_app(app, path='/'):
|
|
||||||
env = create_environ(path, SECRET_KEY)
|
|
||||||
return run_wsgi_app(app, env)
|
|
||||||
|
|
||||||
action_runserver = script.make_runserver(
|
|
||||||
lambda: make_app(dburi, SECRET_KEY),
|
|
||||||
use_reloader=True)
|
|
||||||
|
|
||||||
action_shell = script.make_shell(
|
|
||||||
lambda: {
|
|
||||||
'app': make_app(dburi, SECRET_KEY, False, True),
|
|
||||||
'local': local,
|
|
||||||
'session': session,
|
|
||||||
'run_app': run_app
|
|
||||||
},
|
|
||||||
('\nWelcome to the interactive shell environment of LodgeIt!\n'
|
|
||||||
'\n'
|
|
||||||
'You can use the following predefined objects: app, local, session.\n'
|
|
||||||
'To run the application (creates a request) use *run_app*.')
|
|
||||||
)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
script.run()
|
|
@ -1,8 +0,0 @@
|
|||||||
description "<%= name %> Lodgeit server"
|
|
||||||
author "Andrew Hutchings <andrew@linuxjedi.co.uk>"
|
|
||||||
|
|
||||||
start on (local-filesystems and net-device-up)
|
|
||||||
stop on runlevel [!2345]
|
|
||||||
|
|
||||||
exec python /srv/lodgeit/<%= name %>/manage.py runserver -h 127.0.0.1 -p <%= port %>
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user