Skip to content

Commit f0898bf

Browse files
committed
Initial commit
0 parents  commit f0898bf

File tree

11 files changed

+933
-0
lines changed

11 files changed

+933
-0
lines changed

check_process

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
;; Test complet
2+
; Manifest
3+
domain="domain.tld" (DOMAIN)
4+
path="/path" (PATH)
5+
admin="john" (USER)
6+
is_public=1 (PUBLIC|public=1|private=0)
7+
; Checks
8+
pkg_linter=1
9+
setup_sub_dir=1
10+
setup_root=1
11+
# setup_nourl=0
12+
# setup_private=1
13+
# setup_public=1
14+
# upgrade=1
15+
# backup_restore=1
16+
# multi_instance=1
17+
# incorrect_path=1
18+
# port_already_use=0
19+
# change_url=1
20+
;;; Levels
21+
Level 1=auto
22+
Level 2=auto
23+
Level 3=auto
24+
Level 4=1
25+
# https://github.com/YunoHost-Apps/piwigo_ynh/issues/4
26+
Level 5=1
27+
# https://github.com/YunoHost-Apps/piwigo_ynh/issues/5
28+
Level 6=auto
29+
Level 7=auto
30+
Level 8=0
31+
Level 9=0
32+
Level 10=0
33+
;;; Options
34+
Email=
35+
Notification=none

conf/app.src

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SOURCE_URL=https://github.com/discourse/discourse/archive/v1.9.4.tar.gz
2+
SOURCE_SUM=68a2167fda5689a2817534183c3b890f8657677bc883c34e5dd40ac1cbf0c3ac
3+
SOURCE_FORMAT=tar.gz

conf/discourse-puma.service

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[Unit]
2+
Description=__APP__ puma service
3+
Wants=postgresql.service
4+
Wants=redis-server.service
5+
After=redis-server.service
6+
After=postgresql.service
7+
After=discourse-sidekiq.service
8+
Requires=discourse-sidekiq.service
9+
10+
[Service]
11+
User=__APP__
12+
Group=__APP__
13+
WorkingDirectory=__FINALPATH__
14+
Environment=RAILS_ENV=production
15+
ExecStart=__FINALPATH__/bin/bundle exec puma --config config/puma.rb -e production
16+
ExecStop=__FINALPATH__/bin/bundle exec pumactl stop
17+
RemainAfterExit=true
18+
Restart=always
19+
RestartSec=10
20+
21+
[Install]
22+
WantedBy=multi-user.target

conf/discourse-sidekiq.service

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=__APP__ sidekiq service
3+
After=network.target
4+
5+
[Service]
6+
User=__APP__
7+
Group=__APP__
8+
WorkingDirectory=__FINALPATH__
9+
Environment=RAILS_ENV=production
10+
ExecStart=__FINALPATH__/bin/bundle exec sidekiq -C config/sidekiq.yml
11+
Restart=always
12+
RestartSec=10
13+
14+
[Install]
15+
WantedBy=multi-user.target

conf/ldap-auth.src

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SOURCE_URL=https://github.com/jonmbake/discourse-ldap-auth/archive/v0.3.5.tar.gz
2+
SOURCE_SUM=18aa689a2583ca1dc6bb75257a8bd951e6bbc6b16d64f5585b0452ffe0e91a8c
3+
SOURCE_FORMAT=tar.gz

