Parcourir la Source

Restructure and installation script created for deployment.

Created installation script to deploy not only the web and script files,
but to also complete a swift install on a Linux server.
bmallred 13 ans auparavant
Parent
Commettre
97686717b4

+ 6 - 0
apache/cgi-bin/hgweb.conf

@ -0,0 +1,6 @@
1
[web]
2
allow_push = *
3
style = coal
4
5
[collections]
6
/var/lib/hg = /var/lib/hg

+ 4 - 0
apache/cgi-bin/hgweb.wsgi

@ -0,0 +1,4 @@
1
from mercurial import demandimport; demandimport.enable()
2
from mercurial.hgweb.hgwebdir_mod import hgwebdir
3
4
application = hgwebdir('/usr/lib/cgi-bin/hgweb.conf')

+ 95 - 0
apache/sites-available/devel

@ -0,0 +1,95 @@
1
<VirtualHost *:80>
2
3
    #######################################################
4
    # General Information
5
    #######################################################
6
7
    ServerAdmin bmallred@travisassoc.com
8
    UseCanonicalName Off
9
10
    DocumentRoot /var/www
11
    <Directory />
12
        WSGIApplicationGroup %{GLOBAL}
13
        Options FollowSymLinks
14
        AllowOverride None
15
    </Directory>
16
17
    #######################################################
18
    # Trac
19
    #######################################################
20
21
    Alias /trac /var/lib/trac/
22
    <Directory /var/lib/trac/>
23
        Options Indexes FollowSymLinks MultiViews
24
        AllowOverride None
25
        Order allow,deny
26
        allow from all
27
28
        SetHandler mod_python
29
        PythonHandler trac.web.modpython_frontend
30
        PythonOption TracEnvParentDir /var/lib/trac
31
        PythonOption TracEnvIndexTemplate /var/www/trac/projects.html
32
        PythonOption TracUriRoot /trac/
33
    </Directory>
34
35
    <LocationMatch "/[^/]+/login">
36
        AuthType Basic
37
        AuthName "trac"
38
39
        # Authenticate with HTPASSWD
40
        AuthUserFile /var/lib/trac/.htpasswd
41
42
        # Authenticate wth LDAP
43
        #AuthBasicProvider ldap
44
        #AuthLDAPBindDN ""
45
        #AuthLDAPBindPassword "********"
46
        #AuthLDAPURL "ldap://127.0.0.1/"
47
48
        # Use LDAP group
49
        #Require ldap-group ""
50
        #Satisfy any
51
52
        # Use any valid user
53
        Require valid-user
54
    </LocationMatch>
55
56
    #######################################################
57
    # Mercurial
58
    #######################################################
59
60
    <Directory /var/lib/hg>
61
        DirectoryIndex index.html
62
        Options Indexes FollowSymLinks MultiViews
63
        AllowOverride All
64
        Order allow,deny
65
        Allow from all
66
    </Directory>
67
68
    #######################################################
69
    # Script Handling
70
    #######################################################
71
72
    WSGIScriptAliasMatch ^/hg(.*) /usr/lib/cgi-bin/hgweb.wsgi$1
73
    WSGIScriptAlias /trac /usr/lib/python2.6/dist-packages/trac/admin/templates/deploy_trac.wsgi
74
    WSGIDaemonProcess wsgitrac user=www-data group=www-data processes=5 threads=10 maximum-requests=1000 umask=0007
75
    WSGIProcessGroup wsgitrac
76
77
    ScriptAliasMatch ^/([a-zA-Z0-9]+)/cgi-bin/(.+) /usr/lib/cgi-bin/
78
    <Directory /usr/lib/cgi-bin/>
79
        AddHandler wsgi-script .wsgi
80
        Options ExecCGI FollowSymLinks SymLinksIfOwnerMatch
81
        AllowOverride None
82
        Order allow,deny
83
        Allow from all
84
    </Directory>
85
86
    #######################################################
87
    # Error Logs
88
    #######################################################
