##// END OF EJS Templates
py3: use "python3 -m venv" instead of virtualenv package
Mads Kiilerich -
r8073:89e9aef9 default
parent child Browse files
Show More
@@ -1,211 +1,211 b''
1 def createvirtualenv = ''
1 def createvirtualenv = ''
2 def activatevirtualenv = ''
2 def activatevirtualenv = ''
3
3
4 node {
4 node {
5 properties([[$class: 'BuildDiscarderProperty',
5 properties([[$class: 'BuildDiscarderProperty',
6 strategy: [$class: 'LogRotator',
6 strategy: [$class: 'LogRotator',
7 artifactDaysToKeepStr: '',
7 artifactDaysToKeepStr: '',
8 artifactNumToKeepStr: '10',
8 artifactNumToKeepStr: '10',
9 daysToKeepStr: '',
9 daysToKeepStr: '',
10 numToKeepStr: '']]]);
10 numToKeepStr: '']]]);
11 if (isUnix()) {
11 if (isUnix()) {
12 createvirtualenv = 'rm -r $JENKINS_HOME/venv/$JOB_NAME || true && virtualenv $JENKINS_HOME/venv/$JOB_NAME'
12 createvirtualenv = 'rm -r $JENKINS_HOME/venv/$JOB_NAME || true && python3 -m venv $JENKINS_HOME/venv/$JOB_NAME'
13 activatevirtualenv = '. $JENKINS_HOME/venv/$JOB_NAME/bin/activate'
13 activatevirtualenv = '. $JENKINS_HOME/venv/$JOB_NAME/bin/activate'
14 } else {
14 } else {
15 createvirtualenv = 'rmdir /s /q %JENKINS_HOME%\\venv\\%JOB_NAME% || true && virtualenv %JENKINS_HOME%\\venv\\%JOB_NAME%'
15 createvirtualenv = 'rmdir /s /q %JENKINS_HOME%\\venv\\%JOB_NAME% || true && python3 -m venv %JENKINS_HOME%\\venv\\%JOB_NAME%'
16 activatevirtualenv = 'call %JENKINS_HOME%\\venv\\%JOB_NAME%\\Scripts\\activate.bat'
16 activatevirtualenv = 'call %JENKINS_HOME%\\venv\\%JOB_NAME%\\Scripts\\activate.bat'
17 }
17 }
18
18
19 stage('checkout') {
19 stage('checkout') {
20 checkout scm
20 checkout scm
21 if (isUnix()) {
21 if (isUnix()) {
22 sh 'hg --config extensions.purge= purge --all'
22 sh 'hg --config extensions.purge= purge --all'
23 } else {
23 } else {
24 bat 'hg --config extensions.purge= purge --all'
24 bat 'hg --config extensions.purge= purge --all'
25 }
25 }
26 }
26 }
27 stage('virtual env') {
27 stage('virtual env') {
28 def virtualenvscript = """$createvirtualenv
28 def virtualenvscript = """$createvirtualenv
29 $activatevirtualenv
29 $activatevirtualenv
30 python -m pip install --upgrade pip
30 python -m pip install --upgrade pip
31 pip install --upgrade setuptools
31 pip install --upgrade setuptools
32 pip install --upgrade pylint
32 pip install --upgrade pylint
33 pip install --upgrade pytest-cov
33 pip install --upgrade pytest-cov
34 """
34 """
35 if (isUnix()) {
35 if (isUnix()) {
36 virtualenvscript += """
36 virtualenvscript += """
37 pip install --upgrade python-ldap
37 pip install --upgrade python-ldap
38 pip install --upgrade python-pam
38 pip install --upgrade python-pam
39 """
39 """
40 sh virtualenvscript
40 sh virtualenvscript
41 } else {
41 } else {
42 bat virtualenvscript
42 bat virtualenvscript
43 }
43 }
44 }
44 }
45 stage('setup') {
45 stage('setup') {
46 def virtualenvscript = """$activatevirtualenv
46 def virtualenvscript = """$activatevirtualenv
47 pip install --upgrade -e . -r dev_requirements.txt
47 pip install --upgrade -e . -r dev_requirements.txt
48 python setup.py compile_catalog
48 python setup.py compile_catalog
49 """
49 """
50 if (isUnix()) {
50 if (isUnix()) {
51 sh virtualenvscript
51 sh virtualenvscript
52 } else {
52 } else {
53 bat virtualenvscript
53 bat virtualenvscript
54 }
54 }
55 stash name: 'kallithea', useDefaultExcludes: false
55 stash name: 'kallithea', useDefaultExcludes: false
56 }
56 }
57 stage('pylint') {
57 stage('pylint') {
58 sh script: """$activatevirtualenv
58 sh script: """$activatevirtualenv
59 pylint -j 0 --disable=C -f parseable kallithea > pylint.out
59 pylint -j 0 --disable=C -f parseable kallithea > pylint.out
60 """, returnStatus: true
60 """, returnStatus: true
61 archiveArtifacts 'pylint.out'
61 archiveArtifacts 'pylint.out'
62 try {
62 try {
63 step([$class: 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'PyLint', pattern: 'pylint.out']], unHealthy: ''])
63 step([$class: 'WarningsPublisher', canComputeNew: false, canResolveRelativePaths: false, defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', parserConfigurations: [[parserName: 'PyLint', pattern: 'pylint.out']], unHealthy: ''])
64 } catch (java.lang.IllegalArgumentException exc) {
64 } catch (java.lang.IllegalArgumentException exc) {
65 echo "You need to install the 'Warnings Plug-in' to display the pylint report."
65 echo "You need to install the 'Warnings Plug-in' to display the pylint report."
66 currentBuild.result = 'UNSTABLE'
66 currentBuild.result = 'UNSTABLE'
67 echo "Caught: ${exc}"
67 echo "Caught: ${exc}"
68 }
68 }
69 }
69 }
70 }
70 }
71
71
72 def pytests = [:]
72 def pytests = [:]
73 pytests['sqlite'] = {
73 pytests['sqlite'] = {
74 node {
74 node {
75 ws {
75 ws {
76 deleteDir()
76 deleteDir()
77 unstash name: 'kallithea'
77 unstash name: 'kallithea'
78 if (isUnix()) {
78 if (isUnix()) {
79 sh script: """$activatevirtualenv
79 sh script: """$activatevirtualenv
80 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea
80 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea
81 """, returnStatus: true
81 """, returnStatus: true
82 } else {
82 } else {
83 bat script: """$activatevirtualenv
83 bat script: """$activatevirtualenv
84 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea
84 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_sqlite.xml --cov=kallithea
85 """, returnStatus: true
85 """, returnStatus: true
86 }
86 }
87 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml'
87 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1SQLITE./g" pytest_sqlite.xml'
88 archiveArtifacts 'pytest_sqlite.xml'
88 archiveArtifacts 'pytest_sqlite.xml'
89 junit 'pytest_sqlite.xml'
89 junit 'pytest_sqlite.xml'
90 writeFile(file: '.coverage.sqlite', text: readFile('.coverage'))
90 writeFile(file: '.coverage.sqlite', text: readFile('.coverage'))
91 stash name: 'coverage.sqlite', includes: '.coverage.sqlite'
91 stash name: 'coverage.sqlite', includes: '.coverage.sqlite'
92 }
92 }
93 }
93 }
94 }
94 }
95
95
96 pytests['de'] = {
96 pytests['de'] = {
97 node {
97 node {
98 if (isUnix()) {
98 if (isUnix()) {
99 ws {
99 ws {
100 deleteDir()
100 deleteDir()
101 unstash name: 'kallithea'
101 unstash name: 'kallithea'
102 withEnv(['LANG=de_DE.UTF-8',
102 withEnv(['LANG=de_DE.UTF-8',
103 'LANGUAGE=de',
103 'LANGUAGE=de',
104 'LC_ADDRESS=de_DE.UTF-8',
104 'LC_ADDRESS=de_DE.UTF-8',
105 'LC_IDENTIFICATION=de_DE.UTF-8',
105 'LC_IDENTIFICATION=de_DE.UTF-8',
106 'LC_MEASUREMENT=de_DE.UTF-8',
106 'LC_MEASUREMENT=de_DE.UTF-8',
107 'LC_MONETARY=de_DE.UTF-8',
107 'LC_MONETARY=de_DE.UTF-8',
108 'LC_NAME=de_DE.UTF-8',
108 'LC_NAME=de_DE.UTF-8',
109 'LC_NUMERIC=de_DE.UTF-8',
109 'LC_NUMERIC=de_DE.UTF-8',
110 'LC_PAPER=de_DE.UTF-8',
110 'LC_PAPER=de_DE.UTF-8',
111 'LC_TELEPHONE=de_DE.UTF-8',
111 'LC_TELEPHONE=de_DE.UTF-8',
112 'LC_TIME=de_DE.UTF-8',
112 'LC_TIME=de_DE.UTF-8',
113 ]) {
113 ]) {
114 sh script: """$activatevirtualenv
114 sh script: """$activatevirtualenv
115 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea
115 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_de.xml --cov=kallithea
116 """, returnStatus: true
116 """, returnStatus: true
117 }
117 }
118 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml'
118 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1DE./g" pytest_de.xml'
119 archiveArtifacts 'pytest_de.xml'
119 archiveArtifacts 'pytest_de.xml'
120 junit 'pytest_de.xml'
120 junit 'pytest_de.xml'
121 writeFile(file: '.coverage.de', text: readFile('.coverage'))
121 writeFile(file: '.coverage.de', text: readFile('.coverage'))
122 stash name: 'coverage.de', includes: '.coverage.de'
122 stash name: 'coverage.de', includes: '.coverage.de'
123 }
123 }
124 }
124 }
125 }
125 }
126 }
126 }
127 pytests['mysql'] = {
127 pytests['mysql'] = {
128 node {
128 node {
129 if (isUnix()) {
129 if (isUnix()) {
130 ws {
130 ws {
131 deleteDir()
131 deleteDir()
132 unstash name: 'kallithea'
132 unstash name: 'kallithea'
133 sh """$activatevirtualenv
133 sh """$activatevirtualenv
134 pip install --upgrade MySQL-python
134 pip install --upgrade MySQL-python
135 """
135 """
136 withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) {
136 withEnv(['TEST_DB=mysql://kallithea:kallithea@jenkins_mysql/kallithea_test?charset=utf8']) {
137 if (isUnix()) {
137 if (isUnix()) {
138 sh script: """$activatevirtualenv
138 sh script: """$activatevirtualenv
139 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea
139 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea
140 """, returnStatus: true
140 """, returnStatus: true
141 } else {
141 } else {
142 bat script: """$activatevirtualenv
142 bat script: """$activatevirtualenv
143 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea
143 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_mysql.xml --cov=kallithea
144 """, returnStatus: true
144 """, returnStatus: true
145 }
145 }
146 }
146 }
147 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml'
147 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1MYSQL./g" pytest_mysql.xml'
148 archiveArtifacts 'pytest_mysql.xml'
148 archiveArtifacts 'pytest_mysql.xml'
149 junit 'pytest_mysql.xml'
149 junit 'pytest_mysql.xml'
150 writeFile(file: '.coverage.mysql', text: readFile('.coverage'))
150 writeFile(file: '.coverage.mysql', text: readFile('.coverage'))
151 stash name: 'coverage.mysql', includes: '.coverage.mysql'
151 stash name: 'coverage.mysql', includes: '.coverage.mysql'
152 }
152 }
153 }
153 }
154 }
154 }
155 }
155 }
156 pytests['postgresql'] = {
156 pytests['postgresql'] = {
157 node {
157 node {
158 if (isUnix()) {
158 if (isUnix()) {
159 ws {
159 ws {
160 deleteDir()
160 deleteDir()
161 unstash name: 'kallithea'
161 unstash name: 'kallithea'
162 sh """$activatevirtualenv
162 sh """$activatevirtualenv
163 pip install --upgrade psycopg2
163 pip install --upgrade psycopg2
164 """
164 """
165 withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) {
165 withEnv(['TEST_DB=postgresql://kallithea:kallithea@jenkins_postgresql/kallithea_test']) {
166 if (isUnix()) {
166 if (isUnix()) {
167 sh script: """$activatevirtualenv
167 sh script: """$activatevirtualenv
168 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea
168 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea
169 """, returnStatus: true
169 """, returnStatus: true
170 } else {
170 } else {
171 bat script: """$activatevirtualenv
171 bat script: """$activatevirtualenv
172 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea
172 py.test -p no:sugar --cov-config .coveragerc --junit-xml=pytest_postgresql.xml --cov=kallithea
173 """, returnStatus: true
173 """, returnStatus: true
174 }
174 }
175 }
175 }
176 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml'
176 sh 'sed --in-place "s/\\(classname=[\'\\"]\\)/\\1POSTGRES./g" pytest_postgresql.xml'
177 archiveArtifacts 'pytest_postgresql.xml'
177 archiveArtifacts 'pytest_postgresql.xml'
178 junit 'pytest_postgresql.xml'
178 junit 'pytest_postgresql.xml'
179 writeFile(file: '.coverage.postgresql', text: readFile('.coverage'))
179 writeFile(file: '.coverage.postgresql', text: readFile('.coverage'))
180 stash name: 'coverage.postgresql', includes: '.coverage.postgresql'
180 stash name: 'coverage.postgresql', includes: '.coverage.postgresql'
181 }
181 }
182 }
182 }
183 }
183 }
184 }
184 }
185 stage('Tests') {
185 stage('Tests') {
186 parallel pytests
186 parallel pytests
187 node {
187 node {
188 unstash 'coverage.sqlite'
188 unstash 'coverage.sqlite'
189 unstash 'coverage.de'
189 unstash 'coverage.de'
190 unstash 'coverage.mysql'
190 unstash 'coverage.mysql'
191 unstash 'coverage.postgresql'
191 unstash 'coverage.postgresql'
192 if (isUnix()) {
192 if (isUnix()) {
193 sh script: """$activatevirtualenv
193 sh script: """$activatevirtualenv
194 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql
194 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql
195 coverage xml
195 coverage xml
196 """, returnStatus: true
196 """, returnStatus: true
197 } else {
197 } else {
198 bat script: """$activatevirtualenv
198 bat script: """$activatevirtualenv
199 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql
199 coverage combine .coverage.sqlite .coverage.de .coverage.mysql .coverage.postgresql
200 coverage xml
200 coverage xml
201 """, returnStatus: true
201 """, returnStatus: true
202 }
202 }
203 try {
203 try {
204 step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false])
204 step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage.xml', failNoReports: false, failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, zoomCoverageChart: false])
205 } catch (java.lang.IllegalArgumentException exc) {
205 } catch (java.lang.IllegalArgumentException exc) {
206 echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report."
206 echo "You need to install the pipeline compatible 'CoberturaPublisher Plug-in' to display the coverage report."
207 currentBuild.result = 'UNSTABLE'
207 currentBuild.result = 'UNSTABLE'
208 echo "Caught: ${exc}"
208 echo "Caught: ${exc}"
209 }
209 }
210 }
210 }
211 }
211 }
@@ -1,186 +1,185 b''
1 ================
1 ================
2 Kallithea README
2 Kallithea README
3 ================
3 ================
4
4
5
5
6 About
6 About
7 -----
7 -----
8
8
9 **Kallithea** is a fast and powerful management tool for Mercurial_ and Git_
9 **Kallithea** is a fast and powerful management tool for Mercurial_ and Git_
10 with a built-in push/pull server, full text search and code-review. It works on
10 with a built-in push/pull server, full text search and code-review. It works on
11 HTTP/HTTPS and SSH, has a built-in permission/authentication system with the ability
11 HTTP/HTTPS and SSH, has a built-in permission/authentication system with the ability
12 to authenticate via LDAP or ActiveDirectory. Kallithea also provides simple API
12 to authenticate via LDAP or ActiveDirectory. Kallithea also provides simple API
13 so it's easy to integrate with existing external systems.
13 so it's easy to integrate with existing external systems.
14
14
15 Kallithea is similar in some respects to GitHub_ or Bitbucket_, however
15 Kallithea is similar in some respects to GitHub_ or Bitbucket_, however
16 Kallithea can be run as standalone hosted application on your own server. It is
16 Kallithea can be run as standalone hosted application on your own server. It is
17 open-source and focuses more on providing a customised,
17 open-source and focuses more on providing a customised,
18 self-administered interface for Mercurial_ and Git_ repositories. Kallithea
18 self-administered interface for Mercurial_ and Git_ repositories. Kallithea
19 works on Unix-like systems and Windows.
19 works on Unix-like systems and Windows.
20
20
21 Kallithea was forked from RhodeCode in July 2014 and has been heavily modified.
21 Kallithea was forked from RhodeCode in July 2014 and has been heavily modified.
22
22
23
23
24 Installation
24 Installation
25 ------------
25 ------------
26
26
27 Kallithea requires Python_ 2.7 and it is recommended to install it in a
27 Kallithea requires Python_ 2.7 and it is recommended to install it in a
28 virtualenv_. Official releases of Kallithea can be installed with::
28 virtualenv. Official releases of Kallithea can be installed with::
29
29
30 pip install kallithea
30 pip install kallithea
31
31
32 The development repository is kept very stable and used in production by the
32 The development repository is kept very stable and used in production by the
33 developers -- you can do the same.
33 developers -- you can do the same.
34
34
35 Please visit https://docs.kallithea-scm.org/en/latest/installation.html for
35 Please visit https://docs.kallithea-scm.org/en/latest/installation.html for
36 more details.
36 more details.
37
37
38 There is also an experimental `Puppet module`_ for installing and setting up
38 There is also an experimental `Puppet module`_ for installing and setting up
39 Kallithea. Currently, only basic functionality is provided, but it is still
39 Kallithea. Currently, only basic functionality is provided, but it is still
40 enough to get up and running quickly, especially for people without Python
40 enough to get up and running quickly, especially for people without Python
41 background. See
41 background. See
42 https://docs.kallithea-scm.org/en/latest/installation_puppet.html for further
42 https://docs.kallithea-scm.org/en/latest/installation_puppet.html for further
43 information.
43 information.
44
44
45
45
46 Source code
46 Source code
47 -----------
47 -----------
48
48
49 The latest sources can be obtained from
49 The latest sources can be obtained from
50 https://kallithea-scm.org/repos/kallithea.
50 https://kallithea-scm.org/repos/kallithea.
51
51
52 The issue tracker and a repository mirror can be found at Bitbucket_ on
52 The issue tracker and a repository mirror can be found at Bitbucket_ on
53 https://bitbucket.org/conservancy/kallithea.
53 https://bitbucket.org/conservancy/kallithea.
54
54
55
55
56 Kallithea features
56 Kallithea features
57 ------------------
57 ------------------
58
58
59 - Has its own middleware to handle Mercurial_ and Git_ protocol requests. Each
59 - Has its own middleware to handle Mercurial_ and Git_ protocol requests. Each
60 request is authenticated and logged together with IP address.
60 request is authenticated and logged together with IP address.
61 - Built for speed and performance. You can make multiple pulls/pushes
61 - Built for speed and performance. You can make multiple pulls/pushes
62 simultaneously. Proven to work with thousands of repositories and users.
62 simultaneously. Proven to work with thousands of repositories and users.
63 - Supports HTTP/HTTPS with LDAP, AD, or proxy-pass authentication.
63 - Supports HTTP/HTTPS with LDAP, AD, or proxy-pass authentication.
64 - Supports SSH access with server-side public key management.
64 - Supports SSH access with server-side public key management.
65 - Full permissions (private/read/write/admin) together with IP restrictions for
65 - Full permissions (private/read/write/admin) together with IP restrictions for
66 each repository, additional explicit forking, repositories group and
66 each repository, additional explicit forking, repositories group and
67 repository creation permissions.
67 repository creation permissions.
68 - User groups for easier permission management.
68 - User groups for easier permission management.
69 - Repository groups let you group repos and manage them easier. They come with
69 - Repository groups let you group repos and manage them easier. They come with
70 permission delegation features, so you can delegate groups management.
70 permission delegation features, so you can delegate groups management.
71 - Users can fork other users repos, and compare them at any time.
71 - Users can fork other users repos, and compare them at any time.
72 - Built-in versioned paste functionality (Gist) for sharing code snippets.
72 - Built-in versioned paste functionality (Gist) for sharing code snippets.
73 - Integrates easily with other systems, with custom created mappers you can
73 - Integrates easily with other systems, with custom created mappers you can
74 connect it to almost any issue tracker, and with a JSON-RPC API you can make
74 connect it to almost any issue tracker, and with a JSON-RPC API you can make
75 much more.
75 much more.
76 - Built-in commit API lets you add, edit and commit files right from Kallithea
76 - Built-in commit API lets you add, edit and commit files right from Kallithea
77 web interface using simple editor or upload binary files using simple form.
77 web interface using simple editor or upload binary files using simple form.
78 - Powerful pull request driven review system with inline commenting, changeset
78 - Powerful pull request driven review system with inline commenting, changeset
79 statuses, and notification system.
79 statuses, and notification system.
80 - Importing and syncing repositories from remote locations for Git_, Mercurial_
80 - Importing and syncing repositories from remote locations for Git_, Mercurial_
81 and Subversion.
81 and Subversion.
82 - Mako templates let you customize the look and feel of the application.
82 - Mako templates let you customize the look and feel of the application.
83 - Beautiful diffs, annotations and source code browsing all colored by
83 - Beautiful diffs, annotations and source code browsing all colored by
84 pygments. Raw diffs are made in Git-diff format for both VCS systems,
84 pygments. Raw diffs are made in Git-diff format for both VCS systems,
85 including Git_ binary-patches.
85 including Git_ binary-patches.
86 - Mercurial_ and Git_ DAG graphs and Flot-powered graphs with zooming and
86 - Mercurial_ and Git_ DAG graphs and Flot-powered graphs with zooming and
87 statistics to track activity for repositories.
87 statistics to track activity for repositories.
88 - Admin interface with user/permission management. Admin activity journal logs
88 - Admin interface with user/permission management. Admin activity journal logs
89 pulls, pushes, forks, registrations and other actions made by all users.
89 pulls, pushes, forks, registrations and other actions made by all users.
90 - Server side forks. It is possible to fork a project and modify it freely
90 - Server side forks. It is possible to fork a project and modify it freely
91 without breaking the main repository.
91 without breaking the main repository.
92 - reST and Markdown README support for repositories.
92 - reST and Markdown README support for repositories.
93 - Full text search powered by Whoosh on the source files, commit messages, and
93 - Full text search powered by Whoosh on the source files, commit messages, and
94 file names. Built-in indexing daemons, with optional incremental index build
94 file names. Built-in indexing daemons, with optional incremental index build
95 (no external search servers required all in one application).
95 (no external search servers required all in one application).
96 - Setup project descriptions/tags and info inside built in DB for easy,
96 - Setup project descriptions/tags and info inside built in DB for easy,
97 non-filesystem operations.
97 non-filesystem operations.
98 - Intelligent cache with invalidation after push or project change, provides
98 - Intelligent cache with invalidation after push or project change, provides
99 high performance and always up to date data.
99 high performance and always up to date data.
100 - RSS/Atom feeds, Gravatar support, downloadable sources as zip/tar/gz.
100 - RSS/Atom feeds, Gravatar support, downloadable sources as zip/tar/gz.
101 - Optional async tasks for speed and performance using Celery_.
101 - Optional async tasks for speed and performance using Celery_.
102 - Backup scripts can do backup of whole app and send it over scp to desired
102 - Backup scripts can do backup of whole app and send it over scp to desired
103 location.
103 location.
104 - Based on TurboGears2, SQLAlchemy, Whoosh, Bootstrap, and other open source
104 - Based on TurboGears2, SQLAlchemy, Whoosh, Bootstrap, and other open source
105 libraries.
105 libraries.
106 - Uses PostgreSQL, SQLite, or MariaDB/MySQL databases.
106 - Uses PostgreSQL, SQLite, or MariaDB/MySQL databases.
107
107
108
108
109 License
109 License
110 -------
110 -------
111
111
112 **Kallithea** is released under the GPLv3 license. Kallithea is a `Software
112 **Kallithea** is released under the GPLv3 license. Kallithea is a `Software
113 Freedom Conservancy`_ project and thus controlled by a non-profit organization.
113 Freedom Conservancy`_ project and thus controlled by a non-profit organization.
114 No commercial entity can take ownership of the project and change the
114 No commercial entity can take ownership of the project and change the
115 direction.
115 direction.
116
116
117 Kallithea started out as an effort to make sure the existing GPLv3 codebase
117 Kallithea started out as an effort to make sure the existing GPLv3 codebase
118 would stay available under a legal license. Kallithea thus has to stay GPLv3
118 would stay available under a legal license. Kallithea thus has to stay GPLv3
119 compatible ... but we are also happy it is GPLv3 and happy to keep it that way.
119 compatible ... but we are also happy it is GPLv3 and happy to keep it that way.
120 A different license (such as AGPL) could perhaps help attract a different
120 A different license (such as AGPL) could perhaps help attract a different
121 community with a different mix of Free Software people and companies but we are
121 community with a different mix of Free Software people and companies but we are
122 happy with the current focus.
122 happy with the current focus.
123
123
124
124
125 Community
125 Community
126 ---------
126 ---------
127
127
128 **Kallithea** is maintained by its users who contribute the fixes they would
128 **Kallithea** is maintained by its users who contribute the fixes they would
129 like to see.
129 like to see.
130
130
131 Get in touch with the rest of the community:
131 Get in touch with the rest of the community:
132
132
133 - Join the mailing list users and developers -- see
133 - Join the mailing list users and developers -- see
134 http://lists.sfconservancy.org/mailman/listinfo/kallithea-general.
134 http://lists.sfconservancy.org/mailman/listinfo/kallithea-general.
135
135
136 - Use IRC and join #kallithea on FreeNode (irc.freenode.net) or use
136 - Use IRC and join #kallithea on FreeNode (irc.freenode.net) or use
137 http://webchat.freenode.net/?channels=kallithea.
137 http://webchat.freenode.net/?channels=kallithea.
138
138
139 - Follow Kallithea on Twitter, **@KallitheaSCM**.
139 - Follow Kallithea on Twitter, **@KallitheaSCM**.
140
140
141 - Issues can be reported at `issue tracker
141 - Issues can be reported at `issue tracker
142 <https://bitbucket.org/conservancy/kallithea/issues>`_.
142 <https://bitbucket.org/conservancy/kallithea/issues>`_.
143
143
144 .. note::
144 .. note::
145
145
146 Please try to read the documentation before posting any issues,
146 Please try to read the documentation before posting any issues,
147 especially the **troubleshooting section**
147 especially the **troubleshooting section**
148
148
149
149
150 Online documentation
150 Online documentation
151 --------------------
151 --------------------
152
152
153 Online documentation for the current version of Kallithea is available at
153 Online documentation for the current version of Kallithea is available at
154 https://docs.kallithea-scm.org/en/stable/. Documentation for the current development
154 https://docs.kallithea-scm.org/en/stable/. Documentation for the current development
155 version can be found on https://docs.kallithea-scm.org/en/default/.
155 version can be found on https://docs.kallithea-scm.org/en/default/.
156
156
157 You can also build the documentation locally: go to ``docs/`` and run::
157 You can also build the documentation locally: go to ``docs/`` and run::
158
158
159 make html
159 make html
160
160
161 .. note:: You need to have Sphinx_ installed to build the
161 .. note:: You need to have Sphinx_ installed to build the
162 documentation. If you don't have Sphinx_ installed you can
162 documentation. If you don't have Sphinx_ installed you can
163 install it via the command: ``pip install sphinx`` .
163 install it via the command: ``pip install sphinx`` .
164
164
165
165
166 Migrating from RhodeCode
166 Migrating from RhodeCode
167 ------------------------
167 ------------------------
168
168
169 Kallithea 0.3.2 and earlier supports migrating from an existing RhodeCode
169 Kallithea 0.3.2 and earlier supports migrating from an existing RhodeCode
170 installation. To migrate, install Kallithea 0.3.2 and follow the
170 installation. To migrate, install Kallithea 0.3.2 and follow the
171 instructions in the 0.3.2 README to perform a one-time conversion of the
171 instructions in the 0.3.2 README to perform a one-time conversion of the
172 database from RhodeCode to Kallithea, before upgrading to this version
172 database from RhodeCode to Kallithea, before upgrading to this version
173 of Kallithea.
173 of Kallithea.
174
174
175
175
176 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
177 .. _Python: http://www.python.org/
176 .. _Python: http://www.python.org/
178 .. _Sphinx: http://sphinx.pocoo.org/
177 .. _Sphinx: http://sphinx.pocoo.org/
179 .. _Mercurial: http://mercurial.selenic.com/
178 .. _Mercurial: http://mercurial.selenic.com/
180 .. _Bitbucket: http://bitbucket.org/
179 .. _Bitbucket: http://bitbucket.org/
181 .. _GitHub: http://github.com/
180 .. _GitHub: http://github.com/
182 .. _Subversion: http://subversion.tigris.org/
181 .. _Subversion: http://subversion.tigris.org/
183 .. _Git: http://git-scm.com/
182 .. _Git: http://git-scm.com/
184 .. _Celery: http://celeryproject.org/
183 .. _Celery: http://celeryproject.org/
185 .. _Software Freedom Conservancy: http://sfconservancy.org/
184 .. _Software Freedom Conservancy: http://sfconservancy.org/
186 .. _Puppet module: https://forge.puppetlabs.com/rauch/kallithea
185 .. _Puppet module: https://forge.puppetlabs.com/rauch/kallithea
@@ -1,313 +1,313 b''
1 .. _contributing:
1 .. _contributing:
2
2
3 =========================
3 =========================
4 Contributing to Kallithea
4 Contributing to Kallithea
5 =========================
5 =========================
6
6
7 Kallithea is developed and maintained by its users. Please join us and scratch
7 Kallithea is developed and maintained by its users. Please join us and scratch
8 your own itch.
8 your own itch.
9
9
10
10
11 Infrastructure
11 Infrastructure
12 --------------
12 --------------
13
13
14 The main repository is hosted on Our Own Kallithea (aka OOK) at
14 The main repository is hosted on Our Own Kallithea (aka OOK) at
15 https://kallithea-scm.org/repos/kallithea/, our self-hosted instance
15 https://kallithea-scm.org/repos/kallithea/, our self-hosted instance
16 of Kallithea.
16 of Kallithea.
17
17
18 For now, we use Bitbucket_ for `pull requests`_ and `issue tracking`_. The
18 For now, we use Bitbucket_ for `pull requests`_ and `issue tracking`_. The
19 issue tracker is for tracking bugs, not for support, discussion, or ideas --
19 issue tracker is for tracking bugs, not for support, discussion, or ideas --
20 please use the `mailing list`_ or :ref:`IRC <readme>` to reach the community.
20 please use the `mailing list`_ or :ref:`IRC <readme>` to reach the community.
21
21
22 We use Weblate_ to translate the user interface messages into languages other
22 We use Weblate_ to translate the user interface messages into languages other
23 than English. Join our project on `Hosted Weblate`_ to help us.
23 than English. Join our project on `Hosted Weblate`_ to help us.
24 To register, you can use your Bitbucket or GitHub account. See :ref:`translations`
24 To register, you can use your Bitbucket or GitHub account. See :ref:`translations`
25 for more details.
25 for more details.
26
26
27
27
28 Getting started
28 Getting started
29 ---------------
29 ---------------
30
30
31 To get started with Kallithea development::
31 To get started with Kallithea development::
32
32
33 hg clone https://kallithea-scm.org/repos/kallithea
33 hg clone https://kallithea-scm.org/repos/kallithea
34 cd kallithea
34 cd kallithea
35 virtualenv ../kallithea-venv
35 python3 -m venv ../kallithea-venv
36 source ../kallithea-venv/bin/activate
36 source ../kallithea-venv/bin/activate
37 pip install --upgrade pip setuptools
37 pip install --upgrade pip setuptools
38 pip install --upgrade -e . -r dev_requirements.txt python-ldap python-pam
38 pip install --upgrade -e . -r dev_requirements.txt python-ldap python-pam
39 kallithea-cli config-create my.ini
39 kallithea-cli config-create my.ini
40 kallithea-cli db-create -c my.ini --user=user --email=user@example.com --password=password --repos=/tmp
40 kallithea-cli db-create -c my.ini --user=user --email=user@example.com --password=password --repos=/tmp
41 kallithea-cli front-end-build
41 kallithea-cli front-end-build
42 gearbox serve -c my.ini --reload &
42 gearbox serve -c my.ini --reload &
43 firefox http://127.0.0.1:5000/
43 firefox http://127.0.0.1:5000/
44
44
45 If you plan to use Bitbucket_ for sending contributions, you can also fork
45 If you plan to use Bitbucket_ for sending contributions, you can also fork
46 Kallithea on Bitbucket_ first (https://bitbucket.org/conservancy/kallithea) and
46 Kallithea on Bitbucket_ first (https://bitbucket.org/conservancy/kallithea) and
47 then replace the clone step above by a clone of your fork. In this case, please
47 then replace the clone step above by a clone of your fork. In this case, please
48 see :ref:`contributing-guidelines` below for configuring your fork correctly.
48 see :ref:`contributing-guidelines` below for configuring your fork correctly.
49
49
50
50
51 Contribution flow
51 Contribution flow
52 -----------------
52 -----------------
53
53
54 Starting from an existing Kallithea clone, make sure it is up to date with the
54 Starting from an existing Kallithea clone, make sure it is up to date with the
55 latest upstream changes::
55 latest upstream changes::
56
56
57 hg pull
57 hg pull
58 hg update
58 hg update
59
59
60 Review the :ref:`contributing-guidelines` and :ref:`coding-guidelines`.
60 Review the :ref:`contributing-guidelines` and :ref:`coding-guidelines`.
61
61
62 If you are new to Mercurial, refer to Mercurial `Quick Start`_ and `Beginners
62 If you are new to Mercurial, refer to Mercurial `Quick Start`_ and `Beginners
63 Guide`_ on the Mercurial wiki.
63 Guide`_ on the Mercurial wiki.
64
64
65 Now, make some changes and test them (see :ref:`contributing-tests`). Don't
65 Now, make some changes and test them (see :ref:`contributing-tests`). Don't
66 forget to add new tests to cover new functionality or bug fixes.
66 forget to add new tests to cover new functionality or bug fixes.
67
67
68 For documentation changes, run ``make html`` from the ``docs`` directory to
68 For documentation changes, run ``make html`` from the ``docs`` directory to
69 generate the HTML result, then review them in your browser.
69 generate the HTML result, then review them in your browser.
70
70
71 Before submitting any changes, run the cleanup script::
71 Before submitting any changes, run the cleanup script::
72
72
73 ./scripts/run-all-cleanup
73 ./scripts/run-all-cleanup
74
74
75 When you are completely ready, you can send your changes to the community for
75 When you are completely ready, you can send your changes to the community for
76 review and inclusion. Most commonly used methods are sending patches to the
76 review and inclusion. Most commonly used methods are sending patches to the
77 mailing list (via ``hg email``) or by creating a pull request on Bitbucket_.
77 mailing list (via ``hg email``) or by creating a pull request on Bitbucket_.
78
78
79 .. _contributing-tests:
79 .. _contributing-tests:
80
80
81
81
82 Running tests
82 Running tests
83 -------------
83 -------------
84
84
85 After finishing your changes make sure all tests pass cleanly. Run the testsuite
85 After finishing your changes make sure all tests pass cleanly. Run the testsuite
86 by invoking ``py.test`` from the project root::
86 by invoking ``py.test`` from the project root::
87
87
88 py.test
88 py.test
89
89
90 Note that on unix systems, the temporary directory (``/tmp`` or where
90 Note that on unix systems, the temporary directory (``/tmp`` or where
91 ``$TMPDIR`` points) must allow executable files; Git hooks must be executable,
91 ``$TMPDIR`` points) must allow executable files; Git hooks must be executable,
92 and the test suite creates repositories in the temporary directory. Linux
92 and the test suite creates repositories in the temporary directory. Linux
93 systems with /tmp mounted noexec will thus fail.
93 systems with /tmp mounted noexec will thus fail.
94
94
95 You can also use ``tox`` to run the tests with all supported Python versions
95 You can also use ``tox`` to run the tests with all supported Python versions
96 (currently only Python 2.7).
96 (currently only Python 2.7).
97
97
98 When running tests, Kallithea generates a `test.ini` based on template values
98 When running tests, Kallithea generates a `test.ini` based on template values
99 in `kallithea/tests/conftest.py` and populates the SQLite database specified
99 in `kallithea/tests/conftest.py` and populates the SQLite database specified
100 there.
100 there.
101
101
102 It is possible to avoid recreating the full test database on each invocation of
102 It is possible to avoid recreating the full test database on each invocation of
103 the tests, thus eliminating the initial delay. To achieve this, run the tests as::
103 the tests, thus eliminating the initial delay. To achieve this, run the tests as::
104
104
105 gearbox serve -c /tmp/kallithea-test-XXX/test.ini --pid-file=test.pid --daemon
105 gearbox serve -c /tmp/kallithea-test-XXX/test.ini --pid-file=test.pid --daemon
106 KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
106 KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
107 kill -9 $(cat test.pid)
107 kill -9 $(cat test.pid)
108
108
109 In these commands, the following variables are used::
109 In these commands, the following variables are used::
110
110
111 KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
111 KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
112 KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
112 KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
113
113
114 You can run individual tests by specifying their path as argument to py.test.
114 You can run individual tests by specifying their path as argument to py.test.
115 py.test also has many more options, see `py.test -h`. Some useful options
115 py.test also has many more options, see `py.test -h`. Some useful options
116 are::
116 are::
117
117
118 -k EXPRESSION only run tests which match the given substring
118 -k EXPRESSION only run tests which match the given substring
119 expression. An expression is a python evaluable
119 expression. An expression is a python evaluable
120 expression where all names are substring-matched
120 expression where all names are substring-matched
121 against test names and their parent classes. Example:
121 against test names and their parent classes. Example:
122 -x, --exitfirst exit instantly on first error or failed test.
122 -x, --exitfirst exit instantly on first error or failed test.
123 --lf rerun only the tests that failed at the last run (or
123 --lf rerun only the tests that failed at the last run (or
124 all if none failed)
124 all if none failed)
125 --ff run all tests but run the last failures first. This
125 --ff run all tests but run the last failures first. This
126 may re-order tests and thus lead to repeated fixture
126 may re-order tests and thus lead to repeated fixture
127 setup/teardown
127 setup/teardown
128 --pdb start the interactive Python debugger on errors.
128 --pdb start the interactive Python debugger on errors.
129 -s, --capture=no don't capture stdout (any stdout output will be
129 -s, --capture=no don't capture stdout (any stdout output will be
130 printed immediately)
130 printed immediately)
131
131
132 Performance tests
132 Performance tests
133 ^^^^^^^^^^^^^^^^^
133 ^^^^^^^^^^^^^^^^^
134
134
135 A number of performance tests are present in the test suite, but they are
135 A number of performance tests are present in the test suite, but they are
136 not run in a standard test run. These tests are useful to
136 not run in a standard test run. These tests are useful to
137 evaluate the impact of certain code changes with respect to performance.
137 evaluate the impact of certain code changes with respect to performance.
138
138
139 To run these tests::
139 To run these tests::
140
140
141 env TEST_PERFORMANCE=1 py.test kallithea/tests/performance
141 env TEST_PERFORMANCE=1 py.test kallithea/tests/performance
142
142
143 To analyze performance, you could install pytest-profiling_, which enables the
143 To analyze performance, you could install pytest-profiling_, which enables the
144 --profile and --profile-svg options to py.test.
144 --profile and --profile-svg options to py.test.
145
145
146 .. _pytest-profiling: https://github.com/manahl/pytest-plugins/tree/master/pytest-profiling
146 .. _pytest-profiling: https://github.com/manahl/pytest-plugins/tree/master/pytest-profiling
147
147
148 .. _contributing-guidelines:
148 .. _contributing-guidelines:
149
149
150
150
151 Contribution guidelines
151 Contribution guidelines
152 -----------------------
152 -----------------------
153
153
154 Kallithea is GPLv3 and we assume all contributions are made by the
154 Kallithea is GPLv3 and we assume all contributions are made by the
155 committer/contributor and under GPLv3 unless explicitly stated. We do care a
155 committer/contributor and under GPLv3 unless explicitly stated. We do care a
156 lot about preservation of copyright and license information for existing code
156 lot about preservation of copyright and license information for existing code
157 that is brought into the project.
157 that is brought into the project.
158
158
159 Contributions will be accepted in most formats -- such as pull requests on
159 Contributions will be accepted in most formats -- such as pull requests on
160 Bitbucket, something hosted on your own Kallithea instance, or patches sent by
160 Bitbucket, something hosted on your own Kallithea instance, or patches sent by
161 email to the `kallithea-general`_ mailing list.
161 email to the `kallithea-general`_ mailing list.
162
162
163 When contributing via Bitbucket, please make your fork of
163 When contributing via Bitbucket, please make your fork of
164 https://bitbucket.org/conservancy/kallithea/ `non-publishing`_ -- it is one of
164 https://bitbucket.org/conservancy/kallithea/ `non-publishing`_ -- it is one of
165 the settings on "Repository details" page. This ensures your commits are in
165 the settings on "Repository details" page. This ensures your commits are in
166 "draft" phase and makes it easier for you to address feedback and for project
166 "draft" phase and makes it easier for you to address feedback and for project
167 maintainers to integrate your changes.
167 maintainers to integrate your changes.
168
168
169 .. _non-publishing: https://www.mercurial-scm.org/wiki/Phases#Publishing_Repository
169 .. _non-publishing: https://www.mercurial-scm.org/wiki/Phases#Publishing_Repository
170
170
171 Make sure to test your changes both manually and with the automatic tests
171 Make sure to test your changes both manually and with the automatic tests
172 before posting.
172 before posting.
173
173
174 We care about quality and review and keeping a clean repository history. We
174 We care about quality and review and keeping a clean repository history. We
175 might give feedback that requests polishing contributions until they are
175 might give feedback that requests polishing contributions until they are
176 "perfect". We might also rebase and collapse and make minor adjustments to your
176 "perfect". We might also rebase and collapse and make minor adjustments to your
177 changes when we apply them.
177 changes when we apply them.
178
178
179 We try to make sure we have consensus on the direction the project is taking.
179 We try to make sure we have consensus on the direction the project is taking.
180 Everything non-sensitive should be discussed in public -- preferably on the
180 Everything non-sensitive should be discussed in public -- preferably on the
181 mailing list. We aim at having all non-trivial changes reviewed by at least
181 mailing list. We aim at having all non-trivial changes reviewed by at least
182 one other core developer before pushing. Obvious non-controversial changes will
182 one other core developer before pushing. Obvious non-controversial changes will
183 be handled more casually.
183 be handled more casually.
184
184
185 There is a main development branch ("default") which is generally stable so that
185 There is a main development branch ("default") which is generally stable so that
186 it can be (and is) used in production. There is also a "stable" branch that is
186 it can be (and is) used in production. There is also a "stable" branch that is
187 almost exclusively reserved for bug fixes or trivial changes. Experimental
187 almost exclusively reserved for bug fixes or trivial changes. Experimental
188 changes should live elsewhere (for example in a pull request) until they are
188 changes should live elsewhere (for example in a pull request) until they are
189 ready.
189 ready.
190
190
191 .. _coding-guidelines:
191 .. _coding-guidelines:
192
192
193
193
194 Coding guidelines
194 Coding guidelines
195 -----------------
195 -----------------
196
196
197 We don't have a formal coding/formatting standard. We are currently using a mix
197 We don't have a formal coding/formatting standard. We are currently using a mix
198 of Mercurial's (https://www.mercurial-scm.org/wiki/CodingStyle), pep8, and
198 of Mercurial's (https://www.mercurial-scm.org/wiki/CodingStyle), pep8, and
199 consistency with existing code. Run ``scripts/run-all-cleanup`` before
199 consistency with existing code. Run ``scripts/run-all-cleanup`` before
200 committing to ensure some basic code formatting consistency.
200 committing to ensure some basic code formatting consistency.
201
201
202 We currently only support Python 2.7.x and nothing else. For now we don't care
202 We currently only support Python 2.7.x and nothing else. For now we don't care
203 about Python 3 compatibility.
203 about Python 3 compatibility.
204
204
205 We try to support the most common modern web browsers. IE9 is still supported
205 We try to support the most common modern web browsers. IE9 is still supported
206 to the extent it is feasible, IE8 is not.
206 to the extent it is feasible, IE8 is not.
207
207
208 We primarily support Linux and OS X on the server side but Windows should also work.
208 We primarily support Linux and OS X on the server side but Windows should also work.
209
209
210 HTML templates should use 2 spaces for indentation ... but be pragmatic. We
210 HTML templates should use 2 spaces for indentation ... but be pragmatic. We
211 should use templates cleverly and avoid duplication. We should use reasonable
211 should use templates cleverly and avoid duplication. We should use reasonable
212 semantic markup with element classes and IDs that can be used for styling and testing.
212 semantic markup with element classes and IDs that can be used for styling and testing.
213 We should only use inline styles in places where it really is semantic (such as
213 We should only use inline styles in places where it really is semantic (such as
214 ``display: none``).
214 ``display: none``).
215
215
216 JavaScript must use ``;`` between/after statements. Indentation 4 spaces. Inline
216 JavaScript must use ``;`` between/after statements. Indentation 4 spaces. Inline
217 multiline functions should be indented two levels -- one for the ``()`` and one for
217 multiline functions should be indented two levels -- one for the ``()`` and one for
218 ``{}``.
218 ``{}``.
219 Variables holding jQuery objects should be named with a leading ``$``.
219 Variables holding jQuery objects should be named with a leading ``$``.
220
220
221 Commit messages should have a leading short line summarizing the changes. For
221 Commit messages should have a leading short line summarizing the changes. For
222 bug fixes, put ``(Issue #123)`` at the end of this line.
222 bug fixes, put ``(Issue #123)`` at the end of this line.
223
223
224 Use American English grammar and spelling overall. Use `English title case`_ for
224 Use American English grammar and spelling overall. Use `English title case`_ for
225 page titles, button labels, headers, and 'labels' for fields in forms.
225 page titles, button labels, headers, and 'labels' for fields in forms.
226
226
227 .. _English title case: https://en.wikipedia.org/wiki/Capitalization#Title_case
227 .. _English title case: https://en.wikipedia.org/wiki/Capitalization#Title_case
228
228
229 Template helpers (that is, everything in ``kallithea.lib.helpers``)
229 Template helpers (that is, everything in ``kallithea.lib.helpers``)
230 should only be referenced from templates. If you need to call a
230 should only be referenced from templates. If you need to call a
231 helper from the Python code, consider moving the function somewhere
231 helper from the Python code, consider moving the function somewhere
232 else (e.g. to the model).
232 else (e.g. to the model).
233
233
234 Notes on the SQLAlchemy session
234 Notes on the SQLAlchemy session
235 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
235 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
236
236
237 Each HTTP request runs inside an independent SQLAlchemy session (as well
237 Each HTTP request runs inside an independent SQLAlchemy session (as well
238 as in an independent database transaction). ``Session`` is the session manager
238 as in an independent database transaction). ``Session`` is the session manager
239 and factory. ``Session()`` will create a new session on-demand or return the
239 and factory. ``Session()`` will create a new session on-demand or return the
240 current session for the active thread. Many database operations are methods on
240 current session for the active thread. Many database operations are methods on
241 such session instances - only ``Session.remove()`` should be called directly on
241 such session instances - only ``Session.remove()`` should be called directly on
242 the manager.
242 the manager.
243
243
244 Database model objects
244 Database model objects
245 (almost) always belong to a particular SQLAlchemy session, which means
245 (almost) always belong to a particular SQLAlchemy session, which means
246 that SQLAlchemy will ensure that they're kept in sync with the database
246 that SQLAlchemy will ensure that they're kept in sync with the database
247 (but also means that they cannot be shared across requests).
247 (but also means that they cannot be shared across requests).
248
248
249 Objects can be added to the session using ``Session().add``, but this is
249 Objects can be added to the session using ``Session().add``, but this is
250 rarely needed:
250 rarely needed:
251
251
252 * When creating a database object by calling the constructor directly,
252 * When creating a database object by calling the constructor directly,
253 it must explicitly be added to the session.
253 it must explicitly be added to the session.
254
254
255 * When creating an object using a factory function (like
255 * When creating an object using a factory function (like
256 ``create_repo``), the returned object has already (by convention)
256 ``create_repo``), the returned object has already (by convention)
257 been added to the session, and should not be added again.
257 been added to the session, and should not be added again.
258
258
259 * When getting an object from the session (via ``Session().query`` or
259 * When getting an object from the session (via ``Session().query`` or
260 any of the utility functions that look up objects in the database),
260 any of the utility functions that look up objects in the database),
261 it's already part of the session, and should not be added again.
261 it's already part of the session, and should not be added again.
262 SQLAlchemy monitors attribute modifications automatically for all
262 SQLAlchemy monitors attribute modifications automatically for all
263 objects it knows about and syncs them to the database.
263 objects it knows about and syncs them to the database.
264
264
265 SQLAlchemy also flushes changes to the database automatically; manually
265 SQLAlchemy also flushes changes to the database automatically; manually
266 calling ``Session().flush`` is usually only necessary when the Python
266 calling ``Session().flush`` is usually only necessary when the Python
267 code needs the database to assign an "auto-increment" primary key ID to
267 code needs the database to assign an "auto-increment" primary key ID to
268 a freshly created model object (before flushing, the ID attribute will
268 a freshly created model object (before flushing, the ID attribute will
269 be ``None``).
269 be ``None``).
270
270
271 TurboGears2 DebugBar
271 TurboGears2 DebugBar
272 ^^^^^^^^^^^^^^^^^^^^
272 ^^^^^^^^^^^^^^^^^^^^
273
273
274 It is possible to enable the TurboGears2-provided DebugBar_, a toolbar overlayed
274 It is possible to enable the TurboGears2-provided DebugBar_, a toolbar overlayed
275 over the Kallithea web interface, allowing you to see:
275 over the Kallithea web interface, allowing you to see:
276
276
277 * timing information of the current request, including profiling information
277 * timing information of the current request, including profiling information
278 * request data, including GET data, POST data, cookies, headers and environment
278 * request data, including GET data, POST data, cookies, headers and environment
279 variables
279 variables
280 * a list of executed database queries, including timing and result values
280 * a list of executed database queries, including timing and result values
281
281
282 DebugBar is only activated when ``debug = true`` is set in the configuration
282 DebugBar is only activated when ``debug = true`` is set in the configuration
283 file. This is important, because the DebugBar toolbar will be visible for all
283 file. This is important, because the DebugBar toolbar will be visible for all
284 users, and allow them to see information they should not be allowed to see. Like
284 users, and allow them to see information they should not be allowed to see. Like
285 is anyway the case for ``debug = true``, do not use this in production!
285 is anyway the case for ``debug = true``, do not use this in production!
286
286
287 To enable DebugBar, install ``tgext.debugbar`` and ``kajiki`` (typically via
287 To enable DebugBar, install ``tgext.debugbar`` and ``kajiki`` (typically via
288 ``pip``) and restart Kallithea (in debug mode).
288 ``pip``) and restart Kallithea (in debug mode).
289
289
290
290
291 "Roadmap"
291 "Roadmap"
292 ---------
292 ---------
293
293
294 We do not have a road map but are waiting for your contributions. Refer to the
294 We do not have a road map but are waiting for your contributions. Refer to the
295 wiki_ for some ideas of places we might want to go -- contributions in these
295 wiki_ for some ideas of places we might want to go -- contributions in these
296 areas are very welcome.
296 areas are very welcome.
297
297
298
298
299 Thank you for your contribution!
299 Thank you for your contribution!
300 --------------------------------
300 --------------------------------
301
301
302
302
303 .. _Weblate: http://weblate.org/
303 .. _Weblate: http://weblate.org/
304 .. _issue tracking: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
304 .. _issue tracking: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
305 .. _pull requests: https://bitbucket.org/conservancy/kallithea/pull-requests
305 .. _pull requests: https://bitbucket.org/conservancy/kallithea/pull-requests
306 .. _bitbucket: http://bitbucket.org/
306 .. _bitbucket: http://bitbucket.org/
307 .. _mailing list: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
307 .. _mailing list: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
308 .. _kallithea-general: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
308 .. _kallithea-general: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
309 .. _Hosted Weblate: https://hosted.weblate.org/projects/kallithea/kallithea/
309 .. _Hosted Weblate: https://hosted.weblate.org/projects/kallithea/kallithea/
310 .. _wiki: https://bitbucket.org/conservancy/kallithea/wiki/Home
310 .. _wiki: https://bitbucket.org/conservancy/kallithea/wiki/Home
311 .. _DebugBar: https://github.com/TurboGears/tgext.debugbar
311 .. _DebugBar: https://github.com/TurboGears/tgext.debugbar
312 .. _Quick Start: https://www.mercurial-scm.org/wiki/QuickStart
312 .. _Quick Start: https://www.mercurial-scm.org/wiki/QuickStart
313 .. _Beginners Guide: https://www.mercurial-scm.org/wiki/BeginnersGuides
313 .. _Beginners Guide: https://www.mercurial-scm.org/wiki/BeginnersGuides
@@ -1,90 +1,89 b''
1 .. _index:
1 .. _index:
2
2
3 #######################
3 #######################
4 Kallithea Documentation
4 Kallithea Documentation
5 #######################
5 #######################
6
6
7 * :ref:`genindex`
7 * :ref:`genindex`
8 * :ref:`search`
8 * :ref:`search`
9
9
10
10
11 Readme
11 Readme
12 ******
12 ******
13
13
14 .. toctree::
14 .. toctree::
15 :maxdepth: 1
15 :maxdepth: 1
16
16
17 readme
17 readme
18
18
19
19
20 Administrator guide
20 Administrator guide
21 *******************
21 *******************
22
22
23 **Installation and upgrade**
23 **Installation and upgrade**
24
24
25 .. toctree::
25 .. toctree::
26 :maxdepth: 1
26 :maxdepth: 1
27
27
28 overview
28 overview
29 installation
29 installation
30 installation_win
30 installation_win
31 installation_win_old
31 installation_win_old
32 installation_iis
32 installation_iis
33 installation_puppet
33 installation_puppet
34 upgrade
34 upgrade
35
35
36 **Setup and configuration**
36 **Setup and configuration**
37
37
38 .. toctree::
38 .. toctree::
39 :maxdepth: 1
39 :maxdepth: 1
40
40
41 setup
41 setup
42 administrator_guide/auth
42 administrator_guide/auth
43 administrator_guide/vcs_setup
43 administrator_guide/vcs_setup
44 usage/email
44 usage/email
45 usage/customization
45 usage/customization
46
46
47 **Maintenance**
47 **Maintenance**
48
48
49 .. toctree::
49 .. toctree::
50 :maxdepth: 1
50 :maxdepth: 1
51
51
52 usage/backup
52 usage/backup
53 usage/performance
53 usage/performance
54 usage/debugging
54 usage/debugging
55 usage/troubleshooting
55 usage/troubleshooting
56
56
57
57
58 User guide
58 User guide
59 **********
59 **********
60
60
61 .. toctree::
61 .. toctree::
62 :maxdepth: 1
62 :maxdepth: 1
63
63
64 usage/general
64 usage/general
65 usage/vcs_notes
65 usage/vcs_notes
66 usage/statistics
66 usage/statistics
67 api/api
67 api/api
68
68
69
69
70 Developer guide
70 Developer guide
71 ***************
71 ***************
72
72
73 .. toctree::
73 .. toctree::
74 :maxdepth: 1
74 :maxdepth: 1
75
75
76 contributing
76 contributing
77 dev/translation
77 dev/translation
78 dev/dbmigrations
78 dev/dbmigrations
79
79
80
80
81 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
82 .. _python: http://www.python.org/
81 .. _python: http://www.python.org/
83 .. _django: http://www.djangoproject.com/
82 .. _django: http://www.djangoproject.com/
84 .. _mercurial: https://www.mercurial-scm.org/
83 .. _mercurial: https://www.mercurial-scm.org/
85 .. _bitbucket: http://bitbucket.org/
84 .. _bitbucket: http://bitbucket.org/
86 .. _subversion: http://subversion.tigris.org/
85 .. _subversion: http://subversion.tigris.org/
87 .. _git: http://git-scm.com/
86 .. _git: http://git-scm.com/
88 .. _celery: http://celeryproject.org/
87 .. _celery: http://celeryproject.org/
89 .. _Sphinx: http://sphinx.pocoo.org/
88 .. _Sphinx: http://sphinx.pocoo.org/
90 .. _vcs: http://pypi.python.org/pypi/vcs
89 .. _vcs: http://pypi.python.org/pypi/vcs
@@ -1,138 +1,135 b''
1 .. _installation:
1 .. _installation:
2
2
3 ==========================
3 ==========================
4 Installation on Unix/Linux
4 Installation on Unix/Linux
5 ==========================
5 ==========================
6
6
7 The following describes three different ways of installing Kallithea:
7 The following describes three different ways of installing Kallithea:
8
8
9 - :ref:`installation-source`: The simplest way to keep the installation
9 - :ref:`installation-source`: The simplest way to keep the installation
10 up-to-date and track any local customizations is to run directly from
10 up-to-date and track any local customizations is to run directly from
11 source in a Kallithea repository clone, preferably inside a virtualenv
11 source in a Kallithea repository clone, preferably inside a virtualenv
12 virtual Python environment.
12 virtual Python environment.
13
13
14 - :ref:`installation-virtualenv`: If you prefer to only use released versions
14 - :ref:`installation-virtualenv`: If you prefer to only use released versions
15 of Kallithea, the recommended method is to install Kallithea in a virtual
15 of Kallithea, the recommended method is to install Kallithea in a virtual
16 Python environment using `virtualenv`. The advantages of this method over
16 Python environment using `virtualenv`. The advantages of this method over
17 direct installation is that Kallithea and its dependencies are completely
17 direct installation is that Kallithea and its dependencies are completely
18 contained inside the virtualenv (which also means you can have multiple
18 contained inside the virtualenv (which also means you can have multiple
19 installations side by side or remove it entirely by just removing the
19 installations side by side or remove it entirely by just removing the
20 virtualenv directory) and does not require root privileges.
20 virtualenv directory) and does not require root privileges.
21
21
22 - :ref:`installation-without-virtualenv`: The alternative method of installing
22 - :ref:`installation-without-virtualenv`: The alternative method of installing
23 a Kallithea release is using standard pip. The package will be installed in
23 a Kallithea release is using standard pip. The package will be installed in
24 the same location as all other Python packages you have ever installed. As a
24 the same location as all other Python packages you have ever installed. As a
25 result, removing it is not as straightforward as with a virtualenv, as you'd
25 result, removing it is not as straightforward as with a virtualenv, as you'd
26 have to remove its dependencies manually and make sure that they are not
26 have to remove its dependencies manually and make sure that they are not
27 needed by other packages.
27 needed by other packages.
28
28
29 Regardless of the installation method you may need to make sure you have
29 Regardless of the installation method you may need to make sure you have
30 appropriate development packages installed, as installation of some of the
30 appropriate development packages installed, as installation of some of the
31 Kallithea dependencies requires a working C compiler and libffi library
31 Kallithea dependencies requires a working C compiler and libffi library
32 headers. Depending on your configuration, you may also need to install
32 headers. Depending on your configuration, you may also need to install
33 Git and development packages for the database of your choice.
33 Git and development packages for the database of your choice.
34
34
35 For Debian and Ubuntu, the following command will ensure that a reasonable
35 For Debian and Ubuntu, the following command will ensure that a reasonable
36 set of dependencies is installed::
36 set of dependencies is installed::
37
37
38 sudo apt-get install build-essential git python-pip python-virtualenv libffi-dev python-dev
38 sudo apt-get install build-essential git python-pip python-virtualenv libffi-dev python-dev
39
39
40 For Fedora and RHEL-derivatives, the following command will ensure that a
40 For Fedora and RHEL-derivatives, the following command will ensure that a
41 reasonable set of dependencies is installed::
41 reasonable set of dependencies is installed::
42
42
43 sudo yum install gcc git python-pip python-virtualenv libffi-devel python-devel
43 sudo yum install gcc git python-pip python-virtualenv libffi-devel python-devel
44
44
45 .. _installation-source:
45 .. _installation-source:
46
46
47
47
48 Installation from repository source
48 Installation from repository source
49 -----------------------------------
49 -----------------------------------
50
50
51 To install Kallithea in a virtualenv_ using the stable branch of the development
51 To install Kallithea in a virtualenv using the stable branch of the development
52 repository, follow the instructions below::
52 repository, follow the instructions below::
53
53
54 hg clone https://kallithea-scm.org/repos/kallithea -u stable
54 hg clone https://kallithea-scm.org/repos/kallithea -u stable
55 cd kallithea
55 cd kallithea
56 virtualenv ../kallithea-venv
56 python3 -m venv ../kallithea-venv
57 . ../kallithea-venv/bin/activate
57 . ../kallithea-venv/bin/activate
58 pip install --upgrade pip setuptools
58 pip install --upgrade pip setuptools
59 pip install --upgrade -e .
59 pip install --upgrade -e .
60 python2 setup.py compile_catalog # for translation of the UI
60 python2 setup.py compile_catalog # for translation of the UI
61
61
62 You can now proceed to :ref:`setup`.
62 You can now proceed to :ref:`setup`.
63
63
64 .. _installation-virtualenv:
64 .. _installation-virtualenv:
65
65
66
66
67 Installing a released version in a virtualenv
67 Installing a released version in a virtualenv
68 ---------------------------------------------
68 ---------------------------------------------
69
69
70 It is highly recommended to use a separate virtualenv_ for installing Kallithea.
70 It is highly recommended to use a separate virtualenv for installing Kallithea.
71 This way, all libraries required by Kallithea will be installed separately from your
71 This way, all libraries required by Kallithea will be installed separately from your
72 main Python installation and other applications and things will be less
72 main Python installation and other applications and things will be less
73 problematic when upgrading the system or Kallithea.
73 problematic when upgrading the system or Kallithea.
74 An additional benefit of virtualenv_ is that it doesn't require root privileges.
74 An additional benefit of virtualenv is that it doesn't require root privileges.
75
75
76 - Assuming you have installed virtualenv_, create a new virtual environment
76 - Assuming you have installed virtualenv, create a new virtual environment
77 for example, in `/srv/kallithea/venv`, using the virtualenv command::
77 for example, in `/srv/kallithea/venv`, using the venv command::
78
78
79 virtualenv /srv/kallithea/venv
79 python3 -m venv /srv/kallithea/venv
80
80
81 - Activate the virtualenv_ in your current shell session and make sure the
81 - Activate the virtualenv in your current shell session and make sure the
82 basic requirements are up-to-date by running::
82 basic requirements are up-to-date by running::
83
83
84 . /srv/kallithea/venv/bin/activate
84 . /srv/kallithea/venv/bin/activate
85 pip install --upgrade pip setuptools
85 pip install --upgrade pip setuptools
86
86
87 .. note:: You can't use UNIX ``sudo`` to source the ``virtualenv`` script; it
87 .. note:: You can't use UNIX ``sudo`` to source the ``virtualenv`` script; it
88 will "activate" a shell that terminates immediately. It is also perfectly
88 will "activate" a shell that terminates immediately. It is also perfectly
89 acceptable (and desirable) to create a virtualenv as a normal user.
89 acceptable (and desirable) to create a virtualenv as a normal user.
90
90
91 - Make a folder for Kallithea data files, and configuration somewhere on the
91 - Make a folder for Kallithea data files, and configuration somewhere on the
92 filesystem. For example::
92 filesystem. For example::
93
93
94 mkdir /srv/kallithea
94 mkdir /srv/kallithea
95
95
96 - Go into the created directory and run this command to install Kallithea::
96 - Go into the created directory and run this command to install Kallithea::
97
97
98 pip install --upgrade kallithea
98 pip install --upgrade kallithea
99
99
100 .. note:: Some dependencies are optional. If you need them, install them in
100 .. note:: Some dependencies are optional. If you need them, install them in
101 the virtualenv too::
101 the virtualenv too::
102
102
103 pip install --upgrade kallithea python-ldap python-pam psycopg2
103 pip install --upgrade kallithea python-ldap python-pam psycopg2
104
104
105 This might require installation of development packages using your
105 This might require installation of development packages using your
106 distribution's package manager.
106 distribution's package manager.
107
107
108 Alternatively, download a .tar.gz from http://pypi.python.org/pypi/Kallithea,
108 Alternatively, download a .tar.gz from http://pypi.python.org/pypi/Kallithea,
109 extract it and install from source by running::
109 extract it and install from source by running::
110
110
111 pip install --upgrade .
111 pip install --upgrade .
112
112
113 - This will install Kallithea together with all other required
113 - This will install Kallithea together with all other required
114 Python libraries into the activated virtualenv.
114 Python libraries into the activated virtualenv.
115
115
116 You can now proceed to :ref:`setup`.
116 You can now proceed to :ref:`setup`.
117
117
118 .. _installation-without-virtualenv:
118 .. _installation-without-virtualenv:
119
119
120
120
121 Installing a released version without virtualenv
121 Installing a released version without virtualenv
122 ------------------------------------------------
122 ------------------------------------------------
123
123
124 For installation without virtualenv, 'just' use::
124 For installation without virtualenv, 'just' use::
125
125
126 pip install kallithea
126 pip install kallithea
127
127
128 Note that this method requires root privileges and will install packages
128 Note that this method requires root privileges and will install packages
129 globally without using the system's package manager.
129 globally without using the system's package manager.
130
130
131 To install as a regular user in ``~/.local``, you can use::
131 To install as a regular user in ``~/.local``, you can use::
132
132
133 pip install --user kallithea
133 pip install --user kallithea
134
134
135 You can now proceed to :ref:`setup`.
135 You can now proceed to :ref:`setup`.
136
137
138 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
@@ -1,223 +1,217 b''
1 .. _installation_win:
1 .. _installation_win:
2
2
3 ====================================================
3 ====================================================
4 Installation on Windows (7/Server 2008 R2 and newer)
4 Installation on Windows (7/Server 2008 R2 and newer)
5 ====================================================
5 ====================================================
6
6
7
7
8 First time install
8 First time install
9 ------------------
9 ------------------
10
10
11 Target OS: Windows 7 and newer or Windows Server 2008 R2 and newer
11 Target OS: Windows 7 and newer or Windows Server 2008 R2 and newer
12
12
13 Tested on Windows 8.1, Windows Server 2008 R2 and Windows Server 2012
13 Tested on Windows 8.1, Windows Server 2008 R2 and Windows Server 2012
14
14
15 To install on an older version of Windows, see `<installation_win_old.html>`_
15 To install on an older version of Windows, see `<installation_win_old.html>`_
16
16
17 Step 1 -- Install Python
17 Step 1 -- Install Python
18 ^^^^^^^^^^^^^^^^^^^^^^^^
18 ^^^^^^^^^^^^^^^^^^^^^^^^
19
19
20 Install Python 2.7.x. Latest version is recommended. If you need another version, they can run side by side.
20 Install Python 2.7.x. Latest version is recommended. If you need another version, they can run side by side.
21
21
22 .. warning:: Python 3.x is not supported.
22 .. warning:: Python 3.x is not supported.
23
23
24 - Download Python 2.7.x from http://www.python.org/download/
24 - Download Python 2.7.x from http://www.python.org/download/
25 - Choose and click on the version
25 - Choose and click on the version
26 - Click on "Windows X86-64 Installer" for x64 or "Windows x86 MSI installer" for Win32.
26 - Click on "Windows X86-64 Installer" for x64 or "Windows x86 MSI installer" for Win32.
27 - Disable UAC or run the installer with admin privileges. If you chose to disable UAC, do not forget to reboot afterwards.
27 - Disable UAC or run the installer with admin privileges. If you chose to disable UAC, do not forget to reboot afterwards.
28
28
29 While writing this guide, the latest version was v2.7.9.
29 While writing this guide, the latest version was v2.7.9.
30 Remember the specific major and minor versions installed, because they will
30 Remember the specific major and minor versions installed, because they will
31 be needed in the next step. In this case, it is "2.7".
31 be needed in the next step. In this case, it is "2.7".
32
32
33 Step 2 -- Python BIN
33 Step 2 -- Python BIN
34 ^^^^^^^^^^^^^^^^^^^^
34 ^^^^^^^^^^^^^^^^^^^^
35
35
36 Add Python BIN folder to the path. This can be done manually (editing
36 Add Python BIN folder to the path. This can be done manually (editing
37 "PATH" environment variable) or by using Windows Support Tools that
37 "PATH" environment variable) or by using Windows Support Tools that
38 come pre-installed in Windows Vista/7 and later.
38 come pre-installed in Windows Vista/7 and later.
39
39
40 Open a CMD and type::
40 Open a CMD and type::
41
41
42 SETX PATH "%PATH%;[your-python-path]" /M
42 SETX PATH "%PATH%;[your-python-path]" /M
43
43
44 Please substitute [your-python-path] with your Python installation
44 Please substitute [your-python-path] with your Python installation
45 path. Typically this is ``C:\\Python27``.
45 path. Typically this is ``C:\\Python27``.
46
46
47 Step 3 -- Install pywin32 extensions
47 Step 3 -- Install pywin32 extensions
48 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49
49
50 Download pywin32 from:
50 Download pywin32 from:
51 http://sourceforge.net/projects/pywin32/files/
51 http://sourceforge.net/projects/pywin32/files/
52
52
53 - Click on "pywin32" folder
53 - Click on "pywin32" folder
54 - Click on the first folder (in this case, Build 219, maybe newer when you try)
54 - Click on the first folder (in this case, Build 219, maybe newer when you try)
55 - Choose the file ending with ".amd64-py2.x.exe" (".win32-py2.x.exe"
55 - Choose the file ending with ".amd64-py2.x.exe" (".win32-py2.x.exe"
56 for Win32) where x is the minor version of Python you installed.
56 for Win32) where x is the minor version of Python you installed.
57 When writing this guide, the file was:
57 When writing this guide, the file was:
58 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe/download
58 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe/download
59 (x64)
59 (x64)
60 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download
60 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download
61 (Win32)
61 (Win32)
62
62
63 Step 4 -- Install pip
63 Step 4 -- Install pip
64 ^^^^^^^^^^^^^^^^^^^^^
64 ^^^^^^^^^^^^^^^^^^^^^
65
65
66 pip is a package management system for Python. You will need it to install Kallithea and its dependencies.
66 pip is a package management system for Python. You will need it to install Kallithea and its dependencies.
67
67
68 If you installed Python 2.7.9+, you already have it (as long as you ran the installer with admin privileges or disabled UAC).
68 If you installed Python 2.7.9+, you already have it (as long as you ran the installer with admin privileges or disabled UAC).
69
69
70 If it was not installed or if you are using Python < 2.7.9:
70 If it was not installed or if you are using Python < 2.7.9:
71
71
72 - Go to https://bootstrap.pypa.io
72 - Go to https://bootstrap.pypa.io
73 - Right-click on get-pip.py and choose Saves as...
73 - Right-click on get-pip.py and choose Saves as...
74 - Run "python2 get-pip.py" in the folder where you downloaded get-pip.py (may require admin access).
74 - Run "python2 get-pip.py" in the folder where you downloaded get-pip.py (may require admin access).
75
75
76 .. note::
76 .. note::
77
77
78 See http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows
78 See http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows
79 for details and alternative methods.
79 for details and alternative methods.
80
80
81 Note that pip.exe will be placed inside your Python installation's
81 Note that pip.exe will be placed inside your Python installation's
82 Scripts folder, which is likely not on your path. To correct this,
82 Scripts folder, which is likely not on your path. To correct this,
83 open a CMD and type::
83 open a CMD and type::
84
84
85 SETX PATH "%PATH%;[your-python-path]\Scripts" /M
85 SETX PATH "%PATH%;[your-python-path]\Scripts" /M
86
86
87 Step 5 -- Kallithea folder structure
87 Step 5 -- Kallithea folder structure
88 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
89
89
90 Create a Kallithea folder structure.
90 Create a Kallithea folder structure.
91
91
92 This is only an example to install Kallithea. Of course, you can
92 This is only an example to install Kallithea. Of course, you can
93 change it. However, this guide will follow the proposed structure, so
93 change it. However, this guide will follow the proposed structure, so
94 please later adapt the paths if you change them. Folders without
94 please later adapt the paths if you change them. Folders without
95 spaces are recommended.
95 spaces are recommended.
96
96
97 Create the following folder structure::
97 Create the following folder structure::
98
98
99 C:\Kallithea
99 C:\Kallithea
100 C:\Kallithea\Bin
100 C:\Kallithea\Bin
101 C:\Kallithea\Env
101 C:\Kallithea\Env
102 C:\Kallithea\Repos
102 C:\Kallithea\Repos
103
103
104 Step 6 -- Install virtualenv
104 Step 6 -- Install virtualenv
105 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106
106
107 .. note::
107 .. note::
108 A python virtual environment will allow for isolation between the Python packages of your system and those used for Kallithea.
108 A python virtual environment will allow for isolation between the Python packages of your system and those used for Kallithea.
109 It is strongly recommended to use it to ensure that Kallithea does not change a dependency that other software uses or vice versa.
109 It is strongly recommended to use it to ensure that Kallithea does not change a dependency that other software uses or vice versa.
110
110
111 In a command prompt type::
112
113 pip install virtualenv
114
115 Virtualenv will now be inside your Python Scripts path (C:\\Python27\\Scripts or similar).
116
117 To create a virtual environment, run::
111 To create a virtual environment, run::
118
112
119 virtualenv C:\Kallithea\Env
113 python3 -m venv C:\Kallithea\Env
120
114
121 Step 7 -- Install Kallithea
115 Step 7 -- Install Kallithea
122 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
116 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
123
117
124 In order to install Kallithea, you need to be able to run "pip install kallithea". It will use pip to install the Kallithea Python package and its dependencies.
118 In order to install Kallithea, you need to be able to run "pip install kallithea". It will use pip to install the Kallithea Python package and its dependencies.
125 Some Python packages use managed code and need to be compiled.
119 Some Python packages use managed code and need to be compiled.
126 This can be done on Linux without any special steps. On Windows, you will need to install Microsoft Visual C++ compiler for Python 2.7.
120 This can be done on Linux without any special steps. On Windows, you will need to install Microsoft Visual C++ compiler for Python 2.7.
127
121
128 Download and install "Microsoft Visual C++ Compiler for Python 2.7" from http://aka.ms/vcpython27
122 Download and install "Microsoft Visual C++ Compiler for Python 2.7" from http://aka.ms/vcpython27
129
123
130 .. note::
124 .. note::
131 You can also install the dependencies using already compiled Windows binaries packages. A good source of compiled Python packages is http://www.lfd.uci.edu/~gohlke/pythonlibs/. However, not all of the necessary packages for Kallithea are on this site and some are hard to find, so we will stick with using the compiler.
125 You can also install the dependencies using already compiled Windows binaries packages. A good source of compiled Python packages is http://www.lfd.uci.edu/~gohlke/pythonlibs/. However, not all of the necessary packages for Kallithea are on this site and some are hard to find, so we will stick with using the compiler.
132
126
133 In a command prompt type (adapting paths if necessary)::
127 In a command prompt type (adapting paths if necessary)::
134
128
135 cd C:\Kallithea\Env\Scripts
129 cd C:\Kallithea\Env\Scripts
136 activate
130 activate
137 pip install --upgrade pip setuptools
131 pip install --upgrade pip setuptools
138
132
139 The prompt will change into "(Env) C:\\Kallithea\\Env\\Scripts" or similar
133 The prompt will change into "(Env) C:\\Kallithea\\Env\\Scripts" or similar
140 (depending of your folder structure). Then type::
134 (depending of your folder structure). Then type::
141
135
142 pip install kallithea
136 pip install kallithea
143
137
144 .. note:: This will take some time. Please wait patiently until it is fully
138 .. note:: This will take some time. Please wait patiently until it is fully
145 complete. Some warnings will appear. Don't worry, they are
139 complete. Some warnings will appear. Don't worry, they are
146 normal.
140 normal.
147
141
148 Step 8 -- Install Git (optional)
142 Step 8 -- Install Git (optional)
149 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
150
144
151 Mercurial being a python package, was installed automatically when doing ``pip install kallithea``.
145 Mercurial being a python package, was installed automatically when doing ``pip install kallithea``.
152
146
153 You need to install Git manually if you want Kallithea to be able to host Git repositories.
147 You need to install Git manually if you want Kallithea to be able to host Git repositories.
154 See http://git-scm.com/book/en/v2/Getting-Started-Installing-Git#Installing-on-Windows for instructions.
148 See http://git-scm.com/book/en/v2/Getting-Started-Installing-Git#Installing-on-Windows for instructions.
155 The location of the Git binaries (like ``c:\path\to\git\bin``) must be
149 The location of the Git binaries (like ``c:\path\to\git\bin``) must be
156 added to the ``PATH`` environment variable so ``git.exe`` and other tools like
150 added to the ``PATH`` environment variable so ``git.exe`` and other tools like
157 ``gzip.exe`` are available.
151 ``gzip.exe`` are available.
158
152
159 Step 9 -- Configuring Kallithea
153 Step 9 -- Configuring Kallithea
160 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
161
155
162 Steps taken from `<setup.html>`_
156 Steps taken from `<setup.html>`_
163
157
164 You have to use the same command prompt as in Step 7, so if you closed
158 You have to use the same command prompt as in Step 7, so if you closed
165 it, reopen it following the same commands (including the "activate"
159 it, reopen it following the same commands (including the "activate"
166 one). When ready, type::
160 one). When ready, type::
167
161
168 cd C:\Kallithea\Bin
162 cd C:\Kallithea\Bin
169 kallithea-cli config-create my.ini
163 kallithea-cli config-create my.ini
170
164
171 Then you must edit my.ini to fit your needs (IP address, IP
165 Then you must edit my.ini to fit your needs (IP address, IP
172 port, mail settings, database, etc.). `NotePad++`__ or a similar text
166 port, mail settings, database, etc.). `NotePad++`__ or a similar text
173 editor is recommended to properly handle the newline character
167 editor is recommended to properly handle the newline character
174 differences between Unix and Windows.
168 differences between Unix and Windows.
175
169
176 __ http://notepad-plus-plus.org/
170 __ http://notepad-plus-plus.org/
177
171
178 For the sake of simplicity, run it with the default settings. After your edits (if any) in the previous command prompt, type::
172 For the sake of simplicity, run it with the default settings. After your edits (if any) in the previous command prompt, type::
179
173
180 kallithea-cli db-create -c my.ini
174 kallithea-cli db-create -c my.ini
181
175
182 .. warning:: This time a *new* database will be installed. You must
176 .. warning:: This time a *new* database will be installed. You must
183 follow a different process to later :ref:`upgrade <upgrade>`
177 follow a different process to later :ref:`upgrade <upgrade>`
184 to a newer Kallithea version.
178 to a newer Kallithea version.
185
179
186 The script will ask you for confirmation about creating a new database, answer yes (y)
180 The script will ask you for confirmation about creating a new database, answer yes (y)
187
181
188 The script will ask you for the repository path, answer C:\\Kallithea\\Repos (or similar).
182 The script will ask you for the repository path, answer C:\\Kallithea\\Repos (or similar).
189
183
190 The script will ask you for the admin username and password, answer "admin" + "123456" (or whatever you want)
184 The script will ask you for the admin username and password, answer "admin" + "123456" (or whatever you want)
191
185
192 The script will ask you for admin mail, answer "admin@xxxx.com" (or whatever you want).
186 The script will ask you for admin mail, answer "admin@xxxx.com" (or whatever you want).
193
187
194 If you make a mistake and the script doesn't end, don't worry: start it again.
188 If you make a mistake and the script doesn't end, don't worry: start it again.
195
189
196 If you decided not to install Git, you will get errors about it that you can ignore.
190 If you decided not to install Git, you will get errors about it that you can ignore.
197
191
198 Step 10 -- Running Kallithea
192 Step 10 -- Running Kallithea
199 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
200
194
201 In the previous command prompt, being in the C:\\Kallithea\\Bin folder, type::
195 In the previous command prompt, being in the C:\\Kallithea\\Bin folder, type::
202
196
203 gearbox serve -c my.ini
197 gearbox serve -c my.ini
204
198
205 Open your web server, and go to http://127.0.0.1:5000
199 Open your web server, and go to http://127.0.0.1:5000
206
200
207 It works!! :-)
201 It works!! :-)
208
202
209 Remark:
203 Remark:
210 If it does not work the first time, Ctrl-C the CMD process and start it again. Don't forget the "http://" in Internet Explorer.
204 If it does not work the first time, Ctrl-C the CMD process and start it again. Don't forget the "http://" in Internet Explorer.
211
205
212 What this guide does not cover:
206 What this guide does not cover:
213
207
214 - Installing Celery
208 - Installing Celery
215 - Running Kallithea as a Windows Service. You can investigate here:
209 - Running Kallithea as a Windows Service. You can investigate here:
216
210
217 - http://pypi.python.org/pypi/wsgisvc
211 - http://pypi.python.org/pypi/wsgisvc
218 - http://ryrobes.com/python/running-python-scripts-as-a-windows-service/
212 - http://ryrobes.com/python/running-python-scripts-as-a-windows-service/
219 - http://wiki.pylonshq.com/display/pylonscookbook/How+to+run+Pylons+as+a+Windows+service
213 - http://wiki.pylonshq.com/display/pylonscookbook/How+to+run+Pylons+as+a+Windows+service
220
214
221 - Using Apache. You can investigate here:
215 - Using Apache. You can investigate here:
222
216
223 - https://groups.google.com/group/rhodecode/msg/c433074e813ffdc4
217 - https://groups.google.com/group/rhodecode/msg/c433074e813ffdc4
@@ -1,263 +1,251 b''
1 .. _installation_win_old:
1 .. _installation_win_old:
2
2
3 ==========================================================
3 ==========================================================
4 Installation on Windows (XP/Vista/Server 2003/Server 2008)
4 Installation on Windows (XP/Vista/Server 2003/Server 2008)
5 ==========================================================
5 ==========================================================
6
6
7
7
8 First-time install
8 First-time install
9 ------------------
9 ------------------
10
10
11 Target OS: Windows XP SP3 32-bit English (Clean installation)
11 Target OS: Windows XP SP3 32-bit English (Clean installation)
12 + All Windows Updates until 24-may-2012
12 + All Windows Updates until 24-may-2012
13
13
14 .. note::
14 .. note::
15
15
16 This installation is for 32-bit systems, for 64-bit Windows you might need
16 This installation is for 32-bit systems, for 64-bit Windows you might need
17 to download proper 64-bit versions of the different packages (Windows Installer, Win32py extensions)
17 to download proper 64-bit versions of the different packages (Windows Installer, Win32py extensions)
18 plus some extra tweaks.
18 plus some extra tweaks.
19 These extra steps haven been marked as "64-bit".
19 These extra steps haven been marked as "64-bit".
20 Tested on Windows Server 2008 R2 SP1, 9-feb-2013.
20 Tested on Windows Server 2008 R2 SP1, 9-feb-2013.
21 If you run into any 64-bit related problems, please check these pages:
21 If you run into any 64-bit related problems, please check these pages:
22
22
23 - http://blog.victorjabur.com/2011/06/05/compiling-python-2-7-modules-on-windows-32-and-64-using-msvc-2008-express/
23 - http://blog.victorjabur.com/2011/06/05/compiling-python-2-7-modules-on-windows-32-and-64-using-msvc-2008-express/
24 - http://bugs.python.org/issue7511
24 - http://bugs.python.org/issue7511
25
25
26 Step 1 -- Install Visual Studio 2008 Express
26 Step 1 -- Install Visual Studio 2008 Express
27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28
28
29 Optional: You can also install MinGW, but VS2008 installation is easier.
29 Optional: You can also install MinGW, but VS2008 installation is easier.
30
30
31 Download "Visual C++ 2008 Express Edition with SP1" from:
31 Download "Visual C++ 2008 Express Edition with SP1" from:
32 http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso
32 http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso
33 (if not found or relocated, google for "visual studio 2008 express" for updated link. This link was taken from http://stackoverflow.com/questions/15318560/visual-c-2008-express-download-link-dead)
33 (if not found or relocated, google for "visual studio 2008 express" for updated link. This link was taken from http://stackoverflow.com/questions/15318560/visual-c-2008-express-download-link-dead)
34
34
35 You can also download full ISO file for offline installation, just
35 You can also download full ISO file for offline installation, just
36 choose "All -- Offline Install ISO image file" in the previous page and
36 choose "All -- Offline Install ISO image file" in the previous page and
37 choose "Visual C++ 2008 Express" when installing.
37 choose "Visual C++ 2008 Express" when installing.
38
38
39 .. note::
39 .. note::
40
40
41 Using other versions of Visual Studio will lead to random crashes.
41 Using other versions of Visual Studio will lead to random crashes.
42 You must use Visual Studio 2008!"
42 You must use Visual Studio 2008!"
43
43
44 .. note::
44 .. note::
45
45
46 Silverlight Runtime and SQL Server 2008 Express Edition are not
46 Silverlight Runtime and SQL Server 2008 Express Edition are not
47 required, you can uncheck them
47 required, you can uncheck them
48
48
49 .. note::
49 .. note::
50
50
51 64-bit: You also need to install the Microsoft Windows SDK for .NET 3.5 SP1 (.NET 4.0 won't work).
51 64-bit: You also need to install the Microsoft Windows SDK for .NET 3.5 SP1 (.NET 4.0 won't work).
52 Download from: http://www.microsoft.com/en-us/download/details.aspx?id=3138
52 Download from: http://www.microsoft.com/en-us/download/details.aspx?id=3138
53
53
54 .. note::
54 .. note::
55
55
56 64-bit: You also need to copy and rename a .bat file to make the Visual C++ compiler work.
56 64-bit: You also need to copy and rename a .bat file to make the Visual C++ compiler work.
57 I am not sure why this is not necessary for 32-bit.
57 I am not sure why this is not necessary for 32-bit.
58 Copy C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat
58 Copy C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat
59
59
60 Step 2 -- Install Python
60 Step 2 -- Install Python
61 ^^^^^^^^^^^^^^^^^^^^^^^^
61 ^^^^^^^^^^^^^^^^^^^^^^^^
62
62
63 Install Python 2.7.x x86 version (32-bit). DO NOT USE A 3.x version.
63 Install Python 2.7.x x86 version (32-bit). DO NOT USE A 3.x version.
64 Download Python 2.7.x from:
64 Download Python 2.7.x from:
65 http://www.python.org/download/
65 http://www.python.org/download/
66
66
67 Choose "Windows Installer" (32-bit version) not "Windows X86-64
67 Choose "Windows Installer" (32-bit version) not "Windows X86-64
68 Installer". While writing this guide, the latest version was v2.7.3.
68 Installer". While writing this guide, the latest version was v2.7.3.
69 Remember the specific major and minor version installed, because it will
69 Remember the specific major and minor version installed, because it will
70 be needed in the next step. In this case, it is "2.7".
70 be needed in the next step. In this case, it is "2.7".
71
71
72 .. note::
72 .. note::
73
73
74 64-bit: Just download and install the 64-bit version of python.
74 64-bit: Just download and install the 64-bit version of python.
75
75
76 Step 3 -- Install Win32py extensions
76 Step 3 -- Install Win32py extensions
77 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78
78
79 Download pywin32 from:
79 Download pywin32 from:
80 http://sourceforge.net/projects/pywin32/files/
80 http://sourceforge.net/projects/pywin32/files/
81
81
82 - Click on "pywin32" folder
82 - Click on "pywin32" folder
83 - Click on the first folder (in this case, Build 217, maybe newer when you try)
83 - Click on the first folder (in this case, Build 217, maybe newer when you try)
84 - Choose the file ending with ".win32-py2.x.exe" -> x being the minor
84 - Choose the file ending with ".win32-py2.x.exe" -> x being the minor
85 version of Python you installed (in this case, 7)
85 version of Python you installed (in this case, 7)
86 When writing this guide, the file was:
86 When writing this guide, the file was:
87 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download
87 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download
88
88
89 .. note::
89 .. note::
90
90
91 64-bit: Download and install the 64-bit version.
91 64-bit: Download and install the 64-bit version.
92 At the time of writing you can find this at:
92 At the time of writing you can find this at:
93 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py2.7.exe/download
93 http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win-amd64-py2.7.exe/download
94
94
95 Step 4 -- Python BIN
95 Step 4 -- Python BIN
96 ^^^^^^^^^^^^^^^^^^^^
96 ^^^^^^^^^^^^^^^^^^^^
97
97
98 Add Python BIN folder to the path
98 Add Python BIN folder to the path
99
99
100 You have to add the Python folder to the path, you can do it manually
100 You have to add the Python folder to the path, you can do it manually
101 (editing "PATH" environment variable) or using Windows Support Tools
101 (editing "PATH" environment variable) or using Windows Support Tools
102 that came preinstalled in Vista/7 and can be installed in Windows XP.
102 that came preinstalled in Vista/7 and can be installed in Windows XP.
103
103
104 - Using support tools on WINDOWS XP:
104 - Using support tools on WINDOWS XP:
105 If you use Windows XP you can install them using Windows XP CD and
105 If you use Windows XP you can install them using Windows XP CD and
106 navigating to \SUPPORT\TOOLS. There, execute Setup.EXE (not MSI).
106 navigating to \SUPPORT\TOOLS. There, execute Setup.EXE (not MSI).
107 Afterwards, open a CMD and type::
107 Afterwards, open a CMD and type::
108
108
109 SETX PATH "%PATH%;[your-python-path]" -M
109 SETX PATH "%PATH%;[your-python-path]" -M
110
110
111 Close CMD (the path variable will be updated then)
111 Close CMD (the path variable will be updated then)
112
112
113 - Using support tools on WINDOWS Vista/7:
113 - Using support tools on WINDOWS Vista/7:
114
114
115 Open a CMD and type::
115 Open a CMD and type::
116
116
117 SETX PATH "%PATH%;[your-python-path]" /M
117 SETX PATH "%PATH%;[your-python-path]" /M
118
118
119 Please substitute [your-python-path] with your Python installation path.
119 Please substitute [your-python-path] with your Python installation path.
120 Typically: C:\\Python27
120 Typically: C:\\Python27
121
121
122 Step 5 -- Kallithea folder structure
122 Step 5 -- Kallithea folder structure
123 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124
124
125 Create a Kallithea folder structure
125 Create a Kallithea folder structure
126
126
127 This is only a example to install Kallithea, you can of course change
127 This is only a example to install Kallithea, you can of course change
128 it. However, this guide will follow the proposed structure, so please
128 it. However, this guide will follow the proposed structure, so please
129 later adapt the paths if you change them. My recommendation is to use
129 later adapt the paths if you change them. My recommendation is to use
130 folders with NO SPACES. But you can try if you are brave...
130 folders with NO SPACES. But you can try if you are brave...
131
131
132 Create the following folder structure::
132 Create the following folder structure::
133
133
134 C:\Kallithea
134 C:\Kallithea
135 C:\Kallithea\Bin
135 C:\Kallithea\Bin
136 C:\Kallithea\Env
136 C:\Kallithea\Env
137 C:\Kallithea\Repos
137 C:\Kallithea\Repos
138
138
139 Step 6 -- Install virtualenv
139 Step 6 -- Install virtualenv
140 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
141
141
142 Install Virtual Env for Python
142 Create a virtual Python environment in C:\\Kallithea\\Env (or similar). To
143
143 do so, open a CMD (Python Path should be included in Step3), and write::
144 Navigate to: http://www.virtualenv.org/en/latest/index.html#installation
145 Right click on "virtualenv.py" file and choose "Save link as...".
146 Download to C:\\Kallithea (or whatever you want)
147 (the file is located at
148 https://raw.github.com/pypa/virtualenv/master/virtualenv.py)
149
144
150 Create a virtual Python environment in C:\\Kallithea\\Env (or similar). To
145 python3 -m venv C:\Kallithea\Env
151 do so, open a CMD (Python Path should be included in Step3), navigate
152 where you downloaded "virtualenv.py", and write::
153
154 python2 virtualenv.py C:\Kallithea\Env
155
156 (--no-site-packages is now the default behaviour of virtualenv, no need
157 to include it)
158
146
159 Step 7 -- Install Kallithea
147 Step 7 -- Install Kallithea
160 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
148 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
161
149
162 Finally, install Kallithea
150 Finally, install Kallithea
163
151
164 Close previously opened command prompt/s, and open a Visual Studio 2008
152 Close previously opened command prompt/s, and open a Visual Studio 2008
165 Command Prompt (**IMPORTANT!!**). To do so, go to Start Menu, and then open
153 Command Prompt (**IMPORTANT!!**). To do so, go to Start Menu, and then open
166 "Microsoft Visual C++ 2008 Express Edition" -> "Visual Studio Tools" ->
154 "Microsoft Visual C++ 2008 Express Edition" -> "Visual Studio Tools" ->
167 "Visual Studio 2008 Command Prompt"
155 "Visual Studio 2008 Command Prompt"
168
156
169 .. note::
157 .. note::
170
158
171 64-bit: For 64-bit you need to modify the shortcut that is used to start the
159 64-bit: For 64-bit you need to modify the shortcut that is used to start the
172 Visual Studio 2008 Command Prompt. Use right-mouse click to open properties.
160 Visual Studio 2008 Command Prompt. Use right-mouse click to open properties.
173
161
174 Change commandline from::
162 Change commandline from::
175
163
176 %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
164 %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
177
165
178 to::
166 to::
179
167
180 %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" amd64
168 %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" amd64
181
169
182 In that CMD (loaded with VS2008 PATHs) type::
170 In that CMD (loaded with VS2008 PATHs) type::
183
171
184 cd C:\Kallithea\Env\Scripts (or similar)
172 cd C:\Kallithea\Env\Scripts (or similar)
185 activate
173 activate
186 pip install --upgrade pip setuptools
174 pip install --upgrade pip setuptools
187
175
188 The prompt will change into "(Env) C:\\Kallithea\\Env\\Scripts" or similar
176 The prompt will change into "(Env) C:\\Kallithea\\Env\\Scripts" or similar
189 (depending of your folder structure). Then type::
177 (depending of your folder structure). Then type::
190
178
191 pip install kallithea
179 pip install kallithea
192
180
193 (long step, please wait until fully complete)
181 (long step, please wait until fully complete)
194
182
195 Some warnings will appear, don't worry as they are normal.
183 Some warnings will appear, don't worry as they are normal.
196
184
197 Step 8 -- Configuring Kallithea
185 Step 8 -- Configuring Kallithea
198 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
199
187
200 steps taken from http://packages.python.org/Kallithea/setup.html
188 steps taken from http://packages.python.org/Kallithea/setup.html
201
189
202 You have to use the same Visual Studio 2008 command prompt as Step7, so
190 You have to use the same Visual Studio 2008 command prompt as Step7, so
203 if you closed it reopen it following the same commands (including the
191 if you closed it reopen it following the same commands (including the
204 "activate" one). When ready, just type::
192 "activate" one). When ready, just type::
205
193
206 cd C:\Kallithea\Bin
194 cd C:\Kallithea\Bin
207 kallithea-cli config-create my.ini
195 kallithea-cli config-create my.ini
208
196
209 Then, you must edit my.ini to fit your needs (network address and
197 Then, you must edit my.ini to fit your needs (network address and
210 port, mail settings, database, whatever). I recommend using NotePad++
198 port, mail settings, database, whatever). I recommend using NotePad++
211 (free) or similar text editor, as it handles well the EndOfLine
199 (free) or similar text editor, as it handles well the EndOfLine
212 character differences between Unix and Windows
200 character differences between Unix and Windows
213 (http://notepad-plus-plus.org/)
201 (http://notepad-plus-plus.org/)
214
202
215 For the sake of simplicity lets run it with the default settings. After
203 For the sake of simplicity lets run it with the default settings. After
216 your edits (if any), in the previous Command Prompt, type::
204 your edits (if any), in the previous Command Prompt, type::
217
205
218 kallithea-cli db-create -c my.ini
206 kallithea-cli db-create -c my.ini
219
207
220 .. warning:: This time a *new* database will be installed. You must
208 .. warning:: This time a *new* database will be installed. You must
221 follow a different process to later :ref:`upgrade <upgrade>`
209 follow a different process to later :ref:`upgrade <upgrade>`
222 to a newer Kallithea version.
210 to a newer Kallithea version.
223
211
224 The script will ask you for confirmation about creating a NEW database,
212 The script will ask you for confirmation about creating a NEW database,
225 answer yes (y)
213 answer yes (y)
226 The script will ask you for repository path, answer C:\\Kallithea\\Repos
214 The script will ask you for repository path, answer C:\\Kallithea\\Repos
227 (or similar)
215 (or similar)
228 The script will ask you for admin username and password, answer "admin"
216 The script will ask you for admin username and password, answer "admin"
229 + "123456" (or whatever you want)
217 + "123456" (or whatever you want)
230 The script will ask you for admin mail, answer "admin@xxxx.com" (or
218 The script will ask you for admin mail, answer "admin@xxxx.com" (or
231 whatever you want)
219 whatever you want)
232
220
233 If you make some mistake and the script does not end, don't worry, start
221 If you make some mistake and the script does not end, don't worry, start
234 it again.
222 it again.
235
223
236 Step 9 -- Running Kallithea
224 Step 9 -- Running Kallithea
237 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
225 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
238
226
239 In the previous command prompt, being in the C:\\Kallithea\\Bin folder,
227 In the previous command prompt, being in the C:\\Kallithea\\Bin folder,
240 just type::
228 just type::
241
229
242 gearbox serve -c my.ini
230 gearbox serve -c my.ini
243
231
244 Open yout web server, and go to http://127.0.0.1:5000
232 Open yout web server, and go to http://127.0.0.1:5000
245
233
246 It works!! :-)
234 It works!! :-)
247
235
248 Remark:
236 Remark:
249 If it does not work first time, just Ctrl-C the CMD process and start it
237 If it does not work first time, just Ctrl-C the CMD process and start it
250 again. Don't forget the "http://" in Internet Explorer
238 again. Don't forget the "http://" in Internet Explorer
251
239
252 What this Guide does not cover:
240 What this Guide does not cover:
253
241
254 - Installing Celery
242 - Installing Celery
255 - Running Kallithea as Windows Service. You can investigate here:
243 - Running Kallithea as Windows Service. You can investigate here:
256
244
257 - http://pypi.python.org/pypi/wsgisvc
245 - http://pypi.python.org/pypi/wsgisvc
258 - http://ryrobes.com/python/running-python-scripts-as-a-windows-service/
246 - http://ryrobes.com/python/running-python-scripts-as-a-windows-service/
259 - http://wiki.pylonshq.com/display/pylonscookbook/How+to+run+Pylons+as+a+Windows+service
247 - http://wiki.pylonshq.com/display/pylonscookbook/How+to+run+Pylons+as+a+Windows+service
260
248
261 - Using Apache. You can investigate here:
249 - Using Apache. You can investigate here:
262
250
263 - https://groups.google.com/group/rhodecode/msg/c433074e813ffdc4
251 - https://groups.google.com/group/rhodecode/msg/c433074e813ffdc4
@@ -1,181 +1,180 b''
1 .. _overview:
1 .. _overview:
2
2
3 =====================
3 =====================
4 Installation overview
4 Installation overview
5 =====================
5 =====================
6
6
7 Some overview and some details that can help understanding the options when
7 Some overview and some details that can help understanding the options when
8 installing Kallithea.
8 installing Kallithea.
9
9
10
10
11 Python environment
11 Python environment
12 ------------------
12 ------------------
13
13
14 **Kallithea** is written entirely in Python_ and requires Python version
14 **Kallithea** is written entirely in Python_ and requires Python version
15 2.7 or higher. Python 3.x is currently not supported.
15 2.7 or higher. Python 3.x is currently not supported.
16
16
17 Given a Python installation, there are different ways of providing the
17 Given a Python installation, there are different ways of providing the
18 environment for running Python applications. Each of them pretty much
18 environment for running Python applications. Each of them pretty much
19 corresponds to a ``site-packages`` directory somewhere where packages can be
19 corresponds to a ``site-packages`` directory somewhere where packages can be
20 installed.
20 installed.
21
21
22 Kallithea itself can be run from source or be installed, but even when running
22 Kallithea itself can be run from source or be installed, but even when running
23 from source, there are some dependencies that must be installed in the Python
23 from source, there are some dependencies that must be installed in the Python
24 environment used for running Kallithea.
24 environment used for running Kallithea.
25
25
26 - Packages *could* be installed in Python's ``site-packages`` directory ... but
26 - Packages *could* be installed in Python's ``site-packages`` directory ... but
27 that would require running pip_ as root and it would be hard to uninstall or
27 that would require running pip_ as root and it would be hard to uninstall or
28 upgrade and is probably not a good idea unless using a package manager.
28 upgrade and is probably not a good idea unless using a package manager.
29
29
30 - Packages could also be installed in ``~/.local`` ... but that is probably
30 - Packages could also be installed in ``~/.local`` ... but that is probably
31 only a good idea if using a dedicated user per application or instance.
31 only a good idea if using a dedicated user per application or instance.
32
32
33 - Finally, it can be installed in a virtualenv_. That is a very lightweight
33 - Finally, it can be installed in a virtualenv. That is a very lightweight
34 "container" where each Kallithea instance can get its own dedicated and
34 "container" where each Kallithea instance can get its own dedicated and
35 self-contained virtual environment.
35 self-contained virtual environment.
36
36
37 We recommend using virtualenv for installing Kallithea.
37 We recommend using virtualenv for installing Kallithea.
38
38
39
39
40 Locale environment
40 Locale environment
41 ------------------
41 ------------------
42
42
43 In order to ensure a correct functioning of Kallithea with respect to non-ASCII
43 In order to ensure a correct functioning of Kallithea with respect to non-ASCII
44 characters in user names, file paths, commit messages, etc., it is very
44 characters in user names, file paths, commit messages, etc., it is very
45 important that Kallithea is run with a correct `locale` configuration.
45 important that Kallithea is run with a correct `locale` configuration.
46
46
47 On Unix, environment variables like ``LANG`` or ``LC_ALL`` can specify a language (like
47 On Unix, environment variables like ``LANG`` or ``LC_ALL`` can specify a language (like
48 ``en_US``) and encoding (like ``UTF-8``) to use for code points outside the ASCII
48 ``en_US``) and encoding (like ``UTF-8``) to use for code points outside the ASCII
49 range. The flexibility of supporting multiple encodings of Unicode has the flip
49 range. The flexibility of supporting multiple encodings of Unicode has the flip
50 side of having to specify which encoding to use - especially for Mercurial.
50 side of having to specify which encoding to use - especially for Mercurial.
51
51
52 It depends on the OS distribution and system configuration which locales are
52 It depends on the OS distribution and system configuration which locales are
53 available. For example, some Docker containers based on Debian default to only
53 available. For example, some Docker containers based on Debian default to only
54 supporting the ``C`` language, while other Linux environments have ``en_US`` but not
54 supporting the ``C`` language, while other Linux environments have ``en_US`` but not
55 ``C``. The ``locale -a`` command will show which values are available on the
55 ``C``. The ``locale -a`` command will show which values are available on the
56 current system. Regardless of the actual language, you should normally choose a
56 current system. Regardless of the actual language, you should normally choose a
57 locale that has the ``UTF-8`` encoding (note that spellings ``utf8``, ``utf-8``,
57 locale that has the ``UTF-8`` encoding (note that spellings ``utf8``, ``utf-8``,
58 ``UTF8``, ``UTF-8`` are all referring to the same thing)
58 ``UTF8``, ``UTF-8`` are all referring to the same thing)
59
59
60 For technical reasons, the locale configuration **must** be provided in the
60 For technical reasons, the locale configuration **must** be provided in the
61 environment in which Kallithea runs - it cannot be specified in the ``.ini`` file.
61 environment in which Kallithea runs - it cannot be specified in the ``.ini`` file.
62 How to practically do this depends on the web server that is used and the way it
62 How to practically do this depends on the web server that is used and the way it
63 is started. For example, gearbox is often started by a normal user, either
63 is started. For example, gearbox is often started by a normal user, either
64 manually or via a script. In this case, the required locale environment
64 manually or via a script. In this case, the required locale environment
65 variables can be provided directly in that user's environment or in the script.
65 variables can be provided directly in that user's environment or in the script.
66 However, web servers like Apache are often started at boot via an init script or
66 However, web servers like Apache are often started at boot via an init script or
67 service file. Modifying the environment for this case would thus require
67 service file. Modifying the environment for this case would thus require
68 root/administrator privileges. Moreover, that environment would dictate the
68 root/administrator privileges. Moreover, that environment would dictate the
69 settings for all web services running under that web server, Kallithea being
69 settings for all web services running under that web server, Kallithea being
70 just one of them. Specifically in the case of Apache with ``mod_wsgi``, the
70 just one of them. Specifically in the case of Apache with ``mod_wsgi``, the
71 locale can be set for a specific service in its ``WSGIDaemonProcess`` directive,
71 locale can be set for a specific service in its ``WSGIDaemonProcess`` directive,
72 using the ``lang`` parameter.
72 using the ``lang`` parameter.
73
73
74
74
75 Installation methods
75 Installation methods
76 --------------------
76 --------------------
77
77
78 Kallithea must be installed on a server. Kallithea is installed in a Python
78 Kallithea must be installed on a server. Kallithea is installed in a Python
79 environment so it can use packages that are installed there and make itself
79 environment so it can use packages that are installed there and make itself
80 available for other packages.
80 available for other packages.
81
81
82 Two different cases will pretty much cover the options for how it can be
82 Two different cases will pretty much cover the options for how it can be
83 installed.
83 installed.
84
84
85 - The Kallithea source repository can be cloned and used -- it is kept stable and
85 - The Kallithea source repository can be cloned and used -- it is kept stable and
86 can be used in production. The Kallithea maintainers use the development
86 can be used in production. The Kallithea maintainers use the development
87 branch in production. The advantage of installation from source and regularly
87 branch in production. The advantage of installation from source and regularly
88 updating it is that you take advantage of the most recent improvements. Using
88 updating it is that you take advantage of the most recent improvements. Using
89 it directly from a DVCS also means that it is easy to track local customizations.
89 it directly from a DVCS also means that it is easy to track local customizations.
90
90
91 Running ``pip install -e .`` in the source will use pip to install the
91 Running ``pip install -e .`` in the source will use pip to install the
92 necessary dependencies in the Python environment and create a
92 necessary dependencies in the Python environment and create a
93 ``.../site-packages/Kallithea.egg-link`` file there that points at the Kallithea
93 ``.../site-packages/Kallithea.egg-link`` file there that points at the Kallithea
94 source.
94 source.
95
95
96 - Kallithea can also be installed from ready-made packages using a package manager.
96 - Kallithea can also be installed from ready-made packages using a package manager.
97 The official released versions are available on PyPI_ and can be downloaded and
97 The official released versions are available on PyPI_ and can be downloaded and
98 installed with all dependencies using ``pip install kallithea``.
98 installed with all dependencies using ``pip install kallithea``.
99
99
100 With this method, Kallithea is installed in the Python environment as any
100 With this method, Kallithea is installed in the Python environment as any
101 other package, usually as a ``.../site-packages/Kallithea-X-py2.7.egg/``
101 other package, usually as a ``.../site-packages/Kallithea-X-py2.7.egg/``
102 directory with Python files and everything else that is needed.
102 directory with Python files and everything else that is needed.
103
103
104 (``pip install kallithea`` from a source tree will do pretty much the same
104 (``pip install kallithea`` from a source tree will do pretty much the same
105 but build the Kallithea package itself locally instead of downloading it.)
105 but build the Kallithea package itself locally instead of downloading it.)
106
106
107 .. note::
107 .. note::
108 Kallithea includes front-end code that needs to be processed first.
108 Kallithea includes front-end code that needs to be processed first.
109 The tool npm_ is used to download external dependencies and orchestrate the
109 The tool npm_ is used to download external dependencies and orchestrate the
110 processing. The ``npm`` binary must thus be available.
110 processing. The ``npm`` binary must thus be available.
111
111
112
112
113 Web server
113 Web server
114 ----------
114 ----------
115
115
116 Kallithea is (primarily) a WSGI_ application that must be run from a web
116 Kallithea is (primarily) a WSGI_ application that must be run from a web
117 server that serves WSGI applications over HTTP.
117 server that serves WSGI applications over HTTP.
118
118
119 Kallithea itself is not serving HTTP (or HTTPS); that is the web server's
119 Kallithea itself is not serving HTTP (or HTTPS); that is the web server's
120 responsibility. Kallithea does however need to know its own user facing URL
120 responsibility. Kallithea does however need to know its own user facing URL
121 (protocol, address, port and path) for each HTTP request. Kallithea will
121 (protocol, address, port and path) for each HTTP request. Kallithea will
122 usually use its own HTML/cookie based authentication but can also be configured
122 usually use its own HTML/cookie based authentication but can also be configured
123 to use web server authentication.
123 to use web server authentication.
124
124
125 There are several web server options:
125 There are several web server options:
126
126
127 - Kallithea uses the Gearbox_ tool as command line interface. Gearbox provides
127 - Kallithea uses the Gearbox_ tool as command line interface. Gearbox provides
128 ``gearbox serve`` as a convenient way to launch a Python WSGI / web server
128 ``gearbox serve`` as a convenient way to launch a Python WSGI / web server
129 from the command line. That is perfect for development and evaluation.
129 from the command line. That is perfect for development and evaluation.
130 Actual use in production might have different requirements and need extra
130 Actual use in production might have different requirements and need extra
131 work to make it manageable as a scalable system service.
131 work to make it manageable as a scalable system service.
132
132
133 Gearbox comes with its own built-in web server but Kallithea defaults to use
133 Gearbox comes with its own built-in web server but Kallithea defaults to use
134 Waitress_. Gunicorn_ is also an option. These web servers have different
134 Waitress_. Gunicorn_ is also an option. These web servers have different
135 limited feature sets.
135 limited feature sets.
136
136
137 The web server used by ``gearbox`` is configured in the ``.ini`` file passed
137 The web server used by ``gearbox`` is configured in the ``.ini`` file passed
138 to it. The entry point for the WSGI application is configured
138 to it. The entry point for the WSGI application is configured
139 in ``setup.py`` as ``kallithea.config.middleware:make_app``.
139 in ``setup.py`` as ``kallithea.config.middleware:make_app``.
140
140
141 - `Apache httpd`_ can serve WSGI applications directly using mod_wsgi_ and a
141 - `Apache httpd`_ can serve WSGI applications directly using mod_wsgi_ and a
142 simple Python file with the necessary configuration. This is a good option if
142 simple Python file with the necessary configuration. This is a good option if
143 Apache is an option.
143 Apache is an option.
144
144
145 - uWSGI_ is also a full web server with built-in WSGI module.
145 - uWSGI_ is also a full web server with built-in WSGI module.
146
146
147 - IIS_ can also server WSGI applications directly using isapi-wsgi_.
147 - IIS_ can also server WSGI applications directly using isapi-wsgi_.
148
148
149 - A `reverse HTTP proxy <https://en.wikipedia.org/wiki/Reverse_proxy>`_
149 - A `reverse HTTP proxy <https://en.wikipedia.org/wiki/Reverse_proxy>`_
150 can be put in front of another web server which has WSGI support.
150 can be put in front of another web server which has WSGI support.
151 Such a layered setup can be complex but might in some cases be the right
151 Such a layered setup can be complex but might in some cases be the right
152 option, for example to standardize on one internet-facing web server, to add
152 option, for example to standardize on one internet-facing web server, to add
153 encryption or special authentication or for other security reasons, to
153 encryption or special authentication or for other security reasons, to
154 provide caching of static files, or to provide load balancing or fail-over.
154 provide caching of static files, or to provide load balancing or fail-over.
155 Nginx_, Varnish_ and HAProxy_ are often used for this purpose, often in front
155 Nginx_, Varnish_ and HAProxy_ are often used for this purpose, often in front
156 of a ``gearbox serve`` that somehow is wrapped as a service.
156 of a ``gearbox serve`` that somehow is wrapped as a service.
157
157
158 The best option depends on what you are familiar with and the requirements for
158 The best option depends on what you are familiar with and the requirements for
159 performance and stability. Also, keep in mind that Kallithea mainly is serving
159 performance and stability. Also, keep in mind that Kallithea mainly is serving
160 dynamically generated pages from a relatively slow Python process. Kallithea is
160 dynamically generated pages from a relatively slow Python process. Kallithea is
161 also often used inside organizations with a limited amount of users and thus no
161 also often used inside organizations with a limited amount of users and thus no
162 continuous hammering from the internet.
162 continuous hammering from the internet.
163
163
164
164
165 .. _Python: http://www.python.org/
165 .. _Python: http://www.python.org/
166 .. _Gunicorn: http://gunicorn.org/
166 .. _Gunicorn: http://gunicorn.org/
167 .. _Waitress: http://waitress.readthedocs.org/en/latest/
167 .. _Waitress: http://waitress.readthedocs.org/en/latest/
168 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
169 .. _Gearbox: http://turbogears.readthedocs.io/en/latest/turbogears/gearbox.html
168 .. _Gearbox: http://turbogears.readthedocs.io/en/latest/turbogears/gearbox.html
170 .. _PyPI: https://pypi.python.org/pypi
169 .. _PyPI: https://pypi.python.org/pypi
171 .. _Apache httpd: http://httpd.apache.org/
170 .. _Apache httpd: http://httpd.apache.org/
172 .. _mod_wsgi: https://code.google.com/p/modwsgi/
171 .. _mod_wsgi: https://code.google.com/p/modwsgi/
173 .. _isapi-wsgi: https://github.com/hexdump42/isapi-wsgi
172 .. _isapi-wsgi: https://github.com/hexdump42/isapi-wsgi
174 .. _uWSGI: https://uwsgi-docs.readthedocs.org/en/latest/
173 .. _uWSGI: https://uwsgi-docs.readthedocs.org/en/latest/
175 .. _nginx: http://nginx.org/en/
174 .. _nginx: http://nginx.org/en/
176 .. _iis: http://en.wikipedia.org/wiki/Internet_Information_Services
175 .. _iis: http://en.wikipedia.org/wiki/Internet_Information_Services
177 .. _pip: http://en.wikipedia.org/wiki/Pip_%28package_manager%29
176 .. _pip: http://en.wikipedia.org/wiki/Pip_%28package_manager%29
178 .. _WSGI: http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
177 .. _WSGI: http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
179 .. _HAProxy: http://www.haproxy.org/
178 .. _HAProxy: http://www.haproxy.org/
180 .. _Varnish: https://www.varnish-cache.org/
179 .. _Varnish: https://www.varnish-cache.org/
181 .. _npm: https://www.npmjs.com/
180 .. _npm: https://www.npmjs.com/
@@ -1,637 +1,636 b''
1 .. _setup:
1 .. _setup:
2
2
3 =====
3 =====
4 Setup
4 Setup
5 =====
5 =====
6
6
7
7
8 Setting up Kallithea
8 Setting up Kallithea
9 --------------------
9 --------------------
10
10
11 First, you will need to create a Kallithea configuration file. Run the
11 First, you will need to create a Kallithea configuration file. Run the
12 following command to do so::
12 following command to do so::
13
13
14 kallithea-cli config-create my.ini
14 kallithea-cli config-create my.ini
15
15
16 This will create the file ``my.ini`` in the current directory. This
16 This will create the file ``my.ini`` in the current directory. This
17 configuration file contains the various settings for Kallithea, e.g.
17 configuration file contains the various settings for Kallithea, e.g.
18 proxy port, email settings, usage of static files, cache, Celery
18 proxy port, email settings, usage of static files, cache, Celery
19 settings, and logging. Extra settings can be specified like::
19 settings, and logging. Extra settings can be specified like::
20
20
21 kallithea-cli config-create my.ini host=8.8.8.8 "[handler_console]" formatter=color_formatter
21 kallithea-cli config-create my.ini host=8.8.8.8 "[handler_console]" formatter=color_formatter
22
22
23 Next, you need to create the databases used by Kallithea. It is recommended to
23 Next, you need to create the databases used by Kallithea. It is recommended to
24 use PostgreSQL or SQLite (default). If you choose a database other than the
24 use PostgreSQL or SQLite (default). If you choose a database other than the
25 default, ensure you properly adjust the database URL in your ``my.ini``
25 default, ensure you properly adjust the database URL in your ``my.ini``
26 configuration file to use this other database. Kallithea currently supports
26 configuration file to use this other database. Kallithea currently supports
27 PostgreSQL, SQLite and MySQL databases. Create the database by running
27 PostgreSQL, SQLite and MySQL databases. Create the database by running
28 the following command::
28 the following command::
29
29
30 kallithea-cli db-create -c my.ini
30 kallithea-cli db-create -c my.ini
31
31
32 This will prompt you for a "root" path. This "root" path is the location where
32 This will prompt you for a "root" path. This "root" path is the location where
33 Kallithea will store all of its repositories on the current machine. After
33 Kallithea will store all of its repositories on the current machine. After
34 entering this "root" path ``db-create`` will also prompt you for a username
34 entering this "root" path ``db-create`` will also prompt you for a username
35 and password for the initial admin account which ``db-create`` sets
35 and password for the initial admin account which ``db-create`` sets
36 up for you.
36 up for you.
37
37
38 The ``db-create`` values can also be given on the command line.
38 The ``db-create`` values can also be given on the command line.
39 Example::
39 Example::
40
40
41 kallithea-cli db-create -c my.ini --user=nn --password=secret --email=nn@example.com --repos=/srv/repos
41 kallithea-cli db-create -c my.ini --user=nn --password=secret --email=nn@example.com --repos=/srv/repos
42
42
43 The ``db-create`` command will create all needed tables and an
43 The ``db-create`` command will create all needed tables and an
44 admin account. When choosing a root path you can either use a new
44 admin account. When choosing a root path you can either use a new
45 empty location, or a location which already contains existing
45 empty location, or a location which already contains existing
46 repositories. If you choose a location which contains existing
46 repositories. If you choose a location which contains existing
47 repositories Kallithea will add all of the repositories at the chosen
47 repositories Kallithea will add all of the repositories at the chosen
48 location to its database. (Note: make sure you specify the correct
48 location to its database. (Note: make sure you specify the correct
49 path to the root).
49 path to the root).
50
50
51 .. note:: the given path for Mercurial_ repositories **must** be write
51 .. note:: the given path for Mercurial_ repositories **must** be write
52 accessible for the application. It's very important since
52 accessible for the application. It's very important since
53 the Kallithea web interface will work without write access,
53 the Kallithea web interface will work without write access,
54 but when trying to do a push it will fail with permission
54 but when trying to do a push it will fail with permission
55 denied errors unless it has write access.
55 denied errors unless it has write access.
56
56
57 Finally, prepare the front-end by running::
57 Finally, prepare the front-end by running::
58
58
59 kallithea-cli front-end-build
59 kallithea-cli front-end-build
60
60
61 You are now ready to use Kallithea. To run it simply execute::
61 You are now ready to use Kallithea. To run it simply execute::
62
62
63 gearbox serve -c my.ini
63 gearbox serve -c my.ini
64
64
65 - This command runs the Kallithea server. The web app should be available at
65 - This command runs the Kallithea server. The web app should be available at
66 http://127.0.0.1:5000. The IP address and port is configurable via the
66 http://127.0.0.1:5000. The IP address and port is configurable via the
67 configuration file created in the previous step.
67 configuration file created in the previous step.
68 - Log in to Kallithea using the admin account created when running ``db-create``.
68 - Log in to Kallithea using the admin account created when running ``db-create``.
69 - The default permissions on each repository is read, and the owner is admin.
69 - The default permissions on each repository is read, and the owner is admin.
70 Remember to update these if needed.
70 Remember to update these if needed.
71 - In the admin panel you can toggle LDAP, anonymous, and permissions
71 - In the admin panel you can toggle LDAP, anonymous, and permissions
72 settings, as well as edit more advanced options on users and
72 settings, as well as edit more advanced options on users and
73 repositories.
73 repositories.
74
74
75
75
76 Internationalization (i18n support)
76 Internationalization (i18n support)
77 -----------------------------------
77 -----------------------------------
78
78
79 The Kallithea web interface is automatically displayed in the user's preferred
79 The Kallithea web interface is automatically displayed in the user's preferred
80 language, as indicated by the browser. Thus, different users may see the
80 language, as indicated by the browser. Thus, different users may see the
81 application in different languages. If the requested language is not available
81 application in different languages. If the requested language is not available
82 (because the translation file for that language does not yet exist or is
82 (because the translation file for that language does not yet exist or is
83 incomplete), English is used.
83 incomplete), English is used.
84
84
85 If you want to disable automatic language detection and instead configure a
85 If you want to disable automatic language detection and instead configure a
86 fixed language regardless of user preference, set ``i18n.enabled = false`` and
86 fixed language regardless of user preference, set ``i18n.enabled = false`` and
87 specify another language by setting ``i18n.lang`` in the Kallithea
87 specify another language by setting ``i18n.lang`` in the Kallithea
88 configuration file.
88 configuration file.
89
89
90
90
91 Using Kallithea with SSH
91 Using Kallithea with SSH
92 ------------------------
92 ------------------------
93
93
94 Kallithea supports repository access via SSH key based authentication.
94 Kallithea supports repository access via SSH key based authentication.
95 This means:
95 This means:
96
96
97 - repository URLs like ``ssh://kallithea@example.com/name/of/repository``
97 - repository URLs like ``ssh://kallithea@example.com/name/of/repository``
98
98
99 - all network traffic for both read and write happens over the SSH protocol on
99 - all network traffic for both read and write happens over the SSH protocol on
100 port 22, without using HTTP/HTTPS nor the Kallithea WSGI application
100 port 22, without using HTTP/HTTPS nor the Kallithea WSGI application
101
101
102 - encryption and authentication protocols are managed by the system's ``sshd``
102 - encryption and authentication protocols are managed by the system's ``sshd``
103 process, with all users using the same Kallithea system user (e.g.
103 process, with all users using the same Kallithea system user (e.g.
104 ``kallithea``) when connecting to the SSH server, but with users' public keys
104 ``kallithea``) when connecting to the SSH server, but with users' public keys
105 in the Kallithea system user's `.ssh/authorized_keys` file granting each user
105 in the Kallithea system user's `.ssh/authorized_keys` file granting each user
106 sandboxed access to the repositories.
106 sandboxed access to the repositories.
107
107
108 - users and admins can manage SSH public keys in the web UI
108 - users and admins can manage SSH public keys in the web UI
109
109
110 - in their SSH client configuration, users can configure how the client should
110 - in their SSH client configuration, users can configure how the client should
111 control access to their SSH key - without passphrase, with passphrase, and
111 control access to their SSH key - without passphrase, with passphrase, and
112 optionally with passphrase caching in the local shell session (``ssh-agent``).
112 optionally with passphrase caching in the local shell session (``ssh-agent``).
113 This is standard SSH functionality, not something Kallithea provides or
113 This is standard SSH functionality, not something Kallithea provides or
114 interferes with.
114 interferes with.
115
115
116 - network communication between client and server happens in a bidirectional
116 - network communication between client and server happens in a bidirectional
117 stateful stream, and will in some cases be faster than HTTP/HTTPS with several
117 stateful stream, and will in some cases be faster than HTTP/HTTPS with several
118 stateless round-trips.
118 stateless round-trips.
119
119
120 .. note:: At this moment, repository access via SSH has been tested on Unix
120 .. note:: At this moment, repository access via SSH has been tested on Unix
121 only. Windows users that care about SSH are invited to test it and report
121 only. Windows users that care about SSH are invited to test it and report
122 problems, ideally contributing patches that solve these problems.
122 problems, ideally contributing patches that solve these problems.
123
123
124 Users and admins can upload SSH public keys (e.g. ``.ssh/id_rsa.pub``) through
124 Users and admins can upload SSH public keys (e.g. ``.ssh/id_rsa.pub``) through
125 the web interface. The server's ``.ssh/authorized_keys`` file is automatically
125 the web interface. The server's ``.ssh/authorized_keys`` file is automatically
126 maintained with an entry for each SSH key. Each entry will tell ``sshd`` to run
126 maintained with an entry for each SSH key. Each entry will tell ``sshd`` to run
127 ``kallithea-cli`` with the ``ssh-serve`` sub-command and the right Kallithea user ID
127 ``kallithea-cli`` with the ``ssh-serve`` sub-command and the right Kallithea user ID
128 when encountering the corresponding SSH key.
128 when encountering the corresponding SSH key.
129
129
130 To enable SSH repository access, Kallithea must be configured with the path to
130 To enable SSH repository access, Kallithea must be configured with the path to
131 the ``.ssh/authorized_keys`` file for the Kallithea user, and the path to the
131 the ``.ssh/authorized_keys`` file for the Kallithea user, and the path to the
132 ``kallithea-cli`` command. Put something like this in the ``.ini`` file::
132 ``kallithea-cli`` command. Put something like this in the ``.ini`` file::
133
133
134 ssh_enabled = true
134 ssh_enabled = true
135 ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
135 ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
136 kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
136 kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
137
137
138 The SSH service must be running, and the Kallithea user account must be active
138 The SSH service must be running, and the Kallithea user account must be active
139 (not necessarily with password access, but public key access must be enabled),
139 (not necessarily with password access, but public key access must be enabled),
140 all file permissions must be set as sshd wants it, and ``authorized_keys`` must
140 all file permissions must be set as sshd wants it, and ``authorized_keys`` must
141 be writeable by the Kallithea user.
141 be writeable by the Kallithea user.
142
142
143 .. note:: The ``authorized_keys`` file will be rewritten from scratch on
143 .. note:: The ``authorized_keys`` file will be rewritten from scratch on
144 each update. If it already exists with other data, Kallithea will not
144 each update. If it already exists with other data, Kallithea will not
145 overwrite the existing ``authorized_keys``, and the server process will
145 overwrite the existing ``authorized_keys``, and the server process will
146 instead throw an exception. The system administrator thus cannot ssh
146 instead throw an exception. The system administrator thus cannot ssh
147 directly to the Kallithea user but must use su/sudo from another account.
147 directly to the Kallithea user but must use su/sudo from another account.
148
148
149 If ``/home/kallithea/.ssh/`` (the directory of the path specified in the
149 If ``/home/kallithea/.ssh/`` (the directory of the path specified in the
150 ``ssh_authorized_keys`` setting of the ``.ini`` file) does not exist as a
150 ``ssh_authorized_keys`` setting of the ``.ini`` file) does not exist as a
151 directory, Kallithea will attempt to create it. If that path exists but is
151 directory, Kallithea will attempt to create it. If that path exists but is
152 *not* a directory, or is not readable-writable-executable by the server
152 *not* a directory, or is not readable-writable-executable by the server
153 process, the server process will raise an exception each time it attempts to
153 process, the server process will raise an exception each time it attempts to
154 write the ``authorized_keys`` file.
154 write the ``authorized_keys`` file.
155
155
156 .. warning:: The handling of SSH access is steered directly by the command
156 .. warning:: The handling of SSH access is steered directly by the command
157 specified in the ``authorized_keys`` file. There is no interaction with the
157 specified in the ``authorized_keys`` file. There is no interaction with the
158 web UI. Once SSH access is correctly configured and enabled, it will work
158 web UI. Once SSH access is correctly configured and enabled, it will work
159 regardless of whether the Kallithea web process is actually running. Hence,
159 regardless of whether the Kallithea web process is actually running. Hence,
160 if you want to perform repository or server maintenance and want to fully
160 if you want to perform repository or server maintenance and want to fully
161 disable all access to the repositories, disable SSH access by setting
161 disable all access to the repositories, disable SSH access by setting
162 ``ssh_enabled = false`` in the correct ``.ini`` file (i.e. the ``.ini`` file
162 ``ssh_enabled = false`` in the correct ``.ini`` file (i.e. the ``.ini`` file
163 specified in the ``authorized_keys`` file.)
163 specified in the ``authorized_keys`` file.)
164
164
165 The ``authorized_keys`` file can be updated manually with ``kallithea-cli
165 The ``authorized_keys`` file can be updated manually with ``kallithea-cli
166 ssh-update-authorized-keys -c my.ini``. This command is not needed in normal
166 ssh-update-authorized-keys -c my.ini``. This command is not needed in normal
167 operation but is for example useful after changing SSH-related settings in the
167 operation but is for example useful after changing SSH-related settings in the
168 ``.ini`` file or renaming that file. (The path to the ``.ini`` file is used in
168 ``.ini`` file or renaming that file. (The path to the ``.ini`` file is used in
169 the generated ``authorized_keys`` file).
169 the generated ``authorized_keys`` file).
170
170
171
171
172 Setting up Whoosh full text search
172 Setting up Whoosh full text search
173 ----------------------------------
173 ----------------------------------
174
174
175 Kallithea provides full text search of repositories using `Whoosh`__.
175 Kallithea provides full text search of repositories using `Whoosh`__.
176
176
177 .. __: https://whoosh.readthedocs.io/en/latest/
177 .. __: https://whoosh.readthedocs.io/en/latest/
178
178
179 For an incremental index build, run::
179 For an incremental index build, run::
180
180
181 kallithea-cli index-create -c my.ini
181 kallithea-cli index-create -c my.ini
182
182
183 For a full index rebuild, run::
183 For a full index rebuild, run::
184
184
185 kallithea-cli index-create -c my.ini --full
185 kallithea-cli index-create -c my.ini --full
186
186
187 The ``--repo-location`` option allows the location of the repositories to be overridden;
187 The ``--repo-location`` option allows the location of the repositories to be overridden;
188 usually, the location is retrieved from the Kallithea database.
188 usually, the location is retrieved from the Kallithea database.
189
189
190 The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list::
190 The ``--index-only`` option can be used to limit the indexed repositories to a comma-separated list::
191
191
192 kallithea-cli index-create -c my.ini --index-only=vcs,kallithea
192 kallithea-cli index-create -c my.ini --index-only=vcs,kallithea
193
193
194 To keep your index up-to-date it is necessary to do periodic index builds;
194 To keep your index up-to-date it is necessary to do periodic index builds;
195 for this, it is recommended to use a crontab entry. Example::
195 for this, it is recommended to use a crontab entry. Example::
196
196
197 0 3 * * * /path/to/virtualenv/bin/kallithea-cli index-create -c /path/to/kallithea/my.ini
197 0 3 * * * /path/to/virtualenv/bin/kallithea-cli index-create -c /path/to/kallithea/my.ini
198
198
199 When using incremental mode (the default), Whoosh will check the last
199 When using incremental mode (the default), Whoosh will check the last
200 modification date of each file and add it to be reindexed if a newer file is
200 modification date of each file and add it to be reindexed if a newer file is
201 available. The indexing daemon checks for any removed files and removes them
201 available. The indexing daemon checks for any removed files and removes them
202 from index.
202 from index.
203
203
204 If you want to rebuild the index from scratch, you can use the ``-f`` flag as above,
204 If you want to rebuild the index from scratch, you can use the ``-f`` flag as above,
205 or in the admin panel you can check the "build from scratch" checkbox.
205 or in the admin panel you can check the "build from scratch" checkbox.
206
206
207
207
208 Integration with issue trackers
208 Integration with issue trackers
209 -------------------------------
209 -------------------------------
210
210
211 Kallithea provides a simple integration with issue trackers. It's possible
211 Kallithea provides a simple integration with issue trackers. It's possible
212 to define a regular expression that will match an issue ID in commit messages,
212 to define a regular expression that will match an issue ID in commit messages,
213 and have that replaced with a URL to the issue.
213 and have that replaced with a URL to the issue.
214
214
215 This is achieved with following three variables in the ini file::
215 This is achieved with following three variables in the ini file::
216
216
217 issue_pat = #(\d+)
217 issue_pat = #(\d+)
218 issue_server_link = https://issues.example.com/{repo}/issue/\1
218 issue_server_link = https://issues.example.com/{repo}/issue/\1
219 issue_sub =
219 issue_sub =
220
220
221 ``issue_pat`` is the regular expression describing which strings in
221 ``issue_pat`` is the regular expression describing which strings in
222 commit messages will be treated as issue references. The expression can/should
222 commit messages will be treated as issue references. The expression can/should
223 have one or more parenthesized groups that can later be referred to in
223 have one or more parenthesized groups that can later be referred to in
224 ``issue_server_link`` and ``issue_sub`` (see below). If you prefer, named groups
224 ``issue_server_link`` and ``issue_sub`` (see below). If you prefer, named groups
225 can be used instead of simple parenthesized groups.
225 can be used instead of simple parenthesized groups.
226
226
227 If the pattern should only match if it is preceded by whitespace, add the
227 If the pattern should only match if it is preceded by whitespace, add the
228 following string before the actual pattern: ``(?:^|(?<=\s))``.
228 following string before the actual pattern: ``(?:^|(?<=\s))``.
229 If the pattern should only match if it is followed by whitespace, add the
229 If the pattern should only match if it is followed by whitespace, add the
230 following string after the actual pattern: ``(?:$|(?=\s))``.
230 following string after the actual pattern: ``(?:$|(?=\s))``.
231 These expressions use lookbehind and lookahead assertions of the Python regular
231 These expressions use lookbehind and lookahead assertions of the Python regular
232 expression module to avoid the whitespace to be part of the actual pattern,
232 expression module to avoid the whitespace to be part of the actual pattern,
233 otherwise the link text will also contain that whitespace.
233 otherwise the link text will also contain that whitespace.
234
234
235 Matched issue references are replaced with the link specified in
235 Matched issue references are replaced with the link specified in
236 ``issue_server_link``, in which any backreferences are resolved. Backreferences
236 ``issue_server_link``, in which any backreferences are resolved. Backreferences
237 can be ``\1``, ``\2``, ... or for named groups ``\g<groupname>``.
237 can be ``\1``, ``\2``, ... or for named groups ``\g<groupname>``.
238 The special token ``{repo}`` is replaced with the full repository path
238 The special token ``{repo}`` is replaced with the full repository path
239 (including repository groups), while token ``{repo_name}`` is replaced with the
239 (including repository groups), while token ``{repo_name}`` is replaced with the
240 repository name (without repository groups).
240 repository name (without repository groups).
241
241
242 The link text is determined by ``issue_sub``, which can be a string containing
242 The link text is determined by ``issue_sub``, which can be a string containing
243 backreferences to the groups specified in ``issue_pat``. If ``issue_sub`` is
243 backreferences to the groups specified in ``issue_pat``. If ``issue_sub`` is
244 empty, then the text matched by ``issue_pat`` is used verbatim.
244 empty, then the text matched by ``issue_pat`` is used verbatim.
245
245
246 The example settings shown above match issues in the format ``#<number>``.
246 The example settings shown above match issues in the format ``#<number>``.
247 This will cause the text ``#300`` to be transformed into a link:
247 This will cause the text ``#300`` to be transformed into a link:
248
248
249 .. code-block:: html
249 .. code-block:: html
250
250
251 <a href="https://issues.example.com/example_repo/issue/300">#300</a>
251 <a href="https://issues.example.com/example_repo/issue/300">#300</a>
252
252
253 The following example transforms a text starting with either of 'pullrequest',
253 The following example transforms a text starting with either of 'pullrequest',
254 'pull request' or 'PR', followed by an optional space, then a pound character
254 'pull request' or 'PR', followed by an optional space, then a pound character
255 (#) and one or more digits, into a link with the text 'PR #' followed by the
255 (#) and one or more digits, into a link with the text 'PR #' followed by the
256 digits::
256 digits::
257
257
258 issue_pat = (pullrequest|pull request|PR) ?#(\d+)
258 issue_pat = (pullrequest|pull request|PR) ?#(\d+)
259 issue_server_link = https://issues.example.com/\2
259 issue_server_link = https://issues.example.com/\2
260 issue_sub = PR #\2
260 issue_sub = PR #\2
261
261
262 The following example demonstrates how to require whitespace before the issue
262 The following example demonstrates how to require whitespace before the issue
263 reference in order for it to be recognized, such that the text ``issue#123`` will
263 reference in order for it to be recognized, such that the text ``issue#123`` will
264 not cause a match, but ``issue #123`` will::
264 not cause a match, but ``issue #123`` will::
265
265
266 issue_pat = (?:^|(?<=\s))#(\d+)
266 issue_pat = (?:^|(?<=\s))#(\d+)
267 issue_server_link = https://issues.example.com/\1
267 issue_server_link = https://issues.example.com/\1
268 issue_sub =
268 issue_sub =
269
269
270 If needed, more than one pattern can be specified by appending a unique suffix to
270 If needed, more than one pattern can be specified by appending a unique suffix to
271 the variables. For example, also demonstrating the use of named groups::
271 the variables. For example, also demonstrating the use of named groups::
272
272
273 issue_pat_wiki = wiki-(?P<pagename>\S+)
273 issue_pat_wiki = wiki-(?P<pagename>\S+)
274 issue_server_link_wiki = https://wiki.example.com/\g<pagename>
274 issue_server_link_wiki = https://wiki.example.com/\g<pagename>
275 issue_sub_wiki = WIKI-\g<pagename>
275 issue_sub_wiki = WIKI-\g<pagename>
276
276
277 With these settings, wiki pages can be referenced as wiki-some-id, and every
277 With these settings, wiki pages can be referenced as wiki-some-id, and every
278 such reference will be transformed into:
278 such reference will be transformed into:
279
279
280 .. code-block:: html
280 .. code-block:: html
281
281
282 <a href="https://wiki.example.com/some-id">WIKI-some-id</a>
282 <a href="https://wiki.example.com/some-id">WIKI-some-id</a>
283
283
284 Refer to the `Python regular expression documentation`_ for more details about
284 Refer to the `Python regular expression documentation`_ for more details about
285 the supported syntax in ``issue_pat``, ``issue_server_link`` and ``issue_sub``.
285 the supported syntax in ``issue_pat``, ``issue_server_link`` and ``issue_sub``.
286
286
287
287
288 Hook management
288 Hook management
289 ---------------
289 ---------------
290
290
291 Hooks can be managed in similar way to that used in ``.hgrc`` files.
291 Hooks can be managed in similar way to that used in ``.hgrc`` files.
292 To manage hooks, choose *Admin > Settings > Hooks*.
292 To manage hooks, choose *Admin > Settings > Hooks*.
293
293
294 The built-in hooks cannot be modified, though they can be enabled or disabled in the *VCS* section.
294 The built-in hooks cannot be modified, though they can be enabled or disabled in the *VCS* section.
295
295
296 To add another custom hook simply fill in the first textbox with
296 To add another custom hook simply fill in the first textbox with
297 ``<name>.<hook_type>`` and the second with the hook path. Example hooks
297 ``<name>.<hook_type>`` and the second with the hook path. Example hooks
298 can be found in ``kallithea.lib.hooks``.
298 can be found in ``kallithea.lib.hooks``.
299
299
300
300
301 Changing default encoding
301 Changing default encoding
302 -------------------------
302 -------------------------
303
303
304 By default, Kallithea uses UTF-8 encoding.
304 By default, Kallithea uses UTF-8 encoding.
305 This is configurable as ``default_encoding`` in the .ini file.
305 This is configurable as ``default_encoding`` in the .ini file.
306 This affects many parts in Kallithea including user names, filenames, and
306 This affects many parts in Kallithea including user names, filenames, and
307 encoding of commit messages. In addition Kallithea can detect if the ``chardet``
307 encoding of commit messages. In addition Kallithea can detect if the ``chardet``
308 library is installed. If ``chardet`` is detected Kallithea will fallback to it
308 library is installed. If ``chardet`` is detected Kallithea will fallback to it
309 when there are encode/decode errors.
309 when there are encode/decode errors.
310
310
311 The Mercurial encoding is configurable as ``hgencoding``. It is similar to
311 The Mercurial encoding is configurable as ``hgencoding``. It is similar to
312 setting the ``HGENCODING`` environment variable, but will override it.
312 setting the ``HGENCODING`` environment variable, but will override it.
313
313
314
314
315 Celery configuration
315 Celery configuration
316 --------------------
316 --------------------
317
317
318 Kallithea can use the distributed task queue system Celery_ to run tasks like
318 Kallithea can use the distributed task queue system Celery_ to run tasks like
319 cloning repositories or sending emails.
319 cloning repositories or sending emails.
320
320
321 Kallithea will in most setups work perfectly fine out of the box (without
321 Kallithea will in most setups work perfectly fine out of the box (without
322 Celery), executing all tasks in the web server process. Some tasks can however
322 Celery), executing all tasks in the web server process. Some tasks can however
323 take some time to run and it can be better to run such tasks asynchronously in
323 take some time to run and it can be better to run such tasks asynchronously in
324 a separate process so the web server can focus on serving web requests.
324 a separate process so the web server can focus on serving web requests.
325
325
326 For installation and configuration of Celery, see the `Celery documentation`_.
326 For installation and configuration of Celery, see the `Celery documentation`_.
327 Note that Celery requires a message broker service like RabbitMQ_ (recommended)
327 Note that Celery requires a message broker service like RabbitMQ_ (recommended)
328 or Redis_.
328 or Redis_.
329
329
330 The use of Celery is configured in the Kallithea ini configuration file.
330 The use of Celery is configured in the Kallithea ini configuration file.
331 To enable it, simply set::
331 To enable it, simply set::
332
332
333 use_celery = true
333 use_celery = true
334
334
335 and add or change the ``celery.*`` and ``broker.*`` configuration variables.
335 and add or change the ``celery.*`` and ``broker.*`` configuration variables.
336
336
337 Remember that the ini files use the format with '.' and not with '_' like
337 Remember that the ini files use the format with '.' and not with '_' like
338 Celery. So for example setting `BROKER_HOST` in Celery means setting
338 Celery. So for example setting `BROKER_HOST` in Celery means setting
339 `broker.host` in the configuration file.
339 `broker.host` in the configuration file.
340
340
341 To start the Celery process, run::
341 To start the Celery process, run::
342
342
343 kallithea-cli celery-run -c my.ini
343 kallithea-cli celery-run -c my.ini
344
344
345 Extra options to the Celery worker can be passed after ``--`` - see ``-- -h``
345 Extra options to the Celery worker can be passed after ``--`` - see ``-- -h``
346 for more info.
346 for more info.
347
347
348 .. note::
348 .. note::
349 Make sure you run this command from the same virtualenv, and with the same
349 Make sure you run this command from the same virtualenv, and with the same
350 user that Kallithea runs.
350 user that Kallithea runs.
351
351
352
352
353 HTTPS support
353 HTTPS support
354 -------------
354 -------------
355
355
356 Kallithea will by default generate URLs based on the WSGI environment.
356 Kallithea will by default generate URLs based on the WSGI environment.
357
357
358 Alternatively, you can use some special configuration settings to control
358 Alternatively, you can use some special configuration settings to control
359 directly which scheme/protocol Kallithea will use when generating URLs:
359 directly which scheme/protocol Kallithea will use when generating URLs:
360
360
361 - With ``https_fixup = true``, the scheme will be taken from the
361 - With ``https_fixup = true``, the scheme will be taken from the
362 ``X-Url-Scheme``, ``X-Forwarded-Scheme`` or ``X-Forwarded-Proto`` HTTP header
362 ``X-Url-Scheme``, ``X-Forwarded-Scheme`` or ``X-Forwarded-Proto`` HTTP header
363 (default ``http``).
363 (default ``http``).
364 - With ``force_https = true`` the default will be ``https``.
364 - With ``force_https = true`` the default will be ``https``.
365 - With ``use_htsts = true``, Kallithea will set ``Strict-Transport-Security`` when using https.
365 - With ``use_htsts = true``, Kallithea will set ``Strict-Transport-Security`` when using https.
366
366
367 .. _nginx_virtual_host:
367 .. _nginx_virtual_host:
368
368
369
369
370 Nginx virtual host example
370 Nginx virtual host example
371 --------------------------
371 --------------------------
372
372
373 Sample config for Nginx using proxy:
373 Sample config for Nginx using proxy:
374
374
375 .. code-block:: nginx
375 .. code-block:: nginx
376
376
377 upstream kallithea {
377 upstream kallithea {
378 server 127.0.0.1:5000;
378 server 127.0.0.1:5000;
379 # add more instances for load balancing
379 # add more instances for load balancing
380 #server 127.0.0.1:5001;
380 #server 127.0.0.1:5001;
381 #server 127.0.0.1:5002;
381 #server 127.0.0.1:5002;
382 }
382 }
383
383
384 ## gist alias
384 ## gist alias
385 server {
385 server {
386 listen 443;
386 listen 443;
387 server_name gist.example.com;
387 server_name gist.example.com;
388 access_log /var/log/nginx/gist.access.log;
388 access_log /var/log/nginx/gist.access.log;
389 error_log /var/log/nginx/gist.error.log;
389 error_log /var/log/nginx/gist.error.log;
390
390
391 ssl on;
391 ssl on;
392 ssl_certificate gist.your.kallithea.server.crt;
392 ssl_certificate gist.your.kallithea.server.crt;
393 ssl_certificate_key gist.your.kallithea.server.key;
393 ssl_certificate_key gist.your.kallithea.server.key;
394
394
395 ssl_session_timeout 5m;
395 ssl_session_timeout 5m;
396
396
397 ssl_protocols SSLv3 TLSv1;
397 ssl_protocols SSLv3 TLSv1;
398 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
398 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
399 ssl_prefer_server_ciphers on;
399 ssl_prefer_server_ciphers on;
400
400
401 rewrite ^/(.+)$ https://kallithea.example.com/_admin/gists/$1;
401 rewrite ^/(.+)$ https://kallithea.example.com/_admin/gists/$1;
402 rewrite (.*) https://kallithea.example.com/_admin/gists;
402 rewrite (.*) https://kallithea.example.com/_admin/gists;
403 }
403 }
404
404
405 server {
405 server {
406 listen 443;
406 listen 443;
407 server_name kallithea.example.com
407 server_name kallithea.example.com
408 access_log /var/log/nginx/kallithea.access.log;
408 access_log /var/log/nginx/kallithea.access.log;
409 error_log /var/log/nginx/kallithea.error.log;
409 error_log /var/log/nginx/kallithea.error.log;
410
410
411 ssl on;
411 ssl on;
412 ssl_certificate your.kallithea.server.crt;
412 ssl_certificate your.kallithea.server.crt;
413 ssl_certificate_key your.kallithea.server.key;
413 ssl_certificate_key your.kallithea.server.key;
414
414
415 ssl_session_timeout 5m;
415 ssl_session_timeout 5m;
416
416
417 ssl_protocols SSLv3 TLSv1;
417 ssl_protocols SSLv3 TLSv1;
418 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
418 ssl_ciphers DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:EDH-RSA-DES-CBC3-SHA:AES256-SHA:DES-CBC3-SHA:AES128-SHA:RC4-SHA:RC4-MD5;
419 ssl_prefer_server_ciphers on;
419 ssl_prefer_server_ciphers on;
420
420
421 ## uncomment root directive if you want to serve static files by nginx
421 ## uncomment root directive if you want to serve static files by nginx
422 ## requires static_files = false in .ini file
422 ## requires static_files = false in .ini file
423 #root /srv/kallithea/kallithea/kallithea/public;
423 #root /srv/kallithea/kallithea/kallithea/public;
424 include /etc/nginx/proxy.conf;
424 include /etc/nginx/proxy.conf;
425 location / {
425 location / {
426 try_files $uri @kallithea;
426 try_files $uri @kallithea;
427 }
427 }
428
428
429 location @kallithea {
429 location @kallithea {
430 proxy_pass http://127.0.0.1:5000;
430 proxy_pass http://127.0.0.1:5000;
431 }
431 }
432
432
433 }
433 }
434
434
435 Here's the proxy.conf. It's tuned so it will not timeout on long
435 Here's the proxy.conf. It's tuned so it will not timeout on long
436 pushes or large pushes::
436 pushes or large pushes::
437
437
438 proxy_redirect off;
438 proxy_redirect off;
439 proxy_set_header Host $host;
439 proxy_set_header Host $host;
440 ## needed for container auth
440 ## needed for container auth
441 #proxy_set_header REMOTE_USER $remote_user;
441 #proxy_set_header REMOTE_USER $remote_user;
442 #proxy_set_header X-Forwarded-User $remote_user;
442 #proxy_set_header X-Forwarded-User $remote_user;
443 proxy_set_header X-Url-Scheme $scheme;
443 proxy_set_header X-Url-Scheme $scheme;
444 proxy_set_header X-Host $http_host;
444 proxy_set_header X-Host $http_host;
445 proxy_set_header X-Real-IP $remote_addr;
445 proxy_set_header X-Real-IP $remote_addr;
446 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
446 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
447 proxy_set_header Proxy-host $proxy_host;
447 proxy_set_header Proxy-host $proxy_host;
448 proxy_buffering off;
448 proxy_buffering off;
449 proxy_connect_timeout 7200;
449 proxy_connect_timeout 7200;
450 proxy_send_timeout 7200;
450 proxy_send_timeout 7200;
451 proxy_read_timeout 7200;
451 proxy_read_timeout 7200;
452 proxy_buffers 8 32k;
452 proxy_buffers 8 32k;
453 client_max_body_size 1024m;
453 client_max_body_size 1024m;
454 client_body_buffer_size 128k;
454 client_body_buffer_size 128k;
455 large_client_header_buffers 8 64k;
455 large_client_header_buffers 8 64k;
456
456
457 .. _apache_virtual_host_reverse_proxy:
457 .. _apache_virtual_host_reverse_proxy:
458
458
459
459
460 Apache virtual host reverse proxy example
460 Apache virtual host reverse proxy example
461 -----------------------------------------
461 -----------------------------------------
462
462
463 Here is a sample configuration file for Apache using proxy:
463 Here is a sample configuration file for Apache using proxy:
464
464
465 .. code-block:: apache
465 .. code-block:: apache
466
466
467 <VirtualHost *:80>
467 <VirtualHost *:80>
468 ServerName kallithea.example.com
468 ServerName kallithea.example.com
469
469
470 <Proxy *>
470 <Proxy *>
471 # For Apache 2.4 and later:
471 # For Apache 2.4 and later:
472 Require all granted
472 Require all granted
473
473
474 # For Apache 2.2 and earlier, instead use:
474 # For Apache 2.2 and earlier, instead use:
475 # Order allow,deny
475 # Order allow,deny
476 # Allow from all
476 # Allow from all
477 </Proxy>
477 </Proxy>
478
478
479 #important !
479 #important !
480 #Directive to properly generate url (clone url) for Kallithea
480 #Directive to properly generate url (clone url) for Kallithea
481 ProxyPreserveHost On
481 ProxyPreserveHost On
482
482
483 #kallithea instance
483 #kallithea instance
484 ProxyPass / http://127.0.0.1:5000/
484 ProxyPass / http://127.0.0.1:5000/
485 ProxyPassReverse / http://127.0.0.1:5000/
485 ProxyPassReverse / http://127.0.0.1:5000/
486
486
487 #to enable https use line below
487 #to enable https use line below
488 #SetEnvIf X-Url-Scheme https HTTPS=1
488 #SetEnvIf X-Url-Scheme https HTTPS=1
489 </VirtualHost>
489 </VirtualHost>
490
490
491 Additional tutorial
491 Additional tutorial
492 http://pylonsbook.com/en/1.1/deployment.html#using-apache-to-proxy-requests-to-pylons
492 http://pylonsbook.com/en/1.1/deployment.html#using-apache-to-proxy-requests-to-pylons
493
493
494 .. _apache_subdirectory:
494 .. _apache_subdirectory:
495
495
496
496
497 Apache as subdirectory
497 Apache as subdirectory
498 ----------------------
498 ----------------------
499
499
500 Apache subdirectory part:
500 Apache subdirectory part:
501
501
502 .. code-block:: apache
502 .. code-block:: apache
503
503
504 <Location /PREFIX >
504 <Location /PREFIX >
505 ProxyPass http://127.0.0.1:5000/PREFIX
505 ProxyPass http://127.0.0.1:5000/PREFIX
506 ProxyPassReverse http://127.0.0.1:5000/PREFIX
506 ProxyPassReverse http://127.0.0.1:5000/PREFIX
507 SetEnvIf X-Url-Scheme https HTTPS=1
507 SetEnvIf X-Url-Scheme https HTTPS=1
508 </Location>
508 </Location>
509
509
510 Besides the regular apache setup you will need to add the following line
510 Besides the regular apache setup you will need to add the following line
511 into ``[app:main]`` section of your .ini file::
511 into ``[app:main]`` section of your .ini file::
512
512
513 filter-with = proxy-prefix
513 filter-with = proxy-prefix
514
514
515 Add the following at the end of the .ini file::
515 Add the following at the end of the .ini file::
516
516
517 [filter:proxy-prefix]
517 [filter:proxy-prefix]
518 use = egg:PasteDeploy#prefix
518 use = egg:PasteDeploy#prefix
519 prefix = /PREFIX
519 prefix = /PREFIX
520
520
521 then change ``PREFIX`` into your chosen prefix
521 then change ``PREFIX`` into your chosen prefix
522
522
523 .. _apache_mod_wsgi:
523 .. _apache_mod_wsgi:
524
524
525
525
526 Apache with mod_wsgi
526 Apache with mod_wsgi
527 --------------------
527 --------------------
528
528
529 Alternatively, Kallithea can be set up with Apache under mod_wsgi. For
529 Alternatively, Kallithea can be set up with Apache under mod_wsgi. For
530 that, you'll need to:
530 that, you'll need to:
531
531
532 - Install mod_wsgi. If using a Debian-based distro, you can install
532 - Install mod_wsgi. If using a Debian-based distro, you can install
533 the package libapache2-mod-wsgi::
533 the package libapache2-mod-wsgi::
534
534
535 aptitude install libapache2-mod-wsgi
535 aptitude install libapache2-mod-wsgi
536
536
537 - Enable mod_wsgi::
537 - Enable mod_wsgi::
538
538
539 a2enmod wsgi
539 a2enmod wsgi
540
540
541 - Add global Apache configuration to tell mod_wsgi that Python only will be
541 - Add global Apache configuration to tell mod_wsgi that Python only will be
542 used in the WSGI processes and shouldn't be initialized in the Apache
542 used in the WSGI processes and shouldn't be initialized in the Apache
543 processes::
543 processes::
544
544
545 WSGIRestrictEmbedded On
545 WSGIRestrictEmbedded On
546
546
547 - Create a WSGI dispatch script, like the one below. Make sure you
547 - Create a WSGI dispatch script, like the one below. Make sure you
548 check that the paths correctly point to where you installed Kallithea
548 check that the paths correctly point to where you installed Kallithea
549 and its Python Virtual Environment.
549 and its Python Virtual Environment.
550
550
551 .. code-block:: python
551 .. code-block:: python
552
552
553 import os
553 import os
554 os.environ['PYTHON_EGG_CACHE'] = '/srv/kallithea/.egg-cache'
554 os.environ['PYTHON_EGG_CACHE'] = '/srv/kallithea/.egg-cache'
555
555
556 # sometimes it's needed to set the current dir
556 # sometimes it's needed to set the current dir
557 os.chdir('/srv/kallithea/')
557 os.chdir('/srv/kallithea/')
558
558
559 import site
559 import site
560 site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages")
560 site.addsitedir("/srv/kallithea/venv/lib/python2.7/site-packages")
561
561
562 ini = '/srv/kallithea/my.ini'
562 ini = '/srv/kallithea/my.ini'
563 from logging.config import fileConfig
563 from logging.config import fileConfig
564 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'})
564 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'})
565 from paste.deploy import loadapp
565 from paste.deploy import loadapp
566 application = loadapp('config:' + ini)
566 application = loadapp('config:' + ini)
567
567
568 Or using proper virtualenv activation:
568 Or using proper virtualenv activation:
569
569
570 .. code-block:: python
570 .. code-block:: python
571
571
572 activate_this = '/srv/kallithea/venv/bin/activate_this.py'
572 activate_this = '/srv/kallithea/venv/bin/activate_this.py'
573 execfile(activate_this, dict(__file__=activate_this))
573 execfile(activate_this, dict(__file__=activate_this))
574
574
575 import os
575 import os
576 os.environ['HOME'] = '/srv/kallithea'
576 os.environ['HOME'] = '/srv/kallithea'
577
577
578 ini = '/srv/kallithea/kallithea.ini'
578 ini = '/srv/kallithea/kallithea.ini'
579 from logging.config import fileConfig
579 from logging.config import fileConfig
580 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'})
580 fileConfig(ini, {'__file__': ini, 'here': '/srv/kallithea'})
581 from paste.deploy import loadapp
581 from paste.deploy import loadapp
582 application = loadapp('config:' + ini)
582 application = loadapp('config:' + ini)
583
583
584 - Add the necessary ``WSGI*`` directives to the Apache Virtual Host configuration
584 - Add the necessary ``WSGI*`` directives to the Apache Virtual Host configuration
585 file, like in the example below. Notice that the WSGI dispatch script created
585 file, like in the example below. Notice that the WSGI dispatch script created
586 above is referred to with the ``WSGIScriptAlias`` directive.
586 above is referred to with the ``WSGIScriptAlias`` directive.
587 The default locale settings Apache provides for web services are often not
587 The default locale settings Apache provides for web services are often not
588 adequate, with `C` as the default language and `ASCII` as the encoding.
588 adequate, with `C` as the default language and `ASCII` as the encoding.
589 Instead, use the ``lang`` parameter of ``WSGIDaemonProcess`` to specify a
589 Instead, use the ``lang`` parameter of ``WSGIDaemonProcess`` to specify a
590 suitable locale. See also the :ref:`overview` section and the
590 suitable locale. See also the :ref:`overview` section and the
591 `WSGIDaemonProcess documentation`_.
591 `WSGIDaemonProcess documentation`_.
592
592
593 Apache will by default run as a special Apache user, on Linux systems
593 Apache will by default run as a special Apache user, on Linux systems
594 usually ``www-data`` or ``apache``. If you need to have the repositories
594 usually ``www-data`` or ``apache``. If you need to have the repositories
595 directory owned by a different user, use the user and group options to
595 directory owned by a different user, use the user and group options to
596 WSGIDaemonProcess to set the name of the user and group.
596 WSGIDaemonProcess to set the name of the user and group.
597
597
598 Once again, check that all paths are correctly specified.
598 Once again, check that all paths are correctly specified.
599
599
600 .. code-block:: apache
600 .. code-block:: apache
601
601
602 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \
602 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 \
603 python-home=/srv/kallithea/venv lang=C.UTF-8
603 python-home=/srv/kallithea/venv lang=C.UTF-8
604 WSGIProcessGroup kallithea
604 WSGIProcessGroup kallithea
605 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
605 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
606 WSGIPassAuthorization On
606 WSGIPassAuthorization On
607
607
608 Or if using a dispatcher WSGI script with proper virtualenv activation:
608 Or if using a dispatcher WSGI script with proper virtualenv activation:
609
609
610 .. code-block:: apache
610 .. code-block:: apache
611
611
612 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 lang=en_US.utf8
612 WSGIDaemonProcess kallithea processes=5 threads=1 maximum-requests=100 lang=en_US.utf8
613 WSGIProcessGroup kallithea
613 WSGIProcessGroup kallithea
614 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
614 WSGIScriptAlias / /srv/kallithea/dispatch.wsgi
615 WSGIPassAuthorization On
615 WSGIPassAuthorization On
616
616
617
617
618 Other configuration files
618 Other configuration files
619 -------------------------
619 -------------------------
620
620
621 A number of `example init.d scripts`__ can be found in
621 A number of `example init.d scripts`__ can be found in
622 the ``init.d`` directory of the Kallithea source.
622 the ``init.d`` directory of the Kallithea source.
623
623
624 .. __: https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
624 .. __: https://kallithea-scm.org/repos/kallithea/files/tip/init.d/ .
625
625
626
626
627 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
628 .. _python: http://www.python.org/
627 .. _python: http://www.python.org/
629 .. _Python regular expression documentation: https://docs.python.org/2/library/re.html
628 .. _Python regular expression documentation: https://docs.python.org/2/library/re.html
630 .. _Mercurial: https://www.mercurial-scm.org/
629 .. _Mercurial: https://www.mercurial-scm.org/
631 .. _Celery: http://celeryproject.org/
630 .. _Celery: http://celeryproject.org/
632 .. _Celery documentation: http://docs.celeryproject.org/en/latest/getting-started/index.html
631 .. _Celery documentation: http://docs.celeryproject.org/en/latest/getting-started/index.html
633 .. _RabbitMQ: http://www.rabbitmq.com/
632 .. _RabbitMQ: http://www.rabbitmq.com/
634 .. _Redis: http://redis.io/
633 .. _Redis: http://redis.io/
635 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
634 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
636 .. _PublishingRepositories: https://www.mercurial-scm.org/wiki/PublishingRepositories
635 .. _PublishingRepositories: https://www.mercurial-scm.org/wiki/PublishingRepositories
637 .. _WSGIDaemonProcess documentation: https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIDaemonProcess.html
636 .. _WSGIDaemonProcess documentation: https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIDaemonProcess.html
@@ -1,246 +1,243 b''
1 .. _upgrade:
1 .. _upgrade:
2
2
3 ===================
3 ===================
4 Upgrading Kallithea
4 Upgrading Kallithea
5 ===================
5 ===================
6
6
7 This describes the process for upgrading Kallithea, independently of the
7 This describes the process for upgrading Kallithea, independently of the
8 Kallithea installation method.
8 Kallithea installation method.
9
9
10 .. note::
10 .. note::
11 If you are upgrading from a RhodeCode installation, you must first
11 If you are upgrading from a RhodeCode installation, you must first
12 install Kallithea 0.3.2 and follow the instructions in the 0.3.2
12 install Kallithea 0.3.2 and follow the instructions in the 0.3.2
13 README to perform a one-time conversion of the database from
13 README to perform a one-time conversion of the database from
14 RhodeCode to Kallithea, before upgrading to the latest version
14 RhodeCode to Kallithea, before upgrading to the latest version
15 of Kallithea.
15 of Kallithea.
16
16
17
17
18 1. Stop the Kallithea web application
18 1. Stop the Kallithea web application
19 -------------------------------------
19 -------------------------------------
20
20
21 This step depends entirely on the web server software used to serve
21 This step depends entirely on the web server software used to serve
22 Kallithea, but in any case, Kallithea should not be running during
22 Kallithea, but in any case, Kallithea should not be running during
23 the upgrade.
23 the upgrade.
24
24
25 .. note::
25 .. note::
26 If you're using Celery, make sure you stop all instances during the
26 If you're using Celery, make sure you stop all instances during the
27 upgrade.
27 upgrade.
28
28
29
29
30 2. Create a backup of both database and configuration
30 2. Create a backup of both database and configuration
31 -----------------------------------------------------
31 -----------------------------------------------------
32
32
33 You are of course strongly recommended to make backups regularly, but it
33 You are of course strongly recommended to make backups regularly, but it
34 is *especially* important to make a full database and configuration
34 is *especially* important to make a full database and configuration
35 backup before performing a Kallithea upgrade.
35 backup before performing a Kallithea upgrade.
36
36
37 Back up your configuration
37 Back up your configuration
38 ^^^^^^^^^^^^^^^^^^^^^^^^^^
38 ^^^^^^^^^^^^^^^^^^^^^^^^^^
39
39
40 Make a copy of your Kallithea configuration (``.ini``) file.
40 Make a copy of your Kallithea configuration (``.ini``) file.
41
41
42 If you are using :ref:`rcextensions <customization>`, you should also
42 If you are using :ref:`rcextensions <customization>`, you should also
43 make a copy of the entire ``rcextensions`` directory.
43 make a copy of the entire ``rcextensions`` directory.
44
44
45 Back up your database
45 Back up your database
46 ^^^^^^^^^^^^^^^^^^^^^
46 ^^^^^^^^^^^^^^^^^^^^^
47
47
48 If using SQLite, simply make a copy of the Kallithea database (``.db``)
48 If using SQLite, simply make a copy of the Kallithea database (``.db``)
49 file.
49 file.
50
50
51 If using PostgreSQL, please consult the documentation for the ``pg_dump``
51 If using PostgreSQL, please consult the documentation for the ``pg_dump``
52 utility.
52 utility.
53
53
54 If using MySQL, please consult the documentation for the ``mysqldump``
54 If using MySQL, please consult the documentation for the ``mysqldump``
55 utility.
55 utility.
56
56
57 Look for ``sqlalchemy.url`` in your configuration file to determine
57 Look for ``sqlalchemy.url`` in your configuration file to determine
58 database type, settings, location, etc. If you were running Kallithea 0.3.x or
58 database type, settings, location, etc. If you were running Kallithea 0.3.x or
59 older, this was ``sqlalchemy.db1.url``.
59 older, this was ``sqlalchemy.db1.url``.
60
60
61
61
62 3. Activate or recreate the Kallithea virtual environment (if any)
62 3. Activate or recreate the Kallithea virtual environment (if any)
63 ------------------------------------------------------------------
63 ------------------------------------------------------------------
64
64
65 .. note::
65 .. note::
66 If you did not install Kallithea in a virtual environment, skip this step.
66 If you did not install Kallithea in a virtual environment, skip this step.
67
67
68 For major upgrades, e.g. from 0.3.x to 0.4.x, it is recommended to create a new
68 For major upgrades, e.g. from 0.3.x to 0.4.x, it is recommended to create a new
69 virtual environment, rather than reusing the old. For minor upgrades, e.g.
69 virtual environment, rather than reusing the old. For minor upgrades, e.g.
70 within the 0.4.x range, this is not really necessary (but equally fine).
70 within the 0.4.x range, this is not really necessary (but equally fine).
71
71
72 To create a new virtual environment, please refer to the appropriate
72 To create a new virtual environment, please refer to the appropriate
73 installation page for details. After creating and activating the new virtual
73 installation page for details. After creating and activating the new virtual
74 environment, proceed with the rest of the upgrade process starting from the next
74 environment, proceed with the rest of the upgrade process starting from the next
75 section.
75 section.
76
76
77 To reuse the same virtual environment, first activate it, then verify that you
77 To reuse the same virtual environment, first activate it, then verify that you
78 are using the correct environment by running::
78 are using the correct environment by running::
79
79
80 pip freeze
80 pip freeze
81
81
82 This will list all packages installed in the current environment. If
82 This will list all packages installed in the current environment. If
83 Kallithea isn't listed, deactivate the environment and then activate the correct
83 Kallithea isn't listed, deactivate the environment and then activate the correct
84 one, or recreate a new environment. See the appropriate installation page for
84 one, or recreate a new environment. See the appropriate installation page for
85 details.
85 details.
86
86
87
87
88 4. Install new version of Kallithea
88 4. Install new version of Kallithea
89 -----------------------------------
89 -----------------------------------
90
90
91 Please refer to the instructions for the installation method you
91 Please refer to the instructions for the installation method you
92 originally used to install Kallithea.
92 originally used to install Kallithea.
93
93
94 If you originally installed using pip, it is as simple as::
94 If you originally installed using pip, it is as simple as::
95
95
96 pip install --upgrade kallithea
96 pip install --upgrade kallithea
97
97
98 If you originally installed from version control, assuming you did not make
98 If you originally installed from version control, assuming you did not make
99 private changes (in which case you should adapt the instructions accordingly)::
99 private changes (in which case you should adapt the instructions accordingly)::
100
100
101 cd my-kallithea-clone
101 cd my-kallithea-clone
102 hg parent # make a note of the original revision
102 hg parent # make a note of the original revision
103 hg pull
103 hg pull
104 hg update
104 hg update
105 hg parent # make a note of the new revision
105 hg parent # make a note of the new revision
106 pip install --upgrade -e .
106 pip install --upgrade -e .
107
107
108 .. _upgrade_config:
108 .. _upgrade_config:
109
109
110
110
111 5. Upgrade your configuration
111 5. Upgrade your configuration
112 -----------------------------
112 -----------------------------
113
113
114 Run the following command to create a new configuration (``.ini``) file::
114 Run the following command to create a new configuration (``.ini``) file::
115
115
116 kallithea-cli config-create new.ini
116 kallithea-cli config-create new.ini
117
117
118 Then compare it with your old config file and copy over the required
118 Then compare it with your old config file and copy over the required
119 configuration values from the old to the new file.
119 configuration values from the old to the new file.
120
120
121 .. note::
121 .. note::
122 Please always make sure your ``.ini`` files are up to date. Errors
122 Please always make sure your ``.ini`` files are up to date. Errors
123 can often be caused by missing parameters added in new versions.
123 can often be caused by missing parameters added in new versions.
124
124
125 .. _upgrade_db:
125 .. _upgrade_db:
126
126
127
127
128 6. Upgrade your database
128 6. Upgrade your database
129 ------------------------
129 ------------------------
130
130
131 .. note::
131 .. note::
132 If you are *downgrading* Kallithea, you should perform the database
132 If you are *downgrading* Kallithea, you should perform the database
133 migration step *before* installing the older version. (That is,
133 migration step *before* installing the older version. (That is,
134 always perform migrations using the most recent of the two versions
134 always perform migrations using the most recent of the two versions
135 you're migrating between.)
135 you're migrating between.)
136
136
137 First, run the following command to see your current database version::
137 First, run the following command to see your current database version::
138
138
139 alembic -c new.ini current
139 alembic -c new.ini current
140
140
141 Typical output will be something like "9358dc3d6828 (head)", which is
141 Typical output will be something like "9358dc3d6828 (head)", which is
142 the current Alembic database "revision ID". Write down the entire output
142 the current Alembic database "revision ID". Write down the entire output
143 for troubleshooting purposes.
143 for troubleshooting purposes.
144
144
145 The output will be empty if you're upgrading from Kallithea 0.3.x or
145 The output will be empty if you're upgrading from Kallithea 0.3.x or
146 older. That's expected. If you get an error that the config file was not
146 older. That's expected. If you get an error that the config file was not
147 found or has no ``[alembic]`` section, see the next section.
147 found or has no ``[alembic]`` section, see the next section.
148
148
149 Next, if you are performing an *upgrade*: Run the following command to
149 Next, if you are performing an *upgrade*: Run the following command to
150 upgrade your database to the current Kallithea version::
150 upgrade your database to the current Kallithea version::
151
151
152 alembic -c new.ini upgrade head
152 alembic -c new.ini upgrade head
153
153
154 If you are performing a *downgrade*: Run the following command to
154 If you are performing a *downgrade*: Run the following command to
155 downgrade your database to the given version::
155 downgrade your database to the given version::
156
156
157 alembic -c new.ini downgrade 0.4
157 alembic -c new.ini downgrade 0.4
158
158
159 Alembic will show the necessary migrations (if any) as it executes them.
159 Alembic will show the necessary migrations (if any) as it executes them.
160 If no "ERROR" is displayed, the command was successful.
160 If no "ERROR" is displayed, the command was successful.
161
161
162 Should an error occur, the database may be "stranded" half-way
162 Should an error occur, the database may be "stranded" half-way
163 through the migration, and you should restore it from backup.
163 through the migration, and you should restore it from backup.
164
164
165 Enabling old Kallithea config files for Alembic use
165 Enabling old Kallithea config files for Alembic use
166 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
166 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167
167
168 Kallithea configuration files created before the introduction of Alembic
168 Kallithea configuration files created before the introduction of Alembic
169 (i.e. predating Kallithea 0.4) need to be updated for use with Alembic.
169 (i.e. predating Kallithea 0.4) need to be updated for use with Alembic.
170 Without this, Alembic will fail with an error like this::
170 Without this, Alembic will fail with an error like this::
171
171
172 FAILED: No config file 'my.ini' found, or file has no '[alembic]' section
172 FAILED: No config file 'my.ini' found, or file has no '[alembic]' section
173
173
174 .. note::
174 .. note::
175 If you followed this upgrade guide correctly, you will have created a
175 If you followed this upgrade guide correctly, you will have created a
176 new configuration file in section :ref:`Upgrading your configuration
176 new configuration file in section :ref:`Upgrading your configuration
177 <upgrade_config>`. When calling Alembic, make
177 <upgrade_config>`. When calling Alembic, make
178 sure to use this new config file. In this case, you should not get any
178 sure to use this new config file. In this case, you should not get any
179 errors and the below manual steps should not be needed.
179 errors and the below manual steps should not be needed.
180
180
181 If Alembic complains specifically about a missing ``alembic.ini``, it is
181 If Alembic complains specifically about a missing ``alembic.ini``, it is
182 likely because you did not specify a config file using the ``-c`` option.
182 likely because you did not specify a config file using the ``-c`` option.
183 On the other hand, if the mentioned config file actually exists, you
183 On the other hand, if the mentioned config file actually exists, you
184 need to append the following lines to it::
184 need to append the following lines to it::
185
185
186 [alembic]
186 [alembic]
187 script_location = kallithea:alembic
187 script_location = kallithea:alembic
188
188
189 Your config file should now work with Alembic.
189 Your config file should now work with Alembic.
190
190
191
191
192 7. Prepare the front-end
192 7. Prepare the front-end
193 ------------------------
193 ------------------------
194
194
195 Starting with Kallithea 0.4, external front-end dependencies are no longer
195 Starting with Kallithea 0.4, external front-end dependencies are no longer
196 shipped but need to be downloaded and/or generated at installation time. Run the
196 shipped but need to be downloaded and/or generated at installation time. Run the
197 following command::
197 following command::
198
198
199 kallithea-cli front-end-build
199 kallithea-cli front-end-build
200
200
201
201
202 8. Rebuild the Whoosh full-text index
202 8. Rebuild the Whoosh full-text index
203 -------------------------------------
203 -------------------------------------
204
204
205 It is recommended that you rebuild the Whoosh index after upgrading since
205 It is recommended that you rebuild the Whoosh index after upgrading since
206 new Whoosh versions can introduce incompatible index changes.
206 new Whoosh versions can introduce incompatible index changes.
207
207
208
208
209 9. Start the Kallithea web application
209 9. Start the Kallithea web application
210 --------------------------------------
210 --------------------------------------
211
211
212 This step once again depends entirely on the web server software used to
212 This step once again depends entirely on the web server software used to
213 serve Kallithea.
213 serve Kallithea.
214
214
215 If you were running Kallithea 0.3.x or older and were using ``paster serve
215 If you were running Kallithea 0.3.x or older and were using ``paster serve
216 my.ini`` before, then the corresponding command in Kallithea 0.4 and later is::
216 my.ini`` before, then the corresponding command in Kallithea 0.4 and later is::
217
217
218 gearbox serve -c new.ini
218 gearbox serve -c new.ini
219
219
220 Before starting the new version of Kallithea, you may find it helpful to
220 Before starting the new version of Kallithea, you may find it helpful to
221 clear out your log file so that new errors are readily apparent.
221 clear out your log file so that new errors are readily apparent.
222
222
223 .. note::
223 .. note::
224 If you're using Celery, make sure you restart all instances of it after
224 If you're using Celery, make sure you restart all instances of it after
225 upgrade.
225 upgrade.
226
226
227
227
228 10. Update Git repository hooks
228 10. Update Git repository hooks
229 -------------------------------
229 -------------------------------
230
230
231 It is possible that an upgrade involves changes to the Git hooks installed by
231 It is possible that an upgrade involves changes to the Git hooks installed by
232 Kallithea. As these hooks are created inside the repositories on the server
232 Kallithea. As these hooks are created inside the repositories on the server
233 filesystem, they are not updated automatically when upgrading Kallithea itself.
233 filesystem, they are not updated automatically when upgrading Kallithea itself.
234
234
235 To update the hooks of your Git repositories:
235 To update the hooks of your Git repositories:
236
236
237 * Go to *Admin > Settings > Remap and Rescan*
237 * Go to *Admin > Settings > Remap and Rescan*
238 * Select the checkbox *Install Git hooks*
238 * Select the checkbox *Install Git hooks*
239 * Click the button *Rescan repositories*
239 * Click the button *Rescan repositories*
240
240
241 .. note::
241 .. note::
242 Kallithea does not use hooks on Mercurial repositories. This step is thus
242 Kallithea does not use hooks on Mercurial repositories. This step is thus
243 not necessary if you only have Mercurial repositories.
243 not necessary if you only have Mercurial repositories.
244
245
246 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
@@ -1,75 +1,74 b''
1 .. _troubleshooting:
1 .. _troubleshooting:
2
2
3 ===============
3 ===============
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 :Q: **Missing static files?**
7 :Q: **Missing static files?**
8 :A: Make sure either to set the ``static_files = true`` in the .ini file or
8 :A: Make sure either to set the ``static_files = true`` in the .ini file or
9 double check the root path for your http setup. It should point to
9 double check the root path for your http setup. It should point to
10 for example:
10 for example:
11 ``/home/my-virtual-python/lib/python2.7/site-packages/kallithea/public``
11 ``/home/my-virtual-python/lib/python2.7/site-packages/kallithea/public``
12
12
13 |
13 |
14
14
15 :Q: **Can't install celery/rabbitmq?**
15 :Q: **Can't install celery/rabbitmq?**
16 :A: Don't worry. Kallithea works without them, too. No extra setup is required.
16 :A: Don't worry. Kallithea works without them, too. No extra setup is required.
17 Try out the great Celery docs for further help.
17 Try out the great Celery docs for further help.
18
18
19 |
19 |
20
20
21 :Q: **Long lasting push timeouts?**
21 :Q: **Long lasting push timeouts?**
22 :A: Make sure you set a longer timeout in your proxy/fcgi settings. Timeouts
22 :A: Make sure you set a longer timeout in your proxy/fcgi settings. Timeouts
23 are caused by the http server and not Kallithea.
23 are caused by the http server and not Kallithea.
24
24
25 |
25 |
26
26
27 :Q: **Large pushes timeouts?**
27 :Q: **Large pushes timeouts?**
28 :A: Make sure you set a proper ``max_body_size`` for the http server. Very often
28 :A: Make sure you set a proper ``max_body_size`` for the http server. Very often
29 Apache, Nginx, or other http servers kill the connection due to to large
29 Apache, Nginx, or other http servers kill the connection due to to large
30 body.
30 body.
31
31
32 |
32 |
33
33
34 :Q: **Apache doesn't pass basicAuth on pull/push?**
34 :Q: **Apache doesn't pass basicAuth on pull/push?**
35 :A: Make sure you added ``WSGIPassAuthorization true``.
35 :A: Make sure you added ``WSGIPassAuthorization true``.
36
36
37 |
37 |
38
38
39 :Q: **Git fails on push/pull?**
39 :Q: **Git fails on push/pull?**
40 :A: Make sure you're using a WSGI http server that can handle chunked encoding
40 :A: Make sure you're using a WSGI http server that can handle chunked encoding
41 such as ``waitress`` or ``gunicorn``.
41 such as ``waitress`` or ``gunicorn``.
42
42
43 |
43 |
44
44
45 :Q: **How can I use hooks in Kallithea?**
45 :Q: **How can I use hooks in Kallithea?**
46 :A: It's easy if they are Python hooks: just use advanced link in
46 :A: It's easy if they are Python hooks: just use advanced link in
47 hooks section in Admin panel, that works only for Mercurial. If
47 hooks section in Admin panel, that works only for Mercurial. If
48 you want to use Git hooks, just install th proper one in the repository,
48 you want to use Git hooks, just install th proper one in the repository,
49 e.g., create a file `/gitrepo/hooks/pre-receive`. You can also use
49 e.g., create a file `/gitrepo/hooks/pre-receive`. You can also use
50 Kallithea-extensions to connect to callback hooks, for both Git
50 Kallithea-extensions to connect to callback hooks, for both Git
51 and Mercurial.
51 and Mercurial.
52
52
53 |
53 |
54
54
55 :Q: **Kallithea is slow for me, how can I make it faster?**
55 :Q: **Kallithea is slow for me, how can I make it faster?**
56 :A: See the :ref:`performance` section.
56 :A: See the :ref:`performance` section.
57
57
58 |
58 |
59
59
60 :Q: **UnicodeDecodeError on Apache mod_wsgi**
60 :Q: **UnicodeDecodeError on Apache mod_wsgi**
61 :A: Please read: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#if-you-get-a-unicodeencodeerror.
61 :A: Please read: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#if-you-get-a-unicodeencodeerror.
62
62
63 |
63 |
64
64
65 :Q: **Requests hanging on Windows**
65 :Q: **Requests hanging on Windows**
66 :A: Please try out with disabled Antivirus software, there are some known problems with Eset Antivirus. Make sure
66 :A: Please try out with disabled Antivirus software, there are some known problems with Eset Antivirus. Make sure
67 you have installed the latest Windows patches (especially KB2789397).
67 you have installed the latest Windows patches (especially KB2789397).
68
68
69
69
70 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
71 .. _python: http://www.python.org/
70 .. _python: http://www.python.org/
72 .. _mercurial: https://www.mercurial-scm.org/
71 .. _mercurial: https://www.mercurial-scm.org/
73 .. _celery: http://celeryproject.org/
72 .. _celery: http://celeryproject.org/
74 .. _rabbitmq: http://www.rabbitmq.com/
73 .. _rabbitmq: http://www.rabbitmq.com/
75 .. _python-ldap: http://www.python-ldap.org/
74 .. _python-ldap: http://www.python-ldap.org/
@@ -1,81 +1,81 b''
1 #!/bin/bash
1 #!/bin/bash
2 set -e
2 set -e
3 set -x
3 set -x
4
4
5 cleanup()
5 cleanup()
6 {
6 {
7 echo "Removing venv $venv"
7 echo "Removing venv $venv"
8 rm -rf "$venv"
8 rm -rf "$venv"
9 }
9 }
10
10
11 echo "Checking that you are NOT inside a virtualenv"
11 echo "Checking that you are NOT inside a virtualenv"
12 [ -z "$VIRTUAL_ENV" ]
12 [ -z "$VIRTUAL_ENV" ]
13
13
14 venv=$(mktemp -d --tmpdir kallithea-release-XXXXX)
14 venv=$(mktemp -d --tmpdir kallithea-release-XXXXX)
15 trap cleanup EXIT
15 trap cleanup EXIT
16
16
17 echo "Setting up a fresh virtualenv in $venv"
17 echo "Setting up a fresh virtualenv in $venv"
18 virtualenv -p python3 "$venv"
18 python3 -m venv "$venv"
19 . "$venv/bin/activate"
19 . "$venv/bin/activate"
20
20
21 echo "Install/verify tools needed for building and uploading stuff"
21 echo "Install/verify tools needed for building and uploading stuff"
22 pip install --upgrade -e . -r dev_requirements.txt twine python-ldap python-pam
22 pip install --upgrade -e . -r dev_requirements.txt twine python-ldap python-pam
23
23
24 echo "Cleanup and update copyrights ... and clean checkout"
24 echo "Cleanup and update copyrights ... and clean checkout"
25 scripts/run-all-cleanup
25 scripts/run-all-cleanup
26 scripts/update-copyrights.py
26 scripts/update-copyrights.py
27 hg up -cr .
27 hg up -cr .
28
28
29 echo "Make release build from clean checkout in build/"
29 echo "Make release build from clean checkout in build/"
30 rm -rf build dist
30 rm -rf build dist
31 hg archive build
31 hg archive build
32 cd build
32 cd build
33
33
34 echo "Check that each entry in MANIFEST.in match something"
34 echo "Check that each entry in MANIFEST.in match something"
35 sed -e 's/[^ ]*[ ]*\([^ ]*\).*/\1/g' MANIFEST.in | xargs ls -lad
35 sed -e 's/[^ ]*[ ]*\([^ ]*\).*/\1/g' MANIFEST.in | xargs ls -lad
36
36
37 echo "Build dist"
37 echo "Build dist"
38 python3 setup.py compile_catalog
38 python3 setup.py compile_catalog
39 python3 setup.py sdist
39 python3 setup.py sdist
40
40
41 echo "Verify VERSION from kallithea/__init__.py"
41 echo "Verify VERSION from kallithea/__init__.py"
42 namerel=$(cd dist && echo Kallithea-*.tar.gz)
42 namerel=$(cd dist && echo Kallithea-*.tar.gz)
43 namerel=${namerel%.tar.gz}
43 namerel=${namerel%.tar.gz}
44 version=${namerel#Kallithea-}
44 version=${namerel#Kallithea-}
45 ls -l $(pwd)/dist/$namerel.tar.gz
45 ls -l $(pwd)/dist/$namerel.tar.gz
46 echo "Releasing Kallithea $version in directory $namerel"
46 echo "Releasing Kallithea $version in directory $namerel"
47
47
48 echo "Verify dist file content"
48 echo "Verify dist file content"
49 diff -u <((hg mani | grep -v '^\.hg\|^kallithea/i18n/en/LC_MESSAGES/kallithea.mo$') | LANG=C sort) <(tar tf dist/Kallithea-$version.tar.gz | sed "s|^$namerel/||" | grep . | grep -v '^kallithea/i18n/.*/LC_MESSAGES/kallithea.mo$\|^Kallithea.egg-info/\|^PKG-INFO$\|/$' | LANG=C sort)
49 diff -u <((hg mani | grep -v '^\.hg\|^kallithea/i18n/en/LC_MESSAGES/kallithea.mo$') | LANG=C sort) <(tar tf dist/Kallithea-$version.tar.gz | sed "s|^$namerel/||" | grep . | grep -v '^kallithea/i18n/.*/LC_MESSAGES/kallithea.mo$\|^Kallithea.egg-info/\|^PKG-INFO$\|/$' | LANG=C sort)
50
50
51 echo "Verify docs build"
51 echo "Verify docs build"
52 python3 setup.py build_sphinx # the results are not actually used, but we want to make sure it builds
52 python3 setup.py build_sphinx # the results are not actually used, but we want to make sure it builds
53
53
54 echo "Shortlog for inclusion in the release announcement"
54 echo "Shortlog for inclusion in the release announcement"
55 scripts/shortlog.py "only('.', branch('stable') & tagged() & public() & not '.')"
55 scripts/shortlog.py "only('.', branch('stable') & tagged() & public() & not '.')"
56
56
57 cat - << EOT
57 cat - << EOT
58
58
59 Now, make sure
59 Now, make sure
60 * all tests are passing
60 * all tests are passing
61 * release note is ready
61 * release note is ready
62 * announcement is ready
62 * announcement is ready
63 * source has been pushed to https://kallithea-scm.org/repos/kallithea
63 * source has been pushed to https://kallithea-scm.org/repos/kallithea
64
64
65 EOT
65 EOT
66
66
67 echo "Verify current revision is tagged for $version"
67 echo "Verify current revision is tagged for $version"
68 hg log -r "'$version'&." | grep .
68 hg log -r "'$version'&." | grep .
69
69
70 echo -n "Enter \"pypi\" to upload Kallithea $version to pypi: "
70 echo -n "Enter \"pypi\" to upload Kallithea $version to pypi: "
71 read answer
71 read answer
72 [ "$answer" = "pypi" ]
72 [ "$answer" = "pypi" ]
73
73
74 echo "Rebuild readthedocs for docs.kallithea-scm.org"
74 echo "Rebuild readthedocs for docs.kallithea-scm.org"
75 xdg-open https://readthedocs.org/projects/kallithea/
75 xdg-open https://readthedocs.org/projects/kallithea/
76 curl -X POST http://readthedocs.org/build/kallithea
76 curl -X POST http://readthedocs.org/build/kallithea
77 xdg-open https://readthedocs.org/projects/kallithea/builds
77 xdg-open https://readthedocs.org/projects/kallithea/builds
78 xdg-open http://docs.kallithea-scm.org/en/latest/ # or whatever the branch is
78 xdg-open http://docs.kallithea-scm.org/en/latest/ # or whatever the branch is
79
79
80 twine upload dist/*
80 twine upload dist/*
81 xdg-open https://pypi.python.org/pypi/Kallithea
81 xdg-open https://pypi.python.org/pypi/Kallithea
@@ -1,64 +1,64 b''
1 #!/bin/bash
1 #!/bin/bash
2 # Validate the specified commits against test suite and other checks.
2 # Validate the specified commits against test suite and other checks.
3
3
4 if [ -n "$VIRTUAL_ENV" ]; then
4 if [ -n "$VIRTUAL_ENV" ]; then
5 echo "Please run this script from outside a virtualenv."
5 echo "Please run this script from outside a virtualenv."
6 exit 1
6 exit 1
7 fi
7 fi
8
8
9 if ! hg update --check -q .; then
9 if ! hg update --check -q .; then
10 echo "Working dir is not clean, please commit/revert changes first."
10 echo "Working dir is not clean, please commit/revert changes first."
11 exit 1
11 exit 1
12 fi
12 fi
13
13
14 venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX)
14 venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX)
15 resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX)
15 resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX)
16 echo > "$resultfile"
16 echo > "$resultfile"
17
17
18 cleanup()
18 cleanup()
19 {
19 {
20 rm -rf /tmp/kallithea-test*
20 rm -rf /tmp/kallithea-test*
21 rm -rf "$venv"
21 rm -rf "$venv"
22 }
22 }
23 finish()
23 finish()
24 {
24 {
25 cleanup
25 cleanup
26 # print (possibly intermediate) results
26 # print (possibly intermediate) results
27 cat "$resultfile"
27 cat "$resultfile"
28 rm "$resultfile"
28 rm "$resultfile"
29 }
29 }
30 trap finish EXIT
30 trap finish EXIT
31
31
32 for rev in $(hg log -r "$1" -T '{node}\n'); do
32 for rev in $(hg log -r "$1" -T '{node}\n'); do
33 hg log -r "$rev"
33 hg log -r "$rev"
34 hg update "$rev"
34 hg update "$rev"
35
35
36 cleanup
36 cleanup
37 virtualenv -p "$(command -v python3)" "$venv"
37 python3 -m venv "$venv"
38 source "$venv/bin/activate"
38 source "$venv/bin/activate"
39 pip install --upgrade pip setuptools
39 pip install --upgrade pip setuptools
40 pip install -e . -r dev_requirements.txt python-ldap python-pam
40 pip install -e . -r dev_requirements.txt python-ldap python-pam
41
41
42 # run-all-cleanup
42 # run-all-cleanup
43 scripts/run-all-cleanup
43 scripts/run-all-cleanup
44 if ! hg update --check -q .; then
44 if ! hg update --check -q .; then
45 echo "run-all-cleanup did not give clean results!"
45 echo "run-all-cleanup did not give clean results!"
46 result="NOK"
46 result="NOK"
47 hg diff
47 hg diff
48 hg revert -a
48 hg revert -a
49 else
49 else
50 result=" OK"
50 result=" OK"
51 fi
51 fi
52 echo "$result: $rev (run-all-cleanup)" >> "$resultfile"
52 echo "$result: $rev (run-all-cleanup)" >> "$resultfile"
53
53
54 # pytest
54 # pytest
55 if py.test; then
55 if py.test; then
56 result=" OK"
56 result=" OK"
57 else
57 else
58 result="NOK"
58 result="NOK"
59 fi
59 fi
60 echo "$result: $rev (pytest)" >> "$resultfile"
60 echo "$result: $rev (pytest)" >> "$resultfile"
61
61
62 deactivate
62 deactivate
63 echo
63 echo
64 done
64 done
@@ -1,55 +1,55 b''
1 #!/bin/bash
1 #!/bin/bash
2 # Test that installation of all dependencies works fine if versions are set to
2 # Test that installation of all dependencies works fine if versions are set to
3 # the minimum ones.
3 # the minimum ones.
4
4
5 set -e
5 set -e
6
6
7 if [ -n "$VIRTUAL_ENV" ]; then
7 if [ -n "$VIRTUAL_ENV" ]; then
8 echo "This script will create its own virtualenv - please don't run it inside an existing one." >&2
8 echo "This script will create its own virtualenv - please don't run it inside an existing one." >&2
9 exit 1
9 exit 1
10 fi
10 fi
11
11
12 cd "$(hg root)"
12 cd "$(hg root)"
13
13
14 venv=build/minimum-dependency-versions-venv
14 venv=build/minimum-dependency-versions-venv
15 log=build/minimum-dependency-versions.log
15 log=build/minimum-dependency-versions.log
16 min_requirements=build/minimum-dependency-versions-requirements.txt
16 min_requirements=build/minimum-dependency-versions-requirements.txt
17 echo "virtualenv: $venv"
17 echo "virtualenv: $venv"
18 echo "log: $log"
18 echo "log: $log"
19 echo "minimum requirements file: $min_requirements"
19 echo "minimum requirements file: $min_requirements"
20
20
21 # clean up previous runs
21 # clean up previous runs
22 rm -rf "$venv" "$log"
22 rm -rf "$venv" "$log"
23 mkdir -p "$venv"
23 mkdir -p "$venv"
24
24
25 # Make a light weight parsing of setup.py and dev_requirements.txt,
25 # Make a light weight parsing of setup.py and dev_requirements.txt,
26 # finding all >= requirements and dumping into a custom requirements.txt
26 # finding all >= requirements and dumping into a custom requirements.txt
27 # while fixating the requirement at the lower bound.
27 # while fixating the requirement at the lower bound.
28 sed -n 's/.*"\(.*\)>=\(.*\)".*/\1==\2/p' setup.py > "$min_requirements"
28 sed -n 's/.*"\(.*\)>=\(.*\)".*/\1==\2/p' setup.py > "$min_requirements"
29 sed 's/>=/==/p' dev_requirements.txt >> "$min_requirements"
29 sed 's/>=/==/p' dev_requirements.txt >> "$min_requirements"
30
30
31 virtualenv -p "$(command -v python3)" "$venv"
31 python3 -m venv "$venv"
32 source "$venv/bin/activate"
32 source "$venv/bin/activate"
33 pip install --upgrade pip setuptools
33 pip install --upgrade pip setuptools
34 pip install -e . -r "$min_requirements" python-ldap python-pam 2> >(tee "$log" >&2)
34 pip install -e . -r "$min_requirements" python-ldap python-pam 2> >(tee "$log" >&2)
35
35
36 # Strip out the known Python 2.7 deprecation message.
36 # Strip out the known Python 2.7 deprecation message.
37 sed -i '/DEPRECATION: Python 2\.7 /d' "$log"
37 sed -i '/DEPRECATION: Python 2\.7 /d' "$log"
38
38
39 # Treat any message on stderr as a problem, for the caller to interpret.
39 # Treat any message on stderr as a problem, for the caller to interpret.
40 if [ -s "$log" ]; then
40 if [ -s "$log" ]; then
41 echo
41 echo
42 echo "Error: pip detected following problems:"
42 echo "Error: pip detected following problems:"
43 cat "$log"
43 cat "$log"
44 echo
44 echo
45 exit 1
45 exit 1
46 fi
46 fi
47
47
48 freeze_txt=build/minimum-dependency-versions.txt
48 freeze_txt=build/minimum-dependency-versions.txt
49 pip freeze > $freeze_txt
49 pip freeze > $freeze_txt
50 echo "Installation of minimum packages was successful, providing a set of packages as in $freeze_txt . Now running test suite..."
50 echo "Installation of minimum packages was successful, providing a set of packages as in $freeze_txt . Now running test suite..."
51
51
52 pytest
52 pytest
53
53
54 echo "Test suite execution was successful."
54 echo "Test suite execution was successful."
55 echo "You can now do additional validation using virtual env '$venv'."
55 echo "You can now do additional validation using virtual env '$venv'."
General Comments 0
You need to be logged in to leave comments. Login now