@@ -8,11 +8,26 @@ Make sure to exclude "http://" or "https://" from the environment variable. ⚠
8
8
At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOSTS entries in the docker-compose.yml file and make sure to include your domain name. Example:
9
9
10
10
``` yaml
11
- dawarich_app :
11
+ dawarich_app :
12
12
image : freikin/dawarich:latest
13
13
container_name : dawarich_app
14
+ ...
14
15
environment :
15
- APPLICATION_HOSTS : " yourhost.com,www.yourhost.com,127.0.0.1"
16
+ ...
17
+ APPLICATION_HOST : " yourhost.com" <------------------------------ Edit this
18
+ APPLICATION_HOSTS : " yourhost.com,www.yourhost.com,127.0.0.1" <-- Edit this
19
+ ` ` `
20
+
21
+ ` ` ` yaml
22
+ dawarich_sidekiq :
23
+ image : freikin/dawarich:latest
24
+ container_name : dawarich_sidekiq
25
+ ...
26
+ environment :
27
+ ...
28
+ APPLICATION_HOST : " yourhost.com" <------------------------------ Edit this
29
+ APPLICATION_HOSTS : " yourhost.com,www.yourhost.com,127.0.0.1" <-- Edit this
30
+ ...
16
31
```
17
32
18
33
For a Synology install, refer to ** [ Synology Install Tutorial] ( How_to_install_Dawarich_on_Synology.md ) ** . In this page, it is explained how to set the APPLICATION_HOSTS environment variable.
@@ -24,13 +39,42 @@ Now that the app works with a domain name, the server needs to be set up to use
24
39
Below are examples of reverse proxy configurations.
25
40
26
41
### Nginx
27
- ` ` `
42
+ ``` nginx
28
43
server {
29
44
30
45
listen 80;
31
46
listen [::]:80;
32
47
server_name example.com;
33
48
49
+ brotli on;
50
+ brotli_comp_level 6;
51
+ brotli_types
52
+ text/css
53
+ text/plain
54
+ text/xml
55
+ text/x-component
56
+ text/javascript
57
+ application/x-javascript
58
+ application/javascript
59
+ application/json
60
+ application/manifest+json
61
+ application/vnd.api+json
62
+ application/xml
63
+ application/xhtml+xml
64
+ application/rss+xml
65
+ application/atom+xml
66
+ application/vnd.ms-fontobject
67
+ application/x-font-ttf
68
+ application/x-font-opentype
69
+ application/x-font-truetype
70
+ image/svg+xml
71
+ image/x-icon
72
+ image/vnd.microsoft.icon
73
+ font/ttf
74
+ font/eot
75
+ font/otf
76
+ font/opentype;
77
+
34
78
location / {
35
79
proxy_set_header X-Real-IP $remote_addr;
36
80
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -54,29 +98,34 @@ For Apache2, you might need to enable some modules. Start by entering the follow
54
98
sudo a2enmod proxy
55
99
sudo a2enmod proxy_http
56
100
sudo a2enmod headers
101
+ sudo a2enmod brotli
57
102
```
58
103
59
104
With the above commands entered, the configuration below should work properly.
60
105
61
- ```
106
+ ``` apache
62
107
<VirtualHost *:80>
63
- ServerName example.com
64
-
65
- ProxyRequests Off
66
- ProxyPreserveHost On
67
-
68
- <Proxy *>
69
- Require all granted
70
- </Proxy>
71
-
72
- Header always set X-Real-IP %{REMOTE_ADDR}s
73
- Header always set X-Forwarded-For %{REMOTE_ADDR}s
74
- Header always set X-Forwarded-Proto https
75
- Header always set X-Forwarded-Server %{SERVER_NAME}s
76
- Header always set Host %{HTTP_HOST}s
77
-
78
- ProxyPass / http://127.0.0.1:3000/
79
- ProxyPassReverse / http://127.0.0.1:3000/
108
+ ServerName example.com
109
+
110
+ ProxyRequests Off
111
+ ProxyPreserveHost On
112
+
113
+ <Proxy *>
114
+ Require all granted
115
+ </Proxy>
116
+
117
+ Header always set X-Real-IP %{REMOTE_ADDR}s
118
+ Header always set X-Forwarded-For %{REMOTE_ADDR}s
119
+ Header always set X-Forwarded-Proto https
120
+ Header always set X-Forwarded-Server %{SERVER_NAME}s
121
+ Header always set Host %{HTTP_HOST}s
122
+
123
+ SetOutputFilter BROTLI
124
+ AddOutputFilterByType BROTLI_COMPRESS text/css text/plain text/xml text/javascript application/javascript application/json application/manifest+json application/vnd.api+json application/xml application/xhtml+xml application/rss+xml application/atom+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype image/svg+xml image/x-icon image/vnd.microsoft.icon font/ttf font/eot font/otf font/opentype
125
+ BrotliCompressionQuality 6
126
+
127
+ ProxyPass / http://127.0.0.1:3000/
128
+ ProxyPassReverse / http://127.0.0.1:3000/
80
129
81
130
</VirtualHost>
82
131
```
@@ -94,97 +143,35 @@ Second, create a Docker network for Dawarich to use as the backend network:
94
143
docker network create dawarich
95
144
```
96
145
97
- Adjust your Dawarich docker-compose.yaml so that the web app is exposed to your new network and the backend Dawarich network:
98
- ```
99
- version: '3'
146
+ Adjust the following part of your Dawarich docker-compose.yaml, so that the web app is exposed to your new network and the backend Dawarich network:
147
+ ``` yaml
100
148
networks :
101
149
dawarich :
102
150
frontend :
103
151
external : true
104
152
services :
105
- dawarich_redis:
106
- image: redis:7.0-alpine
107
- command: redis-server
108
- networks:
109
- - dawarich
110
- volumes:
111
- - ./dawarich/redis:/var/shared/redis
112
- dawarich_db:
113
- image: postgres:14.2-alpine
114
- container_name: dawarich_db
115
- volumes:
116
- - ./dawarich/db:/var/lib/postgresql/data
117
- - ./dawarich/shared:/var/shared
118
- networks:
119
- - dawarich
120
- environment:
121
- POSTGRES_USER: postgres
122
- POSTGRES_PASSWORD: password
123
- dawarich_app:
124
- image: freikin/dawarich:latest
125
- container_name: dawarich_app
126
- volumes:
127
- - ./dawarich/gems:/usr/local/bundle/gems
128
- - ./dawarich/public:/var/app/public
129
- networks:
130
- - dawarich
131
- - frontend
132
- stdin_open: true
133
- tty: true
134
- entrypoint: dev-entrypoint.sh
135
- command: ['bin/dev']
136
- restart: on-failure
137
- environment:
138
- RAILS_ENV: development
139
- REDIS_URL: redis://dawarich_redis:6379/0
140
- DATABASE_HOST: dawarich_db
141
- DATABASE_USERNAME: postgres
142
- DATABASE_PASSWORD: password
143
- DATABASE_NAME: dawarich_development
144
- MIN_MINUTES_SPENT_IN_CITY: 60
145
- APPLICATION_HOSTS: <YOUR FQDN HERE (ex. dawarich.example.com)>
146
- TIME_ZONE: America/New_York
147
- depends_on:
148
- - dawarich_db
149
- - dawarich_redis
150
- dawarich_sidekiq:
151
- image: freikin/dawarich:latest
152
- container_name: dawarich_sidekiq
153
- volumes:
154
- - ./dawarich/gems:/usr/local/bundle/gems
155
- - ./dawarich/public:/var/app/public
156
- networks:
157
- - dawarich
158
- stdin_open: true
159
- tty: true
160
- entrypoint: dev-entrypoint.sh
161
- command: ['sidekiq']
162
- restart: on-failure
163
- environment:
164
- RAILS_ENV: development
165
- REDIS_URL: redis://dawarich_redis:6379/0
166
- DATABASE_HOST: dawarich_db
167
- DATABASE_USERNAME: postgres
168
- DATABASE_PASSWORD: password
169
- DATABASE_NAME: dawarich_development
170
- APPLICATION_HOSTS: <YOUR FQDN HERE (ex. dawarich.example.com)>
171
- depends_on:
172
- - dawarich_db
173
- - dawarich_redis
174
- - dawarich_app
153
+ ...
175
154
` ` `
176
155
177
156
Lastly, edit your Caddy config as needed:
178
- ```
157
+ ` ` ` caddy
179
158
{
180
159
http_port 80
181
160
https_port 443
182
161
}
183
162
184
- <YOUR FQDN HERE (ex. dawarich. example.com)> {
163
+ timeline. example.com {
185
164
reverse_proxy dawarich_app:3000
165
+
166
+ encode brotli {
167
+ match {
168
+ content_type text/css text/plain text/xml text/x-component text/javascript application/x-javascript application/javascript application/json application/manifest+json application/vnd.api+json application/xml application/xhtml+xml application/rss+xml application/atom+xml application/vnd.ms-fontobject application/x-font-ttf application/x-font-opentype application/x-font-truetype image/svg+xml image/x-icon image/vnd.microsoft.icon font/ttf font/eot font/otf font/opentype
169
+ }
170
+ }
186
171
}
172
+
187
173
```
174
+ timeline.example.com is an example, use your own (sub) domain.
188
175
189
176
---
190
177
0 commit comments