conf/nginx.conf

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
# maximum file upload size (keep up to date when changing the corresponding site setting)
2+
client_max_body_size 10m;
3+
4+
# path to discourse's public directory
5+
set $public __FINALPATH__/public/;
6+
7+
# without weak etags we get zero benefit from etags on dynamically compressed content
8+
# further more etags are based on the file in nginx not sha of data
9+
# use dates, it solves the problem fine even cross server
10+
etag off;
11+
12+
# prevent direct download of backups
13+
location ^~ __PATH__/backups/ {
14+
internal;
15+
}
16+
17+
# bypass rails stack with a cheap 204 for favicon.ico requests
18+
location __PATH__/favicon.ico {
19+
return 204;
20+
access_log off;
21+
log_not_found off;
22+
}
23+
24+
location __PATH__ {
25+
alias $public;
26+
add_header ETag "";
27+
28+
if ($scheme = http) {
29+
rewrite ^ https://$server_name$request_uri? permanent;
30+
}
31+
32+
# auth_basic on;
33+
# auth_basic_user_file /etc/nginx/htpasswd;
34+
35+
# Include SSOWAT user panel.
36+
include conf.d/yunohost_panel.conf.inc;
37+
38+
39+
location ~* (assets|plugins|uploads)/.*\.(eot|ttf|woff|woff2|ico)$ {
40+
expires 1y;
41+
add_header Cache-Control public,immutable;
42+
add_header Access-Control-Allow-Origin *;
43+
}
44+
45+
location = __PATH__/srv/status {
46+
access_log off;
47+
log_not_found off;
48+
proxy_set_header Host $http_host;
49+
proxy_set_header X-Real-IP $remote_addr;
50+
proxy_set_header X-Request-Start "t=${msec}";
51+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
52+
proxy_set_header X-Forwarded-Proto https;
53+
proxy_pass http://unix:__FINALPATH__/tmp/sockets/puma.sock;
54+
break;
55+
}
56+
57+
# some minimal caching here so we don't keep asking
58+
# longer term we should increas probably to 1y
59+
location ~ ^/javascripts/ {
60+
expires 1d;
61+
add_header Cache-Control public,immutable;
62+
}
63+
64+
location ~ ^/assets/(?<asset_path>.+)$ {
65+
expires 1y;
66+
# asset pipeline enables this
67+
# brotli_static on;
68+
gzip_static on;
69+
add_header Cache-Control public,immutable;
70+
# HOOK in asset location (used for extensibility)
71+
# TODO I don't think this break is needed, it just breaks out of rewrite
72+
break;
73+
}
74+
75+
location ~ ^/plugins/ {
76+
expires 1y;
77+
add_header Cache-Control public,immutable;
78+
}
79+
80+
# cache emojis
81+
location ~ /images/emoji/ {
82+
expires 1y;
83+
add_header Cache-Control public,immutable;
84+
}
85+
86+
location ~ ^/uploads/ {
87+
88+
# NOTE: it is really annoying that we can't just define headers
89+
# at the top level and inherit.
90+
#
91+
# proxy_set_header DOES NOT inherit, by design, we must repeat it,
92+
# otherwise headers are not set correctly
93+
proxy_set_header Host $http_host;
94+
proxy_set_header X-Real-IP $remote_addr;
95+
proxy_set_header X-Request-Start "t=${msec}";
96+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
97+
proxy_set_header X-Forwarded-Proto https;
98+
proxy_set_header X-Sendfile-Type X-Accel-Redirect;
99+
proxy_set_header X-Accel-Mapping $public/=/downloads/;
100+
expires 1y;
101+
add_header Cache-Control public,immutable;
102+
103+
## optional upload anti-hotlinking rules
104+
#valid_referers none blocked mysite.com *.mysite.com;
105+
#if ($invalid_referer) { return 403; }
106+
107+
# custom CSS
108+
location ~ /stylesheet-cache/ {
109+
try_files $uri =404;
110+
}
111+
# this allows us to bypass rails
112+
location ~* \.(gif|png|jpg|jpeg|bmp|tif|tiff|svg|ico|webp)$ {
113+
try_files $uri =404;
114+
}
115+
# thumbnails & optimized images
116+
location ~ /_?optimized/ {
117+
try_files $uri =404;
118+
}
119+
120+
proxy_pass http://unix:__FINALPATH__/tmp/sockets/puma.sock;
121+
break;
122+
}
123+
124+
location ~ ^/admin/backups/ {
125+
proxy_set_header Host $http_host;
126+
proxy_set_header X-Real-IP $remote_addr;
127+
proxy_set_header X-Request-Start "t=${msec}";
128+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
129+
proxy_set_header X-Forwarded-Proto https;
130+
proxy_set_header X-Sendfile-Type X-Accel-Redirect;
131+
proxy_set_header X-Accel-Mapping $public/=/downloads/;
132+
proxy_pass http://unix:__FINALPATH__/tmp/sockets/puma.sock;
133+
break;
134+
}
135+
136+
# This big block is needed so we can selectively enable
137+
# acceleration for backups and avatars
138+
# see note about repetition above
139+
location ~ ^/(letter_avatar/|user_avatar|highlight-js|stylesheets|favicon/proxied|service-worker) {
140+
proxy_set_header Host $http_host;
141+
proxy_set_header X-Real-IP $remote_addr;
142+
proxy_set_header X-Request-Start "t=${msec}";
143+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
144+
proxy_set_header X-Forwarded-Proto https;
145+
146+
# if Set-Cookie is in the response nothing gets cached
147+
# this is double bad cause we are not passing last modified in
148+
proxy_ignore_headers "Set-Cookie";
149+
proxy_hide_header "Set-Cookie";
150+
151+
# note x-accel-redirect can not be used with proxy_cache
152+
# proxy_cache one;
153+
proxy_cache_valid 200 301 302 7d;
154+
proxy_cache_valid any 1m;
155+
proxy_pass http://unix:__FINALPATH__/tmp/sockets/puma.sock;
156+
break;
157+
}
158+
159+
# location /letter_avatar_proxy/ {
160+
# # Don't send any client headers to the avatars service
161+
# proxy_method GET;
162+
# proxy_pass_request_headers off;
163+
# proxy_pass_request_body off;
164+
#
165+
# # Don't let cookies interrupt caching, and don't pass them to the
166+
# # client
167+
# proxy_ignore_headers "Set-Cookie";
168+
# proxy_hide_header "Set-Cookie";
169+
#
170+
# proxy_cache one;
171+
# proxy_cache_key $uri;
172+
# proxy_cache_valid 200 7d;
173+
# proxy_cache_valid 404 1m;
174+
# proxy_set_header Connection "";
175+
#
176+
# proxy_pass https://avatars.discourse.org/;
177+
# break;
178+
# }
179+
180+
# we need buffering off for message bus
181+
location __PATH__/message-bus/ {
182+
proxy_set_header X-Request-Start "t=${msec}";
183+
proxy_set_header Host $http_host;
184+
proxy_set_header X-Real-IP $remote_addr;
185+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
186+
proxy_set_header X-Forwarded-Proto https;
187+
proxy_http_version 1.1;
188+
proxy_buffering off;
189+
proxy_pass http://unix:__FINALPATH__/tmp/sockets/puma.sock;
190+
break;
191+
}
192+
193+
# this means every file in public is tried first
194+
try_files $uri @__NAME__;
195+
}
196+
197+
location __PATH__/downloads/ {
198+
internal;
199+
alias $public/;
200+
}
201+
202+
location @__NAME__ {
203+
add_header Referrer-Policy 'no-referrer-when-downgrade';
204+
proxy_set_header Host $http_host;
205+
proxy_set_header X-Request-Start "t=${msec}";
206+
proxy_set_header X-Real-IP $remote_addr;
207+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
208+
proxy_set_header X-Forwarded-Proto https;
209+
proxy_pass http://unix:__FINALPATH__/tmp/sockets/puma.sock;
210+
}

