Projet

Général

Profil

« Précédent | Suivant » 

Révision e090253d

Ajouté par Serghei Mihai (congés, retour 15/05) il y a environ 8 ans

initial debian packaging

Voir les différences:

debian/changelog
1
corbo (0-1) unstable; urgency=low
2

  
3
  * source package automatically created by stdeb 0.8.5
4

  
5
 -- Serghei Mihai <smihai@entrouvert.com>  Tue, 26 Apr 2016 09:40:00 +0200
debian/compat
1
7
debian/control
1
Source: corbo
2
Maintainer: Serghei Mihai <smihai@entrouvert.com>
3
Section: python
4
Priority: optional
5
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7.4.3)
6
Standards-Version: 3.9.1
7

  
8
Package: python-corbo
9
Architecture: all
10
Depends: ${misc:Depends}, ${python:Depends},
11
    python-django (>= 1.7),
12
    django-ckeditor,
13
    python-gadjo
14
Description: Announces Manager
15

  
16
Package: corbo
17
Architecture: all
18
Depends: ${misc:Depends},
19
    python-hobo,
20
    python-django-tenant-schemas,
21
    python-psycopg2,
22
    python-django-mellon,
23
    gunicorn
24
Recommends: nginx, postgresql
25
Description: Announces Manager
26

  
27

  
28

  
debian/corbo-manage
1
#!/bin/sh
2

  
3
NAME=corbo
4
MANAGE=/usr/lib/$NAME/manage.py
5

  
6
# load Debian default configuration
7
export CORBO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
8

  
9
# check user
10
if test x$1 = x"--forceuser"
11
then
12
    shift
13
elif test $(id -un) != "$NAME"
14
then
15
    echo "error: must use $0 with user ${NAME}"
16
    exit 1
17
fi
18

  
19
if test $# -eq 0
20
then
21
    python ${MANAGE} help
22
    exit 1