89
90
    LogLevel warn
91
    ErrorLog /var/log/apache2/error-sites.log
92
    CustomLog /var/log/apache2/access-sites.log combined
93
    CustomLog /var/log/apache2/ssl-access.log combined
94
95
</VirtualHost>

+ 145 - 0
apache/sites-available/devel-ssl

@ -0,0 +1,145 @@
1
<IfModule mod_ssl.c>
2
<VirtualHost _default_:443>
3
4
    #######################################################
5
    # General Information
6
    #######################################################
7
8
    ServerAdmin bmallred@travisassoc.com
9
    UseCanonicalName Off
10
11
    DocumentRoot /var/www
12
    <Directory />
13
        WSGIApplicationGroup %{GLOBAL}
14
        Options FollowSymLinks
15
        AllowOverride None
16
    </Directory>
17
18
    #######################################################
19
    # Trac
20
    #######################################################
21
22
    Alias /trac /var/lib/trac/
23
    <Directory /var/lib/trac/>
24
        Options Indexes FollowSymLinks MultiViews
25
        AllowOverride None
26
        Order allow,deny
27
        allow from all
28
29
        SetHandler mod_python
30
        PythonHandler trac.web.modpython_frontend
31
        PythonOption TracEnvParentDir /var/lib/trac
32
        PythonOption TracEnvIndexTemplate /var/www/trac/projects.html
33
        PythonOption TracUriRoot /trac/
34
    </Directory>
35
36
    <LocationMatch "/[^/]+/login">
37
        AuthType Basic
38
        AuthName "trac"
39
40
        # Authenticate with HTPASSWD
41
        AuthUserFile /var/lib/trac/.htpasswd
42
43
        # Authenticate wth LDAP
44
        #AuthBasicProvider ldap
45
        #AuthLDAPBindDN ""
46
        #AuthLDAPBindPassword "********"
47
        #AuthLDAPURL "ldap://127.0.0.1/"
48
49
        # Use LDAP group
50
        #Require ldap-group ""
51
        #Satisfy any
52
53
        # Use any valid user
54
        Require valid-user
55
    </LocationMatch>
56
57
    #######################################################
58
    # Mercurial
59
    #######################################################
60
61
    <Directory /var/lib/hg>
62
        DirectoryIndex index.html
63
        Options Indexes FollowSymLinks MultiViews
64
        AllowOverride All
65
        Order allow,deny
66
        Allow from all
67
68
        <LimitExcept GET>
69
            Require valid-user
70
        </LimitExcept>
71
    </Directory>
72
73
    <LocationMatch "^/hg(.*)">
74
        AuthType Basic
75
        AuthName "trac"
76
77
        # Authenticate with HTPASSWD
78
        AuthUserFile /var/lib/trac/.htpasswd
79
80
        # Authenticate wth LDAP
81
        #AuthBasicProvider ldap
82
        #AuthLDAPBindDN ""
83
        #AuthLDAPBindPassword "********"
84
        #AuthLDAPURL "ldap://127.0.0.1/"
85
86
        # Use LDAP group
87
        #Require ldap-group ""
88
        #Satisfy any
89
90
        # Use any valid user
91
        Require valid-user
92
    </LocationMatch>
93
94
    #######################################################
95
    # Script Handling
96
    #######################################################
97
98
    WSGIScriptAliasMatch ^/hg(.*) /usr/lib/cgi-bin/hgweb.wsgi$1
99
    WSGIScriptAlias /trac /usr/lib/python2.6/dist-packages/trac/admin/templates/deploy_trac.wsgi
100
    WSGIDaemonProcess wsgitrac user=www-data group=www-data processes=5 threads=10 maximum-requests=1000 umask=0007
101
    WSGIProcessGroup wsgitrac
102
103
    ScriptAliasMatch ^/([a-zA-Z0-9]+)/cgi-bin/(.+) /usr/lib/cgi-bin/
104
    <Directory /usr/lib/cgi-bin/>