conf/secrets.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
development:
2+
secret_key_base:
3+
4+
test:
5+
secret_key_base:
6+
7+
production:
8+
secret_key_base: __SECRET__

conf/sidekiq.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
:concurrency: 5
3+
:pidfile: tmp/pids/sidekiq.pid
4+
staging:
5+
:concurrency: 10
6+
production:
7+
:concurrency: 20
8+
:queues:
9+
- default
10+
- critical
11+
- low

manifest.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "Discourse",
3+
"id": "discourse",
4+
"packaging_format": 1,
5+
"description": {
6+
"en": "photo gallery",
7+
"fr": "Galerie photo"
8+
},
9+
"version": "1.9.4~ynh1",
10+
"url": "http://Discourse.org",
11+
"license": "GPL-2.0",
12+
"maintainer": {
13+
"name": "JimboJoe",
14+
"email": "[email protected]",
15+
"url": ""
16+
},
17+
"requirements": {
18+
"yunohost": ">= 2.7.9"
19+
},
20+
"multi_instance": true,
21+
"services": [
22+
"nginx"
23+
],
24+
"arguments": {
25+
"install" : [
26+
{
27+
"name": "domain",
28+
"type": "domain",
29+
"ask": {
30+
"en": "Choose a domain for Discourse",
31+
"fr": "Choisissez un nom de domaine pour Discourse"
32+
},
33+
"example": "domain.org"
34+
},
35+
{
36+
"name": "path",
37+
"type": "path",
38+
"ask": {
39+
"en": "Choose a path for Discourse",
40+
"fr": "Choisissez un chemin pour Discourse"
41+
},
42+
"example": "/forum",
43+
"default": "/forum"
44+
},
45+
{
46+
"name": "admin",
47+
"type": "user",
48+
"ask": {
49+
"en": "Choose an admin user",
50+
"fr": "Choisissez l'administrateur"
51+
},
52+
"example": "homer"
53+
},
54+
{
55+
"name": "is_public",
56+
"type": "boolean",
57+
"ask": {
58+
"en": "Is it a public application?",
59+
"fr": "Est-ce une application publique ?"
60+
},
61+
"default": true
62+
}
63+
]
64+
}
65+
}

0 commit comments

Comments
 (0)