23
fi
24

  
25
python ${MANAGE} "$@"
debian/corbo.dirs
1
/etc/corbo
2
/usr/lib/corbo
3
/var/lib/corbo/collectstatic
4
/var/lib/corbo/tenants
5
/var/log/corbo
debian/corbo.docs
1
COPYING
2
debian/nginx-example.conf
debian/corbo.init
1
#!/bin/sh
2
### BEGIN INIT INFO
3
# Provides:          corbo
4
# Required-Start:    $network $local_fs $remote_fs $syslog
5
# Required-Stop:     $network $local_fs $remote_fs $syslog
6
# Should-start:      postgresql
7
# Should-stop:       postgresql
8
# Default-Start:     2 3 4 5
9
# Default-Stop:      0 1 6
10
# Short-Description: Announces Manager
11
# Description:       Announces Manager
12
### END INIT INFO
13

  
14
# Author:  Serghei Mihai <smihai@entrouvert.com>
15

  
16
PATH=/sbin:/usr/sbin:/bin:/usr/bin
17
DESC="Announces Manager"
18
NAME=corbo
19
DAEMON=/usr/bin/gunicorn
20
RUN_DIR=/run/$NAME
21
PIDFILE=$RUN_DIR/$NAME.pid
22
LOG_DIR=/var/log/$NAME
23
SCRIPTNAME=/etc/init.d/$NAME
24
BIND=unix:$RUN_DIR/$NAME.sock
25
WORKERS=5
26
TIMEOUT=30
27
LOG_LEVEL=debug
28

  
29
CORBO_SETTINGS_FILE=/usr/lib/$NAME/debian_config.py
30
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
31

  
32
USER=$NAME
33
GROUP=$NAME
34

  
35
# Exit if the package is not installed
36
[ -x $MANAGE_SCRIPT ] || exit 0
37

  
38
# Read configuration variable file if it is present
39
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
40

  
41
DAEMON_ARGS=${DAEMON_ARGS:-"--pid $PIDFILE \
42
--user $USER --group $GROUP \
43
--daemon \
44
--access-logfile $LOG_DIR/gunicorn-access.log \
45
--log-file $LOG_DIR/gunicorn-error.log \
46
--log-level=$LOG_LEVEL \
47
--bind=$BIND  \
48
--workers=$WORKERS \
49
--worker-class=sync \
50
--timeout=$TIMEOUT \
51
--name $NAME \
52
$NAME.wsgi:application"}
53

  
54
# Load the VERBOSE setting and other rcS variables
55
. /lib/init/vars.sh
56

  
57
# Define LSB log_* functions.
58
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
59
. /lib/lsb/init-functions
60

  
61
# Create /run directory
62
if [ ! -d $RUN_DIR ]; then
63
    install -d -m 755 -o $USER -g $GROUP $RUN_DIR
64
fi
65

  
66
# environment for wsgi
67
export CORBO_SETTINGS_FILE
68

  
69
#
70
# Function that starts the daemon/service
71
#
72
do_start()
73
{
74
    # Return
75
    #   0 if daemon has been started
76
    #   1 if daemon was already running
77
    #   2 if daemon could not be started
78
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
79
        || return 1
80
    start-stop-daemon --start --quiet --exec $DAEMON -- \
81
        $DAEMON_ARGS \
82
        || return 2
83
}
84

  
85
#
86
# Function that stops the daemon/service
87
#
88
do_stop()
89
{
90
    # Return
91
    #   0 if daemon has been stopped
92
    #   1 if daemon was already stopped
93
    #   2 if daemon could not be stopped
94
    #   other if a failure occurred
95
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
96
    RETVAL="$?"
97
    [ "$RETVAL" = 2 ] && return 2
98
    # Wait for children to finish too if this is a daemon that forks
99
    # and if the daemon is only ever run from this initscript.
100
    # If the above conditions are not satisfied then add some other code
101
    # that waits for the process to drop all resources that could be
102
    # needed by services started subsequently.  A last resort is to
103
    # sleep for some time.
104
    start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
105
    [ "$?" = 2 ] && return 2
106
    # Many daemons don't delete their pidfiles when they exit.
107
    rm -f $PIDFILE
108
    return "$RETVAL"
109
}
110

  
111
#
112
# Function that sends a SIGHUP to the daemon/service
113
#
114
do_reload() {
115
    #
116
    # If the daemon can reload its configuration without
117
    # restarting (for example, when it is sent a SIGHUP),
118
    # then implement that here.
119
    #
120
    start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name `basename $DAEMON`
121
    return 0
122
}
123

  
124
do_migrate() {
125
    log_action_msg "Applying migrations (migrate_schemas).."
126
    su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT migrate_schemas"
127
    log_action_msg "done"
128
}
129

  
130
do_collectstatic() {
131
    log_action_msg "Collect static files (collectstatic).."
132
    su $USER -s /bin/sh -p -c "$MANAGE_SCRIPT collectstatic --noinput"
133
    log_action_msg "done"
134
}
135

  
136
case "$1" in
137
  start)
138
    log_daemon_msg "Starting $DESC " "$NAME"
139
    do_migrate
140
    do_collectstatic
141
    do_start
142
    case "$?" in
143
        0|1) log_end_msg 0 ;;
144
        2) log_end_msg 1 ;;
145
    esac
146
  ;;
147
  stop)
148
    log_daemon_msg "Stopping $DESC" "$NAME"
149
    do_stop
150
    case "$?" in
151
        0|1) log_end_msg 0 ;;
152
        2) log_end_msg 1 ;;
153
    esac
154
    ;;
155
  status)
156
    status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
157
    ;;
158
  reload|force-reload)
159
    #
160
    # If do_reload() is not implemented then leave this commented out
161
    # and leave 'force-reload' as an alias for 'restart'.
162
    #
163
    log_daemon_msg "Reloading $DESC" "$NAME"
164
    do_collectstatic
165
    do_migrate
166
    do_reload
167
    log_end_msg $?
168
    ;;
169
  restart|force-reload)
170
    #
171
    # If the "reload" option is implemented then remove the
172
    # 'force-reload' alias
173
    #
174
    log_daemon_msg "Restarting $DESC" "$NAME"