105
        AddHandler wsgi-script .wsgi
106
        Options ExecCGI FollowSymLinks SymLinksIfOwnerMatch
107
        AllowOverride None
108
        Order allow,deny
109
        Allow from all
110
    </Directory>
111
112
    #######################################################
113
    # Error Logs
114
    #######################################################
115
116
    LogLevel warn
117
    ErrorLog /var/log/apache2/error-sites.log
118
    CustomLog /var/log/apache2/access-sites.log combined
119
    CustomLog /var/log/apache2/ssl-access.log combined
120
121
    #######################################################
122
    # Secure Socket Layer
123
    #######################################################
124
125
    SSLEngine on
126
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
127
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
128
129
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
130
        SSLOptions +StdEnvVars
131
    </FilesMatch>
132
133
    <Directory /usr/lib/cgi-bin>
134
        SSLOptions +StdEnvVars
135
    </Directory>
136
137
    BrowserMatch "MSIE [2-6]" \
138
        nokeepalive ssl-unclean-shutdown \
139
        downgrade-1.0 force-response-1.0
140
141
    # MSIE 7 and newer should be able to use keepalive
142
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
143
144
</VirtualHost>
145
</IfModule>

+ 56 - 0
install.sh

@ -0,0 +1,56 @@
1
# Update system packages
2
sudo apt-get update
3
4
# Install distributed version control systems
5
sudo apt-get install git
6
sudo apt-get install mercurial
7
8
# Install Apache web server and modules
9
sudo apt-get install apache2
10
sudo apt-get install libapache2-mod-python
11
sudo apt-get install libapache2-mod-wsgi
12
13
# Install Trac and plug-ins or patches
14
sudo apt-get install trac
15
sudo apt-get install trac-accountmanager
16
sudo apt-get install trac-authopenid
17
sudo apt-get install trac-bitten
18
sudo apt-get install trac-customfieldadmin
19
sudo apt-get install trac-git
20
sudo apt-get install trac-graphviz
21
sudo apt-get install trac-mastertickets
22
sudo apt-get install trac-mercurial
23
sudo apt-get install trac-wikiprint
24
sudo apt-get install trac-wikirename
25
sudo apt-get install trac-wysiwyg
26
sudo apt-get install trac-xmlrpc
27
28
# Create directory structure
29
sudo mkdir /var/lib/hg
30
sudo mkdir /var/lib/git
31
sudo mkdir /var/lib/trac
32
33
# Transfer files
34
sudo cp -R ./apache/cgi-bin/* /usr/lib/cgi-bin/
35
sudo cp -R ./apache/sites-available/* /etc/apache2/sites-available/
36
sudo cp -R ./www/* /var/www/
37
sudo cp ./util/* /usr/bin/
38
39
# Configure sites available
40
sudo rm /etc/apache2/sites-enabled/* 
41
cd /etc/apache2/sites-enabled; sudo ln -s ../sites-available/devel .
42
cd /etc/apache2/sites-enabled; sudo ln -s ../sites-available/devel-ssl .
43
cd /etc/apache2/mods-enabled; sudo ln -s ../mods-available/ssl.conf .
44
cd /etc/apache2/mods-enabled; sudo ln -s ../mods-available/ssl.load .
45
46
# Configure permissions
47
sudo chown -R www-data:www-data /var/lib/hg
48
sudo chown -R www-data:www-data /var/lib/git
49
sudo chown -R www-data:www-data /var/lib/trac
50
sudo chown -R www-data:www-data /var/www
51
52
# Create administrator password
53
sudo htpasswd –c /var/lib/trac/.htpasswd admin
54
55
# Restart web server
56
sudo apache2ctl restart

+ 56 - 0
util/trac-create

@ -0,0 +1,56 @@
1
#!/bin/bash
2
3
repodb="sqlite:db/trac.db"
4
5
echo -n "Project name: "
6
read project
7
echo -n "Repository type (hg/git) "
8
read repotype
9
echo
10
11
repopath="/var/lib/$repotype/$project"
12
tracpath="/var/lib/trac/$project"
13
repoinit=""
14
15
if [ "$repotype" == "hg" ]; then
16
	repoinit="hg init"
17
elif [ "$repotype" == "git" ]; then
18
	repoinit="git init"
19
else
20
	echo Incorrect repository type.
21
	exit 1
22
fi
23
24
echo Creating repository...
25
mkdir $repopath
26
cd $repopath
27
echo -n `$repoinit`
28
29
echo Creating Trac environment...
30
trac-admin $tracpath initenv $project $repodb $repotype $repopath
31
trac-admin $tracpath permission add admin TRAC_ADMIN
32
chown -R www-data:www-data $tracpath 
33
34
# Update logo (not necessary)
35
sed -e 's/src = site\/your_project_logo.png/src = \/logo.png/g' $tracpath/conf/trac.ini > tmp.ini
36
cat tmp.ini > $tracpath/conf/trac.ini
37
rm tmp.ini
38
39
# Configure Trac plugins
40
echo "
41
[components]
42
acct_mgr.* = enabled
43
bitten.* = enabled
44
customfieldadmin.* = enabled
45
mastertickets.* = enabled
46
wikiprint.* = enabled
47
wikirename.* = enabled
48
tracwysiwyg.* = enabled
49
tracrpc.* = enabled
50
graphviz.* = enabled
51
tracext.hg.* = enabled
52
tracext.git.* = enabled
53
authopenid.* = enabled" >> "$tracpath/conf/trac.ini"
54
55
# Upgrade Trac environment
56
trac-admin $tracpath upgrade

+ 11 - 0
util/trac-useradd

@ -0,0 +1,11 @@
1
#!/bin/bash
2
3
# Remove user from password file
4
sudo htpasswd /var/lib/trac/.htpasswd $1
5
6
# Iterate through each project
7
for d in 'ls /var/lib/trac'
8
do
9
        echo 'Adding user to project ' $d
10
        sudo trac-admin /var/lib/trac/$d permission add $1
11
done

+ 11 - 0
util/trac-userdel

@ -0,0 +1,11 @@
1
#!/bin/bash
2
3
# Remove user from password file
4
sudo htpasswd -d /var/lib/trac/.htpasswd $1
5
6
# Iterate through each project
7
for d in 'ls /var/lib/trac'
8
do
9
	echo 'Removing user from project ' $d
10
	sudo trac-admin /var/lib/trac/$d permission del $1
11
done

+ 3 - 0
util/trac-userreset

@ -0,0 +1,3 @@
1
#!/bin/bash
2
3
sudo htpasswd /var/lib/trac/.htpasswd $1 $2

404.html → www/404.html


apple-touch-icon-114x114-precomposed.png → www/apple-touch-icon-114x114-precomposed.png


apple-touch-icon-57x57-precomposed.png → www/apple-touch-icon-57x57-precomposed.png


apple-touch-icon-72x72-precomposed.png → www/apple-touch-icon-72x72-precomposed.png


apple-touch-icon-precomposed.png → www/apple-touch-icon-precomposed.png


apple-touch-icon.png → www/apple-touch-icon.png


crossdomain.xml → www/crossdomain.xml


css/handheld.css → www/css/handheld.css


css/style.css → www/css/style.css


favicon.ico → www/favicon.ico


humans.txt → www/humans.txt


index.html → www/index.html


js/jquery.lettering.js → www/js/jquery.lettering.js


js/libs/dd_belatedpng.js → www/js/libs/dd_belatedpng.js


js/libs/jquery-1.5.1.min.js → www/js/libs/jquery-1.5.1.min.js


js/libs/modernizr-1.7.min.js → www/js/libs/modernizr-1.7.min.js


js/plugins.js → www/js/plugins.js


js/script.js → www/js/script.js


BIN
www/logo.png


robots.txt → www/robots.txt


trac/projects.html → www/trac/projects.html