Browse Source

fix docker and apache documentation

philippe 6 years ago
parent
commit
cdea36fe7c
2 changed files with 148 additions and 37 deletions
  1. 28 10
      README.md
  2. 120 27
      doc/apache.md

+ 28 - 10
README.md View File

100
 
100
 
101
 ## Docker ##
101
 ## Docker ##
102
 
102
 
103
-In case you prefer using Docker:
103
+**Important:** docker images is for local usage. If you want to use Tracim from network device, its necessary to change some lines in Development.ini file and build new image.
104
+
105
+
106
+* For windows:
107
+
108
+Install [docker toolbox](https://docs.docker.com/toolbox/toolbox_install_windows/)
109
+
110
+
111
+* For linux:
104
 
112
 
105
 You need to install docker on your server first.
113
 You need to install docker on your server first.
114
+Example on Debian: `sudo apt-get install docker docker-compose`
115
+
106
 Make sure `docker.service` is started correctly.
116
 Make sure `docker.service` is started correctly.
117
+exemple on Debian: `sudo systemctl status docker`
107
 
118
 
108
 **If you want to use the latest stable image: **
119
 **If you want to use the latest stable image: **
109
 
120
 
119
                -p 80:80 -p 3030:3030 -p 5232:5232 \
130
                -p 80:80 -p 3030:3030 -p 5232:5232 \
120
                -v /var/tracim/etc:/etc/tracim -v /var/tracim/var:/var/tracim algoo/tracim:<$tag>
131
                -v /var/tracim/etc:/etc/tracim -v /var/tracim/var:/var/tracim algoo/tracim:<$tag>
121
 
132
 
133
+Description of versioning:
122
 
134
 
123
-* You can use `algoo/tracim:unstable` image:
124
-
125
-        sudo docker run -e DATABASE_TYPE=sqlite \
126
-               -p 80:80 -p 3030:3030 -p 5232:5232 \
127
-               -v /var/tracim/etc:/etc/tracim -v /var/tracim/var:/var/tracim algoo/tracim:unstable
135
+* algoo/`tracim:latest` is latest stable image from branch master
136
+* algoo/`tracim:<$tag>` is a stable tag image from branch master
137
+* algoo/`tracim_testing:latest` is a latest image from branch develop
138
+* algoo/`tracim:unstable` is a latest unstable image from branch develop
128
 
139
 
140
+More information about command:
129
 
141
 
130
-* You can use `algoo/tracim_testing:latest` image:
142
+    sudo docker run \
143
+        -e DATABASE_TYPE=sqlite \   # define database: may be sqlite, mysql, postgresql
144
+        -p 80:80 \  # web server port mapping
145
+        -p 3030:3030 \  # webdav interface port mapping
146
+        -p 5232:5232 \  # caldav interface port mapping
147
+        -v /var/tracim/etc:/etc/tracim \ # config file storage path
148
+        -v /var/tracim/var:/var/tracim \  # file storage path
149
+        algoo/tracim:unstable  # docker image: tracim:unstable for development version, tracim_test:latest for nightly builds
131
 
150
 
132
-        sudo docker run -e DATABASE_TYPE=sqlite \
133
-               -p 80:80 -p 3030:3030 -p 5232:5232 \
134
-               -v /var/tracim/etc:/etc/tracim -v /var/tracim/var:/var/tracim algoo/tracim_testing
135
 
151
 
136
 
152
 
137
 All docker images are available here : https://hub.docker.com/u/algoo/
153
 All docker images are available here : https://hub.docker.com/u/algoo/
154
+More information about build docker image: https://github.com/tracim/docker_tracim
155
+
138
 
156
 
139
 ----
157
 ----
140
 
158
 

+ 120 - 27
doc/apache.md View File

2
 
2
 
3
 ### Installation ###
3
 ### Installation ###
4
 
4
 
5
-Install `Apache` server and its [`WSGI` module](https://github.com/GrahamDumpleton/mod_wsgi):
5
+Install `tracim` first.
6
+Install `Apache` server and uwsgi  its [`WSGI` module](https://github.com/GrahamDumpleton/mod_wsgi):
6
 
7
 
7
-    sudo apt install apache2 libapache2-mod-wsgi-py3
8
+    sudo apt install apache2 libapache2-mod-wsgi-py3 uwsgi uwsgi-plugin-python3
8
 
9
 
9
 ### Configuration ###
10
 ### Configuration ###
10
 
11
 
11
 Create a file named `/etc/apache2/sites-available/tracim.conf` containing:
12
 Create a file named `/etc/apache2/sites-available/tracim.conf` containing:
12
 
13
 
13
-    Listen 8080
14
+    Listen 80
14
 
15
 
15
-    <VirtualHost *:8080>
16
+    <VirtualHost *:80>
16
         ServerName tracim
17
         ServerName tracim
17
 
18
 
18
-        # Serve Tracim through WSGI
19
-        WSGIDaemonProcess tracim user=[your_user] group=[your_user] threads=4 python-home=[tracim_path]/tg2env python-path=[tracim_path]/tracim lang='C.UTF-8' locale='C.UTF-8'
20
-        WSGIProcessGroup tracim
21
-        WSGIScriptAlias / [tracim_path]/tracim/app.wsgi process-group=tracim
22
-        <Directory "[tracim_path]/tracim">
23
-            <Files "app.wsgi">
24
-                Require all granted
25
-            </Files>
26
-        </Directory>
27
-
28
-        # Serve static files directly
29
-        Alias /assets          [tracim_path]/tracim/tracim/public/assets
30
-        Alias /_caldavzap      [tracim_path]/tracim/tracim/public/_caldavzap
31
-        Alias /favicon.ico     [tracim_path]/tracim/tracim/public/favicon.ico
32
-        <Directory "[tracim_path]/tracim/tracim/public">
33
-            Require all granted
34
-        </Directory>
19
+    <Directory "/">
20
+        Require all granted
21
+        Dav On
22
+    </Directory>
23
+    ProxyPreserveHost On 
24
+    CustomLog /var/log/apache2/algoo-access.log combined
25
+    ErrorLog /var/log/apache2/algoo-error.log
26
+    <Location "/webdav">
27
+        # Dav On
28
+    </Location>
29
+
30
+    # RemoteIPHeader X-Forwarded-For
31
+    ProxyPass /webdav http://127.0.0.1:3030/webdav
32
+    ProxyPassReverse /webdav http://127.0.0.1:3030/webdav
33
+    ProxyPass / http://127.0.0.1:8080/
34
+    ProxyPassReverse / http://127.0.0.1:8080/
35
+
35
     </VirtualHost>
36
     </VirtualHost>
36
 
37
 
37
-Replace `[tracim_path]` and `[your_user]` above by your tracim installation path and your user.
38
+Enable this configuration file:
39
+
40
+    sudo ln -s /etc/apache2/sites-available/tracim.conf /etc/apache2/sites-enabled/
41
+
42
+Check if you just have `tracim.conf` in `/etc/apache2/sites-enabled`, if not, remove other file.
43
+
44
+
45
+Create the file named `/etc/uwsgi/apps-available/tracim.ini` containing:
46
+
47
+    [uwsgi]
48
+    plugins = python3
49
+    chdir = [tracim_path]/tracim
50
+    home = [tracim_path]/tg2env
51
+    wsgi-file = app.wsgi
52
+    callable = application
53
+    http-socket = 0.0.0.0:8080
54
+    enable-threads = true
55
+    env = PYTHON_EGG_CACHE=/tmp
56
+
57
+Replace [tracim_path] by your path of tracim
38
 
58
 
39
-Set the `APP_CONFIG` variable of the `tracim/app.wsgi` file to match your tracim installation path:
59
+Enable this configuration file:
60
+
61
+    sudo ln -s /etc/uwsgi/apps-available/tracim.ini /etc/uwsgi/apps-enabled/
62
+
63
+
64
+Create file `tracim.log` in `/var/log/uwsgi/app/`
65
+
66
+Set the `APP_CONFIG` variable of the `[tracim_path]/tracim/app.wsgi` file to match your tracim installation path:
40
 
67
 
41
     # -*- coding: utf-8 -*-
68
     # -*- coding: utf-8 -*-
42
 
69
 
43
-    APP_CONFIG = "[tracim_path]/tracim/development.ini"
70
+    APP_CONFIG = "[tracim_path]/tracim/development.ini" 
71
+    #(in file: replace /var/www/tracim by your [tracim_path] )
44
 
72
 
45
     #Setup logging
73
     #Setup logging
46
     # import logging
74
     # import logging
51
     application = loadapp('config:%s' % APP_CONFIG)
79
     application = loadapp('config:%s' % APP_CONFIG)
52
     application.debug = False
80
     application.debug = False
53
 
81
 
82
+
83
+Add `webdav` at `root_path` in the `[tracim_path]/tracim/wsgidav.conf`:
84
+
85
+    ################################################################################
86
+    # Sample WsgiDAV configuration file
87
+    #
88
+    # 1. Rename this file to `wsgidav.conf`
89
+    # 2. Adjust settings as appropriate
90
+    # 3. Run tracim as you always do :)
91
+    #
92
+    ################################################################################
93
+    
94
+    ################################################################################
95
+    # SERVER OPTIONS
96
+    #===============================================================================
97
+    
98
+    # host  = "localhost"
99
+    # host  = "192.168.0.1"
100
+    host  = "0.0.0.0"
101
+    
102
+    port = 3030
103
+    
104
+    show_history = True
105
+    show_deleted = True
106
+    show_archived = True
107
+    
108
+    manager_locks = True
109
+    
110
+    root_path = ''
111
+    
112
+    #===============================================================================
113
+    # Lock Manager
114
+    #
115
+    # Example: Use PERSISTENT shelve based lock manager
116
+    #from wsgidav.lock_storage import LockStorageShelve
117
+    #locksmanager = LockStorageShelve("wsgidav-locks.shelve")
118
+
119
+
120
+
121
+Open `[tracim_path]/tracim/development.ini` and make some change:
122
+
123
+
124
+    In [server:main] modify IP:
125
+    `host = 127.0.0.1` by `host = 0.0.0.0`
126
+
127
+    For Radical (CalDav server):
128
+    Uncomment `# radicale.server.host = 0.0.0.0`
129
+    Uncomment `# radicale.server.allow_origin = *`
130
+    Uncomment `# radicale.client.base_url.host = http://127.0.0.1:5232`
131
+    and modifiy IP `# radicale.client.base_url.host = http://127.0.0.1:5232`to `radicale.client.base_url.host = http://[Your_server_IP]:5232`
132
+    
133
+    For WSGIDAV
134
+    Uncomment `# wsgidav.client.base_url = 127.0.0.1:<WSGIDAV_PORT>`
135
+    and modify IP and PORT `# wsgidav.client.base_url = 127.0.0.1:<WSGIDAV_PORT>` to `wsgidav.client.base_url = [Your_server_IP]/webdav`
136
+
137
+
138
+Restart `uwsgi` configuration:
139
+
140
+    sudo systemctl restart uwsgi.service
141
+
54
 Load needed proxy modules and enable this site configuration file:
142
 Load needed proxy modules and enable this site configuration file:
55
 
143
 
56
-    sudo a2enmod proxy proxy_http
144
+    sudo a2enmod dav_fs dav proxy proxy_http
57
     sudo a2ensite tracim.conf
145
     sudo a2ensite tracim.conf
58
 
146
 
59
-Reload `Apache` configuration:
147
+Restart `Apache` configuration:
60
 
148
 
61
-    sudo systemctl reload apache2.service
149
+    sudo systemctl restart apache2.service
150
+    
151
+**Important**
152
+In case you have some permission problem, check if `www-data` can access to folder of tracim.
62
 
153
 
63
 ## Documentation Links ##
154
 ## Documentation Links ##
64
 
155
 
156
+[Apache]()
157
+
65
 [TurboGears](http://turbogears.readthedocs.io/en/tg2.3.7/cookbook/deploy/mod_wsgi.html)
158
 [TurboGears](http://turbogears.readthedocs.io/en/tg2.3.7/cookbook/deploy/mod_wsgi.html)
66
 
159
 
67
 [mod_wsgi](http://modwsgi.readthedocs.io/en/develop/index.html)
160
 [mod_wsgi](http://modwsgi.readthedocs.io/en/develop/index.html)