175
    do_stop
176
    case "$?" in
177
      0|1)
178
        do_migrate
179
        do_collectstatic
180
        do_start
181
        case "$?" in
182
            0) log_end_msg 0 ;;
183
            1) log_end_msg 1 ;; # Old process is still running
184
            *) log_end_msg 1 ;; # Failed to start
185
        esac
186
        ;;
187
      *)
188
        # Failed to stop
189
        log_end_msg 1
190
        ;;
191
    esac
192
    ;;
193
  *)
194
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
195
    exit 3
196
    ;;
197
esac
debian/corbo.install
1
debian/corbo-manage       /usr/bin
2
debian/settings.py        /etc/corbo
3
debian/debian_config.py   /usr/lib/corbo
debian/corbo.postinst
1
#! /bin/sh
2

  
3
set -e
4

  
5
NAME="corbo"
6
USER=$NAME
7
GROUP=$NAME
8
CONFIG_DIR="/etc/$NAME"
9
MANAGE_SCRIPT="/usr/bin/$NAME-manage"
10

  
11
case "$1" in
12
  configure)
13

  
14
    # make sure the administrative user exists
15
    if ! getent passwd $USER >/dev/null; then
16
      adduser --disabled-password  --quiet --system \
17
        --no-create-home --home /var/lib/$NAME \
18
        --gecos "$NAME user" --group $USER
19
    fi
20
    # ensure dirs ownership
21
    chown $USER:$GROUP /var/log/$NAME
22
    chown $USER:$GROUP /var/lib/$NAME/collectstatic
23
    chown $USER:$GROUP /var/lib/$NAME/tenants
24
    # create a secret file
25
    SECRET_FILE=$CONFIG_DIR/secret
26
    if [ ! -f $SECRET_FILE ]; then
27
        echo -n "Generating Django secret..." >&2
28
        cat /dev/urandom | tr -dc [:alnum:]-_\!\%\^:\; | head -c70 > $SECRET_FILE
29
        chown root:$GROUP $SECRET_FILE
30
        chmod 0440 $SECRET_FILE
31
    fi
32
  ;;
33

  
34
  triggered)
35
      su -s /bin/sh -c "$MANAGE_SCRIPT hobo_deploy --redeploy" $USER
36
  ;;
37

  
38
  abort-upgrade|abort-remove|abort-deconfigure)
39
  ;;
40

  
41
  *)
42
    echo "postinst called with unknown argument \`$1'" >&2
43
    exit 1
44
  ;;
45
esac
46

  
47
#DEBHELPER#
48

  
49
exit 0
debian/debian_config.py
1
# This file is sourced by "execfile" from corbo.settings
2

  
3
import os
4

  
5
PROJECT_NAME = 'corbo'
6

  
7
# SAML2 authentication
8
INSTALLED_APPS += ('mellon',)
9

  
10
#
11
# hobotization (multitenant)
12
#
13
execfile('/usr/lib/hobo/debian_config_common.py')
14

  
15
#
16
# local settings
17
#
18
execfile(os.path.join(ETC_DIR, 'settings.py'))
debian/nginx-example.conf
1
server {
2
        listen   443;
3
        server_name  *-corbo.example.org;
4

  
5
        ssl                  on;
6
        ssl_certificate      /etc/ssl/certs/ssl-cert-snakeoil.pem;
7
        ssl_certificate_key  /etc/ssl/private/ssl-cert-snakeoil.key;
8

  
9
        access_log  /var/log/nginx/corbo.example.org-access.log combined;
10
        error_log  /var/log/nginx/corbo.example.org-error.log;
11

  
12
        location ~ ^/static/(.+)$ {
13
            root /;
14
            try_files /var/lib/corbo/tenants/$host/static/$1
15
                      /var/lib/corbo/collectstatic/$1
16
                      =404;
17
        }
18

  
19
        location ~ ^/media/(.+)$ {
20
            alias /var/lib/corbo/tenants/$host/media/$1;
21
        }
22

  
23
        location / {
24
            proxy_pass         http://unix:/var/run/corbo/corbo.sock;
25
            proxy_set_header   Host $http_host;
26
            proxy_set_header   X-Forwarded-SSL on;
27
            proxy_set_header   X-Forwarded-Protocol ssl;
28
            proxy_set_header   X-Forwarded-Proto https;
29
            proxy_set_header   X-Real-IP       $remote_addr;
30
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
31
        }
32
}
33

  
34
server {
35
        listen   80;
36
        server_name  *-corbo.example.org;
37

  
38
        access_log  /var/log/nginx/corbo.example.org-access.log combined;
39
        error_log  /var/log/nginx/corbo.example.org-error.log;
40

  
41
        location ~ ^/static/(.+)$ {
42
            root /;
43
            try_files /var/lib/corbo/tenants/$host/static/$1
44
                      /var/lib/corbo/collectstatic/$1
45
                      =404;
46
        }
47

  
48
        location ~ ^/media/(.+)$ {
49
            alias /var/lib/corbo/tenants/$host/media/$1;
50
        }
51

  
52
        location / {
53
            proxy_pass         http://unix:/var/run/corbo/corbo.sock;
54
            proxy_set_header   Host $http_host;
55
            proxy_set_header   X-Real-IP       $remote_addr;
56
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
57
        }
58
}
debian/python-corbo.dirs
1
/usr/lib/corbo
debian/python-corbo.docs
1
COPYING
debian/python-corbo.install
1
usr/bin/manage.py /usr/lib/corbo
2
usr/lib/python2*/*-packages
debian/rules
1
#!/usr/bin/make -f
2
# -*- makefile -*-
3

  
4
# Uncomment this to turn on verbose mode.
5
#export DH_VERBOSE=1
6

  
7
%:
8
	dh $@ --with python2
debian/settings.py
1
# Configuration for corbo.
2
# You can override Corbo default settings here
3

  
4
# Corbo is a Django application: for the full list of settings and their
5
# values, see https://docs.djangoproject.com/en/1.7/ref/settings/
6
# For more information on settings see
7
# https://docs.djangoproject.com/en/1.7/topics/settings/
8

  
9
# WARNING! Quick-start development settings unsuitable for production!
10
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
11

  
12
# This file is sourced by "execfile" from /usr/lib/corbo/debian_config.py
13

  
14
# SECURITY WARNING: don't run with debug turned on in production!
15
DEBUG = False
16
TEMPLATE_DEBUG = False
17

  
18
#ADMINS = (
19
#        # ('User 1', 'watchdog@example.net'),
20
#        # ('User 2', 'janitor@example.net'),
21
#)
22

  
23
# ALLOWED_HOSTS must be correct in production!
24
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
25
ALLOWED_HOSTS = [
26
        '*',
27
]
28

  
29
# Databases
30
# Default: a local database named "corbo"
31
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
32
# Warning: don't change ENGINE
33
# DATABASES['default']['NAME'] = 'corbo'
34
# DATABASES['default']['USER'] = 'corbo'
35
# DATABASES['default']['PASSWORD'] = '******'
36
# DATABASES['default']['HOST'] = 'localhost'
37
# DATABASES['default']['PORT'] = '5432'
38

  
39
LANGUAGE_CODE = 'fr-fr'
40
TIME_ZONE = 'Europe/Paris'
41

  
42
# Email configuration
43
# EMAIL_SUBJECT_PREFIX = '[corbo] '
44
# SERVER_EMAIL = 'root@corbo.example.org'
45
# DEFAULT_FROM_EMAIL = 'webmaster@corbo.example.org'
46

  
47
# SMTP configuration
48
# EMAIL_HOST = 'localhost'
49
# EMAIL_HOST_USER = ''
50
# EMAIL_HOST_PASSWORD = ''
51
# EMAIL_PORT = 25
52

  
53
# HTTPS Security
54
# CSRF_COOKIE_SECURE = True
55
# SESSION_COOKIE_SECURE = True
debian/source/format
1
3.0 (quilt)
debian/source/options
1
extend-diff-ignore="\.egg-info$"

Formats disponibles : Unified diff